Search Postgresql Archives

Re: Deleting orphaned records (not exists is very slow)

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

 



On Sep 27, 2010, at 23:20 , Tim Uckun wrote:

>> Why are you messing with ctid? Does the table have no key? If not, you should fix that first.
>> 
> 
> I got the idea from here
> 
> http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks

If your table already has a key (some column or combination of columns that is unique per row),
there's really no need to use ctid. The only reason they're using ctid on that page because 
they have duplicate rows: the table *doesn't* have a key and they have no other way to specify
rows uniquely. Given you reference an id column, I suspect your your table already has a key, 
so you should just use that.

ctid is an implementation detail of PostgreSQL rather than part of the logical design of the 
database: it really shouldn't be used unless you absolutely have to.

Anyway, sounds like you got it sussed out. Good luck with straightening out the rest of your data!

Michael Glaesemann
grzm seespotcode net




-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[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