Partitining an existing table

  • Just a final point. My initial response to matt stockholm's suggestion above - i.e. that using the $PARTITION fn in the where clause didn't help, was actually wrong. I must have malformed my test query somehow. For the record, the $PARTITION restriction does correct the issue, so the workaround looks like:

    set nocount on

    declare @max_part int

    select @max_part = max(partition_number)

    from sys.partitions

    where [object_id] = object_id('GBEOrderNotification')

    and [index_id] = 1

    and rows > 0

    select max(GBEOrderNotificationId)

    from GBEOrderNotification (nolock)

    WHERE $PARTITION.PFN_Notification(NotificationSequenceID) = @max_part

  • I believe if you create a clustered index on the partition scheme you will partition the table as configured by the partition scheme and function.

    CREATE CLUSTERED INDEX [idx_Name] ON Table(column) ON PartitionScheme(column)

Viewing 2 posts - 46 through 46 (of 46 total)

You must be logged in to reply to this topic. Login to reply