Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 27E25DE314D for ; Tue, 3 Apr 2012 13:08:03 -0300 (ADT) Received: from mail.pub.dw.redsrci.com ([72.29.183.251] helo=mail.dw.redsrci.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SF6H3-0000RL-AI for pgsql-bugs@postgresql.org; Tue, 03 Apr 2012 16:08:03 +0000 Received: from mail.dw.redsrci.com (localhost [127.0.0.1]) by mail.dw.redsrci.com (Postfix) with ESMTP id 5CD216F4AB6; Tue, 3 Apr 2012 09:07:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= experts-exchange.com; h=content-transfer-encoding:content-type :content-type:in-reply-to:references:subject:subject :mime-version:user-agent:from:from:date:date:message-id:received :received; s=ee; t=1333469268; x=1335283668; bh=X4Bd0qIsGnk150QM Dm2S2kvS3R+5WhTWgrbZ9m5HTnY=; b=rHpnLj2bND5KTuYeJHJFlbjkMM9bT1EV FUBgLrv3dXMg9vMMsN7DCF+nuRo7m3WdkGLrfWd9hvSdCcV/5OESpQuIAyba8bL8 sjvq5hpUoYmvh3Pk746MV7l4MwF68znXf2LGrRMs8015Nv7QRyL4bgpc500+IO71 EIHyQWHglHQ= X-Virus-Scanned: amavisd-new at experts-exchange.com Received: from mail.dw.redsrci.com ([127.0.0.1]) by mail.dw.redsrci.com (mail.dw.redsrci.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zJtyTQkrGMZI; Tue, 3 Apr 2012 09:07:48 -0700 (PDT) Received: from [192.168.103.146] (unknown [192.168.103.146]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: amatzinger) by mail.dw.redsrci.com (Postfix) with ESMTPSA id 381E06F4AB0; Tue, 3 Apr 2012 09:07:48 -0700 (PDT) Message-ID: <4F7B2050.9000507@experts-exchange.com> Date: Tue, 03 Apr 2012 09:07:44 -0700 From: Alex Matzinger User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20120312 Thunderbird/11.0 MIME-Version: 1.0 To: Heikki Linnakangas CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6571: Postgres Kills 'Select 1' query randomly on hot standby databases References: <4F7A9D87.9060708@enterprisedb.com> In-Reply-To: <4F7A9D87.9060708@enterprisedb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201204/10 X-Sequence-Number: 32761 The connection that is executing the SELECT 1 are generally open for 1-5 hours before they are killed. The specific connection only executes SELECT 1. The transaction is simply BEGIN, and then SELECT 1's, no other query is executed. The updates we make to the primary database are quiet large, usually several megabytes. Alex On 4/2/2012 11:49 PM, Heikki Linnakangas wrote: > On 03.04.2012 02:23, amatzinger@experts-exchange.com wrote: >> On a hot standby database, while the primary is being updated, >> Postgres will >> randomly kill a process which is performing a "Select 1" command. >> >> The error is this: >> 2012-04-02 13:36:13.269 >> PDT,"smxuser","smxprd1",39523,"127.0.0.1:57893",4f79ffad.9a63,1,"",2012-04-02 >> >> 12:36:13 PDT,3/32,0,FATAL,40001,"terminating connection due to >> conflict with >> recovery","User query might have needed to see row versions that must be >> removed.","In a moment you should be able to reconnect to the >> database and >> repeat your command.",,,,,,,"" >> >> We have 5 hot standby's set up, which all preform this SELECT 1, and >> postgres kills them across all standby's. >> >> There should never be a situation that SELECT 1 is in conflict with >> data, as >> it it never using any table in the database. > > The system doesn't make a difference between queries like "SELECT 1" > that don't access any tables, and those that do. Even if "SELECT 1" > doesn't access any tables, a subsequent statement in the same > transaction might. > > I'm assuming that those "SELECT 1"s were issued in transactions that > had been open for a long time, because you shouldn't get recovery > conflicts with very short transactions, in practice anyway. >