Subject Re: [ib-support] optimizer question
Author Ann W. Harrison
At 09:12 AM 5/23/2001 +0700, Sindu wrote:

>I'm learning how IB optimizer actually works.

Good luck.

>My question is, is IB optimizer using rule-based or cost-based optimizer?

Unfortunately, both. Originally cost-based, it evolved rule-based
behaviors. A goal for Firebird is to revert it to cost-based, but
that goal is a bit far away at the moment.

>But if it's cost-based, where's
>the statistics?

The selectivity is kept in the index header on the index root
page. By default, it is updated only when the index is rebuilt -
activate/deactivate, drop/create, or backup/restore. you should
set the statistics regularly - say just after a regular backup -
and also after any operation that might change a significant percent
( > 10) of the indexed values.

The cardinality is estimated by the record size and the number
of pointer pages for the table. A pointer page is (surprise) a
page of pointers to data tables. It may go as far as to check
the actual number of data pages by reading the pointer pages,
I'm not sure.

>I'd appreciate if anyone would point me to some resource about IB optimizer?

The only one I know is Jim Starkey, and he's grouchy. You can read a
bit more about it in the archives of the IB_architect list.


We have answers.