Re: Make this faster?
Adding (redundant) columns for year and month plus an index on those columns, ie. (year, month) should allow MySQL to utilize that index for the group by operation. You should also drop the order by part in that query. Because of the group by, only the year and month parts of it are actually meaningful and MySQL will order by those anyway, because group by includes ordering and ordering by a different column always forces a file sort.
That said, I'm not sure if COUNT(files.md5_key) is really what you want. IIRC, because of the join, that should give you the number of row in the files table times the number of matching rows in the filesystem table for each file. I'd expect to see COUNT(DISTINCT files.md5_key) there instead.
Subject
Views
Written By
Posted
4133
January 04, 2007 07:38AM
2460
January 04, 2007 10:21AM
2433
January 04, 2007 11:51AM
Re: Make this faster?
2554
January 04, 2007 03:34PM
2535
January 05, 2007 02:40AM
2458
January 05, 2007 05:07AM
2473
January 05, 2007 06:55AM
2533
January 05, 2007 08:31AM
2454
January 05, 2007 08:33AM
2731
January 05, 2007 08:45AM
2455
January 05, 2007 08:31AM
2530
January 05, 2007 08:45AM
2568
January 05, 2007 03:11PM
2474
January 08, 2007 02:44AM
2403
January 08, 2007 04:28AM
2482
January 08, 2007 04:41AM
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.