Received: from tidal.ipinc.com (tidal.ipinc.com [199.245.188.85]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f3304GK67685; Mon, 2 Apr 2001 20:04:18 -0400 (EDT) (envelope-from jliang@tidal.ipinc.com) Received: from localhost (jliang@localhost) by tidal.ipinc.com (8.9.3/8.9.3) with ESMTP id RAA06574; Mon, 2 Apr 2001 17:04:13 -0700 (PDT) (envelope-from jliang@tidal.ipinc.com) Date: Mon, 2 Apr 2001 17:04:13 -0700 (PDT) From: Jie Liang To: pgsql-admin@postgresql.org cc: pgsql-sql@postgresql.org Subject: select statement inside a function: behavior bad In-Reply-To: <200104022047.f32KlwK45266@postgresql.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200104/5 X-Sequence-Number: 1139 I tested select statement inside sql and plpgsql function, very slow CREATE FUNCTION geturllike(text) RETURNS SETOF text AS ' SELECT url as url FROM urlinfo WHERE url LIKE $1; 'LANGUAGE 'sql'; CREATE FUNCTION hasdup(text) RETURNS int4 AS ' declare v_id int4; rat1 text; rat2 text; v_url text; rec record; begin v_url:= $1||''%''; for rec in select id,url from urlinfo where url like v_url order by url loop raise notice ''%'',rec.url; end loop; return 0; end; ' LANGUAGE 'plpgsql'; Why so slow???? Is it a bug?? Jie LIANG St. Bernard Software 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 jliang@ipinc.com www.stbernard.com www.ipinc.com