Subject RE: [firebird-support] Re: Using VIEW (or not)
Author Riho-Rene Ellermaa
I run the SQL Editor in IBAdmin and execution time is taken from the
statistics page.

1. (9sec) select * from v_stat_history
PLAN JOIN (V_STAT_HISTORY ACCOUNT NATURAL,V_STAT_HISTORY STAT_HISTORY
INDEX (RDB$PRIMARY33))
PLAN JOIN (V_STAT_HISTORY ACCOUNT NATURAL,V_STAT_HISTORY STAT_HISTORY
INDEX (RDB$PRIMARY33))
Select statistic shows 50136 for STAT_HISTORY and 10 for ACCOUNT

2. (20 ms) SELECT accid,account.OLDACCOUNT ,
SDATE, ROW , OPTYPE, NAME ,UNAME,
DOCNO, CD , AMOUNT, stat_history.CURRENCY,
BANKREF , DETAILS , CREF ,
stat_history.REGNO, LOCALAMOUNT,
stat_history.BANK , BACCOUNT
from stat_history join account on stat_history.accID=account.id
where account.ibandate>SDATE

PLAN JOIN (ACCOUNT NATURAL,STAT_HISTORY INDEX (RDB$PRIMARY33))
Select statistic shows 36 for STAT_HISTORY and 1 for ACCOUNT


Riho Ellermaa

> OK, Riho, then I understand that you're not expecting to
> return 35000 records in less than 9 seconds, just that you
> want an initial reply in a matter of milliseconds.
>
> I suggest you show us the PLANS generated by the 9.4 sec and
> 20 ms selects. Or, if you use Fb 1.5, you could try