Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wzuw8-00039Q-9E for pgsql-performance@arkaria.postgresql.org; Wed, 25 Jun 2014 21:41:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wzuw7-0001Dq-50 for pgsql-performance@arkaria.postgresql.org; Wed, 25 Jun 2014 21:40:59 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Wzuw5-0001Dj-Od for pgsql-performance@postgresql.org; Wed, 25 Jun 2014 21:40:58 +0000 Received: from qmta11.westchester.pa.mail.comcast.net ([2001:558:fe14:44:76:96:59:211]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wzuw1-0005dT-B2 for pgsql-performance@postgresql.org; Wed, 25 Jun 2014 21:40:55 +0000 Received: from omta19.westchester.pa.mail.comcast.net ([76.96.62.98]) by QMTA11.westchester.pa.mail.comcast.net with comcast id JejF1o00527AodY5Blgs7K; Wed, 25 Jun 2014 21:40:52 +0000 Received: from [IPV6:2600:1001:b028:2a49:bee8:c07d:352e:4afb] ([IPv6:2600:1001:b028:2a49:bee8:c07d:352e:4afb]) by omta19.westchester.pa.mail.comcast.net with comcast id Jlgr1o00C0TXNKw3flgrpG; Wed, 25 Jun 2014 21:40:52 +0000 User-Agent: K-9 Mail for Android In-Reply-To: <53AB35CC.10202@optionshouse.com> References: <53AB2CB1.8080201@comcast.net> <53AB35CC.10202@optionshouse.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----797JFTNG5K4Q5KXPN6AN47A8W9C9G7" Content-Transfer-Encoding: 8bit Subject: Re: how to improve perf of 131MM row table? From: Aaron Weber Date: Wed, 25 Jun 2014 17:40:47 -0400 To: Shaun Thomas , "pgsql-performance@postgresql.org" Message-ID: <1801a5d4-c3f1-4c0c-9c2c-ffb9d7f723a3@email.android.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1403732452; bh=aZVY7NgHIUNHoXSQifbWmzXyHhNHO3ci/SmKC8EVX8c=; h=Received:Received:MIME-Version:Content-Type:Subject:From:Date:To: Message-ID; b=flm2ZOXl10YiEZjAC/y/s2WEQDxOkrI5m+3xnHKCdQ/5N3NTGNVVtFPuC7FxTDgdJ iC+Kvpi/EgfBqvG+pSu95K1lRQlc00yjcJirrTJak2yqOiqBFIcCk+Pe45caETedMG pbWsNkJxjbnPR5dBypV4YgkSDUWSmqG9rqkrqK3akloiiU0ZAXcqSxKyBcy/b7R0HR NxoN1auEX6T5jWQtGSZMeG5R88L5CAXFxKEeBAF85dO2mSfqZg2uYwpjYd6XMbNdmn Uqv6uAql9DZjTNyn7yxXepp6x6ygcSDpNUsGkB9I5B0+seLeVmCc5wz3IX4C3UReC1 f8JU3mUUeJJKg== X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org ------797JFTNG5K4Q5KXPN6AN47A8W9C9G7 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 I will gather the other data tonight. Thank you. In the meantime, I guess I wasn't clear about some other particulars The query's where clause is only an "IN", with a list of id's (those I mentioned are the PK), and the join is explicitly on the PK (so, indexed). Thus, there should be only the explicit matches to the in clause returned, and if postgresql isn't using the unique index on that column, I would be very shocked (to the point I would suggest there is a bug somewhere). An IN with 50 int values took 23sec to return (by way of example). Thanks again. -- Aaron On June 25, 2014 4:49:16 PM EDT, Shaun Thomas wrote: >On 06/25/2014 03:10 PM, AJ Weber wrote: > >> I have a relatively sizable postgresql 9.0.2 DB with a few large >tables >> (keep in mind "large" is relative, I'm sure there are plenty larger >out >> there). > >Regardless of any help we might offer regarding this, you need to >upgrade your installation to 9.0.17. You are behind by several >performance, security, and integrity bugfixes, some of which address >critical corruption bugs related to replication. > >> One of my queries that seems to be bogging-down performance is a join >> between two tables on each of their BIGINT PK's (so they have default >> unique constraint/PK indexes on them). One table is a detail table >for >> the other. > >This isn't enough information. Just knowing the relative sizes of the >tables doesn't tell us which columns are indexed, whether or not the >query is using those indexes, how many rows usually match, which >queries >are performing badly, and so on. > >Please refer to this page to ask performance related questions: > >https://wiki.postgresql.org/wiki/Slow_Query_Questions > >Without much of this information, we'd only be speculating. > >-- >Shaun Thomas >OptionsHouse, LLC | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, >60604 >312-676-8870 >sthomas@optionshouse.com > >______________________________________________ > >See http://www.peak6.com/email_disclaimer/ for terms and conditions >related to this email ------797JFTNG5K4Q5KXPN6AN47A8W9C9G7 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit I will gather the other data tonight. Thank you.

In the meantime, I guess I wasn't clear about some other particulars
The query's where clause is only an "IN", with a list of id's (those I mentioned are the PK), and the join is explicitly on the PK (so, indexed).

Thus, there should be only the explicit matches to the in clause returned, and if postgresql isn't using the unique index on that column, I would be very shocked (to the point I would suggest there is a bug somewhere).

An IN with 50 int values took 23sec to return (by way of example).

Thanks again.
--
Aaron

On June 25, 2014 4:49:16 PM EDT, Shaun Thomas <sthomas@optionshouse.com> wrote:
On 06/25/2014 03:10 PM, AJ Weber wrote:

I have a relatively sizable postgresql 9.0.2 DB with a few large tables
(keep in mind "large" is relative, I'm sure there are plenty larger out
there).

Regardless of any help we might offer regarding this, you need to
upgrade your installation to 9.0.17. You are behind by several
performance, security, and integrity bugfixes, some of which address
critical corruption bugs related to replication.

One of my queries that seems to be bogging-down performance is a join
between two tables on each of their BIGINT PK's (so they have default
unique constraint/PK indexes on them). One table is a detail table for
the other.

This isn't enough information. Just knowing the relative sizes of the
tables doesn't tell us which columns are indexed, whether or not the
query is using those indexes, how many rows usually match, which queries
are performing badly, and so on.

Please refer to this page to ask performance related questions:

https://wiki.postgresql.org/wiki/Slow_Query_Questions

Without much of this information, we'd only be speculating.
------797JFTNG5K4Q5KXPN6AN47A8W9C9G7--