Subject Re: Performance issue
Author pokka_chi
> What is the performance of the following SQL?
>
> select
> DOC.DOC_ID,
> DOC.DOC_TYPE,
> DOC.DOC_SUBTYPE,
> DOC.DOC_DATE
> from doc
> where
> doc_id=1000
> order by
> doc_id
>

I've tested it. No difference from "select * from doc where doc_id =
1000 order by doc_id".


> Separately, you know that your ORDER BY clause is redundant/should
be
> dropped, right?
>
> The DOC_ID is unique, so sorting by the field is simply adding an
> extra/unneeded step.
>

Yes, I know that. I added that just in case FB doesn't use the
doc_id index. I came cross some other SQL engines which don't use the
index unless you specify the order by clause. I have also tested the
SQL "select * from doc where doc_id = 1000" and the speed is the same.

I've done the analysis of the database in FlameRobin and it says that
the index is only 3 levels deep. It seems strange that such a simple
SQL will take so long (5s to prepare, 5s to execute) even if there is
no windows cache. I've done a similar test in postgreSQL and the
response is almost instant (< 1s).