MySQL Forums
Forum List  »  Optimizer & Parser

Re: Optimizing ORDER BY any ideas?
Posted by: Jay Pipes
Date: September 12, 2005 04:41PM

Marc Van Olmen wrote:
> Jay,
>
> thx for writing this down.

No problem at all, any time!

> because SELECT PRY_INDEX
> FROM T_PROPERTY
> ORDER BY PRY_EXPORT_CITY
>
> is super fast: 0.0074
> I was hoping for more progress....

Cool. see below.

> I have a few other ideas on how to optimize this
> query most of the ideas are based on keeping an
> extra table with the sorting order seperate etc..
> so insert is more expensive... also will try out a
> few other database on how they behave in this kind
> of situtation, I tested openbase and that one is
> slower. Also gonna test postgressql just out of
> curiosity I don't have time now but in a week or
> so...

The best thing you can do to increase the efficiency of your queries, IMHO, is to trim the table definitions down to the absolute minimum you can. First off, change your CHAR(xx) to VARCHAR(xx) for the longish fields, and stop using so many NULLable fields. Separate off NULLable fields into its own table (see my earlier post) and trim the field data types down as much as possible...

Also, consider using MyISAM instead of InnoDB unless you are actually utilizing the transactional components of InnoDB... InnoDB is fast, but because of the extra effort expended to ensure the transactional consistency, can sometimes be slower than MyISAM. If you stay with InnoDB, you can ignore my comment about the CHAR/VARCHAR thing, because InnoDB treats them the same way. However, *do* consider changing your VARCHAR(1624) fields to the TEXT data type, which will store a pointer to the text instead the actual data (in most cases).

> thx again, will defintely buy a copy of your book
> for all your efforst.

:)

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Views
Written By
Posted
5009
September 06, 2005 05:35PM
2796
September 06, 2005 06:39PM
2955
September 06, 2005 08:30PM
2723
September 06, 2005 09:18PM
2711
September 07, 2005 07:10AM
2674
September 07, 2005 06:28PM
2727
September 07, 2005 08:55PM
2564
September 08, 2005 08:28AM
2668
September 08, 2005 11:12PM
2657
September 09, 2005 10:00AM
2606
September 09, 2005 10:22AM
2607
September 09, 2005 10:03PM
2831
September 10, 2005 07:30AM
3229
September 10, 2005 09:22AM
2629
September 12, 2005 02:45PM
Re: Optimizing ORDER BY any ideas?
2553
September 12, 2005 04:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.