liveBook · Manning

Partition scheme

As explained in 100 SQL Server Mistakes and How to Avoid Them

A partition scheme maps table partitions to database filegroups.

Mistake: treating a partition scheme as the boundary definition. A partition function sets boundary values and range direction; the partition scheme maps the resulting partitions to filegroups. Using ALL can leave every partition on the same filegroup, so partitioning does not automatically distribute storage. section 10.7

Use this sequence when designing a partitioned table:

  • Create a partition function with a datatype, boundary values, and RANGE LEFT or RANGE RIGHT behavior. section 10.7
  • Create a partition scheme that assigns each partition to precreated filegroups, or deliberately uses ALL for one filegroup. section 10.7
  • Create the table with ON <PARTITION SCHEME>(<PARTITIONING KEY>) instead of ON <FILEGROUP>. section 10.7

Impression archive

A date-based archive can use an ImpressionDatesPF function and ImpressionDatesPS scheme, then query the partitioned table by EventTime. The demonstrated query reduced logical reads from 46,979 to 15,732.

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Explains boundaries, range direction, filegroup choices, and table syntax, but does not detail maintenance operations.
Examples
Uses an ImpressionDatesPF scheme, an EventTime archive query, and logical-read comparisons.
What it assumes
Assumes basic tables, filegroups, and T-SQL while defining partition functions and schemes directly.
What you can do after
Apply it via T-SQL to place partitioned tables on selected filegroups and assess date-range query reads.
How it connects
Connects partition functions, partitioned tables, filegroups, boundary points, and partitioning keys.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.