Subject | Re: Problem slow sorting/distinct in Firebird |
---|---|
Author | Dmitry Yemanov |
Post date | 2012-11-15T05:20:32Z |
15.11.2012 0:16, vanderlinde81 wrote:
SELECT FIRST 30 SKIP 0 distinct tr.NodePosition, tr.IdLink,
tr.IdTargetLink, tr.IdItem
I'd expect PLAN to change to
Dmitry
>What about reordering the fields as
> The Query in FireBird:
>
> SELECT FIRST 30 SKIP 0 distinct tr.IdLink, tr.IdTargetLink, tr.IdItem,
> tr.NodePosition
SELECT FIRST 30 SKIP 0 distinct tr.NodePosition, tr.IdLink,
tr.IdTargetLink, tr.IdItem
I'd expect PLAN to change to
> PLAN SORT (JOIN (TR INDEX (IDX_TREE3_2, IDX_TREE3_3), ART INDEXthat would eliminate one of the sorts.
> (RDB$PRIMARY2)))
> 873424 fetches, 0 marks, 12892 reads, 0 writes.What is your page cache setting?
Dmitry