yes and yes and yes and it works in Flamrobin,.................. BUT it took 16 seconds for listing 58 data with 3 fields each
So there shall be something wrong with the table.
This is what the statisics of FlameRobin say.
and 27726511 fetches?!
should be about 100
Starting transaction...
Preparing statement: select datum, betrag, fk_einkommen from tbkupons order by fk_einkommen
Statement prepared (elapsed time: 0.001s).
Field #01: TBKUPONS.DATUM Alias:DATUM Type:DATE
Field #02: TBKUPONS.BETRAG Alias:BETRAG Type:NUMERIC(18,2)
Field #03: TBKUPONS.FK_EINKOMMEN Alias:FK_EINKOMMEN Type:INTEGER
PLAN (TBKUPONS ORDER FK_TBKUPONS_0)
Parameters: 0
Executing statement...
Statement executed (elapsed time: 0.000s).
27726511 fetches, 2 marks, 911 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 103 index, 25072676 seq.
Delta memory: 101168 bytes.
RDB$PAGES: 25072675 reads sequence.
RDB$DATABASE: 1 reads sequence.
RDB$FIELDS: 4 reads index.
RDB$INDICES: 6 reads index.
RDB$RELATION_FIELDS: 8 reads index.
RDB$RELATIONS: 4 reads index.
RDB$FORMATS: 1 reads index.
RDB$SECURITY_CLASSES: 2 reads index.
RDB$TRIGGERS: 1 reads index.
TBKUPONS: 77 reads index.
Total execution time: 16.781s
Script execution finished.
I tend to delete all data and re-write them including reset the index.
The more I think about it, the more strange things come up to my mind. E.g. that the index was expected to be about 30 and it was 18.000. Perhaps I made a mistake in writing the id's generator. I did not do do this too often in my life.
If anybody guesses better than me what went wrong, I would be grateful, if he shares it.
PS:
I bet, you want to see it:
generator
CREATE SEQUENCE GEN_TBKUPONS_ID START WITH 1 INCREMENT BY 1;
trigger
SET TERM ^ ;
CREATE TRIGGER GEN_TBKUPONS_TR FOR TBKUPONS ACTIVE
BEFORE insert POSITION 0
as
begin
if (new.id_kupon is null) then
new.id_kupon = gen_id(GEN_TBKUPONS_ID,1);
end
^
SET TERM ; ^