Subject | Re: [firebird-support] Re: Performance with indices |
---|---|
Author | Arno Brinkman |
Post date | 2006-04-04T07:09:51Z |
Hi Adam,
The selectivity is calculated as :
1 / (Total Number of index nodes / Number of duplicated nodes)
wouldn't change much.
The lower the selectivity the better it is (compared between indices of the same relation!)
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
General database developer support:
http://www.databasedevelopmentforum.com
Firebird open source database (based on IB-OE) with many SQL-99 features:
http://www.firebirdsql.org
http://www.firebirdsql.info
Support list for Interbase and Firebird users:
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep:
news://newsgroups.firebirdsql.info
> So if my math is right, selectivity equals:<snip>
>
The selectivity is calculated as :
1 / (Total Number of index nodes / Number of duplicated nodes)
>> And if the number of records changes, indices statistics should beIf the proportion of new records stays the same in a non-unique index compared to the existing one. Then the selectivity
>> recomputed too, shouldn't it?
>
> For Foreign keys and non unique indices, yes, changing the number of
> records does indeed impact the selectivity.
wouldn't change much.
> But what is a primary key?PK Selecticity = 1 / (10 - 0) = 0.1
>
> "A column in a table whose values uniquely identify the rows in the
> table. A primary key value cannot be NULL"
>
> There are no duplicates in a primary key index. If there were, then
> it could not uniquely identify the row and would not be a candidate
> key let alone the primary key.
>
> If the table had 10 records in it
> If the table had 500 records in itPK Selectivity = 1 (500 - 0) = 0.002
The lower the selectivity the better it is (compared between indices of the same relation!)
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
General database developer support:
http://www.databasedevelopmentforum.com
Firebird open source database (based on IB-OE) with many SQL-99 features:
http://www.firebirdsql.org
http://www.firebirdsql.info
Support list for Interbase and Firebird users:
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep:
news://newsgroups.firebirdsql.info