Subject | RE: [ib-support] Table size and indexing |
---|---|
Author | Ray Drew |
Post date | 2001-06-18T11:32:44Z |
Wow, first of all, thanks for the quick response.
At 11:25 AM 18-06-01 +0100, you wrote:
... stuff snipped
indexes, viz. low-integrity key +
their low selectivity. You can have foreign >keys in your database
without using the db engine to enforce it!
I agree about the comments but you don't see those when you're looking at a
diagram in Erwin!
if you implement a lookup table and trigger it doesn't apply.
Helen, thanks for the advice. I'd better get back to the drawing board....
Ray
CIA UK
[Non-text portions of this message have been removed]
At 11:25 AM 18-06-01 +0100, you wrote:
>> >Making foreign keys on other tables that reference these small tableswill
>>DEFINITELY slow >things down - IB will form long duplicate chains in thewhich
>>index tree of the mandatory index >and wreck performance. Instead, make
>>composite indexes on such columns, combining the >lookup column + the
>>primary key.
>>
>>I'd just about finished designing the database for an analysis system I'm
>>developing when I read the above. Following is a (stripped down) table
>>records responses to direct response advertising campaigns:Not sure what you mean by this.
>>
>>CREATE TABLE "RESPONSES"
>>(
>> "NUM" "POSITIVEBIGINT" NOT NULL,
>> "CAMPNUM" "POSITIVEBIGINT" NOT NULL,
>> "REGNUM" "POSITIVESMALLINT",
>> "CONTMODENUM" "POSITIVEBIGINT" NOT NULL,
>> "ADNUM" "POSITIVEBIGINT",
>>CONSTRAINT "RESP_PK" PRIMARY KEY ("NUM")
>>);
>>
>>CAMPNUM refers to the advertising campaign that generated the response.
>>CAMPNUM is likely to be in the hundreds (or very low thousands).
>Primary table in the structure?
>>REGNUM refers to the region of the country from which the response came.ok. I can see that, so I should enforce RI with a trigger.
>>REGNUM is about 12 and not likely to change.
>Selectivity is too low to justify an index for sorting or joining purposes.
... stuff snipped
>>ADNUM refers to the advertisement (TV commercial, press ad, radio ad) thatAgreed.
>>generated the response. ADNUM will be in the thousands.
>Foreign key relationship and its index are both justified.
>>All these columns are implemeted as FK's to ensure data integrity and tointegrity. The
>>make use of the IB generated indexes.
>I don't see why the first two tables need to referenced to ensure data
>cost of those indexes is large; if you need data integrity triggers, writeyour own. The
>IB- generated indexes will be terrible. If you want these columns indexedin the referring >table for ordering purposes, define your own composite
indexes, viz. low-integrity key +
>pri key to raise their selectivity.that makes sense too.
>>Also, this keeps the design clean andengine-style foreign key >constraints that kill performance because of
>>understandable.
>/* Comments */ have the same effect without forcing you to accept
their low selectivity. You can have foreign >keys in your database
without using the db engine to enforce it!
I agree about the comments but you don't see those when you're looking at a
diagram in Erwin!
>>Are you saying that none of these should be implemented asMe too, now ;-)
>>FK's?
>Adnum is the only eligible FK I see there.
>>CONTACTMODENUM could be a domain with a check on the content, butmethod ????? If
>>since they are likely to change I would rather not have to change the
>>database structure just to add a new contact method.
>Why would you have to change the database structure to add a new contact
>it's a control table, you only need to add a new row.Just my inexperience showing! I was referring to updating a domain check but
if you implement a lookup table and trigger it doesn't apply.
Helen, thanks for the advice. I'd better get back to the drawing board....
Ray
CIA UK
[Non-text portions of this message have been removed]