X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3DC9E5551D for ; Wed, 16 Mar 2005 16:23:07 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37729-01 for ; Wed, 16 Mar 2005 16:23:01 +0000 (GMT) Received: from mx-00.sil.at (mx-00.sil.at [62.116.68.196]) by svr1.postgresql.org (Postfix) with ESMTP id 093F855478 for ; Wed, 16 Mar 2005 16:22:56 +0000 (GMT) Received: (qmail-ldap/ctrl 2499 invoked from network); 16 Mar 2005 16:22:52 -0000 Received: from unknown (HELO jupiter.sonorys.at) ([213.235.243.42]) (envelope-sender ) by mx-00.sil.at (qmail-ldap-1.03) with SMTP for ; 16 Mar 2005 16:22:52 -0000 Received: from neptun.sonorys.at (neptun.sonorys.at [172.24.1.17]) by jupiter.sonorys.at (8.11.7+Sun/8.11.7) with ESMTP id j2GGMx119445 for ; Wed, 16 Mar 2005 17:22:59 +0100 (MET) Received: by neptun.sonorys.at with Internet Mail Service (5.5.2653.19) id ; Wed, 16 Mar 2005 17:22:59 +0100 Message-ID: From: =?ISO-8859-1?Q?K=D6PFERL_Robert?= To: pgsql-sql@postgresql.org Subject: Re: How does the planner treat a table function. Date: Wed, 16 Mar 2005 17:22:58 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200503/232 X-Sequence-Number: 20711 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=D6PFERL Robert=20 |Sent: Montag, 14. M=E4rz 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=20 |defined like | |get_abc(): |SELECT a,b,c from table_x; | |What happens if I query something like =20 |SELECT a,b from get_abc() where a=3D5; |while table_x is rather big? | | |Will PSQL at first query all records of table_x and then apply=20 |a where a=3D5 |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=20 |broadcast)--------------------------- |TIP 9: the planner will ignore your desire to choose an index=20 |scan if your | joining column's datatypes do not match |