February 27, 2018 at 1:08 pm
I have a table that contains about 8 billion rows. The table has a FK in it called fk_client. The data is split, fairly evenly, among 14 distinct client keys. So...about 500k records per client. ANY and EVERY time we query this table we do so for a particular fk_client. Would it make sense to partition this table by fk_client so each file contains a subset of data by client? Wouldn't querying the table be more efficient if Sql could look to a single partition (or file in the partition) for data related to a client?
Thank you.
February 27, 2018 at 1:27 pm
patreddy - Tuesday, February 27, 2018 1:08 PMI have a table that contains about 8 billion rows. The table has a FK in it called fk_client. The data is split, fairly evenly, among 14 distinct client keys. So...about 500k records per client. ANY and EVERY time we query this table we do so for a particular fk_client. Would it make sense to partition this table by fk_client so each file contains a subset of data by client? Wouldn't querying the table be more efficient if Sql could look to a single partition (or file in the partition) for data related to a client?Thank you.
It might benefit from partition elimination but it depends on the queries. You'd want to test to see. Reading the following can also help when testing:
Why Doesn’t Partition Elimination Work?
Sue
February 27, 2018 at 3:33 pm
patreddy - Tuesday, February 27, 2018 1:08 PMI have a table that contains about 8 billion rows. The table has a FK in it called fk_client. The data is split, fairly evenly, among 14 distinct client keys. So...about 500k records per client. ANY and EVERY time we query this table we do so for a particular fk_client. Would it make sense to partition this table by fk_client so each file contains a subset of data by client? Wouldn't querying the table be more efficient if Sql could look to a single partition (or file in the partition) for data related to a client?Thank you.
I've found that partitioning doesn't do much in the area of performance except to usually make it slower even if your code is written well enough to take advantage of so called partition elimination. A monolithic table with the correct indexes and the correct code playing against it will usually beat the identical index/code combination on a partitioned table. I say "usually" a bit tongue in cheek because I've not yet seen a partitioned table beat a monolithic table for performance.
My disclaimer there is that I have seen some people claim that partitioning helped performance but, for those I'm aware of, it was the indexing they had to do to partition the tables that really made the difference. Doing similar indexing on their old monolithic table was still faster. Fixing bad code is even better.
Partitioning <> Performance. What partitioning is really good for is index maintenance, backups, and the ability to do "Piece Meal" restores if the need should ever arise.
--Jeff Moden
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply