MySQL Forums
Forum List  »  Newbie

Re: select top x with a union
Posted by: Rick James
Date: October 10, 2010 12:31PM

I hope you never get more than a thousand items in your table -- you have combined to very hard to optimize design patterns --
* key-value (EAV) -- the information you are using to pick rows is scattered in other table(s)
* "Find the nearest" in 2D (lat/lng)

Yes, you can have the nested UNION with LIMITs. Off hand, your attempt looks correct; is it giving trouble?

(Perhaps you meant LIMIT 10, not LIMIT 2?)

Will you be adding a third ill-optimized design pattern? --
* Pagination via LIMIT and OFFSET.

Options: ReplyQuote


Subject
Written By
Posted
October 06, 2010 02:52AM
Re: select top x with a union
October 10, 2010 12:31PM


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.