Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2011
    Posts
    17

    Unanswered: 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???

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    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 on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    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
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  4. #4
    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.

  5. #5
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    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
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  6. #6
    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

  7. #7
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    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
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

  8. #8
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •