MySQL Forums
Forum List  »  Partitioning

Re: Partitioning not working need primary key?
Posted by: Rick James
Date: October 24, 2012 09:26PM

int(2) takes 4 bytes. So does int(99). The number says nothing. If you have a 2-digit number, use TINYINT UNSIGNED, which takes only 1 byte. Smaller -> more cacheable -> faster.

TINYINT UNSIGNED has a range of 0..255.

If you are not partitioning on one of these fields: (`receiptID`,`outletID`), you will have not way to enforce the UNIQUEness of that tuple, except by your code.

Adding a million values declared double(10,2) together is likely to be off by a few cents.

Any table _may_ be PARTITIONed. Most tables do not benefit from PARTITIONing.

If your 'report' needs to tally stuff for one `outletID`, then this would be a better order:
PRIMARY KEY(outletID, receiptID)
For a mini-tutorial on compound keys:
http://mysql.rjweb.org/doc.php/index1

You will eventually need "summary tables" for reports.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Partitioning not working need primary key?
1530
October 24, 2012 09:26PM


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.