pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
How does the planner treat a table function. 2+ messages / 1 participants [nested] [flat]
* How does the planner treat a table function. @ 2005-03-14 11:26 KÖPFERL Robert <robert.koepferl@sonorys.at> 0 siblings, 0 replies; 2+ messages in thread From: KÖPFERL Robert @ 2005-03-14 11:26 UTC (permalink / raw) To: pgsql-sql 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) ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: How does the planner treat a table function. @ 2005-03-16 16:22 KÖPFERL Robert <robert.koepferl@sonorys.at> 0 siblings, 0 replies; 2+ messages in thread From: KÖPFERL Robert @ 2005-03-16 16:22 UTC (permalink / raw) To: 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@postgresql.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 | ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-03-16 16:22 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2005-03-14 11:26 How does the planner treat a table function. KÖPFERL Robert <robert.koepferl@sonorys.at> 2005-03-16 16:22 Re: How does the planner treat a table function. KÖPFERL Robert <robert.koepferl@sonorys.at>
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