Subject | Re: [firebird-support] Index in FB 2 |
---|---|
Author | Arno Brinkman |
Post date | 2007-10-08T08:35:30Z |
Hi,
case) it's not optimal, because a lot of index-pages with the same value will be read. If "ItemRef" and "RegionRef"
together still should be unique, the best thing is creating a UNIQUE CONSTRAINT as Adam already pointed out.
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database with many powerful SQL features:
http://www.firebirdsql.org
http://www.firebirdsql.info
General database developer support:
http://www.databasedevelopmentforum.com
Support list for Interbase and Firebird users:
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep:
news://newsgroups.firebirdsql.info
> The table can have millions of records. The existing CPK was RegionRef,Firebird uses prefix-compression. Due that it helped improving performance by using RegionRef in the front.
> ItemRef.
> 1, 1234
> 1, 1235
> 1, 1236
> 1, 1237
> 2, 1234
> etc
>
> This was made worse where users have millions of items but only one region.
> There are also individual index's on Regionref and ItemRef.
>
> My question is should I create a Composite index to mimic the index
> created for the old PK? There is a note with this table that the CPK
> index was changed from Itemref, Regionref to RegionRef, ItemRef to
> improve performance (I assume in some specific area).
> I suppose the safest thing to do is just to mimic the old CPK index butFB2 can indeed use the individual indexes and combine them, but if you've many duplicates for RegionRef (which seems the
> my reading and gut makes this feel wrong. Almost all queries are Where
> ItemRef = x and regionref = y, is FB 2 smart enough to make use of the
> individual indexes.
case) it's not optimal, because a lot of index-pages with the same value will be read. If "ItemRef" and "RegionRef"
together still should be unique, the best thing is creating a UNIQUE CONSTRAINT as Adam already pointed out.
> Also Should I drop the RegionRef index. It probably is more of anIf there are FK's on "RegionRef" and "ItemRef" then automaticly an index is created.
> overhead then a benefit ?
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database with many powerful SQL features:
http://www.firebirdsql.org
http://www.firebirdsql.info
General database developer support:
http://www.databasedevelopmentforum.com
Support list for Interbase and Firebird users:
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep:
news://newsgroups.firebirdsql.info