From: Jie Liang <jliang@ipinc.com>
To: pgsql-admin@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: select statement inside a function: behavior bad
Date: Mon, 2 Apr 2001 17:04:13 -0700 (PDT)
Message-ID: <Pine.BSF.4.10.10104021657330.3774-100000@tidal.ipinc.com> (raw)
In-Reply-To: <200104022047.f32KlwK45266@postgresql.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jliang@ipinc.com, pgsql-admin@postgresql.org
Subject: Re: select statement inside a function: behavior bad
In-Reply-To: <Pine.BSF.4.10.10104021657330.3774-100000@tidal.ipinc.com>
References: <200104022047.f32KlwK45266@postgresql.org> <Pine.BSF.4.10.10104021657330.3774-100000@tidal.ipinc.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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