Re: [SQL] using for rec inside a function: behavior very slow

2001-04-02 Thread Tom Lane
Jie Liang <[EMAIL PROTECTED]> writes: > v_url:= $1||''%''; > for rec in select id,url from urlinfo where url like v_url order by > url loop [ is slow ] LIKE index optimization doesn't happen if the LIKE pattern is a variable when the plan is created. In 7.1 you can wor

[SQL] using for rec inside a function: behavior very slow

2001-04-02 Thread Jie Liang
I have a function: CREATE FUNCTION hasdup(text) RETURNS int4 AS ' declare v_id int4; rat1 text; rat2 text; v_urltext; rec record; begin select id into v_id from urlinfo where url = $1; if NOT FOUND then return -1; end