Composite Primary and Cardinality

Posted by srini.venigalla on Stack Overflow See other posts from Stack Overflow or by srini.venigalla
Published on 2010-05-20T15:45:32Z Indexed on 2010/05/20 16:00 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

I have some questions on Composite Primary Keys and the cardinality of the columns. I searched the web, but did not find any definitive answer, so I am trying again. The questions are:

Context: Large (50M - 500M rows) OLAP Prep tables, not NOSQL, not Columnar. MySQL and DB2

1) Does the order of keys in a PK matter?

2) If the cardinality of the columns varies heavily, which should be used first. For example, if I have CLIENT/CAMPAIGN/PROGRAM where CLIENT is highly cardinal, CAMPAIGN is moderate, PROGRAM is almost like a bitmap index, what order is the best?

3) What order is the best for Join, if there is a Where clause and when there is no Where Clause (for views)

Thanks in advance.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about database