--- Stephan Szabo <[EMAIL PROTECTED]> 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 ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster