name="msvalidate.01" content="439BE949614BBF57E29AEDBC5087737D" /> learning sql server: Spatial Indexing in sql server

Rabu, 24 Juni 2009

Spatial Indexing in sql server

Spatial Indexing
Now that you have these two new spatial data types, how can you use them efficiently? Like
the XML data type, spatial types have a special indexing ability that is focused on optimizing
the querying abilities, as well as the storage of said index data.
Spatial indexes use a decomposition methodology that partitions the area being indexed into
a grid. A second layer (or level) contains grid cells from the first layer, each of which is broken
down into another grid. This process continues for a total of four layers, each containing a
more detailed breakdown of the previous layer. By default, each layer uses an 8x8 grid breakdown
as its basis, which means a default spatial index would be decomposed as follows:
Level 1 would be an 8x8 grid, or 64 cells.
Level 2 would have an 8x8 grid for each of the 64 cells in level 1, or 4,096 cells.
Level 3 would have an 8x8 grid for each of the 4,096 cells in level 2, or 262,144 cells.
Level 4 would have an 8x8 grid for each of the 262,144 cells in level 3, or 16,777,216
cells.
When creating the index, you can override the density of the grid at each level. There are
three levels of density available to use:
LOW Uses a 4x4 grid for a total of 16 cells
MEDIUM Uses an 8x8 grid, or 64 cells
HIGH Uses a 16x16 grid, or 256 cells
Once the index decomposes the space into the four levels, it then begins to tessellate each
spatial object on a row-by-row basis. Tessellation is the process that fits the object into the
grid levels, starting at level 1, and working down until the Cells-Per-Object rule states that it
should stop processing the object. You can use the spatial index’s CELLS_PER_OBJECT option
to any integer value from 1 to 8,192.
The default for the CELLS_PER_OBJECT option is 16; this default value generally provides a
good balance between the index precision and the size of the index. As you increase this
number, the precision increases but so does the size of the index, and a large index can adversely
affect performance.
More Info The tessellation process for both

Tidak ada komentar:

Posting Komentar