最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

azure sql database - Partition elimination with computed column in SQL Server - Stack Overflow

programmeradmin3浏览0评论

We have a sql table in SQL Server (Azure SQL) with the following format

[id] [int] IDENTITY(1,1) NOT NULL
[STRINGID] [varchar](30) NOT NULL
... many data columns

The clustered index is on the id column, the primary key is on the STRINGID column. The STRINGID column is externally generated and always follows this format "{external_id_string}-{YYYYMMDDHHMMSS}". The row data is produced "live" so the timestamp from the external_id_string and the numeric id value are strongly correlated.

The table queries are almost always filtered by STRINGID. However, due to the number of rows, queries tend to become slow and if we look at the execution plan and performance metrics it is always due to data IO. The size of the PK index is ~10GB.

We were thinking if we would profit from table partitioning? We could add a persisted computed column which holds the timestamp from the STRINGID column and partition on that value by month.

However, i am not sure and did not find any information if the query optimizer would be able to perform partition elimination if we still filter only on STRINGID or if all queries would need to filter on both STRINGID and COMPUTED_COLUMN_TIMESTAMP?

Thank you!

发布评论

评论列表(0)

  1. 暂无评论