Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qOB2I-0072Xh-4U for pgsql-general@arkaria.postgresql.org; Tue, 25 Jul 2023 05:56:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qOB2F-00Eh1U-DH for pgsql-general@arkaria.postgresql.org; Tue, 25 Jul 2023 05:56:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qOB2E-00Eh1L-W2 for pgsql-general@lists.postgresql.org; Tue, 25 Jul 2023 05:56:39 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qOB27-001RSx-Sj for pgsql-general@lists.postgresql.org; Tue, 25 Jul 2023 05:56:37 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-31758eb5db8so2076611f8f.2 for ; Mon, 24 Jul 2023 22:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20221208.gappssmtp.com; s=20221208; t=1690264589; x=1690869389; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=2v/oo5bSlDOuNu1T/UQmkILEDnYFB9ALCbScb1xHnuA=; b=GJ1M3G+uiyVFkkskESGEtmWb61fXWx5QwwFmDdMDosKwgeW8QgWmwRpV9VaDt599au hQqJtURue7lsmm77FAmgRrfTxpIqO7hBO2xuDNXVsZeyNDxRG4yz/wMr2giOGQGbmoZF 0D7xyWqfUKwKeXNnNgjswhw8/nIlABpdM64j0u30bW+VQc8f573XYaUasLaQHiMaxAmx 2qgSvjtrhjDORTA6SNJ5TcgfeA747SzyfQAX8QRvdD8wKWuzUjCnC9LJbBshErlI/Yzk zDGprA12VPiTeaAYtAtcSCR/QQChaAe5NrEzPe0aCPK3gIOgkJRX6tz32pYXdw1D50rI s0rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690264589; x=1690869389; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2v/oo5bSlDOuNu1T/UQmkILEDnYFB9ALCbScb1xHnuA=; b=aWtUcgHjRmk5TYc2H5eMqDbE5gzKJu+8grz8xTCHiJvN9KjSJTF3dYfEmUS99FIKWh Htv1zGGECQJ9MEk7Mkvse0XXzfwhcRUMd/1hAtWK6EU8hsHvbLKQMIjTqD3rJDW8dXvx Y3Lmw5e6ZBAlGmx68W0oaqCeBib07gsaWbDgHA0dZBDPnjVJac00LjeuUcMPyanrUcnI cwKEf/ATb8uOTXysfdb4bJiumi8lFGUtjfGJD7IrtEFyAvraYHhDejISJHwEj0vWET6k DDJ0lRcpYc7cYtMHVnxW35G4zMfJoM5i30NpbGNSyN5zwqAqXAY+aZIw/sDIQE7yZS/o 2sIg== X-Gm-Message-State: ABy/qLbf+3JECDEZFMOvwvU8UUy12804nBcJtpB5afWUaZpVPUMN7oCY yckoeV1AuAU1nn+tZl5YKI4n5A== X-Google-Smtp-Source: APBJJlFkzh2jaub5sQtH+JXJv7RQtvjiJvKNsrvBE9EzPEYbo8p8oguk4lYn4VdtCGxexYgdET+gwQ== X-Received: by 2002:adf:fc4d:0:b0:317:5e7a:bf9b with SMTP id e13-20020adffc4d000000b003175e7abf9bmr3844311wrs.63.1690264589391; Mon, 24 Jul 2023 22:56:29 -0700 (PDT) Received: from localhost.localdomain (mobiledyn-62-240-134-163.mrsn.at. [62.240.134.163]) by smtp.gmail.com with ESMTPSA id q7-20020adffec7000000b003143c532431sm14920044wrs.27.2023.07.24.22.56.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 22:56:29 -0700 (PDT) Message-ID: Subject: Re: How to improve the performance of my SQL =?UTF-8?Q?query=EF=BC=9F?= From: Laurenz Albe To: gzh Cc: pgsql-general@lists.postgresql.org Date: Tue, 25 Jul 2023 07:56:25 +0200 In-Reply-To: <6cd42bea.2647.1898b07865a.Coremail.gzhcoder@126.com> References: <6212ea1b.425b.1897221c3cc.Coremail.gzhcoder@126.com> <369ee851ef59bc84190f1631219b5a0c8f7907e9.camel@cybertec.at> <1937d056.71e9.18973a752d0.Coremail.gzhcoder@126.com> <6f3fd2f9.12b3.189761e1ccc.Coremail.gzhcoder@126.com> <4ae89a642b8ee57b8fdcd2f6e106aadc1eb60a4b.camel@cybertec.at> <66883f7d.6d50.189875236b2.Coremail.gzhcoder@126.com> <6cd42bea.2647.1898b07865a.Coremail.gzhcoder@126.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2023-07-25 at 11:11 +0800, gzh wrote: > > I asked for EXPLAIN (ANALYZE, BUFFERS, SETTINGS) ... > > Or do you have a version that is too old for SETTINGS? > Sorry. Please refer to the following execution plan. >=20 > [...] > Settings: effective_cache_size =3D '1886088kB', jit =3D 'off', search_pat= h =3D '"$user", mdb' > [...] No unusual settings. So that theory is dead. > > One other idea: check if the index is INVALID (this will > > be visible if you run "\d tablenane" in "psql"). > > Invalid indexes won't be used. Did you check that? After that, I am out of ideas. Yours, Laurenz Albe