Re: Order of execution

From: Jean-Christophe Boggio <postgresql(at)thefreecat(dot)org>
To: luis(dot)roberto(at)siscobra(dot)com(dot)br, pgsql-performance(at)postgresql(dot)org
Subject: Re: Order of execution
Date: 2021-04-27 19:49:59
Message-ID: 83950412-6367-5bb8-aeb1-a07603acd649@thefreecat.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello,

Le 27/04/2021 à 20:52, luis(dot)roberto(at)siscobra(dot)com(dot)br a écrit :
> My question is: is it possible to optimize function order execution?

I guess you could change the cost of one of the functions.

I personally rewrite my queries but I don't know if it's good practice:

WITH pre AS (
SELECT client_id
FROM clients
WHERE some_other_func(client_id)
)
SELECT *
FROM clients
JOIN pre USING(client_id)
WHERE some_func(client_id)

Best regards,

JC

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Justin Pryzby 2021-04-29 04:24:04 Re: [PATCH] force_parallel_mode and GUC categories
Previous Message luis.roberto 2021-04-27 18:52:37 Order of execution