Hi,

nobody has an idea? :-(

-----Ursprüngliche Nachricht-----
Von: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] Im Auftrag von postgres@countup.de
Gesendet: Freitag, 27. Februar 2004 17:53
An: pgsql-performance@postgresql.org
Betreff: [PERFORM] Select-Insert-Query

Hi,

what is the most performant way to select for example the first 99 rows of a table and insert them into another table...

at the moment i do this:

for userrecord in select * from table where account_id = a_account_id and counter_id = userrecord.counter_id and visitortable_id between a_minid and a_maxid limit 99 loop
insert into lastusers (account_id, counter_id, date, ip, hostname) values(a_account_id,userrecord.counter_id,userrecord.date ,userrecord.ip,userrecord.hostname);
end loop;

i think "limit" is a performance killer, is that right? but what to do instead

thanks
bye