Previous Topic: Define a Table Full-Text Index in SQL ServerNext Topic: Define a View in SQL Server


Define a SQL Server Table Spatial Index

A spatial index is an index on a table based on spatial data in the table (a spatial column). Spatial data uses the new data types, GEOMETRY and GEOGRAPHY. Different tessellation schemes are used depending on the data type of the spatial column; a spatial column assigned the GEOMETRY data type uses the GEOMETRY_GRID tessellation scheme, while a spatial column assigned the GEOGRAPHIC data type uses the GEOGRAPHY_GRID tessellation scheme.

The table spatial index options provide a way to define how the index behaves, such as using index padding, how to store temporary sort results used to build the index, whether distribution statistics are recomputed, allowing row or page locks, and so on.

Tessellation options let you specify the density of the grid at each level of a tessellation scheme and define the number of tessellation cells per object that you can use for a single spatial index object during the tessellation process. There are four levels for which you can specify density, and there are three density values you can select:

Low

Specifies to use the lowest density for the grid. Low equals 16 cells, or a 4x4 grid.

Medium

Specifies to use the medium density for the grid at the given level. Medium equals 64 cells, or an 8x8 grid.

High

Specifies to use the highest possible density for the grid at the given level. High equals 256 cells, or a 16x16 grid.

Boundary box options are used to set the four coordinates of the bounding box when GEOMETRY_GRID is your tessellation scheme.

Use the SQL Server Table Spatial Index Editor in a SQL Server physical model to define general options, tessellation options, and boundary box options for an index on a table that contains spatial columns. You can specify more than one spatial index on a spatial column.

To define a SQL Server table spatial index

  1. Right-click a table spatial index in the Model Explorer and click Properties.

    The SQL Server Table Spatial Index Editor opens.

  2. Select the table from the Table drop-down that contains the table spatial index that you want to define.
  3. Select the table spatial index in the Navigation Grid that you want to define and work with the following options:

    Note: Click New New icon in property editors to create a new object on the toolbar to create a new table spatial index. Use the Enter filter text box to filter a very large list of indexes to quickly locate the index that you want to define.

    Name

    Specifies the name of the table spatial index. You can change the name of the table spatial index in this field.

    Note: Table spatial index names must be unique within the table but do not have to be unique within the database.

    Column

    Specifies the spatial column upon which the table spatial index is based.

    Type

    Displays the data type (and therefore the tessellation scheme) of the spatial column. You do not explicitly define the data type here; the data type of the spatial column is defined in the SQL Server Column Editor.

    Note: A spatial column assigned the GEOMETRY data type uses the GEOMETRY_GRID tessellation scheme, while a spatial column assigned the GEOGRAPHIC data type uses the GEOGRAPHY_GRID tessellation scheme.

    Filegroup

    Specifies the filegroup to which the table spatial index belongs. Select the filegroup from the drop-down.

    Note: The filegroup you specify must already exist. If you do not specify a filegroup and the table is not partitioned, by default the spatial index uses the filegroup of the table upon which the index is based.

    Generate

    Generates SQL during forward engineering. Clear the check box if you do not want to generate SQL.

  4. Click the General tab and specify the following Spatial Index options:
    Fill Factor

    Lets you specify a percentage to indicate how full the database engine should make the leaf level of each index page during table spatial index creation or build. Enter an integer value in this field.

    Pad Index

    Specifies whether to use index padding. Select the option from the drop-down. If Pad Index is set to True, specify the percentage of free space specified by Fill Factor.

    Sort In Temp DB

    Specifies whether to store the temporary sort results used to build the index in tempdb. Select the option from the drop-down.

    No Recompute

    Specifies whether distribution statistics are recomputed. Select the option from the drop-down.

    Drop Existing

    Specifies whether a named preexisting table spatial index is dropped and rebuilt. Select the option using the check box.

    Allow Row Locks

    Specifies whether row locks are allowed for the selected table spatial index. Select the option from the drop-down.

    Allow Page Locks

    Specifies whether page locks are allowed for the selected table spatial index. Select the option from the drop-down.

    Maximum Degree of Parallelism

    Specifies the maximum parallel property for the selected table spatial index. Enter a value in the field. This value overrides the maximum degree of parallelism option for the duration of the index operation. This is to limit the number of processors used in a parallel plan execution.

  5. Specify the density of the grid at each level of a tessellation scheme and the cells per object value using the following tessellation options:
    Level 1 Density Type

    Lets you specify the density of the first (top) level grid. Select either Low, Medium, or High for the density level from the drop-down.

    Level 2 Density Type

    Lets you specify the density of the second level grid. Select either Low, Medium, or High for the density level from the drop-down.

    Level 3 Density Type

    Lets you specify the density of the third level grid. Select either Low, Medium, or High for the density level from the drop-down.

    Level 4 Density Type

    Lets you specify the density of the fourth level grid. Select either Low, Medium, or High for the density level from the drop-down.

    Note: Low density equals 16 cells (4x4 grid), Medium density equals 64 cells (8x8 grid), and High density equals 256 cells (16x16 grid).

    Cells Per Object

    Specifies the number of tessellation cells per object that can be used for a single spatial object in the index by the tessellation process. Enter a numerical value.

  6. Specify the following Boundary Box options:

    Note: Boundary Box options are only available if the spatial column upon which your index is based is Geometric.

    Bound Lower Left X

    Lets you specify the value for the x-coordinate of the lower-left corner of the bounding box. Enter a numerical value.

    Bound Lower Left Y

    Lets you specify the value for the y-coordinate of the lower-left corner of the bounding box. Enter a numerical value.

    Bound Upper Right X

    Lets you specify the value for the x-coordinate of the upper-right corner of the bounding box. Enter a numerical value.

    Bound Upper Right Y

    Lets you specify the value for the y-coordinate of upper-right corner of the bounding box. Enter a numerical value.

  7. (Optional) Click the Comment tab and enter any comments that you want to associate with the object.
  8. (Optional) Click the UDP tab to work with user-defined properties for the object.
  9. (Optional) Click the Notes tab to view and edit user notes.
  10. Click Close.

    The table spatial index is defined and the SQL Server Table Spatial Index Editor closes.