Skip to content

What It Is Not Good For

Andrew Geweke edited this page Nov 2, 2013 · 2 revisions

Here's what low_card_tables is not good for:

Attributes that are not truly low-cardinality.

Here's what that means, in practice:

Ensure your low-card tables don't gather too many rows. low_card_tables will raise exceptions and refuse to work if a low-card table has more than 5,000 rows in it, by default; see Options for the way to raise that limit. Note that this means you can put twelve boolean columns in a single low-card table, however, even if they're completely independent (2 ** 12 == 4096).

While it's obvious that you shouldn't put things like names, email addresses, or prices into a low-card table, while boolean flags or enums with just a few values are OK, there are things in between: should you put someone's age into a low-card table? (Maybe, maybe not; but then, again, you should probably just be storing their date of birth rather than their age directly, anyway.)

The failure mode for low_card_tables is that you get a low-card table that grows to an unreasonable size; you'll be forced to increase :max_row_count with a corresponding increase in permanent RAM usage in your server processes. In the long run, you'll be forced to migrate that data out of your low-card table and into a main table, which isn't the end of the world (it's what you should've done in the first place, anyway, if you run into this problem), but which is a pain.

Clone this wiki locally