Search Postgresql Archives

Re: Slow delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Doug Hall <doughalldev@xxxxxxxxx> writes:
> delete from citizen where id not in (select citizenid from 
> citizen_stage);

> The explain select tells me that there is a sequential select of 
> citizen_stage records. (??) There are 75009 citizen records and 14778 
> records, and it's taking more than half an hour. How can I speed this 
> up?

How old is your Postgres?  I'd expect 7.4 and up to do this with a hashed
IN, which'd be reasonably fast.  If the EXPLAIN output doesn't say
anything about a "hashed subplan", then either you've got an old version
or there's some sort of estimation problem.

If it is a hashed IN and it's still slow, I'd wonder about unindexed
foreign key references to the citizen table.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux