Subject RE: [firebird-support] Optimal algorithm for inventory
Author Leyne, Sean
Slavomir,

> Hi, a compound index is for nothing !
> This task is simple to describe, but hard to realize.
> The problem is because you are interesting in all
> record from interval and in this case you can
> use only one part of coumpond index.

I must completely and utterly disagree with all that you have said.

A compound index can and will be used by a properly constructed SQL
query.


> Because live is realy long, you can't use some simplified
> algoritmus and you must use this one:
>
> Create next two table:
> 1. Time segments (one record for one day)
> 2. Assigning table (assign time segment to person)
>
> All modification of tables will be done in triggers on person.

Really//

If a person is born today, yes the INSERT triggers can fire, but if that
person doesn't die for 100 years, what database operation will trigger
the update to the date table you describe?


> Finally you will ask time segment table for date, and count related
> record in assigning table.

Your suggested implementation would result is a table which would have
27,400,000,000 day/person entries for a database which has 1 million
people that live an average life expectancy (75 years).

This is a HORRIBLE solution.


Sean