MySQL Forums :: Partitioning :: How to handle secondary keys in partitioning?


Advanced Search

How to handle secondary keys in partitioning?
Posted by: John Smith ()
Date: May 04, 2010 12:46AM

Say I have a table "Message" and I want to partition it by "recipient_id".

That way when I want to get all messages sent to a certain user, I only need to query a single partition.

But sometimes I also want to query for all messages sent by a certain user. In that case I'd need to send query to every single partition and then merge the results before sorting them.

Is that going to be very slow (much slower than without using partition) because I'd need to run the query N times (N being the number of partitions) and I can't use index in sorting the final results?

So does it make sense to use partition in a scenario like this where I have secondary indexes & queries that are "cross-partition"?

And what if I want to use Spider Engine to turn the partitions into separate DB shards? Would these cross-shard queries (such as querying for messages from a certain sender) be even slower?

This must be a pretty common scenario. Is there any tricks in dealing with cross-partition queries/indexes like this?

Thanks.

Options: ReplyQuote


Subject Views Written By Posted
How to handle secondary keys in partitioning? 3225 John Smith 05/04/2010 12:46AM
Re: How to handle secondary keys in partitioning? 1866 Mattias Jonsson 05/04/2010 01:29PM
Re: How to handle secondary keys in partitioning? 1612 John Smith 05/04/2010 04:30PM
Re: How to handle secondary keys in partitioning? 1809 Mattias Jonsson 05/05/2010 02:20AM
Re: How to handle secondary keys in partitioning? 1672 Rick James 05/06/2010 12:04AM
Re: How to handle secondary keys in partitioning? 2026 Mattias Jonsson 05/06/2010 03:23PM
Re: How to handle secondary keys in partitioning? 1694 John Smith 05/06/2010 10:50PM
Re: How to handle secondary keys in partitioning? 1687 Mattias Jonsson 05/07/2010 02:38AM
Re: How to handle secondary keys in partitioning? 1643 John Smith 05/08/2010 05:31PM
Re: How to handle secondary keys in partitioning? 1721 Mattias Jonsson 05/09/2010 04:37AM
Re: How to handle secondary keys in partitioning? 1586 John Smith 05/09/2010 12:41PM
Re: How to handle secondary keys in partitioning? 1541 Mattias Jonsson 05/09/2010 01:23PM
Re: How to handle secondary keys in partitioning? 1618 Mattias Jonsson 05/12/2010 05:29AM
Re: How to handle secondary keys in partitioning? 2115 John Smith 05/06/2010 12:34AM


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.