Subject Re: [firebird-support] Re: First word after in alphabetical order
Author Eric SIBERT
> LOL, I remember trying to run Linux (RH, SUSE, Mandrake) on a P200 a
> while back. It liked a lot more RAM than win98 needed on the same box.

On my server, there is no graphic interface nor X server ... and no
screen. So, out of FB, it have enough RAM.

> Jump back into IBOConsole and take a look at the PLAN for the queries.
> I do know from experience that a select first n takes just as long in
> execution time as without the first n, but the fetch time is much
> better (obviously).

With IBOConsole :

PLAN (WAYPOINTS ORDER IDX_WP_NOM)

Statistics :
Execution Time (hh:mm:ss.ssss) 00:01:38.0203
Prepare Time (hh:mm:ss.ssss) 00:00:0219
Starting Memory 4709820
Current Memory 12686120
Delta Memory 7976300
Number of Buffers 2048
Reads 68112
Writes 18
Plan PLAN (WAYPOINTS ORDER IDX_WP_NOM)
Rows Affected 4564838

(5459596 roxs in the table)

With IBConsole :

PLAN (WAYPOINTS ORDER IDX_WP_NOM)

Statistics :
Execution Time (hh:mm:ss.ssss) 00:00:04.0891
Prepare Time (hh:mm:ss.ssss) 00:00:0015
Starting Memory 699868
Current Memory 4675592
Delta Memory 3975724
Number of Buffers 2048
Reads 8024
Writes 9
Plan PLAN (WAYPOINTS ORDER IDX_WP_NOM)

> I would rethink the process a little. I mean do they really want the
> 10 records following chamber, or do they want the first 10 records
> between chamber and chambeu etc.

Well, they want the next ten after the first they find ... but may be we
can find a way not to browse all the end of the table.
Start with :
SELECT ...
WHERE (WP_NOM>='CHAMBER') AND (WP_NOM<='CHAMBES')
ORDDER BY WP_NOM;

if less than 10 rows founds
SELECT ...
WHERE (WP_NOM>='CHAMBER') AND (WP_NOM<='CHAMBF')
ORDDER BY WP_NOM;

if less than 10 rows founds
SELECT ...
WHERE (WP_NOM>='CHAMBER') AND (WP_NOM<='CHAMC')
ORDDER BY WP_NOM;

and so on until I get ten. Each one need a millisecond.

I will look how to put this in a stored procedure.

Eric