From: | ow <oneway_111(at)yahoo(dot)com> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: 7.4 - FK constraint performance |
Date: | 2004-02-12 14:05:16 |
Message-ID: | 20040212140516.65859.qmail@web60807.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
--- Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> wrote:
> Hmm, I'd wonder if maybe it's choosing a sequential scan in the second
> case? As a random question, does increasing the statistics target on
> Large.small_id and re-analyzing change its behavior?
Ran analyze, the result is the same. Here's more info:
1) There's 1 row in "Large" for "small_id" = 239
SELECT 1 FROM ONLY "my"."Large" x WHERE "small_id" = 239 FOR UPDATE OF x
Quick query. Explain shows index scan.
2) There are many rows in "Large" for "small_id" = 1
SELECT 1 FROM ONLY "my"."Large" x WHERE "small_id" = 1 FOR UPDATE OF x
Runs for about 3 min. Explain shows table scan.
3) delete from Small where id = 239
Runs for about 3 min. It does appear that table scan is used for FK
verification. But why? Am deleting "id = 239" not "id = 1" and the query in
(1) runs very quickly. Had suspicion that wrong id is passed during FK
verification but FK constraint DOES work.
4) Domain types used in the example above
my.dint = int
my.dlong = int8
my.dvalue = varchar(15)
Thanks
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2004-02-12 14:06:30 | Re: Circular-freelist bug is still there |
Previous Message | Fred Moyer | 2004-02-12 11:47:18 | Re: [HACKERS] PITR Dead right |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2004-02-12 15:10:38 | Re: array_lower /array_prepend doubt |
Previous Message | Tomasz Myrta | 2004-02-12 12:43:32 | Re: How to avoid nulls while writing string for dynamic query |