SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Optimizing OLTP Spatial Inserts

Optimizing OLTP Spatial Inserts

Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)Grasshopper (16 reputation)

Group: General Forum Members
Points: 16 Visits: 209
A system attempts to transfer thousands of rows with two spatial columns (out of a 37million row source) into table X for interactive users to work with spatial data. The two columns are different projections of the same data.

We are seeing a huge time delay when inserting the records.
- A large insert is taking up to 5 minutes to complete
- A large insert is blocks other inserts. The system/db should support at least 40 concurrent inserts
- 90% of the explain plan cost are sort operations prior to the spatial index inserts.

Most of our spatial tuning experience has been with static prepared data. Without the spatial data and indexes, the insert works fine, but lets assume that isn't an option.

A. We are not sure what is being sorted prior to spatial index inserts. The explain plan says 9 million rows, but on our test, the table X only grew to 1.5 million.
- Does the sort basically rebuild the entire index when an insert contains > 2-5% of the table records?
- Is it just sorting the selected records to insert, which sometimes can be up to 100,000.

B. Is it possible to sort the source data to match the spatial index sequence? We have an identity column on the source as the clustered key. In other static spatial tables we have generated the clustered identity values based on geography data so index lookups are likely to be in memory. The explain plan uses "GetPlanarGeometryTesselation_VarBinary" in the sort. I haven't yet seen if I can get this tessalation number from TSQL to physically order the spatial data (and reset identity clustered key on our source)

I would really like to learn how we could align the clustered key to the spatial index. I am hoping we could then use the aligned identity column to avoid sort delays during inserts.

Any advice or suggestions? Thanks



You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum