MySQL Forums
Forum List  »  Partitioning

Re: Postcodes
Posted by: Phil Hildebrand
Date: October 18, 2008 12:37AM

Currently, outside of key type partitions, you need the field that is being partitioned to resolve to an integer value, so it depends a little on your table structure.

If you had a lookup table that contained the codes -

id 1 = AB, id 2 = NP, etc, etc

and your main table contained the codes, you could then partition on that:

create table my_info
(
postcode_id int,
other_info xxxx,
) partition by hash (postcode_id) partitions 40

(you could also use range or list partitions for that)

if postcode abbr were part of the primary key, then you could use a key partition:

create table my_info
(
id int not null,
postcode_abbr char (2),
other info xxxx,
primary key (id,postcode_abbr)
) partition by key () partitions 40

Options: ReplyQuote


Subject
Views
Written By
Posted
3797
October 17, 2008 07:35AM
Re: Postcodes
2380
October 18, 2008 12:37AM


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.