Never separate or separate current / archived data. This is simply not true. It can be called a “data warehouse” or a bucket of fish, but it is wrong, not necessary and creates problems that were not otherwise present. Result:
- everyone who requests data should now look for it in two places, and not in one
- and, even worse, add aggregated values manually (in Excel or something else)
- you enter anomalies in the key, integrity is lost (which otherwise would be unique with a single db constraint)
- when you need to change a completed order (or many), you must pull it out of the "warehouse" and return it to the "database"
If and only if the answer on the table is slow, then refer to this and increase the speed. Only. Nothing more. This (in every case I saw) is an indexing error (missing indexes or invalid columns or incorrect column sequence - all errors). Typically, all you need is an IsComplete column in the index, along with what your users use most often to search, to enable / exclude Open / Complete Orders.
Now, if your dbms platform cannot handle large tables or large result sets, this is another problem and you need to use any methods available in the tool. But as a problem with database design, this is simply wrong; There is no need to create duplicates, fill them in and maintain (with all the ensuing problems), unless you are limited by your platform.
As in the past year, and in this, as part of the usual performance assignment, I combined such partitioning tables with billions of rows (and had to solve all the problems with duplicate rows that supposedly did not exist, yes, right, 2 days just for of this). Consolidated tables with revised indexes were faster than partitioned tables; the excuse that “billions of rows slowed the table down” was completely false. Users love me because they no longer need to use two tools and query two “databases” to get what they need.
Performancedba
source share