4 ms·
Still missing: * Dynamic repartitioning to balance query load/space/create new partitions when tables get over a certain size. Without this, when you get more
by londons_explore 9y ago
Still missing:
* Dynamic repartitioning to balance query load/space/create new partitions when tables get over a certain size. Without this, when you get more than a few hundred TB of data, you'll end up with terrible hotspots where single partitions are much more loaded than others and theres nothing you can do about it.
* Query replanning: Query plans can sometimes have a lot of error. By replanning, one can start on another query plan if the existing plan is grossly wrong in its estimates.
* Lock Eliding instead of *Exclusive locks. Some major operations, such as schema changes, take locks which effectively stop the server responding to any other requests till the operation is done. Instead, these operations should work on a copy-on-write image of the database, repeatedly re-syncing with recently changed data until the final change necessary is small, and then atomically commit the change.
- tmd83 9y agoWhich database does this dynamic repartitioning and how without user intervention?
- kuschku 9y agoAll the partitioning tools for postgres allow it. You can say that it should aim for ~100GB per partition, partitioned by time, and it'll aromatically add or remove partitions. You can go even further with the time scale extension for postgres.
- arghwhat 9y agoThe question was which DB's do this out-of-the-box like you requested, not plugins or tools. However, seeing that there already is an extension for postgres to do it, why is it a problem in the first place?
- derefr 9y agoThe partitioning features in PG10 and PG11 were also supported by said extensions, but now they're batteries-included features. The GP is implying that, as long as they're eating the lunch of these extensions, they should eat the whole lunch. (Which I personally agree with, given that you almost never get these extension—or support for arbitrary extensions—on Postgres DBaaS hosts. Upstreaming a feature = making it available on these hosts.)
- tpetry 9y agoThe development model of postgres is to start with a simply le implementation and improve it with every release. So maybe with pg13 or 14 this will be available in the core if one developer starts working on the remaining features.
- arghwhat 9y agoThere is a very sharp distinction between providing first-class partitioning, and providing automated maintenance and performance tuning. Providing first-class partitioning is something that extensions can't possibly provide, due to how many places this has to integrate with. On the other hand, manipulating partitions (which is effectively automatic table creation) seems like the sort of magic I expect to only exist in extensions. As mentioned in a different comment, it does sound like people are looking for round-robin load distribution rather than partitioning.
- pgaddict 9y agoI don't think any of the extensions actually provides the type of auto-tuning / balancing you're asking for, actually. For example pg_partman helps with setting up some partitioning schemes (by time, by ID), but does not rebalance it later (e.g. to split a hot or unexpectedly large partition). It probably provides more convenient interface to do that, but it's still up to the DBA to do it. I'm sure this is one of the things people on pgsql-hackers will be talking about, but I wouldn't hold my breath for it to get into PG12. I do expect this to emerge in an extension first, and then getting the most useful bits into core (either in the form of built-in features, or hooks allowing extensions to be smarter).
- londons_explore 9y agoBigtable does it. [1] . Spanner does it [2]. [1]: https://static.googleusercontent.com/media/research.google.com/en//archive/bigtable-osdi06.pdf https://static.googleusercontent.com/media/research.google.c..., Section 5, "and also splits tablets that have grown too large" [2]: https://storage.googleapis.com/pub-tools-public-publication-data/pdf/39966.pdf https://storage.googleapis.com/pub-tools-public-publication-..., Section 1, "it automatically migrates data across machines (even across datacenters) to balance load"
- tmd83 9y agoThose are distributed databases and have completely different characteristics. That's an interesting nice feature to have but no traditional RDBMS supports anything close I presume.
- arghwhat 9y ago#1 seems a bit weird. You could theoretically have the DB automatically create new buckets for a hash partition, but hash partitions shouldn't have hot spots unless you hash on a bad column, and creating new buckets will require all existing rows to be moved. For other types of partitions, partition hotspots would be the fault of the DBA partitioning on a bad column. The DB could theoretically half partition ranges if a range partition is very large, but there are other things that are more important. #2 is a nice performance feature which has been talked about before, but do any DB's actually have this yet? I suspect that it is quite tricky, and won't be universally beneficial. Is #3 really a problem? I certainly wouldn't expect schema changes to perform well, and increasing complexity just to help in this area would seem silly.
- rantanplan 9y ago> Is #3 really a problem? I certainly wouldn't expect schema changes to perform well, and increasing complexity just to help in this area would seem silly. Not the parent, but obviously they refer to the online schema migration problem. Without that online schema migrations are basically impossible. Or you get handed the burden of implementing or finding a tool that does it for you. And yes, pt-online-schema-change[1] is such a tool, but for MySQL. MariaDB has this feature built-in with their `ALTER ONLINE TABLE` [2]. So something similar for Postgres would be godsent. [1] https://www.percona.com/doc/percona-toolkit/LATEST/pt-online-schema-change.html https://www.percona.com/doc/percona-toolkit/LATEST/pt-online... [2] https://mariadb.com/kb/en/library/alter-table/ https://mariadb.com/kb/en/library/alter-table/
- perlwle 9y agomysql 5.7 has pretty good online DDL support[1] I have been using it exclusively now instead of pt-online-schema-change. [1] https://dev.mysql.com/doc/refman/5.7/en/innodb-online-ddl.html https://dev.mysql.com/doc/refman/5.7/en/innodb-online-ddl.ht...
- londons_explore 9y ago> hash partitions shouldn't have hot spots unless you hash on a bad column In the nice world of all data having an even load, sure... But in the real world, you can easily get a handful of users in your "Users" table sending millions of requests per second, and in that case, you would really like to re-partition so that they don't happen to all end up on the same partition. Implementation can be as simple as allowing splittable partitions, so that whenever load/size gets too high, a partition can be split in half, and half the records moved to a new host. The partition map is only a few kilobytes, so is globally shared/updated. There are no concurrency issues, because during the splitting process, either the old or new partition is responsible for each record, and both the old and new partition hosts can respond to a read or write query, either themselves or by forwarding it to the other host. Whenever two neighbouring partitions both see low load/space usage, join them with the same method in reverse. By joining only neighbouring partitions, you can't suffer terrible fragmentation and blowing up the size of the global partition map.