🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Selecting row in which a column value is maximum

#11289
From: Craig Stuntz TeamB
Date: Tue, 26 Nov 2002 16:43
31 lines
2585 bytes
In article <3de2bb5b$1@newsgroups.borland.com>, eddielee@tropicsoft.com 
says...
> If I am controlling the transaction, then I wouldn't be doing so by allowing
> the index to be updated while I need to get the maximum value for my key
> column. 

	The index doesn't need to be in the process of being updated.  Just 
the record.  IB is a versioning database.  There can be many records in 
the index which are not visible to your transaction.  Consider this 
situation:

o  Your transaction starts (SNAPSHOT)
o  Other guy's transaction starts
o  Other guy inserts record which is at top of index
o  You do a MAX
o  IB returns the maximum record visible to your transaction, *not* the 
maximum record in the index (which your transaction can't see).

> I will pass a transaction as part of my SQL statement that freezes
> the table from being updated until I can get back my value.
 
	This is possible, but it will quickly become a bottleneck in a 
heavily multiuser situation.

	-Craig

-- 
Craig Stuntz [TeamB] � Vertex Systems Corp. � Columbus, OH
Delphi/InterBase Weblog : http://delphi.weblogs.com
InterBase Perf. Monitor : http://delphi.weblogs.com/IBPerformanceMonitor
InterBase PLANalyzer 1.1: http://delphi.weblogs.com/IBPLANalyzer
Technical Details
Message-ID: <MPG.184d6eb1c4e6ba7498a277@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-08!supernews.com!newsfeed.news2me.com!dfw3-feed1.news.algx.net!jfk3-feed1.news.algx.net!allegiance!news.maxwell.syr.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> <3de27571$1@newsgroups.borland.com> <MPG.184c493d33d5246b98a267@newsgroups.borland.com> <3de2bb5b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 114a0e,60a1aedc82f6444
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-11-26 09:03:24 PST
From: Craig Stuntz [TeamB] <cstuntz@nospamplease.com  (but use vertexsoftware to email)>
Newsgroups: borland.public.interbase.sql
Subject: Re: Selecting row in which a column value is maximum
Date: Tue, 26 Nov 2002 11:43:15 -0500
Message-ID: <MPG.184d6eb1c4e6ba7498a277@newsgroups.borland.com>
References: <3de051cf@newsgroups.borland.com> <3de0d0f0$1@newsgroups.borland.com> <MPG.184c120210a6b55a98a253@newsgroups.borland.com> <3de24925@newsgroups.borland.com> <MPG.184c1b6154274d7b98a260@newsgroups.borland.com> <3de27571$1@newsgroups.borland.com> <MPG.184c493d33d5246b98a267@newsgroups.borland.com> <3de2bb5b$1@newsgroups.borland.com>
Organization: Vertex Systems Corporation
X-Newsreader: MicroPlanet Gravity v2.60
NNTP-Posting-Host: 65.86.87.242
X-Trace: newsgroups.borland.com 1038328901 65.86.87.242 (26 Nov 2002 08:41:41 -0800)
Lines: 31
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!dfw3-feed1.news.algx.net!jfk3-feed1.news.algx.net!allegiance!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail