where clause + function, execution order - Mailing list pgsql-performance

From Sorin Dudui
Subject where clause + function, execution order
Date
Msg-id 13DE38ECCB7CE74890E7150A7CCB610D3642DD47@exc1.wigeo.lan
Whole thread Raw
Responses Re: where clause + function, execution order  (Julius Tuskenis <julius@nsoft.lt>)
Re: where clause + function, execution order  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance

Hi,

 

I have the following function:

 

===============================

CREATE OR REPLACE FUNCTION xxx(text)

  RETURNS SETOF vvvvv AS

$BODY$

select a.x, a.y,

    CASE

    WHEN strpos($1,b.x) > 0

    THEN b.x

    ELSE NULL

    END AS mp_hm

from  a LEFT JOIN  b ON a.id=b.id

 

                $BODY$

  LANGUAGE sql STABLE

  COST 1000

  ROWS 10000;

===============================

 

which I call as:

 

select * from xxx(‘test0|test1‘)  where a.x = ‘value’

 

 

I am wondering when the where clause (a.x = ‘value’) is executed. After the select statement in the function finishes? Or is it appended at the select statement in the function?

 

 

Thank you,

Sorin

 

 

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: avoiding seq scans when two columns are very correlated
Next
From: Julius Tuskenis
Date:
Subject: Re: where clause + function, execution order