Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 insert and select together

Author  Topic 

noamg
Posting Yak Master

215 Posts

Posted - 2002-10-22 : 10:58:44
hi,
(I will explain myself again)
I have an application that always create files, to insert rows into a table (bulk insert), very high speed. This table will not be indexed.

But other process has to query this table, so it needs the indexes.
the insert and the select queries are running always together. But, it is promised that the select is not required to return the last inserted rows.

I thought to define two tables: one without index and one with index. when an internal job is moving the rows, but this job will cause to extra locking.

what is the best way ?



Noam Graizer

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-10-22 : 11:10:00
you may be misunderstanding how much locking a plain insert statement will do.....it won't lock the ENTIRE table....just a portion of the table...a select and an update/insert can co-exist in seperate SQL sessions....one doesn't always lock out the other....



a BCP will lock a lot (or the whole) of a table....but an ordinary insert should be in an out quite fast...


you also missed the point of "the batch the update into small parts....(10000 recs) in the other post".....small updates will lock less of a table at a time...

also....the selects should wait until the update will finish...if any relevent resources do get locked....(the performance drop might be negligable)


finally....TRY what is suggested....THEORY is fine, PRACTICE is how you learn....



finally.....don't re-start posts....please just continue the conversation on the existing topic...it's easier then to follow the full conversation....(remember it's not just you reading them!!!...but others who are reviewing as well)

Go to Top of Page
   

- Advertisement -