473,394 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Select on large table.

Greetings All, I was wondering what would happen if I were to do a
"select * from table" on a table that has about 5 million rows. Would
my read block other writers to the same table? Would it block other
readers? I know SQL uses optimistic lockign by default but I am not
sure what this means to other users trying to access the same table?
Any advise would be greatly appreciated.

TFD

Jul 23 '05 #1
3 2154
LineVoltageHalogen (tr****************@yahoo.com) writes:
Greetings All, I was wondering what would happen if I were to do a
"select * from table" on a table that has about 5 million rows. Would
my read block other writers to the same table? Would it block other
readers? I know SQL uses optimistic lockign by default but I am not
sure what this means to other users trying to access the same table?
Any advise would be greatly appreciated.


Other readers would not be blocked.

Writers would probably be blocked for the duration of the query, since
I would expect SQL Server take out a table lock. That would mean that
the table would be locked until your client has gotten all rows from
SQL Server.

With row locks, locks would be released when the client has received
the rows, as SQL Servers default isolation level is READ COMMITTED.

In any case, getting five millions is a hefty operation and not really
recommendable.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #2
If you're using access, you might have timeout problems. You can alter
that setting in the Enterprise manager.
I suggest multipart queries if you're selecting from multiple tables or
cursing through the rows if your doing data processing.

-DJ

Jul 23 '05 #3
It will not block readers, since the statement will use read locks, and
read locks are shared.

When I run "SELECT * FROM ..." on a 18 million row table (2.5GB), and
then run sp_lock on a seperate connection, I only see intend shared page
locks (different pages, but just one at a time), and an intend shared
table lock (and a shared database lock).

So this basically means writers are not blocked, apart from the
occasional page lock (which are so short that they didn't show in my
sp_lock experiment).

If I run "SELECT * FROM .. (TABLOCK)", then it is a different story.
Then there are no page locks but the (requested) shared table lock. From
that moment on the transactions on that table are piling up, because
then writers are locked.

Hope this helps,
Gert-Jan

LineVoltageHalogen wrote:

Greetings All, I was wondering what would happen if I were to do a
"select * from table" on a table that has about 5 million rows. Would
my read block other writers to the same table? Would it block other
readers? I know SQL uses optimistic lockign by default but I am not
sure what this means to other users trying to access the same table?
Any advise would be greatly appreciated.

TFD

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Funnyweb | last post by:
I have a database table, which has field that could contain a single integer or a list of comma separated integers. Is it possible to match each row of that field against an array of integers...
3
by: Sven Reifegerste | last post by:
Hi, i have a table with INT columns id,key,b1,b2,c1,c2, having 1.500.000 rows. 'key' and 'id' are indexed (Kardinality 385381) and id (Kardinality 1541525). Performing a SELECT * FROM...
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
13
by: James Conrad St.John Foreman | last post by:
One of the larger tables in our database is now 6.8 million rows (1 per financial transaction since 2000). Every time an amendment is made to a booking, new rows are added to the table for each...
4
by: Ed L. | last post by:
I think I'm seeing table-level lock contention in the following function when I have many different concurrent callers, each with mutually distinct values for $1. Is there a way to reimplement...
5
by: Silvio Matthes | last post by:
Hello, I'm new to the list and did not find a suitable answer to my question so here it is: I try to select the rows of a table where the content of a varchar-column is empty ('') and...
29
by: pb648174 | last post by:
I have the following basic statements being executed: Create a temp table, #TempPaging Insert Into #TempPaging (Col1, Col2) Select Col1, Col2 From SomeOtherTable Order By Col2, Col1 Select...
5
by: rAinDeEr | last post by:
Hi, I have a web application with a table to store terms and conditions of a Company. This may some times run into many pages and some times it may be just a few sentences. It is a character...
3
by: matwilko | last post by:
hi, i am trying to create a simple version of itunes...and i am using iframes to do this. I have already set up the iframes using dreamweaver and used a drop-down menu to select the genre. When...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.