Re: [firebird-support] Find rarely used or unused indices

2016-04-08 Thread Thomas Steinmaurer t...@iblogmanager.com [firebird-support]
Hi,

> What is the best way to go about to find out about this?
>
> I have several projects that are using the FB database and I would like
> to cleanup and remove all the indices that are just taking up space and
> thus indirectly reduces performance?

It is not that easy to clearly define the usefulness of an index. 
Usually indexes with a low selectivity (high number of duplicates) is a 
questionable candidate for a good index, but it depends from a query 
perspective.

Imagine you have an index with 1 million nodes pointing to records but 
with only 2 unique values (e.g. BOOLEAN), one row only with a value of 0 
and the rest with a value of 1. If you query the one row with value 0, 
the index will be definitely useful, but for querying 99 records 
with value 1, it is better to scan the entire table instead of the 
additional "hop" via the index to locate the row. Histograms 
(distribution among unique values) will help the optimizer there to 
choose a better execution plan. AFAIK histograms are planned for Firebird 4.

To get an overview across all your indices in your database from various 
perspectives (size, index depth, selectivity, duplicates etc.), you can 
run the gstat command-line tool and process and interpret the raw output.

But as Alexey has pointed out, there is tool support out there. HQbird 
is one. Upscene's FB TraceManager 
(http://www.upscene.com/fb_tracemanager/) is another product which can 
help you in that area. To get a first impression how this may look lie, 
have a look on that screen:
http://www.upscene.com/fb_tracemanager/images/products/fbtm/fbtm_ss_databasestatistics_index_monitoring.png

In combination with the live tracing functionality including execution 
plans of executed statements etc., you may find suspicious things.



-- 
With regards,
Thomas Steinmaurer
http://www.upscene.com/

Professional Tools and Services for Firebird
FB TraceManager, IB LogManager, Database Health Check, Tuning etc.



Re: [firebird-support] Find rarely used or unused indices

2016-04-08 Thread Alexey Kovyazin a...@ib-aid.com [firebird-support]

Hi,

Check your database with Database Analyst from HQbird (trial will be 
enough) and look at the list of Useless indices (indices with only 1 key 
for all values) and Bad indices (with a few keys for many values).


Then, you need to run tracing of your database in action, for example, 
with HQBird PerfMon with option Show plan text, and analyse log database 
for indices included in plans - essentially, build a list of them (it 
should be done manually).


Then perform
select rdb$index_name from rdb$indices
and compare these 2 lists, then figure out which indices are not used.

In general, this idea is not so good as it appears - if index has good 
selectivity, Firebird usually uses it very effectively, until you have 
some abandoned parts in the database, where you never send SQL queries.


Regards,
Alexey Kovyazin
IBSurgeon
www.ib-aid.com







Hi

What is the best way to go about to find out about this?

I have several projects that are using the FB database and I would 
like to cleanup and remove all the indices that are just taking up 
space and thus indirectly reduces performance?


Best regards

jardar





[firebird-support] Find rarely used or unused indices

2016-04-08 Thread Jardar Maatje jardar.maa...@nds.nortek.no [firebird-support]
Hi

What is the best way to go about to find out about this?

I have several projects that are using the FB database and I would like to
cleanup and remove all the indices that are just taking up space and thus
indirectly reduces performance?

Best regards

jardar