I have a really large table (over 10 million rows) that is starting to show signs of poor performance for queries. Since this table is likely to double or triple in size relatively soon, I am looking for a table layout to squeeze some query performance.
The table looks something like this:
CREATE TABLE [my_data] ( [id] [int] IDENTITY(1,1) NOT NULL, [topic_id] [int] NULL, [data_value] [decimal](19, 5) NULL )
So, a bunch of meanings for any topic. The queries in this table will always be by topic ID, so there is a clustered index (id, topic_id).
In any case, since identifiers are not limited to topics (any number of topics can be added) I would like to try to break this table into the function of the topic identifiers module. So something like:
topic_id % 4 == 0 => partition 0 topic_id % 4 == 1 => partition 1 topic_id % 4 == 2 => partition 2 topic_id % 4 == 3 => partition 3
However, I did not see a way to say "create a partition function" or "create a partition scheme" to perform this operation when selecting a partition.
Is it possible? How can we create a split function based on an operation performed on an input value?
rusty source share