Subject RE: [ib-support] HELP ! Adding a foreign key SLOWS down query
Author Amrita Chaudhury
The tables are :
CREATE TABLE "TRAF_ORG"
(
"PMDATE" VARCHAR(8) NOT NULL,
"PMHOUR" INTEGER NOT NULL,
"BSC" INTEGER NOT NULL,
"BTS" INTEGER NOT NULL,
"SECTOR" INTEGER NOT NULL,
"FA" INTEGER NOT NULL,
"ATT_VOC" INTEGER default 0,
"ATT_DAT" INTEGER default 0,
....
"AVG_DLY" NUMERIC(15, 2) default 0,
CONSTRAINT "TRAF_ORG_PRIMARY" PRIMARY KEY ("PMDATE", "PMHOUR", "BSC", "BTS",
"SECTOR", "FA")
);


CREATE TABLE "TRAF_TER"
(
"PMDATE" VARCHAR(8) NOT NULL,
"PMHOUR" INTEGER NOT NULL,
"BSC" INTEGER NOT NULL,
"BTS" INTEGER NOT NULL,
"SECTOR" INTEGER NOT NULL,
"FA" INTEGER NOT NULL,
"ATT_VOC" INTEGER default 0,
"ATT_DAT" INTEGER default 0,
....
"AVG_DLY" NUMERIC(15, 2) default 0,
CONSTRAINT "TRAF_TER_PRIMARY" PRIMARY KEY ("PMDATE", "PMHOUR", "BSC", "BTS",
"SECTOR", "FA")
);


I was trying to add :
ALTER TABLE "TRAF_ORG" ADD FOREIGN KEY ("BSC") REFERENCES BSCMAP ("BSCID")
ON UPDATE CASCADE ON DELETE CASCADE;

where BSCMAP is a config table defined as :
CREATE TABLE "BSCMAP"
(
"BSCID" INTEGER NOT NULL,
"MSCID" INTEGER NOT NULL,
"BSMID" INTEGER NOT NULL,
"BSCNO" INTEGER NOT NULL,
CONSTRAINT "BSCMAPUNIQUE" UNIQUE ("BSMID", "BSCNO"),
PRIMARY KEY ("BSCID")
);

-----Original Message-----
From: Amrita Chaudhury [mailto:achaudhu@...]
Sent: Tuesday, August 06, 2002 3:30 PM
To: 'ib-support@yahoogroups.com'
Subject: [ib-support] HELP ! Adding a foreign key SLOWS down query


HI,

I had a set of stored procedures that were used to join and query certain
data tables, and
all was working fine, till I had to add foreign key reference on one of the
columns on these
tables to a column in another configuration table.

If I take off the feriegn key reference, everything is ok, as soon as I put
it back on, the
query just never makes it through ..


PLEASE help .. I do need to reference this to the other table - how can I
get away with
this ?

In deep distress,

Regards ! and TIA,

AC


[Non-text portions of this message have been removed]



Yahoo! Groups Sponsor

ADVERTISEMENT

<http://rd.yahoo.com/M=228862.2128520.3581629.1829184/D=egroupweb/S=17051153
86:HM/A=1182689/R=0/*http://adfarm.mediaplex.com/ad/ck/990-1736-1039-335>


To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .




[Non-text portions of this message have been removed]