Subject Re: [firebird-support] Re: Long running gfix - safe to kill?
Author Ann W. Harrison
davemac330 wrote:
>
> I'm a bit worried that it's taking a lot of CPU (100% of one CPU in a
> dual Xeon box running Red Hat 9). I've brought the site up now and the
> database is OK, however, I'd like that gfix process not to be there.
>

Ah. When you get a chance, run a gstat on the database. That behavior
- very high CPU usage during garbage collection is often a symptom of
indexes with lots of duplicates. If you find an index where the value
of max dup: is > 100,000 you've almost certainly got a problem. If it's
a user defined index, you can drop it and replace it with one with the
same initial keys plus a unique (or nearly unique) identifier. For
example...

create table widgets (widget_id, bin, stack, warehouse);

create index widget_warehouse on widgets (warehouse);

Store 10 million widget, all in one of two warehouses. Add, delete, and
move a lot of widgets between warehouses. Notice that garbage
collection is really slow and CPU is near 100%.

drop index widget_warehouse;

create index widget_warehouse on widgets (warehouse, widget_id);

Programs run fast, garbage collection runs fast, all is good in the
world. Or wait for V2 which has indexes that handle massive numbers of
duplicates much more gracefully.

If, on the other hand, the bad index is system created to support a
foreign key relationship, you'll need to sign up for my second seminar.

Cheers,


Ann