Ann,

> The FIRST keyword was added to Firebird's SQL in version 1.0 or 1.1 -
> in 2000 0r 2001, but the use of FIRST in InterBase goes back much further.
> It was part of GDML - and it's purpose was to signal that the query should
> be optimized to walk the index (navigate, in the internals) rather than
> create
> a bitmap and access records in storage order.   There's no reason to limit
> the number of record a query returns - when you've seen enough, just close
> it.  The semantic significance of FIRST and its relatives is "I want
> the first records quickly."

Quite interesting, thanks. This is really close to what I'm trying to 
discuss. Although this seems to be lost with time, as InterBase 6.0 had 
FIRST <N> clause in GDML acting as a row limit and Firebird's FIRST <N> 
clause just reused the same BLR implementation. And the optimizer didn't 
have any indications to treat blr_first as a hint that time.

> So, historically, no, it's neither a workaround nor a hack.

Here I may agree (knowing the history).

> Parsing SQL comments ... that sounds like a hack to me.

And here I agree as well. Although we've already seen other opinions.

> Adding yet another non-standard keyword when one already exists and does what 
> you want
> doesn't appeal all that much either.

But the FIRST clause in both SQL and GDML does not act as a hint for the 
past 15 years (at least). It can surely be considered by the optimizer 
(and this is already committed to v3.0), but its documented semantics is 
quite different.

> So would you consider a connection option?   A transaction option?

As stated in my initial message, I'm open for opinions in this regard. 
It could be specified per database, or per connection, or maybe even per 
transaction (although I doubt it's really needed). But regardless the 
global level FIRST ROWS is specified as the default behavior, users must 
be able to alter it to ALL ROWS at the statement level, if required. And 
it's impossible using the existing syntax.


Dmitry


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to