Unix Technical Forum

ALLOW REVERSE SCANS

This is a discussion on ALLOW REVERSE SCANS within the DB2 forums, part of the Database Server Software category; --> In DB2 8.1.2 for Windows, the CREATE INDEX command has an option, "ALLOW REVERSE SCANS." Why would one ever ...


Go Back   Unix Technical Forum > Database Server Software > DB2

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 03:38 PM
Stanley Sinclair
 
Posts: n/a
Default ALLOW REVERSE SCANS

In DB2 8.1.2 for Windows, the CREATE INDEX command has an option,
"ALLOW REVERSE SCANS."

Why would one ever not want to allow reverse scans?

Stan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2008, 03:38 PM
Blair Adamache
 
Posts: n/a
Default Re: ALLOW REVERSE SCANS

Apparently there's an increased chance of deadlock if you allow a scan
in both directions.

Stanley Sinclair wrote:

> In DB2 8.1.2 for Windows, the CREATE INDEX command has an option,
> "ALLOW REVERSE SCANS."
>
> Why would one ever not want to allow reverse scans?
>
> Stan


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-26-2008, 03:38 PM
Stanley Sinclair
 
Posts: n/a
Default Re: ALLOW REVERSE SCANS

Blair,

The above implies that the index scan goes simultanously in both ASC
and DESC -- ie, that there are two scans simultaneously. Certainly
sound more efficient for a large table. Does the Optimizer put its
$0.02 in?

Stan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-26-2008, 03:38 PM
Blair Adamache
 
Posts: n/a
Default Re: ALLOW REVERSE SCANS

No, the scan for one query won't go in both directions at the same time
- the extra chance for deadlocks could arise from two queries sorting on
the same column in opposite directions.

Stanley Sinclair wrote:

> Blair,
>
> The above implies that the index scan goes simultanously in both ASC
> and DESC -- ie, that there are two scans simultaneously. Certainly
> sound more efficient for a large table. Does the Optimizer put its
> $0.02 in?
>
> Stan


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-26-2008, 03:38 PM
Mark A
 
Posts: n/a
Default Re: ALLOW REVERSE SCANS

"Blair Adamache" <badamache@2muchspam.yahoo.com> wrote in message
news:bmaggg$n6$1@hanover.torolab.ibm.com...
> No, the scan for one query won't go in both directions at the same time
> - the extra chance for deadlocks could arise from two queries sorting on
> the same column in opposite directions.
>

That's nasty. Sounds like a train wreck.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-26-2008, 03:39 PM
Rolf Loeben
 
Posts: n/a
Default Re: ALLOW REVERSE SCANS

> deadlocks could arise from two queries sorting on
> the same column in opposite directions


How can sorting create any deadlock ever?

Regards Rolf
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-26-2008, 03:39 PM
Stanley Sinclair
 
Posts: n/a
Default Re: ALLOW REVERSE SCANS

Rolf,

Instead of "sorting on," read "searching the index on." Right, Blair?

You are reading "sorting" as in the SQL command "SORT BY."

Stan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-26-2008, 03:40 PM
Blair Adamache
 
Posts: n/a
Default Re: ALLOW REVERSE SCANS

Here's how the desginer who built it described it (Type 2 indexes were
added in v8):

"There is a small additional chance of a deadlock between 2 scanners.
This was particularly the case before type 2 indexes, and much less so
now. Before type 2 indexes, you could get deadlock doing a forward scan
and reverse scan on the same range, with at least one X locking."

Stanley Sinclair wrote:

> Rolf,
>
> Instead of "sorting on," read "searching the index on." Right, Blair?
>
> You are reading "sorting" as in the SQL command "SORT BY."
>
> Stan


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:41 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com