Subject | RE: [firebird-support] Optimal algorithm for inventory |
---|---|
Author | Leyne, Sean |
Post date | 2008-06-22T21:28:43Z |
Slavomir,
A compound index can and will be used by a properly constructed SQL
query.
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?
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
> Hi, a compound index is for nothing !I must completely and utterly disagree with all that you have said.
> 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.
A compound index can and will be used by a properly constructed SQL
query.
> Because live is realy long, you can't use some simplifiedReally//
> 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.
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 relatedYour suggested implementation would result is a table which would have
> record in assigning table.
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