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 1s9dE4-003nZE-Tq for pgsql-general@arkaria.postgresql.org; Wed, 22 May 2024 04:05:18 +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 1s9dE4-00Dxtc-7h for pgsql-general@arkaria.postgresql.org; Wed, 22 May 2024 04:05:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s9dE3-00DxtU-SZ for pgsql-general@lists.postgresql.org; Wed, 22 May 2024 04:05:15 +0000 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s9dDx-0008hF-4C for pgsql-general@lists.postgresql.org; Wed, 22 May 2024 04:05:15 +0000 Received: by mail-qt1-x82c.google.com with SMTP id d75a77b69052e-43e0d564136so5529851cf.0 for ; Tue, 21 May 2024 21:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716350708; x=1716955508; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dr/997au9D2vmxQh/lTltReGKHaN0TcnhDUg6HckYaA=; b=EzmIRO9KX2IU+4A5PhlagmBZNASNpkPt6uUYNXV7nkd/e0aCuafnTbt8sYwG0G/BRu MVK1QpJNWr2xHGnJjOVvQInl5dO81ZNhgxlGiwKP73QWTme5NDCCE5WI90EeDpB/7vC7 ds3xteBzhyx0KZjboX1NSTpIO5SlBuOjUmvVoonCwLWVZg28BJF5CGBz4vExaU83KJem jDtAq2/D4xFYRpPRW9T+WCPAFtnYhwr16xvca66UwyJQyGp1RtLEI0es/W+B57dKPrPm BOebDJHWnPbzUjyEDr4t4tV1kEAagdoLmfv7n6ztrpgxMrA1RFDPNUnwd7KhPyp891x4 haDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716350708; x=1716955508; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dr/997au9D2vmxQh/lTltReGKHaN0TcnhDUg6HckYaA=; b=uQalOzIUQWUBm9d0KKyeMJTSIGitkuF1nlch9hX1o4Of70Vsh2IutQzx5K3AVu1IKC FDJraW9CqBAmq9D45gI0e9cDAlD13zIyIh6NnxxijUiURMPtEK+tfzuJGMwcXzqc/87t IYj6IGFOVV/MpNulYZCnXp5fsZMGS6YgmF0jl9HR+4SInpSWG0oobzA7jqOm8/K0nVt+ uuV+N52Q4wZThHGRndZAv9VaZkEZ/4PpkJz+2juAtzWIWTM9J5onaaU+DPJXyilPRBS5 xTQzEyU3zp5tjMJsEaPGBd2zKOVTZErM3UYpmMQGWjmslFImbX2TzWk8xjPn6svSuEXG 9Cqg== X-Forwarded-Encrypted: i=1; AJvYcCVVnYW2TT1Daw7Tbpl73K0JRtwvNe913nBVot5nQHwiD8ZZG3E6fPPFAQY5XW0m9wi9a1IM1sjStA8JEQXtzKfE4XV9MpYQhw4DJXphgJ/bOkAf X-Gm-Message-State: AOJu0YwoHbWfs2FnT5ixzRsUcIxH471LYHRkWIb/pHQL68v1EfhYOuiR TCP9pCc9CI+VXu7zPtpZp82fXoEmQ8DfcahAoyDDsVsefgwSESKA2+prOOrISv5kWlDoFQ5WVv0 FyuKG5cYGrCTEgd4YFNgn/tklkSA= X-Google-Smtp-Source: AGHT+IGpoL+EaM5FkKdX96z/nBJWNg3oYIzfdNtxOtHmrkmWL3JHMUGPRYuOZq3e0laqUsoyHH/HZdbVaPl0bLr7PZM= X-Received: by 2002:ac8:5888:0:b0:43a:c04c:e3d3 with SMTP id d75a77b69052e-43f9e0e1325mr13852961cf.34.1716350707730; Tue, 21 May 2024 21:05:07 -0700 (PDT) MIME-Version: 1.0 References: <3901400.1716301132@sss.pgh.pa.us> In-Reply-To: <3901400.1716301132@sss.pgh.pa.us> From: =?UTF-8?B?U2HFoW8gR2FudGFy?= Date: Wed, 22 May 2024 06:04:56 +0200 Message-ID: Subject: Re: problem with query To: Tom Lane Cc: Laurenz Albe , David Rowley , pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000003e90dd0619030a7b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003e90dd0619030a7b Content-Type: text/plain; charset="UTF-8" ANALYZE pg_class; doesn't help also, query is from "Hasura", so I don't have much room to maneuver On Tue, 21 May 2024 at 16:18, Tom Lane wrote: > =?UTF-8?B?U2HFoW8gR2FudGFy?= writes: > > thanks for the info, but is there any solution, given that it's system > > tables? > > Given the complexity of the query, I wonder if you're running into > problems with join_collapse_limit/from_collapse_limit preventing > the planner from considering all options. > > Also, as David already mentioned, ANALYZE on pg_class might help. > > regards, tom lane > --0000000000003e90dd0619030a7b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
ANALYZE pg_class; doesn't help
also, query is = from "Hasura", so I don't have much room to maneuver

On = Tue, 21 May 2024 at 16:18, Tom Lane <tgl@sss.pgh.pa.us> wrote:
=3D?UTF-8?B?U2HFoW8gR2FudGFy?=3D <sasog23@gmail.com> writes:
> thanks for the info, but is there any solution, given that it's sy= stem
> tables?

Given the complexity of the query, I wonder if you're running into
problems with join_collapse_limit/from_collapse_limit preventing
the planner from considering all options.

Also, as David already mentioned, ANALYZE on pg_class might help.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane
--0000000000003e90dd0619030a7b--