On Mon, 6 Jan 2014 11:38:32 -0500, Ann Harrison <a...@qbeast.net> wrote:
> 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
> itt.  The semantic significance of FIRST and its relatives is "I want
the
> first
> records quickly."

As I see it, optimizer hints are a different beast from limiting the
result set using FIRST. The first is a way to influence decisions of the
optimizer, and the second describes what is to be delivered (number of
rows; which might have a default optimizer behavior, which might be
overridden by an optimizer hint(!)).

I'd prefer a generic (and 'extensible') way for optimizer hints, because
we are currently discussing 'first n rows' only, but that isn't the only
possible optimization that could be added. See for example the way SQL
Server hints work as I posted in an earlier mail.

>  So, historically, no, it's neither a workaround nor a hack.  Parsing
SQL
> comments ... that sounds like a hack to me.  Adding yet another
> non-standard keyword when one already exists and does what you want
> doesn't appeal all that much either.

Yes, using comments might be a hack. But it provides a separation between
describing what you want, and providing the optimizer with hints on how you
think it might choose a better plan, and it doesn't 'pollute' the statement
syntax.

Mark

------------------------------------------------------------------------------
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