pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sivapostgres@yahoo.com <sivapostgres@yahoo.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re:  Query Performance
Date: Sat, 17 Sep 2022 05:28:25 +0000 (UTC)
Message-ID: <96197456.387057.1663392505315@mail.yahoo.com> (raw)
References: <96197456.387057.1663392505315.ref@mail.yahoo.com>

Hello,
My query is like this   
Select a.field1, a.field2, a.field3From   (Select a.field1, b.field2, c.field3        From   table1 a        Join   table2 b        on     b.something = a.something        Join   table3 c        On     c.something = a.something         Where  a.field7 = 'value'
        UNION ALL
        Select a.field4, a.field5, a.field6        From   table11 a        Join   table21 b        On     b.something = a.something        Where  a.field8 = 'something' ) aJoin   table10 bOn     b.field11 = (Select c.field11                    From   table10 c                    Where  c.field10 = a.field1 )                     <- instead of a.field1, if I hardcode value (eg. '100') query runs fasterJoin   table21 cOn     c.something = a.something...

In the above query, If I substitute a value for a.field1, query runs faster.   Any suggestion/guidance/links to improve the query performance without substituting the value ?
Happiness Always
BKR Sivaprakash

view thread (47+ messages)  latest in thread

Message-ID: <96197456.387057.1663392505315@mail.yahoo.com>
Permalink:  ../96197456.387057.1663392505315@mail.yahoo.com/
Also on:    postgresql.org/message-id/96197456.387057.1663392505315@mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: sivapostgres@yahoo.com
  Subject: Re: Query Performance
  In-Reply-To: <96197456.387057.1663392505315@mail.yahoo.com>
  References: <96197456.387057.1663392505315.ref@mail.yahoo.com> <96197456.387057.1663392505315@mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox