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 create a trigger.

Greetings.

Walter.


On Tue, Sep 13, 2016 at 9:26 AM, Maya Opperman m...@omniaccounts.co.za
[firebird-support] <firebird-support@yahoogroups.com> wrote:

>
>
> 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 advance
>
> Maya
>
>
>
>
>
> 
>
  • ... Maya Opperman m...@omniaccounts.co.za [firebird-support]
    • ... Dimitry Sibiryakov s...@ibphoenix.com [firebird-support]
      • ... Louis Kleiman lklei...@sstms.com [firebird-support]
        • ... Maya Opperman m...@omniaccounts.co.za [firebird-support]
    • ... 'Walter R. Ojeda Valiente' sistemas2000profesio...@gmail.com [firebird-support]

Reply via email to