Hello List,
this is a noobie question:
I have had to take over an existing system - it was supposed to have
some contraints that
prevented dangling references - but...
any way i have 2 table - A and B.
each table has a key field and if a row is in B it should have a
corresponding row in A - but theres
the problem it doesn't for all the rows in B.
So I want to do something like
delete from B where key not in (select key from A order by key);
The problem is there are about 1,000,000 rows in A and 300,000 rows in
B. I let the above run
all night and it was still running the next morning. Does anyone have
an idea of a better way.
B = t_event_ack_log
A = t_unit_event_log
explain shows:
Aggregate (cost=4712921585.30..4712921585.31 rows=1 width=0)
-> Seq Scan on t_event_ack_log a (cost=103170.29..4712920878.60
rows=282677 width=0)
Filter: (NOT (subplan))
SubPlan
-> Materialize (cost=103170.29..117301.92 rows=1016163
width=4)
-> Index Scan using pk_tuel_eln on t_unit_event_log
(cost=0.00..98184.12 rows=1016163 width=4)
OBTW: how do I interpret the cost - the manual says:
planner's guess at how long it will take to run the statement
(measured in units of disk page fetches)"
Not sure I understand (measured in units of disk page fetches)
Thanks,
Steve
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend