From: | Jie Liang <jliang(at)ipinc(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | select statement inside a function: behavior bad |
Date: | 2001-04-03 00:04:13 |
Message-ID: | Pine.BSF.4.10.10104021657330.3774-100000@tidal.ipinc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-sql |
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(at)ipinc(dot)com
www.stbernard.com
www.ipinc.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-04-03 01:16:56 | Re: using for rec inside a function: behavior very slow |
Previous Message | Jie Liang | 2001-04-02 22:10:40 | using for rec inside a function: behavior very slow |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-04-03 01:16:56 | Re: using for rec inside a function: behavior very slow |
Previous Message | Jie Liang | 2001-04-02 22:10:40 | using for rec inside a function: behavior very slow |