13.08.2013 11:28, Kjell Rilbe wrote:
>
> I fear that I know too little about the inner workings, but I'm a bit
> surprised... I would have thought that this is what actually happens:
>
> Select Expression
>      -> Aggregate
>        -> Sort (unique)
>          -> Table "RDB$RELATIONS" Access By ID
>             -> Index "RDB$INDEX_0" Scan

The innermost index scan is actually sorting, it backs the GROUP BY 
clause. You example suggests that the stream is then reordered by the 
explicit sort node, but that's not the case. In fact, we have two (or 
more) independents sorts - one for GROUP BY and others are for DISTINCTs 
inside aggregate functions, they work with different fields.


Dmitry


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to