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 1t3yXU-00FhEY-UP for pgsql-general@arkaria.postgresql.org; Thu, 24 Oct 2024 14:10:12 +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 1t3yXS-003dwK-5D for pgsql-general@arkaria.postgresql.org; Thu, 24 Oct 2024 14:10:10 +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 1t3yXR-003dvV-Q1 for pgsql-general@lists.postgresql.org; Thu, 24 Oct 2024 14:10:10 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t3yXK-002kG1-EW for pgsql-general@lists.postgresql.org; Thu, 24 Oct 2024 14:10:09 +0000 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5c9850ae22eso1233508a12.3 for ; Thu, 24 Oct 2024 07:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729779000; x=1730383800; 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=Fxp4Abqyzp/YEgxpxCZyPnz3WXc7y8Q+50LPH3pgUKo=; b=Gr5hpXIrpOcpNXbCs8fKymP/29MbIkrYhJXCeq7KQCiPnnUtJ9yb1eFkjanD/WQok5 LwFjA1ViNnnftss2kby7s7KCur7VA1H15D8nMudEsNAgdYs68hjVWrNLy68vqnZKKRH/ adnpUYEJtBp4B3/RzfC75ud7ub1rOjG3NxVXorjlZpAwxs16EU/lnOy+oTRHFJ8Ng0xI 4Fk1BdmdYw2g1oprx7eP05kvwd4fiuNmfsQXXjdU98fwpT8uPnlZqCgpACVWUG/NyVN+ bwvbwmkSfrVkDw8CdUK8+5IWEkIjdvwJYUxtYFkYbKGDJZjy6IsTZwkDwqI7NV1fE7Iy c9Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729779000; x=1730383800; 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=Fxp4Abqyzp/YEgxpxCZyPnz3WXc7y8Q+50LPH3pgUKo=; b=gEPS/BcpJJ5zdl2HmZnEj/3/13aDqIWyrW6ZHu77WRcrdlwObWU3UOEhFbb8jR5hg2 2tG9z3EL3UOjoqFlmaPUAqXE9fsy9rh4bawiq5ufyjcAMPchgTXzFBob/ORpiKzaqoLR 1DMrjRBYTQ4Z/zrz2huT+FkLeIbLo+StDMyDcdq9sF3AodSOGmS/zrLXT3BieJc2rCc0 9+/tbAZMT0r3qvKGXi3ge/Du0UOA+YuyEgD7EzpxgrqKdVPz3URYuDu4WZOuDwLIDLqV UpWE7bEmyddctKwhVSHPMv34lRC1zH6VcRf6Q7k5bQRYynKmeFy9QHYVj7klha0VCv86 thVA== X-Forwarded-Encrypted: i=1; AJvYcCV0SDrzGKTzrdYWhN/MRW5khKGMzmLPEfv2L/uA4OY/olEDxNWMVVSic0X38UnT8CeRhTmdZ8CZNf6SVklX@lists.postgresql.org X-Gm-Message-State: AOJu0YznKW4TnodNKJJPeXkbhQfZVkOpXKnVi4VRKSVoQ14Wurk1XzYa 396shnoCRsDOUbrxSccEvDbb7094X1XJwK0VAkBrJnurTTPp9OiP4FbgIaBfHqdVn4gtjHG5ubu w8cul7V24+gnmbd6ME4UHKARpHqmkNbOk X-Google-Smtp-Source: AGHT+IGiyr2tY7nx/7J8KrT9C1d6o0u8ypI1jVGSQieia6jEWcPVTnVjySIAk8Z1lXSo9Ve+9WoEo6WBYrwhOt4dQ5w= X-Received: by 2002:a05:6512:2207:b0:52c:fd46:bf07 with SMTP id 2adb3069b0e04-53b23e87d68mr1274598e87.49.1729778518468; Thu, 24 Oct 2024 07:01:58 -0700 (PDT) MIME-Version: 1.0 References: <20241016213610.wbfqj3r7gg5ba6eh@hjp.at> In-Reply-To: From: Greg Sabino Mullane Date: Thu, 24 Oct 2024 10:01:21 -0400 Message-ID: Subject: Re: Query performance issue To: yudhi s Cc: jross@openvistas.net, pgsql-general@lists.postgresql.org, hjp-pgsql@hjp.at Content-Type: multipart/alternative; boundary="000000000000223301062539726b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000223301062539726b Content-Type: text/plain; charset="UTF-8" > > Additionally in the plan which mysql makes and showing the highest > response time, is it suffering because of differences of the speed of the > underlying IO/storage or is it just because of the optimization features > which are available in postgres and not there in mysql ? Trying to > understand if it can be identified from the execution plan itself. > I think trying to compare postgres and mysql plans against each other is not a very useful endeavor. There are fundamental design decisions between the two. Focus on making your Postgres query the best it can be, full stop. Optimize your queries, make sure the database is analyzed, and tweak some configs as needed. Also, you cannot accidentally forget a join condition. Yes, this is the primary reason. Cartesian joins hurt. Again , not able to clearly understand the third point you said below. Can > you please clarify a bit more. Do you mean we should write it as exists > /not exists rather IN and NOT IN and that will improve the performance? It gives Postgres more options on how to do things, so yes, it can be better. Cheers, Greg --000000000000223301062539726b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Additionally in the p= lan which mysql makes and showing=C2=A0the highest response time, is it suf= fering because of differences of the speed of the underlying IO/storage or = is it just because of the optimization features which are available in post= gres and not there in mysql ? Trying to understand if it can be identified = from the execution plan itself.
<= div>
I think trying to compare postgres and mysql plans again= st each other is not a very useful endeavor. There are fundamental design d= ecisions between the two. Focus on making your Postgres query the best it c= an be, full stop. Optimize your queries, make sure the database is analyzed= , and tweak some configs as needed.

Also, you cannot accidentally forget a joi= n condition.

Yes, this is the primary reaso= n. Cartesian joins hurt.

Again , not able to clearly understand the third point = you said below. Can you please clarify a bit more. Do you mean we should wr= ite it as exists /not exists rather IN and NOT IN and that will improve the= performance?

It gives Postgres more option= s on how to do things, so yes, it can be better.

C= heers,
Greg
=C2=A0
--000000000000223301062539726b--