Re: How does the planner treat a table function.

From: KÖPFERL Robert <robert(dot)koepferl(at)sonorys(dot)at>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: How does the planner treat a table function.
Date: 2005-03-16 16:22:58
Message-ID: ED4E30DD9C43D5118DFB00508BBBA76EB16648@neptun.sonorys.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

If you are interested in performance things, you may use the EXPLAIN
command:

explain select * from "GetLanguages"() where "Id" > 44

vs.

explain select * from "Languages" where "Id">44;

However the explain stops at the point a function is invoked.

This may mean that (as you asked) a select over a table function produces a
temprary table and thus costs much ressources if the table is big.

|-----Original Message-----
|From: KÖPFERL Robert
|Sent: Montag, 14. März 2005 12:26
|To: pgsql-sql(at)postgresql(dot)org
|Subject: [SQL] How does the planner treat a table function.
|
|
|
|Hi,
|we have got some tables (uw?) and functions. One function is
|defined like
|
|get_abc():
|SELECT a,b,c from table_x;
|
|What happens if I query something like
|SELECT a,b from get_abc() where a=5;
|while table_x is rather big?
|
|
|Will PSQL at first query all records of table_x and then apply
|a where a=5
|OR
|will PSQL integrate it to a shorter query?
|
|
|(In case there will be of course an intex over a to prevent sequential
|search)
|
|---------------------------(end of
|broadcast)---------------------------
|TIP 9: the planner will ignore your desire to choose an index
|scan if your
| joining column's datatypes do not match
|

Browse pgsql-sql by date

  From Date Subject
Next Message mroyce@gmail.com 2005-03-16 22:57:56 timestamp precision - can I control precision at select time or set for all time?
Previous Message Moran.Michael 2005-03-16 15:45:36 PGCrypto with Integers and DATE types -- how to?