Subject Re: Is it natual ?
Author Adam
Optimisation the easy way

Get yourself a good tool and it will show you visually what is being
used. The plan text is great, but if you think visually then you will
appreciate these tools

Interbase Planalyzer
http://blogs.teamb.com/craigstuntz/articles/InterBasePLANalyzer.aspx

Also IBAdmin and a few other tools have a similar feature built in.

Run the query in question, then make sure you are not looking at
records that are not important. Joins should always work on indexed
fields etc, and you should have an index available to minimise the
workload on any where condition.

If it doesn't use an index you think it should, then chances are the
selectivity isn't good enough because it isn't unique enough, you
could try adding the primary key to the end of it.

I have seen 60 second queries turn into 5 second queries many times
using these tools. It's not rocket science.

Adam


--- In firebird-support@yahoogroups.com, "xuxu" <xufh@c...> wrote:
> firebird-support£¡
>
> There are about 6-8 connections with my FB db. The operations
will become slowly when they operate the db at the same time .Spended
time of a operation will be 30-3000 seconds .The operations normally
like these:
> 1. select count(cdrid) from callingcdr where ...;
> 2. select sum(dialfee) from callingcdr where ...;
> ( 1,000,000 records in the table callingcdr, about 100,000
records will be affected, Indexed )
>
> 3. select feerate from feetbl where areacode like '0'||'%' ;
> ( 1000 records in the table feetbl, Indexed )
>
> Does it seem natual ?