Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id EECF51337BE4 for ; Thu, 12 May 2011 04:28:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 54438-04 for ; Thu, 12 May 2011 07:28:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f46.google.com (mail-bw0-f46.google.com [209.85.214.46]) by mail.postgresql.org (Postfix) with ESMTP id AD4911337999 for ; Thu, 12 May 2011 04:28:16 -0300 (ADT) Received: by bwz15 with SMTP id 15so1062627bwz.19 for ; Thu, 12 May 2011 00:28:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type; bh=8FWoGk6BXc1jL2n/qAkxt13AkEnNbKiQ0qtHiCGRJwo=; b=tENWLQOkkdL8z0dzRtHliDWcsPy+Xe9YvLKFVCUDzJhCV9brWoTTQu+xlGrhDhx+R5 FOgzXK3W4gzRqujtVfRBZq2g+2fnJlP2Kore95qi38LKuG51ByjeOB83b5AbWy8y/iGk 9/qieQLQ6IVykeE2mkcCPZZaCSR7mA2yOhI9I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=EUXSaOe+LtngZtTlMtbl191iVKoBt4BNnmRRx5pQaR8SPrmK4ZfkgVjOJcYk+TbYuB bztsyF0ZqSsl3eYZZJ+MtJTRpQM+togU91X/PtAD6ccPZloUFH/Ti/CLjTGHY+ZsqvQM h47D/OIcyEILG/5JX3ROgjCGoAUsENNeCGRy0= Received: by 10.204.80.223 with SMTP id u31mr3275139bkk.121.1305185295133; Thu, 12 May 2011 00:28:15 -0700 (PDT) Received: from [10.1.1.57] (skuns.zoral.com.ua [91.193.166.194]) by mx.google.com with ESMTPS id d25sm546325bkd.5.2011.05.12.00.28.12 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 May 2011 00:28:13 -0700 (PDT) Message-ID: <4DCB8C31.2000606@gmail.com> Date: Thu, 12 May 2011 10:28:49 +0300 From: Vitalii Tymchyshyn User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: Aren Cambre CC: Craig Ringer , pgsql-performance@postgresql.org Subject: Re: Postgres refusing to use >1 core References: <4DC81A3F020000250003D433@gw.wicourts.gov> <4DC81D56020000250003D438@gw.wicourts.gov> <4DC8B893.3060908@postnewspapers.com.au> <4DC9E7C5.9080309@postnewspapers.com.au> In-Reply-To: Content-Type: multipart/alternative; boundary="------------070701010400080400020504" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.344 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=1.553, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/173 X-Sequence-Number: 43682 This is a multi-part message in MIME format. --------------070701010400080400020504 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 12.05.11 06:18, Aren Cambre ???????(??): > > > Using one thread, the app can do about 111 rows per second, and it's > > only exercising 1.5 of 8 CPU cores while doing this. 12,000,000 > rows / > > 111 rows per second ~= 30 hours. > > I don't know how I missed that. You ARE maxing out one cpu core, so > you're quite right that you need more threads unless you can make your > single worker more efficient. > > > And the problem is my app already has between 20 and 30 threads. > Something about C#'s PLINQ may not be working as intended... > Have you checked that you are really doing fetch and processing in parallel? Dunno about C#, but under Java you have to make specific settings (e.g. setFetchSize) or driver will fetch all the data on query run. Check time needed to fetch first row from the query. Best regards, Vitalii Tymchyshyn --------------070701010400080400020504 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 12.05.11 06:18, Aren Cambre написав(ла):
> Using one thread, the app can do about 111 rows per second, and it's
> only exercising 1.5 of 8 CPU cores while doing this. 12,000,000 rows /
> 111 rows per second ~= 30 hours.

I don't know how I missed that. You ARE maxing out one cpu core, so
you're quite right that you need more threads unless you can make your
single worker more efficient.

And the problem is my app already has between 20 and 30 threads. Something about C#'s PLINQ may not be working as intended...

Have you checked that you are really doing fetch and processing in parallel? Dunno about C#, but under Java you have to make specific settings (e.g. setFetchSize) or driver will fetch all the data on query run. Check time needed to fetch first row from the query.

Best regards, Vitalii Tymchyshyn
--------------070701010400080400020504--