371 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Jobs | Twitter | Bookmarks | Pods | Forum | Blogs | Search | myPL | About 
 
May 24, 2012, 01:14:14 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Calendar Login Register  
Pages: 1 [2]
  Print  
Author Topic: FAQ: Planet Lotus upgrade / move.  (Read 4078 times)
0 Members and 3 Guests are viewing this topic.
DarkRedSpiral
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #15 on: March 23, 2008, 11:29:31 AM »

Yancy no problem :-)

The reason you are getting the "Using temporary; Using filesort" from EXPLAIN
I believe is a combination of your GROUP BY and your our ORDER BY.
You do not (and cant) have an existing index on the calculated "HitCount" field so that
index has to be built. So this will be always forced into temporary by the File sort optimization engine
The benefit of the Sub Query is at the ORDER BY now only has to do 6 Items and not the entire
joined file.

You could try using a FORCE INDEX in the sub-query to ensure that the RSSID key is used by
the GROUP BY I don't think this will remove the "Using temporary; Using filesort" from EXPLAIN
but you may get a performance boost during the Group By data ordering as the SQL engine
may be forced to create a temporary index based on the the ORDER BY.

I would also try using a CAST on the COUNT(*) to force it to be a unsigned integer
as MySql returns the values as a UDT.. (i believe V4 of MYSQL returned a SIGNED)
a UDT can cause performance issues with sorting.

SELECT * FROM (
                         SELECT CAST(count(*) as UNSIGNED) as HitCount, hitsTABLE.rssid
                         FROM `hitsTABLE` FORCE INDEX (hitsTable.rssid)
                         WHERE   (hitsTABLE.created > (DATE_SUB( CURDATE( ) , INTERVAL 5 DAY ))
                         GROUP BY hitsTABLE.rssid
                         ORDER BY 1 DESC
                         Limit 6
                      ) AS TZero, 'rssTable' WHERE TZero.rssid = rssTable.id

Steve





Logged
Yancy Lent
Administrator
Full Member
*****
Offline Offline

Posts: 147



View Profile
« Reply #16 on: March 26, 2008, 04:00:25 PM »

Thanks again Steve!

It didn't like the FORCE INDEX (hitsTable.rssid) but it did everything else. Another huge enhancement was indexing the hitsTABLE.created column; expensive but huge performance increase on the select.
Logged
clinfoot
Newbie
*
Offline Offline

Posts: 16


View Profile
« Reply #17 on: April 01, 2008, 06:56:58 AM »

Just a quick question - what happened to the preview goggles?
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!