Andrew Bullock
Andrew Bullock

Reputation: 37378

How to execute TSQL select without blocking?

I have a table which occasionally gets massive (300k+) amounts of rows inserted into it in a batch.

However, if the table is being read from during this insert period, the inserts and selects time out.

preventing all selects allows the inserts to run just fine.

Is there a way I can allow the selects to happen in a way that doesn't block the inserts?

I'm selecting with READ UNCOMMITTED but that doesn't seem to be enough.

I don't care if the read isn't 100% accurate (with regards the inserted data), it can miss rows if needs be, I just need the select to be fast and not upset the insert. Is this possible?

Upvotes: 0

Views: 341

Answers (1)

Brent
Brent

Reputation: 598

NOLOCK - http://technet.microsoft.com/en-us/library/aa213026(v=sql.80).aspx

Does this help?

SELECT * FROM 'TABLE NAME' WITH (NOLOCK)

Upvotes: 1

Related Questions