Re: delete to slow

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

 



"Spiegelberg, Greg" <gspiegelberg@xxxxxxxxxx> writes:
> Would it be possible to perform a DELETE FROM table WHERE CURRENT OF mycursor?
> Is this implemented in Postgres?  I'm not seeing in in the manual for 7.4 or 8.

It is (or at least ought to be) on the TODO list, but it's not done yet
and I don't think anyone's working on it.

A reasonably efficient way to fake it is to include CTID in the cursor
readout and issue a delete-by-ctid instead.

	DECLARE c CURSOR FOR SELECT ctid, ... FROM mytable WHERE ...;
	FETCH FROM c;
	DELETE FROM mytable WHERE ctid = 'whatever';

This is more or less what would have to happen behind the scenes for
WHERE CURRENT OF to be implemented.

			regards, tom lane


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux