troubleshooting Question

Index design and synchronization

Avatar of bmgoa
bmgoa asked on
Microsoft SQL ServerMicrosoft SQL Server 2005
8 Comments2 Solutions235 ViewsLast Modified:
Hello,
we have a table like:
       Table X
       (
         id bigint,
         nam varchar(10),
         stock varchar(5),
         Updated_Date datetime
        )

we insert records into the above Table X at a high rate in a multi-threaded fashion.

now, the id should be picked up from another table RefId.

Table RefID
 (
   NextUseID int
 )
 

This RefID table stores the Id to be used next when inserting into X and then we have to increment NextUseId by 1.

I query Table X extensively on nam and stock fields.

the updated_datetime is to be populated using getdate().

Now my question i)is what would be the ideal candidates for indexes on X
2)how should i ensure the NextUseId is
not corrupted via multithreaded references.i.e. several clients wanting to insert into X will read nextuseid and then increment it by 1.If this is simulaneous, then there will be data integrity issues.

we have not yet decided on whether to use Sql2k or 2005. so a genric soln would be appreaciated


Regards
bm
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros