Subject | Re: [firebird-support] Firebird Indexing problem |
---|---|
Author | |
Post date | 2015-10-22T19:55:35Z |
Hi,
why do you need to slow down query by index?
If you go throught whole table and only some sub percent (REPL) is not
looked for?
consider something like this
VALUE=’RX’ 100 records
VALUE=’YY’ 100 records
VALUE=’XX’ 100 records
VALUE=’AA’ 100 records
VALUE=’REPL’ 100 records
then this is cheaper to scan table (500 records) then use 400 indexed
reads
regards,
Karol Bieniaszewski
Sent: Thursday, October 22, 2015 1:13 PM
Subject: [firebird-support] Firebird Indexing
problem
Hi guys,
I have a problem with indexing in FB. Heres the query
select rep$log.pk, tablica_ime, client_number, time_stamp, sql_type, sql_query, usr
from rep$log
where usr <> 'REPL' and not exists
(select rep$trans.pk from rep$trans where rep$trans.replicated_pk = rep$log.pk)
Statistics show that rep$log has all non-indexed reads even though I've created an index for the usr field.
What's more interesting is that if I change this line
where usr <> 'REPL' and not
exists
to
where usr = 'SYSDBA' and not exists
all tha reads are indexed. So the problem is in the <> operation. How can I have indexed reads and keep the <> operation?
Thank you in advance guys.