Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • what does ct stand for? count? Commented Mar 19, 2019 at 7:46
  • 7
    @trthhrtz ctid points to the physical location of the record in the table. Contrary to what I wrote at the time in the comment, using the less than operator does not necessarily point to the older version as the ct can wrap around and a value with a lower ctid might actually be newer. Commented Jul 15, 2019 at 21:54
  • 1
    Just FYI, I tried this solution, and aborted it after waiting 15 minutes. Tried rapimo's solution and it completed in about 10 seconds (deleted ~700,000 rows). Commented Jun 8, 2020 at 1:49
  • @Patrick can't imagine if your db doesn't have a unique identifier as rapimo's answer doesn't work in that case. Commented Jun 16, 2020 at 18:17
  • 1
    @isapir I am just curious, the answers above, they are keeping the older records right as they selected min(ctid)? whereas yours are keeping the newer ones? thanks! Commented Jul 16, 2020 at 13:59