Subject Re: [firebird-support] IS this the right thing to do (trigger)
Author Robert martin
Hi Sean

Thansk for all yo0ur help so far :)


Leyne, Sean wrote:
> Robert,
>
>
>>> What indexes are defined on the BranchSend table?
>>>
>> CREATE INDEX BranchSend_RegionRef ON BranchSend(RegionRef)^
>> CREATE INDEX BranchSend_SendTable ON BranchSend(SendTable)^
>> CREATE INDEX BranchSend_PkRef ON BranchSend(PkRef)^
>> CREATE INDEX BranchSend_TransConf ON BranchSend(TransferConfirmed)^
>> CREATE INDEX BranchSend_TransferBatchRef ON
>>
> BranchSend(TransferBatchRef)^
>
> How many unique RegionRef values are there?
>
>
= to the number of regions (branches) currently 15.

> How many unique SendTable values are there?
>
>

About 10
> What is the exact SQL and PLAN generated for the counts query?
>
>
>

SQL

SELECT bs.SendTable, COUNT(bs.SendTable) AS NumRecs
FROM BranchSend bs
WHERE bs.RegionRef = :RegionRef
AND bs.TransferConfirmed = 'F'
GROUP BY bs.SendTable


PLAN

PLAN (BS ORDER BRANCHSEND_SENDTABLE INDEX (BRANCHSEND_REGIONREF,
BranchSend_TransConf))