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 1gJrEB-0004md-7l for pgsql-general@arkaria.postgresql.org; Tue, 06 Nov 2018 02:36:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gJrE8-0002Of-5b for pgsql-general@arkaria.postgresql.org; Tue, 06 Nov 2018 02:36:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJrE7-0002OX-QN for pgsql-general@lists.postgresql.org; Tue, 06 Nov 2018 02:36:23 +0000 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gJrE0-0000Q6-Uh for pgsql-general@lists.postgresql.org; Tue, 06 Nov 2018 02:36:23 +0000 Received: by mail-oi1-x244.google.com with SMTP id g188-v6so3489151oif.8 for ; Mon, 05 Nov 2018 18:36:16 -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-language; bh=nZdm1MoNcn9GK8eC1IMHGWY1/U4TY/Xk1SIM822R+nA=; b=IWVeb8Tmco2BvOKOiydwVox0x8xNMYsHEK9FnOJywf3euaZj8NQvqKI2eaI0HVLHcA kMVqm9VFdnEdCSle0j4/Ckv4SdMnojMXx9dHPqwRF1kIltbQZ3d5Ias06+hqgGR3rsls wHz7e6gfcijj+t3srPJ85No6v+MUZWC/Vi9Jt8KTt80kGS+v7ly7ZudEHrLFz9bMM0SK +lHkeYt7ntVBv/x2UQAxe9Rk+fugl1zR5v/LuzmXTWI/qe6b4MPkZYDQuWdDuM6xUE/X tqvUelChsSy5MOKq+F6hmGVaLDlbZu2cJ1GJwbxysZSrtGISooWL7EpfQg+N3cHTT0Px rPAQ== 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-language; bh=nZdm1MoNcn9GK8eC1IMHGWY1/U4TY/Xk1SIM822R+nA=; b=K/GlnYDh4CAChmyICsI/Ec5uwNUd1ENI6pZnmA4Ga78coQHcKpPfPErwhSPhbrMNs+ FvX+t+kN1AcMKoHb0deqRVfDeZGVo4pZrvxUgdQ/hZcpWFNTL841yqtgeOV7RR54xEtf IuSYew+Vu5BMRoi5hkxBjP8//LKW2jx/AQ0oe5ZYVk7G6P08PTRxL19/ZAIOYO9RVG2V n5mwsK9M7L2Aza2ehdm5EDBeoutPJ7OCgw3bm9tEznyrdk+NcVWJsA3oZKlLckAYuoG2 4oupexaFdkbzaeHU9nqguknCMlxYZlwc4v41hddO35Pgisoj21pBooT1luNAzLJbrN0z 6X0w== X-Gm-Message-State: AGRZ1gLHibO9nfTN5yZKuZdR9+HPLKALx7BIqSVe6XMKjb+JENkwcJU5 rtVUCsECG9tQKSspwyzRV4wYKXNM X-Google-Smtp-Source: AJdET5dZFkNU/G6YzKAkeKrVlBHqGKLYiRUWlMIACvko6+3d2brDlXZH/LGfR9AdvfmnSaGlH+tuOw== X-Received: by 2002:aca:4083:: with SMTP id n125-v6mr14869336oia.108.1541471774864; Mon, 05 Nov 2018 18:36:14 -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 k205-v6sm15722378oia.53.2018.11.05.18.36.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 18:36:14 -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> From: Ron Message-ID: <2394ea86-6a5f-ddce-8929-a37376192eaf@gmail.com> Date: Mon, 5 Nov 2018 20:36:13 -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: multipart/alternative; boundary="------------558F6E330CF6572226D2E38F" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------558F6E330CF6572226D2E38F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 11/05/2018 08:30 PM, Rob Sargent wrote: > > On 11/5/18 7:05 PM, Ron wrote: > >> I've got a very puzzling problem on 9.6.6 systems we just migrated from >> 8.4.  (The same problem happened on 9.6.9, but rolled it back so as to >> make prod have the same version as our Staging systems.) >> >> We've got a giant script full of DROP TRIGGER IF EXISTS and CREATE TABLE >> and DROP TABLE and CREATE OR REPLACE FUNCTION statements. >> >> It's purpose is to drop old parts of partitioned tables and add new tables. >> >> It *ALWAYS worked* just fine on our big, ancient, production 8.4 >> databases (otherwise I'd have heard the screams of user rage), and on our >> 9.6.6 staging environment.  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? >> >> Thanks >> >> -- >> Angular momentum makes the world go 'round. > > > 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. -- Angular momentum makes the world go 'round. --------------558F6E330CF6572226D2E38F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 11/05/2018 08:30 PM, Rob Sargent wrote:

On 11/5/18 7:05 PM, Ron wrote:

I've got a very puzzling problem on 9.6.6 systems we just migrated from 8.4.  (The same problem happened on 9.6.9, but rolled it back so as to make prod have the same version as our Staging systems.)

We've got a giant script full of DROP TRIGGER IF EXISTS and CREATE TABLE and DROP TABLE and CREATE OR REPLACE FUNCTION statements.

It's purpose is to drop old parts of partitioned tables and add new tables.

It ALWAYS worked just fine on our big, ancient, production 8.4 databases (otherwise I'd have heard the screams of user rage), and on our 9.6.6 staging environment.  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?

Thanks

--
Angular momentum makes the world go 'round.


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.

--
Angular momentum makes the world go 'round.
--------------558F6E330CF6572226D2E38F--