Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njM72-0006e0-R1 for pgsql-general@arkaria.postgresql.org; Tue, 26 Apr 2022 14:24:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1njM71-00055r-ID for pgsql-general@arkaria.postgresql.org; Tue, 26 Apr 2022 14:24:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njM71-00055i-4x for pgsql-general@lists.postgresql.org; Tue, 26 Apr 2022 14:24:19 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1njM6y-0007b4-66 for pgsql-general@lists.postgresql.org; Tue, 26 Apr 2022 14:24:18 +0000 Received: by mail-ed1-x535.google.com with SMTP id a21so10370707edb.1 for ; Tue, 26 Apr 2022 07:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=DCFBnevXYvaGOCT8+bsFo0Clco0rxvl7TohHY5w61N0=; b=NBsJHotuN/xpcRK4Y6Q/E5szu+xS61c28fNBWs7Rqot93dYCfa50+aEBe2X+2UnMIe TRZDGZ2RJorOd1v809QQ25rN7GJ21E9hn2Sj8FbGcDxhfX5qoOXenfX01F+kMY3Lp3rg tvYwYHbEZZeWst8kZK/+cP2qq4snLIU2gyZu2NKwpp/2Suq+ZZ49oThch5GpBgUjpBUJ zt3/bZFr/0JK1oveOM9l1ObepdgOKNk5goVYQBOAK+Q4wmaak/alJkkd1KMd1sc+PQw/ R1CWom7zp1yxHHb9THHmcbXgkDBmtJw8pwuRXqSsnhyoGGGJvnrfg82FFtEdQU4q03Tr 7Dlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=DCFBnevXYvaGOCT8+bsFo0Clco0rxvl7TohHY5w61N0=; b=xOlttH+/OUU38MMAdqbwOqDAw6UIhruk9PB1BphIeuCEGP0oKGEfDoNpz4yR4EXCnY YU1RSq3roMJNAILVTLnwAWXPdoogDnuDK70+M+PZ54U5XlLeF36L7fLnA9iT0rhgiEGY dKgItSvpRsYbW/courKgbjyxuInDD88l5hzzlyM3xn1ZUgLuzNZDxa7R++DS+gd/E3T0 a+FzhgtfwkFlwALj4b2WzYacQ9lmGe3PY9x9EiaIm7C8ocBIS8vKIjnSxZr0EYnJLzfw x8FDmSViPLLXITtWF3pkp+iInVU6nTVr7SE+FnFg1HssYZBNymqK+sh9y5QVRM0aAYb8 Ts7g== X-Gm-Message-State: AOAM533OVYHiR5s9THRiHS882Cq+et8bguOcyMEE6eUavZmKnir+qOsY CA5uKzN86ABLBaxfEthOC2TPug== X-Google-Smtp-Source: ABdhPJxeBeD0kWn9BlTatbKoPTrBwrVngjJMUGe1m071B8vjI0GWdFenjrFz7Jl1RQXSwUzWVyNA0w== X-Received: by 2002:a50:ed16:0:b0:425:f420:e51a with SMTP id j22-20020a50ed16000000b00425f420e51amr7476411eds.23.1650983053547; Tue, 26 Apr 2022 07:24:13 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:280:b8e4:fb13:2e22:7e07]) by smtp.gmail.com with ESMTPSA id p12-20020a50c94c000000b00425c48132bfsm5723527edh.55.2022.04.26.07.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 07:24:13 -0700 (PDT) Message-ID: Subject: Re: pg_stat_activity.query empty From: Laurenz Albe To: "David G. Johnston" , Robert Lichtenberger Cc: "pgsql-generallists.postgresql.org" Date: Tue, 26 Apr 2022 16:24:12 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-5.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2022-04-26 at 06:59 -0700, David G. Johnston wrote: > On Tue, Apr 26, 2022 at 6:55 AM Robert Lichtenberger wrote: > > When executing "SELECT * FROM pg_stat_activity" I get lots of rows that  > > have an empty "query" column. > > > > According to [1] this column should contain the "Text of this backend's > > most recent query", either a query that is currently running or the last > > query that was executed. > > > > So how comes that a lot of the rows in pg_stat_activity have an empty > > "query"? > > > > https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW > > They've never executed a query.  Probably due to connection pooling opening connections for the pool but never needing to hand them out. An alternative option is that the last query sent was an empty string. Yours, Laurenz Albe