Re: SelectMethod=cursor and SelectMethod=direct
- From: "Frank Brouwer" <frank.brouwer_no_spam@xxxxxxxxxxxx>
- Date: Thu, 31 Mar 2005 11:18:46 +0200
Hi Joe,
Thanks for the answer.
We use prepared statements only, one per connection and we don't use
updateable and/or scrollable resultsets. All the database updates/inserts
are done by sql using a prepared statement and then setting the field
parameters. After processing a resultset the prepared statement is closed
and the connection is returned to the connection pool, using a "finally
block" in the method.
Reading your advice it seems best to switch using direct cursors. My only
concern is the memory usage as a direct cursor reads the complete resultset
into memory (I asume analyzing profiler output).
Any tips on that issue?
TIA,
Frank.
"Joe Weinstein" <joeNOSPAM@xxxxxxx> wrote in message
news:u8KCl0UNFHA.2468@xxxxxxxxxxxxxxxxxxxxxxx
>
>
> Frank Brouwer wrote:
>
>> Hello All,
>>
>> A query is taking more than 2 minutes to fetch 51 rows using
>> SelectMethod=cursor, when I change that to SelectMethod=direct I get the
>> results split seccond. So in the system only the SelectMethod has been
>> changed nothing else.
>>
>> Has any one a clue why there is so much differance?
>> What are the rules to know what method is best?
>>
>> TIA,
>> Frank Brouwer
>
> Hi. This setting is an artifact of a design decision in the current free
> MS driver.
> I believe this will change in the next major relase. (MS should
> confirm/deny)
> If you never need multiple-statement transactions, or you never have more
> than
> one open statement at a time, you can always use direct. Otherwise you
> need cursor
> mode. With direct, if you have multiple statements open at one time, this
> driver
> creates extra DBMS sessions under-the-covers to process each statement.
> However, there may be some DBMS tuning you can do to make cursor mode
> run
> faster. Does the table (do the tables) you are querying have an
> appropriate index
> to make a row-by-row cursor efficient on the data you want? Are you making
> your
> result sets updateable or scrollable? If you don't have to do that, don't.
> Plain
> forward-only non-updateable result sets are fastest.
>
> Joe Weinstein at BEA
>
.
- Follow-Ups:
- Re: SelectMethod=cursor and SelectMethod=direct
- From: "Carb Simien [MSFT]"
- Re: SelectMethod=cursor and SelectMethod=direct
- From: Joe Weinstein
- Re: SelectMethod=cursor and SelectMethod=direct
- From: Alin Sinpalean
- Re: SelectMethod=cursor and SelectMethod=direct
- References:
- Re: SelectMethod=cursor and SelectMethod=direct
- From: Joe Weinstein
- Re: SelectMethod=cursor and SelectMethod=direct
- Prev by Date: Re: Single Quote
- Next by Date: Re: SelectMethod=cursor and SelectMethod=direct
- Previous by thread: Re: SelectMethod=cursor and SelectMethod=direct
- Next by thread: Re: SelectMethod=cursor and SelectMethod=direct
- Index(es):
Relevant Pages
|