Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gK0Jg-0006Ih-EK for pgsql-general@arkaria.postgresql.org; Tue, 06 Nov 2018 12:18:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gK0Je-0005W4-V6 for pgsql-general@arkaria.postgresql.org; Tue, 06 Nov 2018 12:18:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gK0Je-0005V2-H7 for pgsql-general@lists.postgresql.org; Tue, 06 Nov 2018 12:18:42 +0000 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gK0JX-0008O2-Bx for pgsql-general@lists.postgresql.org; Tue, 06 Nov 2018 12:18:41 +0000 Received: by mail-oi1-x244.google.com with SMTP id c25-v6so10524924oiy.0 for ; Tue, 06 Nov 2018 04:18:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=e+GQtJbB3TFaGTHKcvwAxeQMRAlQhUVwk7OXbazaH4o=; b=pLUymKzTQDdI+o0/D9+Y3rZHMky6MCKIKdBS9Smyq8/qQ1vRFbD9Gc8XFOBQTSms65 x5SLfjvumE2mu4Nuc2P9WT3VVTWVW1q1V2cKx0UFKAcMviljkBI3eloT8Vy2ASHTB8V+ p0vEfuR1JPlzES0U0yHwBlAwqlPKuY0Cff5p5Vj5P2UkFN5VZOOHplesyM9Hc2svR7Qq tT9i4B0hsl9OfXj0HEbUX2Gjgr6D+FZRv2cIj/Nzs+n7aIsJP8vMT6WjqyaiOkXjLl4U 9/nyeJdrvRClK6gCCz6nDEuO0Sy3vVzWCVFjENB6zngLEY+izdY6Z4EluajGisJqWVMY J/6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=e+GQtJbB3TFaGTHKcvwAxeQMRAlQhUVwk7OXbazaH4o=; b=kXF1JuN948lmkwvQ4iwGzvAjy+SCtdMnGnWCVA99Vhs1h9XIB9+S+IEZ1bu/nTeJn+ tRhvbZsZYOUoZyXFep32JiI5rsZ2kRl0aYAaTQ4jZjzsKiRzrkBm/uKOL9jCnUlRDHSf rbGglWoYxJGwpCQ+6d8hxof6bLyfOFbRHun4kehpsCNFOT2qZm3D6agOHgA7rucmF+1O /rUNZdCx2txQjotiDpgzHdiC4Tuxg8Zc+HGLCz7TC1fAeblDSMGVf8jQ2rDhUP/sT8uc Sfva5cJqWrkQWcGbeczkdpxiIXSQ4Qpm1Ncr4v9R+AKdSq+sDXt0H8ACSOj2nyR6CBpL pdmQ== X-Gm-Message-State: AGRZ1gKXSejqQ//6j/iWZWGyemJffxyiOBcfbzCvTm9VNQlxYLlIvu3V EgjCMn/C90GwXeKxA8qmr1kMZxpS X-Google-Smtp-Source: AJdET5fFVaf0FrbEjNSxDk23Mvl+fvFB6tgKDAKy6C0htUC64XyqC4/LZ0x3vXLEjeOQEL1y89JZow== X-Received: by 2002:aca:5f45:: with SMTP id t66-v6mr2569317oib.20.1541506713448; Tue, 06 Nov 2018 04:18:33 -0800 (PST) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id e186-v6sm14152227oia.39.2018.11.06.04.18.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 04:18:32 -0800 (PST) Subject: Re: CREATE OR REPLACE FUNCTION statement just sitting there To: pgsql-general@lists.postgresql.org References: <924318ab-f639-8116-e3a4-af4890dd5e5d@gmail.com> <2394ea86-6a5f-ddce-8929-a37376192eaf@gmail.com> From: Ron Message-ID: <02bf9cee-b94a-5eff-36a4-036f29458003@gmail.com> Date: Tue, 6 Nov 2018 06:18:31 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/06/2018 05:05 AM, Laurenz Albe wrote: > Ron wrote: >>>> However, one or more of our big (and schema-identical) prod databases (which are each on a different server) >>>> it is finicky and tends to just "sit" at a random one of the CREATE OR REPLACE FUNCTION statements. >>>> >>>> The "list all blocking queries" I run doesn't show that anything is blocking it (though it blocks >>>> everything else), and neither top(1) nor iotop(1) show any activity. >>>> >>>> If it matters, this script is fed to the databases via the JDBC driver, and it works fine when I run it via psql. >>>> (I'd gladly run the scripts manually, but these are child databases, and a parent db must be updated >>>> at the same time by a canned application.) >>>> >>>> Where in Postgres can I look to see why it's just sitting there? >>> select * from pg_stat_activity; >>> might shed some light? >> >> That (plus pg_locks) is the heart of the "list all blocking queries" statement I copied >> from https://wiki.postgresql.org/wiki/Lock_Monitoring. > If there is nothing with "granted" set to FALSE in "pg_locks", you are not blocked by > a database lock. > > What is the "state" of the hanging database session in "pg_stat_activity"? > > If it is "idle" or "idle in transaction", then the lock must be in your Java process. Good question.  I'll look at that the next time we try it. -- Angular momentum makes the world go 'round.