Subject | Re: High selectivity |
---|---|
Author | peter_jacobi.rm |
Post date | 2003-09-26T14:40:53Z |
Hi Helen, Jonathan, All,
--- Helen Borrie, responding to Jonathan wrote:
So perhaps, fill the state columns with a generator, and when
state goes from 0 to 1, add a large enough constant, say
1,000,000,000.
Somewhere in your front app you discard the lower 9 decimal digits on
display, and replace
WHERE state = 0
with
WHERE state BETWEEN 0 AND 999999
for retrieval
Regards,
Peter Jacobi
--- Helen Borrie, responding to Jonathan wrote:
> >Suppose for instance that I have a STATE field on a table, that has two[..]
> >possible values, 0 and 1.
> > I know in advance that I willindex?
> >almost never need to select all records in STATE 1, but very frequently
> >all records in STATE 0, would it not be advantageous to define an
>search on
> No way. Firebird maintains indexes as binary trees. An indexed
> this index would take forever and a day shinning up and down twomassive
> chains of duplicates.As I have a similiar use case, I thought about this.
So perhaps, fill the state columns with a generator, and when
state goes from 0 to 1, add a large enough constant, say
1,000,000,000.
Somewhere in your front app you discard the lower 9 decimal digits on
display, and replace
WHERE state = 0
with
WHERE state BETWEEN 0 AND 999999
for retrieval
Regards,
Peter Jacobi