MySQL Forums
Forum List  »  General

Re: Optimising a GROUP BY and ORDER BY in a joined query
Posted by: Peter Brawley
Date: April 02, 2010 11:34AM

Michael,

Does performance improve when you add VC_Valid to the vod_control PK, move VP_Family from the vod_package VP_FamilyIndex key to the vod_package PK, and write the query this way ...

SELECT p.VP_Family 
FROM vod_package p
JOIN vod_control c ON p.VP_AssetId = c.VC_AssetId AND c.VC_Valid = 1
ORDER BY p.VP_Family;

Then, what happens to performance if you give vod_control a surrogate (auto_inrement) PK, replace the vod_package PK with a reference to that, and adjust the query to use the new keys?

PB
http://www.artfulsoftware.com

Options: ReplyQuote




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.