473,383 Members | 1,877 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,383 software developers and data experts.

ExecuteReader Blocks Inserts on a Table

I have a sproc that returns data from a table using a simple SELECT. There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through the
rows, writing them out to a file. This takes about 5 minutes until I close
the reader.

Whilst this is going on, I have another application that is trying to insert
rows into the table. Normally, the inserts happen straight away, but when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select statement,
and even if they were (which they won't), I wouldn't want them included in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles
Jun 27 '08 #1
18 1195
Charles,

Are the 2 applications on the same machine or different machines?

Is the database server on a different machine than the applications?

Kerry Moorman
"Charles Law" wrote:
I have a sproc that returns data from a table using a simple SELECT. There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through the
rows, writing them out to a file. This takes about 5 minutes until I close
the reader.

Whilst this is going on, I have another application that is trying to insert
rows into the table. Normally, the inserts happen straight away, but when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select statement,
and even if they were (which they won't), I wouldn't want them included in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles
Jun 27 '08 #2
Charles,

You are by the way not using transaction locking, because then this is the
normal behaviour.

Cor

"Charles Law" <bl***@nowhere.comschreef in bericht
news:Om**************@TK2MSFTNGP06.phx.gbl...
>I have a sproc that returns data from a table using a simple SELECT. There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through
the rows, writing them out to a file. This takes about 5 minutes until I
close the reader.

Whilst this is going on, I have another application that is trying to
insert rows into the table. Normally, the inserts happen straight away,
but when the reader is open each insert takes a very long time to
complete.

I realise that this is not an unreasonable thing to happen, given that I
am trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select statement,
and even if they were (which they won't), I wouldn't want them included in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles

Jun 27 '08 #3
On Thu, 19 Jun 2008 02:17:57 +0100, "Charles Law" <bl***@nowhere.com>
wrote:
>I have a sproc that returns data from a table using a simple SELECT. There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through the
rows, writing them out to a file. This takes about 5 minutes until I close
the reader.

Whilst this is going on, I have another application that is trying to insert
rows into the table. Normally, the inserts happen straight away, but when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select statement,
and even if they were (which they won't), I wouldn't want them included in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles
You might take a look at the Transact-SQL statement SET TRANSACTION
ISOLATION LEVEL.
Jun 27 '08 #4
If the SELECT limits itself using a WHERE clause to rows which aren't in the inserted set, then you
have a chance to have the SELECT not blocked by your INSERTs. But that also depends on what
execution plan you get. If SQL Server drive the SELECT using an index which is on something that can
be used to exclude the rows to INSERT then you shouldn't see this blocking. However, considering you
return so many rows, you need to carefully evaluate your indexing strategy as well as your SELECT
query to make this happen.

Other options include Snapshot isolation and the READPAST optimizer hint. Those are well documented
in Books Online.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Charles Law" <bl***@nowhere.comwrote in message news:Om**************@TK2MSFTNGP06.phx.gbl...
>I have a sproc that returns data from a table using a simple SELECT. There are quite a few rows
returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through the rows, writing them
out to a file. This takes about 5 minutes until I close the reader.

Whilst this is going on, I have another application that is trying to insert rows into the table.
Normally, the inserts happen straight away, but when the reader is open each insert takes a very
long time to complete.

I realise that this is not an unreasonable thing to happen, given that I am trying to write to the
table whilst reading from it, but the rows being written will never be included in the WHERE
clause in my select statement, and even if they were (which they won't), I wouldn't want them
included in the selected rows.

Is there a way to read rows so that inserts can still occur without blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles

Jun 27 '08 #5
Hi Kerry

The two applications are on different machines, connected by a fairly slow
link, which is why it takes so long to iterate through the rows returned by
the reader. The database server is clustered on another machine, which is on
a Gb link to the second application, but the first (reader) application is
at the other end of the slow connection.

I could run both on the same machine, but then I would have to transfer the
resulting file over the slow link, and that would take longer in real time.

Charles
"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:6A**********************************@microsof t.com...
Charles,

Are the 2 applications on the same machine or different machines?

Is the database server on a different machine than the applications?

Kerry Moorman
"Charles Law" wrote:
>I have a sproc that returns data from a table using a simple SELECT.
There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through
the
rows, writing them out to a file. This takes about 5 minutes until I
close
the reader.

Whilst this is going on, I have another application that is trying to
insert
rows into the table. Normally, the inserts happen straight away, but when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I
am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select
statement,
and even if they were (which they won't), I wouldn't want them included
in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles

Jun 27 '08 #6
Hi Cor

No, I'm not explicitly using transaction locking. I thought, therefore, that
the reader would use row level locking, but if it is, it is still causing
some kind of locking problem.

Charles
"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:1E**********************************@microsof t.com...
Charles,

You are by the way not using transaction locking, because then this is the
normal behaviour.

Cor

"Charles Law" <bl***@nowhere.comschreef in bericht
news:Om**************@TK2MSFTNGP06.phx.gbl...
>>I have a sproc that returns data from a table using a simple SELECT. There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through
the rows, writing them out to a file. This takes about 5 minutes until I
close the reader.

Whilst this is going on, I have another application that is trying to
insert rows into the table. Normally, the inserts happen straight away,
but when the reader is open each insert takes a very long time to
complete.

I realise that this is not an unreasonable thing to happen, given that I
am trying to write to the table whilst reading from it, but the rows
being written will never be included in the WHERE clause in my select
statement, and even if they were (which they won't), I wouldn't want them
included in the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles


Jun 27 '08 #7
Hi Jack

I did read up about this, but it suggested that the default is row level
locking, which seemed to be the one I'd want anyway, so I haven't attempted
to change it. I have just looked again, and I see there is more to this than
I first thought, so I will read up.

Cheers

Charles
"Jack Jackson" <jj******@cinnovations.netwrote in message
news:55********************************@4ax.com...
On Thu, 19 Jun 2008 02:17:57 +0100, "Charles Law" <bl***@nowhere.com>
wrote:
>>I have a sproc that returns data from a table using a simple SELECT. There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through
the
rows, writing them out to a file. This takes about 5 minutes until I close
the reader.

Whilst this is going on, I have another application that is trying to
insert
rows into the table. Normally, the inserts happen straight away, but when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I
am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select statement,
and even if they were (which they won't), I wouldn't want them included in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles

You might take a look at the Transact-SQL statement SET TRANSACTION
ISOLATION LEVEL.

Jun 27 '08 #8
Hi Tibor

Thanks for the reply. I hadn't thought about the indexing issue. I will add
these to my reading list.

Cheers

Charles
"Tibor Karaszi" <ti***************************@hotmail.nomail.comw rote in
message news:FC**********************************@microsof t.com...
If the SELECT limits itself using a WHERE clause to rows which aren't in
the inserted set, then you have a chance to have the SELECT not blocked by
your INSERTs. But that also depends on what execution plan you get. If SQL
Server drive the SELECT using an index which is on something that can be
used to exclude the rows to INSERT then you shouldn't see this blocking.
However, considering you return so many rows, you need to carefully
evaluate your indexing strategy as well as your SELECT query to make this
happen.

Other options include Snapshot isolation and the READPAST optimizer hint.
Those are well documented in Books Online.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Charles Law" <bl***@nowhere.comwrote in message
news:Om**************@TK2MSFTNGP06.phx.gbl...
>>I have a sproc that returns data from a table using a simple SELECT. There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through
the rows, writing them out to a file. This takes about 5 minutes until I
close the reader.

Whilst this is going on, I have another application that is trying to
insert rows into the table. Normally, the inserts happen straight away,
but when the reader is open each insert takes a very long time to
complete.

I realise that this is not an unreasonable thing to happen, given that I
am trying to write to the table whilst reading from it, but the rows
being written will never be included in the WHERE clause in my select
statement, and even if they were (which they won't), I wouldn't want them
included in the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles


Jun 27 '08 #9
I did read up about this, but it suggested that the default is row level locking,

It is not that easy. First, SQL Server decided itself whether to lock row, page, or table level.
Factors involved in this decision is selectivity of query and concurrent users. Also, something that
start up as row level can during execution escalate to table level.

But even with row level, you are not helped if SQL Server need to look at every row. How do SQL
Server know if a row satisfy your criteria without looking at it first? See my other post for
elaboration about this topic.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Charles Law" <bl***@nowhere.comwrote in message news:uE**************@TK2MSFTNGP04.phx.gbl...
Hi Jack

I did read up about this, but it suggested that the default is row level locking, which seemed to
be the one I'd want anyway, so I haven't attempted to change it. I have just looked again, and I
see there is more to this than I first thought, so I will read up.

Cheers

Charles
"Jack Jackson" <jj******@cinnovations.netwrote in message
news:55********************************@4ax.com...
>On Thu, 19 Jun 2008 02:17:57 +0100, "Charles Law" <bl***@nowhere.com>
wrote:
>>>I have a sproc that returns data from a table using a simple SELECT. There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through the
rows, writing them out to a file. This takes about 5 minutes until I close
the reader.

Whilst this is going on, I have another application that is trying to insert
rows into the table. Normally, the inserts happen straight away, but when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select statement,
and even if they were (which they won't), I wouldn't want them included in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles

You might take a look at the Transact-SQL statement SET TRANSACTION
ISOLATION LEVEL.

Jun 27 '08 #10
Hi Tibor

Yes, I was obviously viewing this too simplistically. I have a couple of
Kalen Delaney's books, and there are some good topics in them that prove how
naive I was.

Cheers.

Charles
"Tibor Karaszi" <ti***************************@hotmail.nomail.comw rote in
message news:8A**********************************@microsof t.com...
>I did read up about this, but it suggested that the default is row level
locking,

It is not that easy. First, SQL Server decided itself whether to lock row,
page, or table level. Factors involved in this decision is selectivity of
query and concurrent users. Also, something that start up as row level can
during execution escalate to table level.

But even with row level, you are not helped if SQL Server need to look at
every row. How do SQL Server know if a row satisfy your criteria without
looking at it first? See my other post for elaboration about this topic.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Charles Law" <bl***@nowhere.comwrote in message
news:uE**************@TK2MSFTNGP04.phx.gbl...
>Hi Jack

I did read up about this, but it suggested that the default is row level
locking, which seemed to be the one I'd want anyway, so I haven't
attempted to change it. I have just looked again, and I see there is more
to this than I first thought, so I will read up.

Cheers

Charles
"Jack Jackson" <jj******@cinnovations.netwrote in message
news:55********************************@4ax.com.. .
>>On Thu, 19 Jun 2008 02:17:57 +0100, "Charles Law" <bl***@nowhere.com>
wrote:

I have a sproc that returns data from a table using a simple SELECT.
There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through
the
rows, writing them out to a file. This takes about 5 minutes until I
close
the reader.

Whilst this is going on, I have another application that is trying to
insert
rows into the table. Normally, the inserts happen straight away, but
when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I
am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select
statement,
and even if they were (which they won't), I wouldn't want them included
in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles
You might take a look at the Transact-SQL statement SET TRANSACTION
ISOLATION LEVEL.


Jun 27 '08 #11
Yes, Kalen's books, along with Books Online and possibly some hints mentioned in this thread should
get you going on this. :-)

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Charles Law" <bl***@nowhere.comwrote in message news:ug**************@TK2MSFTNGP06.phx.gbl...
Hi Tibor

Yes, I was obviously viewing this too simplistically. I have a couple of Kalen Delaney's books,
and there are some good topics in them that prove how naive I was.

Cheers.

Charles
"Tibor Karaszi" <ti***************************@hotmail.nomail.comw rote in message
news:8A**********************************@microsof t.com...
>>I did read up about this, but it suggested that the default is row level locking,

It is not that easy. First, SQL Server decided itself whether to lock row, page, or table level.
Factors involved in this decision is selectivity of query and concurrent users. Also, something
that start up as row level can during execution escalate to table level.

But even with row level, you are not helped if SQL Server need to look at every row. How do SQL
Server know if a row satisfy your criteria without looking at it first? See my other post for
elaboration about this topic.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Charles Law" <bl***@nowhere.comwrote in message news:uE**************@TK2MSFTNGP04.phx.gbl...
>>Hi Jack

I did read up about this, but it suggested that the default is row level locking, which seemed
to be the one I'd want anyway, so I haven't attempted to change it. I have just looked again,
and I see there is more to this than I first thought, so I will read up.

Cheers

Charles
"Jack Jackson" <jj******@cinnovations.netwrote in message
news:55********************************@4ax.com. ..
On Thu, 19 Jun 2008 02:17:57 +0100, "Charles Law" <bl***@nowhere.com>
wrote:

>I have a sproc that returns data from a table using a simple SELECT. There
>are quite a few rows returned, e.g. ~150,000.
>
>In my first application, I use a reader on the sproc and iterate through the
>rows, writing them out to a file. This takes about 5 minutes until I close
>the reader.
>
>Whilst this is going on, I have another application that is trying to insert
>rows into the table. Normally, the inserts happen straight away, but when
>the reader is open each insert takes a very long time to complete.
>
>I realise that this is not an unreasonable thing to happen, given that I am
>trying to write to the table whilst reading from it, but the rows being
>written will never be included in the WHERE clause in my select statement,
>and even if they were (which they won't), I wouldn't want them included in
>the selected rows.
>
>Is there a way to read rows so that inserts can still occur without
>blocking?
>
>I am using VB.NET in VS2005, and SQL Server 2005.
>
>TIA
>
>Charles
>

You might take a look at the Transact-SQL statement SET TRANSACTION
ISOLATION LEVEL.


Jun 27 '08 #12
Charles Law wrote:
I have a sproc that returns data from a table using a simple SELECT.
There are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate
through the rows, writing them out to a file. This takes about 5
minutes until I close the reader.
If you are doing

while moreRecords
begin
read record
write record to file
end

then maybe the writing to disk is the slow step, so how about

while moreRecords
begin
read record
append record to stringbuilder
end
write stringbuilder to file

?

I take it getting the sp to write to a file is not an option?

Andrew
Jun 27 '08 #13
Hi Andrew

Because of the speed of the connection, I think the extended times are
simply because of the time it takes to transfer that many records down the
wire. The file write is almost certainly not the slow bit.

If the sproc were to create the file then it would end up server-side, and I
need it client-side. Copying it would take much longer than the current 5
minutes.

Charles
"Andrew Morton" <ak*@in-press.co.uk.invalidwrote in message
news:6b*************@mid.individual.net...
Charles Law wrote:
>I have a sproc that returns data from a table using a simple SELECT.
There are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate
through the rows, writing them out to a file. This takes about 5
minutes until I close the reader.

If you are doing

while moreRecords
begin
read record
write record to file
end

then maybe the writing to disk is the slow step, so how about

while moreRecords
begin
read record
append record to stringbuilder
end
write stringbuilder to file

?

I take it getting the sp to write to a file is not an option?

Andrew

Jun 27 '08 #14
Charles Law wrote:
I have a sproc that returns data from a table using a simple SELECT. There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through the
rows, writing them out to a file. This takes about 5 minutes until I close
the reader.

Whilst this is going on, I have another application that is trying to insert
rows into the table. Normally, the inserts happen straight away, but when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select statement,
and even if they were (which they won't), I wouldn't want them included in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles
As already has been mentioned, there is different levels of locking. As
you are reading so many lines, the row locks will probably escalate into
page locks or a table lock to preserve resources. When that happens, it
will also lock other rows than the ones that you have selected.

You can specify (ROWLOCK) in your query. That should keep the database
from escalating the locks.

--
Göran Andersson
_____
http://www.guffa.com
Jun 27 '08 #15
On Jun 18, 8:17 pm, "Charles Law" <bl...@nowhere.comwrote:
I have a sproc that returns data from a table using a simple SELECT. There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through the
rows, writing them out to a file. This takes about 5 minutes until I close
the reader.

Whilst this is going on, I have another application that is trying to insert
rows into the table. Normally, the inserts happen straight away, but when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select statement,
and even if they were (which they won't), I wouldn't want them included in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles
Consider using snapshot isolation, so that readers do not block
writers.
Jun 27 '08 #16
Hi Göran

Thanks for the tip. That fits in with what I am seeing. I will give it a
try.

Charles
"Göran Andersson" <gu***@guffa.comwrote in message
news:eU**************@TK2MSFTNGP05.phx.gbl...
Charles Law wrote:
>I have a sproc that returns data from a table using a simple SELECT.
There are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through
the rows, writing them out to a file. This takes about 5 minutes until I
close the reader.

Whilst this is going on, I have another application that is trying to
insert rows into the table. Normally, the inserts happen straight away,
but when the reader is open each insert takes a very long time to
complete.

I realise that this is not an unreasonable thing to happen, given that I
am trying to write to the table whilst reading from it, but the rows
being written will never be included in the WHERE clause in my select
statement, and even if they were (which they won't), I wouldn't want them
included in the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles

As already has been mentioned, there is different levels of locking. As
you are reading so many lines, the row locks will probably escalate into
page locks or a table lock to preserve resources. When that happens, it
will also lock other rows than the ones that you have selected.

You can specify (ROWLOCK) in your query. That should keep the database
from escalating the locks.

--
Göran Andersson
_____
http://www.guffa.com

Jun 27 '08 #17
Hi Alex

I have just been reading about snapshot isolation and it also looks like a
likely candidate, as are some of the other suggestions.

Thanks.

Charles
"Alex Kuznetsov" <al****@gmail.comwrote in message
news:f5**********************************@a70g2000 hsh.googlegroups.com...
On Jun 18, 8:17 pm, "Charles Law" <bl...@nowhere.comwrote:
>I have a sproc that returns data from a table using a simple SELECT.
There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through
the
rows, writing them out to a file. This takes about 5 minutes until I
close
the reader.

Whilst this is going on, I have another application that is trying to
insert
rows into the table. Normally, the inserts happen straight away, but when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I
am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select
statement,
and even if they were (which they won't), I wouldn't want them included
in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles

Consider using snapshot isolation, so that readers do not block
writers.

Jun 27 '08 #18
Charles,

I thought that I had read once from William Vaughn that in fact the
datareader is processing a big resultset, which is simply build in one time.
Therefore the problem seems strange for me.

Try it in the AdoNet newsgroup, this is honey for Bill.

Cor

"Charles Law" <bl***@nowhere.comschreef in bericht
news:Oa**************@TK2MSFTNGP05.phx.gbl...
Hi Kerry

The two applications are on different machines, connected by a fairly slow
link, which is why it takes so long to iterate through the rows returned
by the reader. The database server is clustered on another machine, which
is on a Gb link to the second application, but the first (reader)
application is at the other end of the slow connection.

I could run both on the same machine, but then I would have to transfer
the resulting file over the slow link, and that would take longer in real
time.

Charles
"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:6A**********************************@microsof t.com...
>Charles,

Are the 2 applications on the same machine or different machines?

Is the database server on a different machine than the applications?

Kerry Moorman
"Charles Law" wrote:
>>I have a sproc that returns data from a table using a simple SELECT.
There
are quite a few rows returned, e.g. ~150,000.

In my first application, I use a reader on the sproc and iterate through
the
rows, writing them out to a file. This takes about 5 minutes until I
close
the reader.

Whilst this is going on, I have another application that is trying to
insert
rows into the table. Normally, the inserts happen straight away, but
when
the reader is open each insert takes a very long time to complete.

I realise that this is not an unreasonable thing to happen, given that I
am
trying to write to the table whilst reading from it, but the rows being
written will never be included in the WHERE clause in my select
statement,
and even if they were (which they won't), I wouldn't want them included
in
the selected rows.

Is there a way to read rows so that inserts can still occur without
blocking?

I am using VB.NET in VS2005, and SQL Server 2005.

TIA

Charles

Jun 27 '08 #19

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

Similar topics

6
by: Chris Ochs | last post by:
I want to do a series of inserts within a single transaction block, but with postgresql if one insert fails, the whole block is aborted. Is there any way to get around this behavior so that...
18
by: Charles Law | last post by:
I have a sproc that returns data from a table using a simple SELECT. There are quite a few rows returned, e.g. ~150,000. In my first application, I use a reader on the sproc and iterate through...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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...

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.