Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 38F655377DB for ; Tue, 29 May 2012 17:53:41 -0300 (ADT) Received: from mail-bk0-f46.google.com ([209.85.214.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SZTQB-0005j0-HR for pgsql-performance@postgresql.org; Tue, 29 May 2012 20:53:40 +0000 Received: by bkcji2 with SMTP id ji2so3479328bkc.19 for ; Tue, 29 May 2012 13:53:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding :x-gm-message-state; bh=PLiJ54/ti6HBJxcb+cdq8ynEvrspi34Nkcf++uS25j8=; b=YVjLGpxmQMXwg401RqjuWoeqwVM9nl2NTzm/6DWBK8KUD3VTyJDZGblFHzYtUtq5mt bW7RIkbACXUO0IH7oIqMwel1T0uPfK8Hwizga8HPIeEBrR8ls2brOn8YucPwc46m6ja3 P9CMMFA6Sf13ef9DjBcQtDyO5ZJLq5Z11ZafIAPyF8wajo2Ufm2qAuu1DZj66C+XbF1n UHsb5yB1j+DnQ70xaFW6u6nXHYnwGv8j8Uuy/gdh0PpIuDQPuCQL77vV0zj3muBdC0Mb TYybOcqGJicVvqXs/JWS94tW+pR6LZJDy78O8Qa7Xu83a92Rhb9Q4rWMntQ17Te/aUTQ M0MA== Received: by 10.204.152.199 with SMTP id h7mr7576697bkw.39.1338324805224; Tue, 29 May 2012 13:53:25 -0700 (PDT) Received: from ?IPv6:::1? (li224-40.members.linode.com. [173.255.214.40]) by mx.google.com with ESMTPS id gm18sm19731007bkc.7.2012.05.29.13.53.22 (version=SSLv3 cipher=OTHER); Tue, 29 May 2012 13:53:24 -0700 (PDT) Subject: Re: Recover rows deleted From: Jeff Davis To: Alejandro Carrillo Cc: "pgsql-performance@postgresql.org" In-Reply-To: <1338229453.91030.YahooMailNeo@web171005.mail.ukl.yahoo.com> References: <1338229453.91030.YahooMailNeo@web171005.mail.ukl.yahoo.com> Content-Type: text/plain; charset="ISO-8859-1" Date: Tue, 29 May 2012 13:53:20 -0700 Message-ID: <1338324800.28651.5.camel@sussancws0025> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 8bit X-Gm-Message-State: ALoCoQmNxx2x80ZGtxdWbQpCpi43jwI66HyeHhbrs3USAJ3PAgwwKl7XagLM4dRQ345JFod+Q4aI X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201205/168 X-Sequence-Number: 46992 On Mon, 2012-05-28 at 19:24 +0100, Alejandro Carrillo wrote: > Hi, > > > ¿How I can recover a row delete of a table that wasn't vacuummed? > I have PostgreSQL 9.1 in Windows XP/7. The first thing to do is shut down postgresql and take a full backup of the data directory, including any archived WAL you might have (files in pg_xlog). Make sure this is done first. Next, do you have any backups? If you have a base backup from before the delete, and all the WAL files from the time of the base backup until now, then you can try point-in-time recovery to the point right before the data loss: http://www.postgresql.org/docs/9.1/static/continuous-archiving.html If not, are we talking about a single row, or many rows? If it's a single row you might be able to do some manual steps, like examining the pages to recover the data. Another option is to try pg_resetxlog (make sure you have a safe backup first!): http://www.postgresql.org/docs/9.1/static/app-pgresetxlog.html And try setting the current transaction ID to just before the delete ran. Then you may be able to use pg_dump or otherwise export the deleted rows. Regards, Jeff Davis