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 2008 Forums
 Transact-SQL (2008)
 Concurrent access

Author  Topic 

aaroww11
Starting Member

12 Posts

Posted - 2012-01-31 : 12:44:39
I have one table with 7 million records.
I have to read date from that table couple times in second from 10 concurrent threads.
I need to read some record only once.

The idea is that I add other table and insert id’s of records which I read.
The query for the upper query would be left join between 2 tables.
I would use snapshot isolation.
Is this good approach?

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-31 : 12:50:23
care to show us your sql and ddl?


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

aaroww11
Starting Member

12 Posts

Posted - 2012-01-31 : 13:02:09
For example we have

CREATE TABLE table1(
[ID] [int] IDENTITY(1,1) NOT NULL,
[data1] [int] NOT NULL,
[data2] [int] NOT NULL,
[insertdate] timedate not null
CONSTRAINT [PK_ table1] PRIMARY KEY CLUSTERED
(
[ID] ASC
)

CREATE TABLE table1read(
[ID] [int] IDENTITY(1,1) NOT NULL,
[table1id] [int] NOT NULL,
[insertdate] timedate not null
CONSTRAINT [PK_ table1read] PRIMARY KEY CLUSTERED
(
[ID] ASC
)

The select wolud be something like

select top 100 *
from table1 left join table1read on table1.id=table1read.table1id
where table1id is null

After that I wolud insert all 100 records id’s into table1read

Go to Top of Page
   

- Advertisement -