4 ms·
> Yes, fair enough. In such a case, why not use an explicit index like letters of the alphabet, in other words why not reindex the table just once, hierarchical
by fdr 14y ago
> Yes, fair enough. In such a case, why not use an explicit index like letters of the alphabet, in other words why not reindex the table just once, hierarchically, with something relevant to table searches, in a way that breaks the table up into manageable chunks?
In an ideal world where we still only want to physically organize but one copy of data, the criteria for what partitioning would be ideal is dependent on query workload: for example, aggregates over a month (avg, stddev, max, min). In that case, choosing a partitioning metric makes a lot of sense, and reorganizations are seldom.
Sometimes people just want to have roughly-equal physical partitioning of the data, but want it more-or-less clustered by some metric (the ideal is typically a sort, but maintaining a strict sorted order may be too punishingly expensive on modification), with each partition being aware of some aggregation of its metric (such as spanning range). In this case, partitions will require re-balancing, and that's roughly the class of solution the post here falls into.
See also: index organized tables (not supported in Postgres), and their many, many problems when dealing with data modifications. However, they do perform well for some workloads.
> Yes, but if the solution doesn't address the underlying problem, just the symptom, it will need to be reapplied perpetually.
Yes. However, this solution composes on tools already available, and are already caveat-loaded enough as-is (if you look at the pg_reorg page, they are quite upfront about those). There will always be a frontier of workarounds to problems that have not been polished, because polishing is probably about one hundred fold as expensive (sometimes more), and achieving the incremental, nice versions without database management system support is not very lucid and quite complicated, and not therefore not an economic choice for many situations.