{"id":9980,"date":"2022-01-06T10:00:16","date_gmt":"2022-01-06T09:00:16","guid":{"rendered":"https:\/\/www.credativ.de\/blog\/credativ-inside\/postgresql-and-undelete\/"},"modified":"2022-01-06T10:00:16","modified_gmt":"2022-01-06T09:00:16","slug":"postgresql-and-undelete","status":"publish","type":"post","link":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/","title":{"rendered":"PostgreSQL and Undelete"},"content":{"rendered":"<h1>pg_dirtyread<\/h1>\n<p>I recently updated <a href=\"https:\/\/github.com\/df7cb\/pg_dirtyread\">pg_dirtyread<\/a> to work with <a href=\"https:\/\/www.postgresql.org\/docs\/14\/index.html\">PostgreSQL 14<\/a>. pg_dirtyread is a PostgreSQL extension that allows reading &#8220;dead&#8221; rows from tables, i.e., rows that have already been deleted or updated. Of course, this only works if the table has not yet been cleaned by a VACUUM command or autovacuum, PostgreSQL&#8217;s garbage collection.  <\/p>\n<p>Here is an example of pg_dirtyread in action:<\/p>\n<pre><i># create table foo (id int, t text);<\/i>\n<i>CREATE TABLE<\/i>\n<i># insert into foo values (1, 'Doc1');<\/i>\n<i>INSERT 0 1<\/i>\n<i># insert into foo values (2, 'Doc2');<\/i>\n<i>INSERT 0 1<\/i>\n<i># insert into foo values (3, 'Doc3');<\/i>\n<i>INSERT 0 1<\/i>\n\n<i># select * from foo;<\/i>\n<i> id \u2502 t<\/i>\n<i>\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500<\/i>\n<i> 1 \u2502 Doc1<\/i>\n<i> 2 \u2502 Doc2<\/i>\n<i> 3 \u2502 Doc3<\/i>\n<i>(3 rows)<\/i>\n\n<i># delete from foo where id &lt; 3;\n<\/i><i>DELETE 2<\/i>\n\n<i># select * from foo;<\/i>\n<i> id \u2502 t<\/i>\n<i>\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500<\/i>\n<i>  3 \u2502 Doc3<\/i>\n<i>(1 row)<\/i><\/pre>\n<p>Oops! The first two documents are gone. <\/p>\n<p>Let&#8217;s now use pg_dirtyread to view the table:<\/p>\n<pre><i># create extension pg_dirtyread;<\/i>\n<i>CREATE EXTENSION<\/i>\n\n<i># select * from pg_dirtyread('foo') t(id int, t text);<\/i>\n<i>  id \u2502 t<\/i>\n<i>\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500<\/i>\n<i>  1 \u2502 Doc1<\/i>\n<i>  2 \u2502 Doc2<\/i>\n<i>  3 \u2502 Doc3<\/i><\/pre>\n<p>All three documents are still present, but only one of them is visible.<\/p>\n<p>pg_dirtyread can also display the system columns of PostgreSQL with information about the position and visibility of the rows. For the first two documents, xmax is set, which means that the row has been deleted: <\/p>\n<pre><i># select * from pg_dirtyread('foo') t(ctid tid, xmin xid, xmax xid, id int, t text);<\/i>\n\n<i> ctid \u2502 xmin \u2502 xmax \u2502 id \u2502 t<\/i>\n<i>\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500<\/i>\n<i> (0,1) \u2502 1577 \u2502 1580 \u2502 1 \u2502 Doc1<\/i>\n<i> (0,2) \u2502 1578 \u2502 1580 \u2502 2 \u2502 Doc2<\/i>\n<i> (0,3) \u2502 1579 \u2502 0 \u2502 3 \u2502 Doc3<\/i>\n<i>(3 rows)<\/i><\/pre>\n<h1>Undelete<\/h1>\n<p><strong>Caveat:<\/strong> <em>I cannot promise that any of the ideas listed below will work in practice. There are some uncertainties and a good deal of complicated knowledge about PostgreSQL internals may be required to succeed. I would ask you to consider consulting your preferred PostgreSQL service provider for advice before attempting to restore data on a production system.  <\/em> <strong>Do not try this at work!<\/strong><\/p>\n<p>I always had plans to extend pg_dirtyread with an &#8220;Undelete&#8221; command to make deleted rows reappear, but unfortunately, I never got around to trying it out in the past. However, rows can already be restored by using the output of pg_dirtyread itself: <\/p>\n<pre><i># insert into foo select * from pg_dirtyread('foo') t(id int, t text) where id = 1;<\/i><\/pre>\n<p>However, this is not a real \u201cUndelete\u201d or &#8220;undo&#8221; &#8211; it only inserts new rows from the data read from the table.<\/p>\n<h1>pg_surgery<\/h1>\n<p>Let&#8217;s welcome <a href=\"https:\/\/www.postgresql.org\/docs\/current\/pgsurgery.html)\">pg_surgery<\/a>, a new PostgreSQL extension that comes with PostgreSQL 14. It contains two functions for &#8220;surgery on a broken relationship&#8221;. As a side effect, they can also make deleted tuples reappear.  <\/p>\n<p>As I have now discovered, one of the functions, heap_force_freeze(), works well with pg_dirtyread. It takes a list of ctids (row positions) that it marks as &#8220;frozen&#8221; but also as &#8220;not deleted&#8221;. <\/p>\n<p>Let&#8217;s apply it to our test table using the ctids that pg_dirtyread can read:<\/p>\n<pre><i># create extension pg_surgery;<\/i>\n<i>CREATE EXTENSION<\/i>\n\n<i># select heap_force_freeze('foo', array_agg(ctid))<\/i>\n<i>    <\/i><i>from pg_dirtyread('foo') t(ctid tid, xmin xid, xmax xid, id int, t text) where id = 1;<\/i>\n<i> heap_force_freeze<\/i>\n<i>\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<\/i>\n\n<i>(1 row)<\/i><\/pre>\n<p>And voil\u00e0, our deleted document is back:<\/p>\n<pre><i># select * from foo;<\/i>\n<i>  id \u2502 t<\/i>\n<i>\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500<\/i>\n<i>  1 \u2502 Doc1<\/i>\n<i>  3 \u2502 Doc3<\/i>\n<i>(2 rows)<\/i>\n\n<i>#select * from pg_dirtyread('foo') t(ctid tid, xmin xid, xmax xid, id int, t text);<\/i>\n<i>  ctid \u2502 xmin \u2502 xmax \u2502 id \u2502 t<\/i>\n<i>\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500<\/i>\n<i> (0,1) \u2502 2 \u2502 0 \u2502 1 \u2502 Doc1<\/i>\n<i>  (0,2) \u2502 1578 \u2502 1580 \u2502 2 \u2502 Doc2<\/i>\n<i>  (0,3) \u2502 1579 \u2502 0 \u2502 3 \u2502 Doc3<\/i>\n<i>(3 rows)<\/i><\/pre>\n<h1>Disclaimer<\/h1>\n<p>Most importantly, none of the above methods will work if the data you just deleted has already been cleaned by VACUUM or Autovacuum. This actively deletes the recovered storage space. Restore your data from the backup.  <\/p>\n<p>Since both pg_dirtyread and pg_surgery operate outside of the normal PostgreSQL MVCC machinery, it is easy to create corrupt data with them. This includes duplicate rows, duplicate primary key values, indexes that are not synchronized with the tables, broken foreign key constraints, and others.  <em>You have been warned.<\/em><\/p>\n<p>Furthermore, pg_dirtyread does not (yet) work if the deleted rows contain any <a href=\"https:\/\/www.postgresql.org\/docs\/current\/storage-toast.html\">toasted<\/a> values. Possible other approaches are the use of <a href=\"https:\/\/www.postgresql.org\/docs\/current\/pageinspect.html\">pageinspect<\/a> and <a href=\"https:\/\/wiki.postgresql.org\/wiki\/Pg_filedump\">pg_filedump<\/a> to get the ctids of the deleted rows. Please make sure you have working backups and do not need any of the above methods.  <\/p>\n<h1>We are Happy to Support You<\/h1>\n<p>The necessity of the above operations can be completely prevented in most cases by professional administration or setup of the PostgreSQL infrastructure by a competent service provider. If you are currently facing one of these problems and are looking for ways out of a predicament, please contact us by email at info@credativ.de or via the contact form. <\/p>\n<p>With over 22+ years of development and service experience in the PostgreSQL and Open Source area, credativ GmbH can professionally accompany you with an unprecedented and individually configurable support and fully support you in all questions regarding your Open Source infrastructure.<\/p>\n<p>&nbsp;<\/p>\n<p><em>This article was originally written by Christoph Berg<\/em><\/p>\n<h1>Also Worth Reading<\/h1>\n<ul>\n<li><a href=\"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/recover-data-from-corrupt-tables-in-postgresql\/\">Rescuing Corrupt Tables in PostgreSQL<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>pg_dirtyread I recently updated pg_dirtyread to work with PostgreSQL 14. pg_dirtyread is a PostgreSQL extension that allows reading &#8220;dead&#8221; rows from tables, i.e., rows that have already been deleted or updated. Of course, this only works if the table has not yet been cleaned by a VACUUM command or autovacuum, PostgreSQL&#8217;s garbage collection. Here is [&hellip;]<\/p>\n","protected":false},"author":90,"featured_media":3201,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1883,1708],"tags":[],"class_list":["post-9980","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian-en","category-postgresql-en"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.6 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>PostgreSQL and Undelete - credativ\u00ae<\/title>\n<meta name=\"description\" content=\"Use the functions of pg_dirtyread to recover deleted data in PostgreSQL undelete.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL and Undelete\" \/>\n<meta property=\"og:description\" content=\"Understand how postgresql undelete helps enable data recovery through pg_dirtyread. Read more about protected rows.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/\" \/>\n<meta property=\"og:site_name\" content=\"credativ\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/credativDE\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-06T09:00:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.credativ.de\/wp-content\/uploads\/2019\/07\/postgresql-competence-center-640x390.jpg\" \/>\n<meta name=\"author\" content=\"credativ Redaktion\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@credativde\" \/>\n<meta name=\"twitter:site\" content=\"@credativde\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"credativ Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/\"},\"author\":{\"name\":\"credativ Redaktion\",\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/#\\\/schema\\\/person\\\/63430ac9e022ccceba0f8d53ffe6db12\"},\"headline\":\"PostgreSQL and Undelete\",\"datePublished\":\"2022-01-06T09:00:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/\"},\"wordCount\":618,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.credativ.de\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/postgresql-competence-center.jpg\",\"articleSection\":[\"Debian\",\"PostgreSQL\u00ae\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#respond\"]}],\"copyrightYear\":\"2022\",\"copyrightHolder\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/\",\"url\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/\",\"name\":\"PostgreSQL and Undelete - credativ\u00ae\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.credativ.de\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/postgresql-competence-center.jpg\",\"datePublished\":\"2022-01-06T09:00:16+00:00\",\"description\":\"Use the functions of pg_dirtyread to recover deleted data in PostgreSQL undelete.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.credativ.de\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/postgresql-competence-center.jpg\",\"contentUrl\":\"https:\\\/\\\/www.credativ.de\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/postgresql-competence-center.jpg\",\"width\":800,\"height\":533,\"caption\":\"PostgreSQL\u00ae Competence Center\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL and Undelete\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/\",\"name\":\"credativ GmbH\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Organization\",\"Place\"],\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/#organization\",\"name\":\"credativ\u00ae\",\"url\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/\",\"logo\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#local-main-organization-logo\"},\"image\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#local-main-organization-logo\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/credativDE\\\/\",\"https:\\\/\\\/x.com\\\/credativde\",\"https:\\\/\\\/mastodon.social\\\/@credativde\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/credativ-gmbh\",\"https:\\\/\\\/www.instagram.com\\\/credativ\\\/\"],\"description\":\"Die credativ GmbH ist ein f\u00fchrendes, auf Open Source Software spezialisiertes IT-Dienstleistungs- und Beratungsunternehmen. Wir bieten umfassende und professionelle Services, von Beratung und Infrastruktur-Betrieb \u00fcber 24\\\/7 Support bis hin zu individuellen L\u00f6sungen und Schulungen. Unser Fokus liegt auf dem ganzheitlichen Management von gesch\u00e4ftskritischen Open-Source-Systemen, darunter Betriebssysteme (z.B. Linux), Datenbanken (z.B. PostgreSQL), Konfigurationsmanagement (z.B. Ansible, Puppet) und Virtualisierung. Als engagierter Teil der Open-Source-Community unterst\u00fctzen wir unsere Kunden dabei, die Vorteile freier Software sicher, stabil und effizient in ihrer IT-Umgebung zu nutzen.\",\"legalName\":\"credativ GmbH\",\"foundingDate\":\"2025-03-01\",\"duns\":\"316387060\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"},\"address\":{\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#local-main-place-address\"},\"geo\":{\"@type\":\"GeoCoordinates\",\"latitude\":\"51.1732374\",\"longitude\":\"6.392010099999999\"},\"telephone\":[\"+4921619174200\",\"08002733284\"],\"contactPoint\":{\"@type\":\"ContactPoint\",\"telephone\":\"08002733284\",\"email\":\"vertrieb@credativ.de\"},\"openingHoursSpecification\":[{\"@type\":\"OpeningHoursSpecification\",\"dayOfWeek\":[\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\"],\"opens\":\"09:00\",\"closes\":\"17:00\"},{\"@type\":\"OpeningHoursSpecification\",\"dayOfWeek\":[\"Saturday\",\"Sunday\"],\"opens\":\"00:00\",\"closes\":\"00:00\"}],\"email\":\"info@credativ.de\",\"areaServed\":\"D-A-CH\",\"vatID\":\"DE452151696\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/#\\\/schema\\\/person\\\/63430ac9e022ccceba0f8d53ffe6db12\",\"name\":\"credativ Redaktion\",\"description\":\"Dieser Account dient als Sammelpunkt f\u00fcr die wertvollen Beitr\u00e4ge ehemaliger Mitarbeiter von credativ. Wir bedanken uns f\u00fcr ihre gro\u00dfartigen Inhalte, die das technische Wissen in unserem Blog \u00fcber die Jahre hinweg bereichert haben. Ihre Artikel bleiben hier weiterhin f\u00fcr unsere Leser zug\u00e4nglich.\"},{\"@type\":\"PostalAddress\",\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#local-main-place-address\",\"streetAddress\":\"Hennes-Weisweiler-Allee 23\",\"addressLocality\":\"M\u00f6nchengladbach\",\"postalCode\":\"41179\",\"addressRegion\":\"Deutschland\",\"addressCountry\":\"DE\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.credativ.de\\\/en\\\/blog\\\/postgresql-en\\\/postgresql-and-undelete\\\/#local-main-organization-logo\",\"url\":\"https:\\\/\\\/www.credativ.de\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/credativ-logo-right.svg\",\"contentUrl\":\"https:\\\/\\\/www.credativ.de\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/credativ-logo-right.svg\",\"caption\":\"credativ\u00ae\"}]}<\/script>\n<meta name=\"geo.placename\" content=\"M\u00f6nchengladbach\" \/>\n<meta name=\"geo.position\" content=\"51.1732374;6.392010099999999\" \/>\n<meta name=\"geo.region\" content=\"Germany\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"PostgreSQL and Undelete - credativ\u00ae","description":"Use the functions of pg_dirtyread to recover deleted data in PostgreSQL undelete.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/","og_locale":"en_US","og_type":"article","og_title":"PostgreSQL and Undelete","og_description":"Understand how postgresql undelete helps enable data recovery through pg_dirtyread. Read more about protected rows.","og_url":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/","og_site_name":"credativ\u00ae","article_publisher":"https:\/\/www.facebook.com\/credativDE\/","article_published_time":"2022-01-06T09:00:16+00:00","og_image":[{"url":"https:\/\/www.credativ.de\/wp-content\/uploads\/2019\/07\/postgresql-competence-center-640x390.jpg","type":"","width":"","height":""}],"author":"credativ Redaktion","twitter_card":"summary_large_image","twitter_creator":"@credativde","twitter_site":"@credativde","twitter_misc":{"Written by":"credativ Editorial Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#article","isPartOf":{"@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/"},"author":{"name":"credativ Redaktion","@id":"https:\/\/www.credativ.de\/en\/#\/schema\/person\/63430ac9e022ccceba0f8d53ffe6db12"},"headline":"PostgreSQL and Undelete","datePublished":"2022-01-06T09:00:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/"},"wordCount":618,"commentCount":0,"publisher":{"@id":"https:\/\/www.credativ.de\/en\/#organization"},"image":{"@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#primaryimage"},"thumbnailUrl":"https:\/\/www.credativ.de\/wp-content\/uploads\/2019\/07\/postgresql-competence-center.jpg","articleSection":["Debian","PostgreSQL\u00ae"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#respond"]}],"copyrightYear":"2022","copyrightHolder":{"@id":"https:\/\/www.credativ.de\/#organization"}},{"@type":"WebPage","@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/","url":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/","name":"PostgreSQL and Undelete - credativ\u00ae","isPartOf":{"@id":"https:\/\/www.credativ.de\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#primaryimage"},"image":{"@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#primaryimage"},"thumbnailUrl":"https:\/\/www.credativ.de\/wp-content\/uploads\/2019\/07\/postgresql-competence-center.jpg","datePublished":"2022-01-06T09:00:16+00:00","description":"Use the functions of pg_dirtyread to recover deleted data in PostgreSQL undelete.","breadcrumb":{"@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#primaryimage","url":"https:\/\/www.credativ.de\/wp-content\/uploads\/2019\/07\/postgresql-competence-center.jpg","contentUrl":"https:\/\/www.credativ.de\/wp-content\/uploads\/2019\/07\/postgresql-competence-center.jpg","width":800,"height":533,"caption":"PostgreSQL\u00ae Competence Center"},{"@type":"BreadcrumbList","@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.credativ.de\/en\/"},{"@type":"ListItem","position":2,"name":"PostgreSQL and Undelete"}]},{"@type":"WebSite","@id":"https:\/\/www.credativ.de\/en\/#website","url":"https:\/\/www.credativ.de\/en\/","name":"credativ GmbH","description":"","publisher":{"@id":"https:\/\/www.credativ.de\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.credativ.de\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Organization","Place"],"@id":"https:\/\/www.credativ.de\/en\/#organization","name":"credativ\u00ae","url":"https:\/\/www.credativ.de\/en\/","logo":{"@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#local-main-organization-logo"},"image":{"@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#local-main-organization-logo"},"sameAs":["https:\/\/www.facebook.com\/credativDE\/","https:\/\/x.com\/credativde","https:\/\/mastodon.social\/@credativde","https:\/\/www.linkedin.com\/company\/credativ-gmbh","https:\/\/www.instagram.com\/credativ\/"],"description":"Die credativ GmbH ist ein f\u00fchrendes, auf Open Source Software spezialisiertes IT-Dienstleistungs- und Beratungsunternehmen. Wir bieten umfassende und professionelle Services, von Beratung und Infrastruktur-Betrieb \u00fcber 24\/7 Support bis hin zu individuellen L\u00f6sungen und Schulungen. Unser Fokus liegt auf dem ganzheitlichen Management von gesch\u00e4ftskritischen Open-Source-Systemen, darunter Betriebssysteme (z.B. Linux), Datenbanken (z.B. PostgreSQL), Konfigurationsmanagement (z.B. Ansible, Puppet) und Virtualisierung. Als engagierter Teil der Open-Source-Community unterst\u00fctzen wir unsere Kunden dabei, die Vorteile freier Software sicher, stabil und effizient in ihrer IT-Umgebung zu nutzen.","legalName":"credativ GmbH","foundingDate":"2025-03-01","duns":"316387060","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"},"address":{"@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#local-main-place-address"},"geo":{"@type":"GeoCoordinates","latitude":"51.1732374","longitude":"6.392010099999999"},"telephone":["+4921619174200","08002733284"],"contactPoint":{"@type":"ContactPoint","telephone":"08002733284","email":"vertrieb@credativ.de"},"openingHoursSpecification":[{"@type":"OpeningHoursSpecification","dayOfWeek":["Monday","Tuesday","Wednesday","Thursday","Friday"],"opens":"09:00","closes":"17:00"},{"@type":"OpeningHoursSpecification","dayOfWeek":["Saturday","Sunday"],"opens":"00:00","closes":"00:00"}],"email":"info@credativ.de","areaServed":"D-A-CH","vatID":"DE452151696"},{"@type":"Person","@id":"https:\/\/www.credativ.de\/en\/#\/schema\/person\/63430ac9e022ccceba0f8d53ffe6db12","name":"credativ Redaktion","description":"Dieser Account dient als Sammelpunkt f\u00fcr die wertvollen Beitr\u00e4ge ehemaliger Mitarbeiter von credativ. Wir bedanken uns f\u00fcr ihre gro\u00dfartigen Inhalte, die das technische Wissen in unserem Blog \u00fcber die Jahre hinweg bereichert haben. Ihre Artikel bleiben hier weiterhin f\u00fcr unsere Leser zug\u00e4nglich."},{"@type":"PostalAddress","@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#local-main-place-address","streetAddress":"Hennes-Weisweiler-Allee 23","addressLocality":"M\u00f6nchengladbach","postalCode":"41179","addressRegion":"Deutschland","addressCountry":"DE"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.credativ.de\/en\/blog\/postgresql-en\/postgresql-and-undelete\/#local-main-organization-logo","url":"https:\/\/www.credativ.de\/wp-content\/uploads\/2025\/04\/credativ-logo-right.svg","contentUrl":"https:\/\/www.credativ.de\/wp-content\/uploads\/2025\/04\/credativ-logo-right.svg","caption":"credativ\u00ae"}]},"geo.placename":"M\u00f6nchengladbach","geo.position":{"lat":"51.1732374","long":"6.392010099999999"},"geo.region":"Germany"},"_links":{"self":[{"href":"https:\/\/www.credativ.de\/en\/wp-json\/wp\/v2\/posts\/9980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.credativ.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.credativ.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.credativ.de\/en\/wp-json\/wp\/v2\/users\/90"}],"replies":[{"embeddable":true,"href":"https:\/\/www.credativ.de\/en\/wp-json\/wp\/v2\/comments?post=9980"}],"version-history":[{"count":0,"href":"https:\/\/www.credativ.de\/en\/wp-json\/wp\/v2\/posts\/9980\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.credativ.de\/en\/wp-json\/wp\/v2\/media\/3201"}],"wp:attachment":[{"href":"https:\/\/www.credativ.de\/en\/wp-json\/wp\/v2\/media?parent=9980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.credativ.de\/en\/wp-json\/wp\/v2\/categories?post=9980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.credativ.de\/en\/wp-json\/wp\/v2\/tags?post=9980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}