Hi,
I have a large table, and I'm only extracting a few records using:
Select t.ID
>From my_table t
Where t.Invoiced < t.Received
Invoice and received are of type decimal(18,5)
IBExpert is reporting these as unindexed reads.
Is there an index I could create to speed up the loading?
Thanks in
13.09.2016 15:26, Maya Opperman m...@omniaccounts.co.za [firebird-support]
wrote:
> Is there an index I could create to speed up the loading?
No.
--
WBR, SD.
You could create a denormalized field that contains the difference of those
values (updated by a trigger, perhaps), and you can put an index on that
new field. Then change the query to find rows where [new difference field]
< 0.
Make sense?
On Tue, Sep 13, 2016 at 9:37 AM Dimitry Sibiryakov s..
>Loius Wrote:
>You could create a denormalized field that contains the difference of those
>values (updated by a trigger, perhaps), and you can put
>an index on that new field. Then change the query to find rows where [new
>difference field] < 0.
>Make sense?
Thank you, looks like I will need
Yes, you can, using an expression index
CREATE INDEX IDX_MYINDEX ON MY_TABLE COMPUTED BY (INVOICED - RECEIVED);
and your SELECT would be:
SELECT
*
FROM
MY_TABLE
WHERE
INVOICED - RECEIVED < 0
That way you will not need to create an additional column neither to do an
UPDATE neither to cr