I'm looking through the queries being executed by a third party application. The application was flagged as being slow by some of our end-users.
It seems to INSERT
records into a HEAP, then DELETE
them again after the session ends (without any selects happening on them?)
But at the end of each INSERT
statement there is a SELECT 0
.
Am I seeing some kind of artifact from the query plan cache? Is it possible there is some parameter that's missing? All other parameters are clearly indicated as for example @P1
.
There are 350 INSERT
actions per minute and a DELETE
of everything in the table ever hour. Which seems to be an OK case to use a HEAP, however if this SELECT 0 is actually selecting something from this heap, I'm wondering if I should ad a clustered index.
Update: Added a screenshot to show the select:
DELETE of everything in the table ever hour.
If the table is not referenced by foreign key to any other tables, then a truncate would be much betSELECT 0
??? If so, that is totally useless; I assumed you meant something likeSELECT 0 FROM schema.table...
and just didn't include the unnecessary details.