If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > sort_buffer_size

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-12-11, 02:08
chandu123 chandu123 is offline
Registered User
 
Join Date: Nov 2011
Posts: 17
sort_buffer_size

I have a query which doesn't use indexes and undergoing full table scan and sort_merge_pass=0. will the performance increase if we increase or decrease sort_buffer_size???
Reply With Quote
  #2 (permalink)  
Old 12-12-11, 02:55
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
dunno, why not try it and see
I would expect an improvement if you do index the relevant columns if performance is proving to be a problem
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 12-12-11, 03:34
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
From my understanding the sort_merge_passes indicates the number of temporary files created during the sort process when the sort_buffer_size is too small to have everything sorted in memory. In your case it appears that everything gets sorted in memory. Decreasing sort_buffer_size may result in this creating temporary files to perform the sorts when there is insufficient sort buffer.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #4 (permalink)  
Old 12-12-11, 04:39
chandu123 chandu123 is offline
Registered User
 
Join Date: Nov 2011
Posts: 17
sort_buffer_size

Hi Ronan,

I have decreased the size of sort_buffer_size and tested for the performance. But I didn't find any improvement in the performance.
Reply With Quote
  #5 (permalink)  
Old 12-12-11, 05:26
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
I think we need to take a step back and look at the data that you are trying to work with. How large is your table (how many records)? We will also need an EXPLAIN on your query to see what you are trying to do and how MySQL is handling this. It might be that you have so many rows that a large portion of your time is being used up during the full scan of the table instead of adding appropriate indexes.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #6 (permalink)  
Old 12-12-11, 05:40
chandu123 chandu123 is offline
Registered User
 
Join Date: Nov 2011
Posts: 17
sort_buffer_size

Hi Ranon,

Thanks for your reply and my table has 10k rows and indexes are not used since we are using '%' where field and tats mandatory in my application.
here is the Explain tool output of the query.



id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE con ref PRIMARY,cont_ctyp_fk_i,cont_ssvr_fk_i cont_ctyp_fk_i 8 const 4534 Using where; Using temporary; Using filesort
1 SIMPLE ss eq_ref PRIMARY PRIMARY 8 attano.con.ssvr_id 1
1 SIMPLE uc eq_ref unique,NewIndex1 unique 16 attano.con.id,const 1 Using index
1 SIMPLE ev ref FK_elemet_lo_content_view_cont_id,cntd_idx cntd_idx 9 attano.con.id 7 Using where
Reply With Quote
  #7 (permalink)  
Old 12-13-11, 02:30
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
If your table is small for example, each row used in the sort contains 20 bytes then 10k of rows will only use up 200k of space. So I am assuming you have far more memory allocated to sort buffer that this is as efficient as you can get it. What sort of timings are you getting on the SQL request and what are you expecting this to be?
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #8 (permalink)  
Old 12-13-11, 02:45
chandu123 chandu123 is offline
Registered User
 
Join Date: Nov 2011
Posts: 17
sort_buffer_size

Hi Ronan,


The cost of the query is .872 secs and any thing less than .500 will be fine for me.Thanks for the reply.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On