Link to home
Start Free TrialLog in
Avatar of hmiura
hmiuraFlag for Brazil

asked on

Is there an order of precedence in executing SQL commands?

I have a very large database, with about 1 million users and also a large number of queries running simultaneously. Sometimes the database freezes. It only reads records (SELECT), but does not make any INSERTS nor UPDATES.

I guess the INSERTS get stuck in the spool.

Is there an order of precedence in executing these SQL commands? Does SQL server first do all SELECTS and them execute INSERTS and UPDATES?

Is there a solution for this? Basicly the INSERTs and UPDATEs are used for my Ad Server (check if the media exists, insert or update click and pageview records).
Avatar of Neil Russell
Neil Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

"with about 1 million users" ?? USERS?
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hmiura

ASKER

"1 million users" ... I mean registered users. Not everybody at the same time. But we have a very high number of pageviews and user interaction within the portal.
Avatar of hmiura

ASKER

Thanks for your help. I'll try creating more indexes and see if it really keeps DB cool.
Avatar of Rich Weissler
Rich Weissler

Just a side note -- Indexes help with READ (Select) performance, at the expense of WRITE (Update/Insert) performance.  If you add additional indexes, do not be surprised if insert/update performance gets worse.

What you might want to check is to see whether the index/updates are being blocked... (you should be able to see that in the activity monitor or the sp_who stored procedure.)