From: | Ron <ronljohnsonjr(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Query Performance |
Date: | 2022-09-17 08:48:48 |
Message-ID: | ab198555-1b4a-521f-d5a1-2674852b5e35@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 9/17/22 00:28, sivapostgres(at)yahoo(dot)com wrote:
> Hello,
>
> My query is like this
>
> Select a.field1, a.field2, a.field3
> From (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' ) a
> Join table10 b
> On 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 faster
> Join table21 c
> On 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 ?
Is there an index on table1.field1?
Have you vacuumed or analyzed table1 lately?
Have you decomposed the query into the smallest possible query that
demonstrates the problem?
--
Angular momentum makes the world go 'round.
From | Date | Subject | |
---|---|---|---|
Next Message | Peter J. Holzer | 2022-09-17 10:03:28 | Re: Query Performance |
Previous Message | sivapostgres@yahoo.com | 2022-09-17 05:28:25 | Re: Query Performance |