Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id EAD0E9FA214 for ; Fri, 19 Oct 2007 13:11:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 13473-02 for ; Fri, 19 Oct 2007 13:11:37 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from web56407.mail.re3.yahoo.com (web56407.mail.re3.yahoo.com [216.252.111.86]) by postgresql.org (Postfix) with SMTP id A60F49FA20E for ; Fri, 19 Oct 2007 13:11:37 -0300 (ADT) Received: (qmail 37252 invoked by uid 60001); 19 Oct 2007 16:11:36 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Message-ID; b=aY96jnTyY/A0Hr6jSm5zUFS5rDuQMrDCRWJFUafwB60LUL0ecqTqcJkHSy2eEfoV9EUL69iX+fBKuUlWhEziNz0sMHnG5aH1HgiioHCia7pXBhqdiKQgxA0tBSrsqeR053q4SXEq3JCoJOZsJdir0ikdfYRLLqGdC/qBXEbdsQY=; X-YMail-OSG: b8bJlWsVM1kIY2_5i0nW16Q5yNW3GeKzaXXMS8vZ1A4qpMRWnYth3eltQagQGWheefEOsoKjYH84Vg_bTe39ui2PyUCY1_ov35AE_mB1HZ7cA5gqr4g- Received: from [83.149.198.98] by web56407.mail.re3.yahoo.com via HTTP; Fri, 19 Oct 2007 09:11:36 PDT X-Mailer: YahooMailRC/814.06 YahooMailWebService/0.7.134.12 Date: Fri, 19 Oct 2007 09:11:36 -0700 (PDT) From: Pavel Velikhov Subject: Re: need help with a query To: "Jonah H. Harris" Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-653152674-1192810296=:37238" Message-ID: <499575.37238.qm@web56407.mail.re3.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/232 X-Sequence-Number: 27254 --0-653152674-1192810296=:37238 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Thanks for you help!=0A=0AGot a very different query plan this time, with a= hash join between links and articles. At least now postgres is using both = shared memory buffers and working mem, but its still completely IO bound, o= nly getting in 5-6% CPU once in a while. I guess I can't squeeze more out o= f the laptop, but I also have a machine with 16GB RAM that I'll try this on= next. Should I allocate tons of memory into shared buffers or into the wor= king memory?=0A=0AThanks in advance!=0A=0A----- Original Message ----=0AFro= m: Jonah H. Harris =0ATo: Pavel Velikhov =0ACc: pgsql-performance@postgresql.org=0ASent: Friday, October = 19, 2007 7:52:58 PM=0ASubject: Re: [PERFORM] need help with a query=0A=0AOn= 10/19/07, Pavel Velikhov wrote:=0A>=0A> Hi,=0A>=0A> = I am updating a big table (90M records) with data from another=0A rather= =0A> large table (4M entries). Here is my update query:=0A>=0A> update = links set target_size =3D=0A> ( select size from articles where article= s.article_id =3D=0A> links.article_to)=0A=0Atry:=0A=0AUPDATE links=0A SET= target_size =3D size=0A FROM articles=0A WHERE articles.article_id =3D li= nks.article_to;=0A=0A-- =0AJonah H. Harris, Sr. Software Architect | phone:= 732.331.1324=0AEnterpriseDB Corporation | fax: 732.331.1301= =0A499 Thornall Street, 2nd Floor | jonah.harris@enterprisedb.com= =0AEdison, NJ 08837 | http://www.enterprisedb.com/= =0A=0A---------------------------(end of=0A broadcast)---------------------= ------=0ATIP 6: explain analyze is your friend=0A=0A=0A=0A=0A=0A___________= _______________________________________=0ADo You Yahoo!?=0ATired of spam? = Yahoo! Mail has the best spam protection around =0Ahttp://mail.yahoo.com --0-653152674-1192810296=:37238 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable
Thanks for you help!

Got a very different qu= ery plan this time, with a hash join between links and articles. At least n= ow postgres is using both shared memory buffers and working mem, but its st= ill completely IO bound, only getting in 5-6% CPU once in a while. I guess = I can't squeeze more out of the laptop, but I also have a machine with 16GB= RAM that I'll try this on next. Should I allocate tons of memory into shar= ed buffers or into the working memory?

Thanks in advance!

----- Original Message ----
From: Jonah H. Harris <jonah.harris@= gmail.com>
To: Pavel Velikhov <pvelikhov@yahoo.com>
Cc: pgsql-performance@postgresql.org
Sent: Friday, October 19, 2007 7:52:58= PM
Subject: Re: [PERFORM] need help with a query

On 10/19/07, Pa= vel Velikhov <pvelikhov@yahoo.com> wrote:
>
> Hi,<= br>>
>  I am updating a big table (90M records) with data fr= om another=0A rather
> large table (4M entries). Here is my update qu= ery:
>
>    update links set target_size =3D
>=     ( select size from articles where articles.article_id =3D> links.article_to)

try:

UPDATE links
  SET targ= et_size =3D size
  FROM articles
WHERE articles.article_id =3D = links.article_to;

--
Jonah H. Harris, Sr. Software Architect | p= hone: 732.331.1324
EnterpriseDB Corporation        &= nbsp;       | fax: 732.331.1301
499 Thornall Street, 2nd = Floor          | jonah.harr= is@enterprisedb.com
Edison, NJ 08837        &nbs= p;               | http://www.enterprisedb.com/

----------------= -----------(end of=0A broadcast)---------------------------
TIP 6: expla= in analyze is your friend


____________________= ______________________________
Do You Yahoo!?
Tired of spam? Yahoo! = Mail has the best spam protection around
http://mail.yahoo.com <= /html> --0-653152674-1192810296=:37238--