🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11384

Re: Selecting row in which a column value is maximum

#11384
From: Edward Diener
Date: Mon, 25 Nov 2002 19:12
24 lines
2318 bytes
"Craig Stuntz [TeamB]" <cstuntz@nospamplease.com (but use vertexsoftware to
email)> wrote in message
news:MPG.184c1b6154274d7b98a260@newsgroups.borland.com...
> In article <3de24925@newsgroups.borland.com>, eddielee@tropicsoft.com
> says...
> > I don't see what the difference between a descending and ascending index
is
> > in this situation. I think the key point is that there be an index so
that
> > each row doesn't have to be read to find the maximum value.
> >
> IB can use a DESCENDING INDEX to find a MAX value, but it can't use
> an ASCENDING INDEX to find a MAX.  (Conversely, it can use an ASCENDING
> INDEX for a MIN value, but not a DESCENDING INDEX.)
>
> The reason is that IB prefix-compresses the index, and it would have
> to walk the entire index to get to the max node.  It would then have to
> determine if that row (or rows) was visible to the current transaction,
> and "back out" if not.

If the index is sorted based on the index value, which seems pretty natural
so that a particular record can be found easily based on its index, then
going to the last record of the index of an ascending index will give the
max value.
Technical Details
Message-ID: <3de27571$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!newsfeed.wirehub.nl!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3de051cf@newsgroups.borland.com> <3de0d0f0$1@newsgroups.borland.com> <MPG.184c120210a6b55a98a253@newsgroups.borland.com> <3de24925@newsgroups.borland.com> <MPG.184c1b6154274d7b98a260@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,60a1aedc82f6444
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-11-25 11:27:22 PST
From: "Edward Diener" <eddielee@tropicsoft.com>
Newsgroups: borland.public.interbase.sql
References: <3de051cf@newsgroups.borland.com> <3de0d0f0$1@newsgroups.borland.com> <MPG.184c120210a6b55a98a253@newsgroups.borland.com> <3de24925@newsgroups.borland.com> <MPG.184c1b6154274d7b98a260@newsgroups.borland.com>
Subject: Re: Selecting row in which a column value is maximum
Date: Mon, 25 Nov 2002 14:12:25 -0500
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 66.32.65.244
Message-ID: <3de27571$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1038251377 66.32.65.244 (25 Nov 2002 11:09:37 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!newsfeed.wirehub.nl!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail