Skip site navigation (1) Skip section navigation (2)


From: postgres(at)countup(dot)de
To: pgsql-performance(at)postgresql(dot)org
Subject: Select-Insert-Query
Date: 2004-02-27 16:52:39
Message-ID: (view raw or whole thread)
Lists: pgsql-performance
<html><head></head><body bgcolor="#ffffff" text="#000000" link="#000000" alink="#000000" vlink="#000000" marginwidth=10 marginheight=10 topmargin=10 leftmargin=10>Hi,
<br>what is the most performant way to select for example the first 99 rows of a table and insert them into another table...
<br>at the moment i do this:
<br>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
<br>	insert into lastusers (account_id, counter_id, date, ip, hostname) values(a_account_id,userrecord.counter_id,,userrecord.ip,userrecord.hostname);
<br>end loop;
<br>i think "limit" is a performance killer, is that right? but what to do instead

Attachment: unknown_filename
Description: text/html (818 bytes)


pgsql-performance by date

Next:From: Dror MatalonDate: 2004-02-27 18:27:26
Subject: Re: FreeBSD config
Previous:From: scott.marloweDate: 2004-02-27 15:33:40
Subject: Re: FreeBSD config

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group