[SQL] puzzled by SELECT INTO

2007-10-30 Thread Gerardo Herzig
Hi all. Im having some trouble here that cannot understand. Consider this function: CREATE OR REPLACE FUNCTION read_words(bigint, varchar) returns varchar as $$ declare returnValue varchar ; BEGIN select * into returnValue from array_to_string(array(select word from words where page_id=$1

[SQL] Perfomance benefit using Min() against order by & limit 1?

2007-10-30 Thread Fernando Hevia
Hi guys. Is there any difference between these two queries regarding performance? Table stopvoip has several million records. I suspect using the aggregate function would be best, but benchmarking doesn't seem to confirm it. Both queries take around 150 - 175 ms once data has been cached. Any hi

Re: [SQL] puzzled by SELECT INTO

2007-10-30 Thread Rodrigo De León
On 10/30/07, Gerardo Herzig <[EMAIL PROTECTED]> wrote: > Wreird enough to me, need some advice plz! CREATE OR REPLACE FUNCTION READ_WORDS(BIGINT, INT[]) RETURNS VARCHAR AS $$ DECLARE RETURNVALUE VARCHAR; BEGIN SELECT ARRAY_TO_STRING(ARRAY( SELECT WORD FROM WORDS WHERE PAGE_

Re: [SQL] Perfomance benefit using Min() against order by & limit 1?

2007-10-30 Thread Fernando Hevia
Oops. Previous message went in HMTL. Sorry for that. Text-only version follows. --- Hi guys. Is there any difference between these two queries regarding performance? Table stopvoip has several million records. I suspect using the aggregate function would be best, but benchmarking doesn’t seem to