Subject | Re: Performance issue |
---|---|
Author | pokka_chi |
Post date | 2008-02-19T00:20:04Z |
> What is the performance of the following SQL?I've tested it. No difference from "select * from doc where doc_id =
>
> select
> DOC.DOC_ID,
> DOC.DOC_TYPE,
> DOC.DOC_SUBTYPE,
> DOC.DOC_DATE
> from doc
> where
> doc_id=1000
> order by
> doc_id
>
1000 order by doc_id".
> Separately, you know that your ORDER BY clause is redundant/shouldbe
> dropped, right?Yes, I know that. I added that just in case FB doesn't use the
>
> The DOC_ID is unique, so sorting by the field is simply adding an
> extra/unneeded step.
>
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).