From pgsql-performance-owner@postgresql.org Tue Feb 1 03:43:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 30B9C8B9C75 for ; Tue, 1 Feb 2005 01:59:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85102-05 for ; Tue, 1 Feb 2005 01:59:28 +0000 (GMT) Received: from brvwbansx0010.volkswagen.com.br (mx1.volkswagen.com.br [200.192.4.15]) by svr1.postgresql.org (Postfix) with SMTP id CC3958B9C44 for ; Tue, 1 Feb 2005 01:59:29 +0000 (GMT) Received: by brvwbansx0010.volkswagen.com.br with Internet Mail Service (5.5.2657.72) id <1BA3LAW1>; Mon, 31 Jan 2005 23:59:28 -0200 Message-ID: <4AE1514A9BFBEF408F3D8CAE93C4C5B9038A0E88@brvwbansx0008> From: "Lago, Bruno Almeida do" To: pgsql-performance@postgresql.org Subject: Very important choice Date: Mon, 31 Jan 2005 23:59:46 -0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C50801.B494B040" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200502/2 X-Sequence-Number: 10331 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C50801.B494B040 Content-Type: text/plain Hello my friends, I'd like to know (based on your experience and technical details) which OS is recommended for running PostgreSQL keeping in mind 3 indicators: 1 - Performance (SO, Network and IO) 2 - SO Stability 3 - File System Integrity Comparisons between Slackware, Gentoo and FreeBSD are welcome. Which file system has the best performance and integrity: XFS (Linux) or UFS (FreeBSD)? *I've read that UFS is not a journaling FS. Is this right? How much this difference affects performance and integrity? I don't have experience with FreeBSD so I'd like to know if it is possible to run XFS on FreeBSD 5.3. Thank you, Bruno Almeida do Lago ------_=_NextPart_001_01C50801.B494B040 Content-Type: text/html

Hello my friends,

 

I'd like to know (based on your experience and technical details) which OS is recommended for running PostgreSQL keeping in mind 3 indicators:

 

1 - Performance (SO, Network and IO)

2 - SO Stability

3 - File System Integrity

 

Comparisons between Slackware, Gentoo and FreeBSD are welcome.

 

Which file system has the best performance and integrity: XFS (Linux) or UFS (FreeBSD)?

*I've read that UFS is not a journaling FS. Is this right? How much this difference affects performance and integrity?

 

I don't have experience with FreeBSD so I'd like to know if it is possible to run XFS on FreeBSD 5.3.

 

 

Thank you,

Bruno Almeida do Lago

------_=_NextPart_001_01C50801.B494B040-- From pgsql-performance-owner@postgresql.org Tue Feb 1 04:52:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ACB9A8B9CC8 for ; Tue, 1 Feb 2005 04:52:18 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05410-02 for ; Tue, 1 Feb 2005 04:52:15 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id A0EEC8B9D00 for ; Tue, 1 Feb 2005 04:52:14 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id F0D361C916; Mon, 31 Jan 2005 22:52:11 -0600 (CST) Date: Mon, 31 Jan 2005 22:52:11 -0600 From: "Jim C. Nasby" To: Tom Lane Cc: josh@agliodbs.com, Markus Schaber , Christopher Kings-Lynne , PostgreSQL Performance List Subject: Re: Automagic tuning Message-ID: <20050201045211.GB32356@decibel.org> References: <20040727151531.4f60b5b0@kingfisher.intern.logi-track.com> <41066485.7080502@familyhealth.com.au> <41FE4692.6080104@logi-track.com> <200501311209.31827.josh@agliodbs.com> <3900.1107203172@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3900.1107203172@sss.pgh.pa.us> X-Operating-System: FreeBSD 4.10-RELEASE-p3 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/3 X-Sequence-Number: 10332 On Mon, Jan 31, 2005 at 03:26:12PM -0500, Tom Lane wrote: > Josh Berkus writes: > >> I would like something that really measures values like random_page_cost > >> or cpu_tuple_cost that are hardware dependent. > >> > >> I assume such thing does not exist? > > > Nope. You gotta whip out your calculator and run some queries. > > Preferably a whole lot of queries. All the measurement techniques I can > think of are going to have a great deal of noise, so you shouldn't > twiddle these cost settings based on just a few examples. Are there any examples of how you can take numbers from pg_stats_* or explain analize and turn them into configuration settings (such and random page cost)? -- Jim C. Nasby, Database Consultant decibel@decibel.org Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?" From pgsql-performance-owner@postgresql.org Tue Feb 1 04:56:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 30C188B9CA0 for ; Tue, 1 Feb 2005 04:56:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06138-01 for ; Tue, 1 Feb 2005 04:56:46 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id 1B7508B9BCA for ; Tue, 1 Feb 2005 04:56:45 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 7D0811C916; Mon, 31 Jan 2005 22:56:45 -0600 (CST) Date: Mon, 31 Jan 2005 22:56:45 -0600 From: "Jim C. Nasby" To: Cosimo Streppone Cc: Postgresql Performance list Subject: Re: High end server and storage for a PostgreSQL OLTP system Message-ID: <20050201045645.GC32356@decibel.org> References: <41FE97FC.3060106@streppone.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41FE97FC.3060106@streppone.it> X-Operating-System: FreeBSD 4.10-RELEASE-p3 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/4 X-Sequence-Number: 10333 On Mon, Jan 31, 2005 at 09:41:32PM +0100, Cosimo Streppone wrote: > 2) The goal is to make the db handle 100 tps (something like > 100 users). What kind of server and storage should I provide? > > The actual servers our application runs on normally have > 2 Intel Xeon processors, 2-4 Gb RAM, RAID 0/1/5 SCSI > disk storage with hard drives @ 10,000 rpm You might look at Opteron's, which theoretically have a higher data bandwidth. If you're doing anything data intensive, like a sort in memory, this could make a difference. > 4) Is it correct to suppose that multiple RAID 1 arrays > can provide the fastest I/O ? > I usually reserve one RAID1 array to db data directory, > one RAID1 array to pg_xlog directory and one RAID1 array > for os and application needs. RAID10 will be faster than RAID1. The key factor to a high performance database is a high performance I/O system. If you look in the archives you'll find people running postgresql on 30 and 40 drive arrays. -- Jim C. Nasby, Database Consultant decibel@decibel.org Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?" From pgsql-performance-owner@postgresql.org Tue Feb 1 05:06:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F13058B9BCA for ; Tue, 1 Feb 2005 05:06:46 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07018-04 for ; Tue, 1 Feb 2005 05:06:39 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 12F918B9CE7 for ; Tue, 1 Feb 2005 05:06:38 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1156RUO010115; Tue, 1 Feb 2005 00:06:27 -0500 (EST) To: "Jim C. Nasby" Cc: josh@agliodbs.com, Markus Schaber , Christopher Kings-Lynne , PostgreSQL Performance List Subject: Re: Automagic tuning In-reply-to: <20050201045211.GB32356@decibel.org> References: <20040727151531.4f60b5b0@kingfisher.intern.logi-track.com> <41066485.7080502@familyhealth.com.au> <41FE4692.6080104@logi-track.com> <200501311209.31827.josh@agliodbs.com> <3900.1107203172@sss.pgh.pa.us> <20050201045211.GB32356@decibel.org> Comments: In-reply-to "Jim C. Nasby" message dated "Mon, 31 Jan 2005 22:52:11 -0600" Date: Tue, 01 Feb 2005 00:06:27 -0500 Message-ID: <10114.1107234387@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/5 X-Sequence-Number: 10334 "Jim C. Nasby" writes: > On Mon, Jan 31, 2005 at 03:26:12PM -0500, Tom Lane wrote: >> Preferably a whole lot of queries. All the measurement techniques I can >> think of are going to have a great deal of noise, so you shouldn't >> twiddle these cost settings based on just a few examples. > Are there any examples of how you can take numbers from pg_stats_* or > explain analize and turn them into configuration settings (such and > random page cost)? Well, the basic idea is to adjust random_page_cost so that the ratio of estimated cost to real elapsed time (as shown by EXPLAIN ANALYZE) is the same for seqscans and indexscans. What you have to watch out for is that the estimated cost model is oversimplified and doesn't take into account a lot of real-world factors, such as the activity of other concurrent processes. The reason for needing a whole lot of tests is essentially to try to average out the effects of those unmodeled factors, so that you have a number that makes sense within the planner's limited view of reality. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Feb 1 05:29:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 686BF8B9C9C for ; Tue, 1 Feb 2005 05:29:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08523-10 for ; Tue, 1 Feb 2005 05:29:17 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 969298B9BC9 for ; Tue, 1 Feb 2005 05:29:16 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j115TF8Y010298; Tue, 1 Feb 2005 00:29:15 -0500 (EST) To: "Trevor Ball" Cc: pgsql-performance@postgresql.org Subject: Re: Index Slowing Insert >50x In-reply-to: References: Comments: In-reply-to "Trevor Ball" message dated "Mon, 31 Jan 2005 16:14:39 -0500" Date: Tue, 01 Feb 2005 00:29:15 -0500 Message-ID: <10297.1107235755@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/6 X-Sequence-Number: 10335 "Trevor Ball" writes: > ... it doesn't > seem reasonable to me that an index would slow an insert more than > 50-fold, regardless of hardware or the nature of the index. Seems pretty slow to me too. Can you provide a self-contained test case? One possibility is that depending on your platform and locale setting, varchar comparisons can be a whole lot slower than a normal person would consider sane. If you're not using C locale, you might try C locale and see if it helps. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Feb 1 06:06:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 606D18B9E20 for ; Tue, 1 Feb 2005 06:06:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13261-03 for ; Tue, 1 Feb 2005 06:06:22 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id CC4A78B9E1C for ; Tue, 1 Feb 2005 06:06:22 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id D209A1C90B; Tue, 1 Feb 2005 00:06:20 -0600 (CST) Date: Tue, 1 Feb 2005 00:06:20 -0600 From: "Jim C. Nasby" To: Tom Lane Cc: josh@agliodbs.com, Markus Schaber , Christopher Kings-Lynne , PostgreSQL Performance List Subject: Re: Automagic tuning Message-ID: <20050201060620.GE32356@decibel.org> References: <20040727151531.4f60b5b0@kingfisher.intern.logi-track.com> <41066485.7080502@familyhealth.com.au> <41FE4692.6080104@logi-track.com> <200501311209.31827.josh@agliodbs.com> <3900.1107203172@sss.pgh.pa.us> <20050201045211.GB32356@decibel.org> <10114.1107234387@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10114.1107234387@sss.pgh.pa.us> X-Operating-System: FreeBSD 4.10-RELEASE-p3 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/7 X-Sequence-Number: 10336 On Tue, Feb 01, 2005 at 12:06:27AM -0500, Tom Lane wrote: > "Jim C. Nasby" writes: > > On Mon, Jan 31, 2005 at 03:26:12PM -0500, Tom Lane wrote: > >> Preferably a whole lot of queries. All the measurement techniques I can > >> think of are going to have a great deal of noise, so you shouldn't > >> twiddle these cost settings based on just a few examples. > > > Are there any examples of how you can take numbers from pg_stats_* or > > explain analize and turn them into configuration settings (such and > > random page cost)? > > Well, the basic idea is to adjust random_page_cost so that the ratio of > estimated cost to real elapsed time (as shown by EXPLAIN ANALYZE) is the > same for seqscans and indexscans. What you have to watch out for is > that the estimated cost model is oversimplified and doesn't take into > account a lot of real-world factors, such as the activity of other > concurrent processes. The reason for needing a whole lot of tests is > essentially to try to average out the effects of those unmodeled > factors, so that you have a number that makes sense within the planner's > limited view of reality. Given that, I guess the next logical question is: what would it take to collect stats on queries so that such an estimate could be made? And would it be possible/make sense to gather stats useful for tuning the other parameters? -- Jim C. Nasby, Database Consultant decibel@decibel.org Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?" From pgsql-performance-owner@postgresql.org Tue Feb 1 06:27:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0DD158B9E20 for ; Tue, 1 Feb 2005 06:27:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14151-09 for ; Tue, 1 Feb 2005 06:27:11 +0000 (GMT) Received: from smtp0.libero.it (smtp0.libero.it [193.70.192.33]) by svr1.postgresql.org (Postfix) with ESMTP id 623188B9E1B for ; Tue, 1 Feb 2005 06:27:10 +0000 (GMT) Received: from localhost (172.16.1.84) by smtp0.libero.it (7.0.027-DD01) id 41BDA86900A54093; Tue, 1 Feb 2005 07:27:00 +0100 Received: from [62.98.87.210] (62.98.87.210) by smtp0.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41BF5F48036C89F4; Tue, 1 Feb 2005 07:26:59 +0100 Message-ID: <41FF212D.8010500@streppone.it> Date: Tue, 01 Feb 2005 07:26:53 +0100 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Postgresql Performance list Subject: Re: High end server and storage for a PostgreSQL OLTP system References: <41FE97FC.3060106@streppone.it> <4429.1107207308@sss.pgh.pa.us> In-Reply-To: <4429.1107207308@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at libero.it serv5 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/8 X-Sequence-Number: 10337 Tom Lane wrote: > Cosimo writes: > >>1) What kind of performance gain can I expect switching from >> 7.1 to 7.4 (or 8.0)? Obviously I'm doing my own testing, >> but I'm not very impressed by 8.0 speed, may be I'm doing >> testing on a low end server... > > Most people report a noticeable speedup in each new release > [...] > I'm surprised that you're not seeing any gain at all. > What was your test case exactly? Have you perhaps tuned your app > so specifically to 7.1 that you need to detune it? We tend to use the lowest common SQL features that will allow us to work with any db, so probably the problem is the opposite, there is no pg-specific overtuning. Also, the real pg load, that should be my ideal test case, is somewhat difficult to reproduce (~ 50 users with handhelds and browser clients). Another good test is a particular procedure that opens several (~1000) subsequent transactions, composed of many repeated selection queries with massive write loads on 6/7 different tables, as big as 300/400k tuples. Every transaction ends with either commit or rollback state Indexing here should be ok, for I've analyzed every single query also under database "stress". Probably one big issue is that I need to vacuum/reindex too often to keep db performances at a good(tm) level. I realize that this has been addressed in several ways with newer PGs. However, I need to do a lot of application and performance tests and do them more seriously. Then I'll report the results here. -- Cosimo From pgsql-performance-owner@postgresql.org Tue Feb 1 06:35:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2A2AF8B9B29 for ; Tue, 1 Feb 2005 06:35:46 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15470-07 for ; Tue, 1 Feb 2005 06:35:43 +0000 (GMT) Received: from smtp2.libero.it (smtp2.libero.it [193.70.192.52]) by svr1.postgresql.org (Postfix) with ESMTP id 61B6F8B9B27 for ; Tue, 1 Feb 2005 06:35:43 +0000 (GMT) Received: from localhost (172.16.1.80) by smtp2.libero.it (7.0.027-DD01) id 41BDB66300A4BF21; Tue, 1 Feb 2005 07:36:00 +0100 Received: from [62.98.87.210] (62.98.87.210) by smtp0.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41BF5F48036C9407; Tue, 1 Feb 2005 07:35:41 +0100 Message-ID: <41FF2337.7070809@streppone.it> Date: Tue, 01 Feb 2005 07:35:35 +0100 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Jim C. Nasby" Cc: Postgresql Performance list Subject: Re: High end server and storage for a PostgreSQL OLTP system References: <41FE97FC.3060106@streppone.it> <20050201045645.GC32356@decibel.org> In-Reply-To: <20050201045645.GC32356@decibel.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at libero.it serv2 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/9 X-Sequence-Number: 10338 Jim C. Nasby wrote: > On Mon, Jan 31, 2005 at 09:41:32PM +0100, Cosimo wrote: > > >2) The goal is to make the db handle 100 tps (something like > > 100 users). What kind of server and storage should I provide? > > You might look at Opteron's, which theoretically have a higher data > bandwidth. If you're doing anything data intensive, like a sort in > memory, this could make a difference. Would Opteron systems need 64-bit postgresql (and os, gcc, ...) build to have that advantage? > >4) Is it correct to suppose that multiple RAID 1 arrays > > can provide the fastest I/O ? > > I usually reserve one RAID1 array to db data directory, > > one RAID1 array to pg_xlog directory and one RAID1 array > > for os and application needs. > > RAID10 will be faster than RAID1. Sorry Jim, by RAID10 you mean several raid1 arrays mounted on different linux partitions? Or several raid1 arrays that build up a raid0 array? In the latter case, who decides which data goes in which raid1 array? Raid Adapter? > The key factor to a high performance database is a high > performance I/O system. If you look in the archives > you'll find people running postgresql on 30 and 40 > drive arrays. I'll do a search, thank you. -- Cosimo From pgsql-performance-owner@postgresql.org Tue Feb 1 08:51:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 642488B9E20 for ; Tue, 1 Feb 2005 08:51:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33870-02 for ; Tue, 1 Feb 2005 08:51:02 +0000 (GMT) Received: from anchor-post-36.mail.demon.net (anchor-post-36.mail.demon.net [194.217.242.86]) by svr1.postgresql.org (Postfix) with ESMTP id 4B6A68B9BF5 for ; Tue, 1 Feb 2005 08:51:01 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-36.mail.demon.net with esmtp (Exim 4.42) id 1CvtkP-000CSN-LK; Tue, 01 Feb 2005 08:50:59 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9A4471794F; Tue, 1 Feb 2005 08:50:55 +0000 (GMT) Message-ID: <41FF42EE.1060501@archonet.com> Date: Tue, 01 Feb 2005 08:50:54 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Lago, Bruno Almeida do" Cc: pgsql-performance@postgresql.org Subject: Re: Very important choice References: <4AE1514A9BFBEF408F3D8CAE93C4C5B9038A0E88@brvwbansx0008> In-Reply-To: <4AE1514A9BFBEF408F3D8CAE93C4C5B9038A0E88@brvwbansx0008> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.067 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/10 X-Sequence-Number: 10339 Lago, Bruno Almeida do wrote: > Hello my friends, > > I'd like to know (based on your experience and technical details) which OS > is recommended for running PostgreSQL keeping in mind 3 indicators: > > 1 - Performance (SO, Network and IO) > 2 - SO Stability > 3 - File System Integrity The short answer is almost certainly whichever OS you are most familiar with. If you have a problem, you don't want to be learning new details about your OS while fixing it. That rules out FreeBSD for now. What hardware you want to use will affect performance and choice of OS. You'll need to decide what hardware you're looking to use. As far as file-systems are concerned, ext3 seems to be the slowest, and the general feeling seems to be that XFS is perhaps the fastest. In terms of reliability, avoid cutting-edge releases of any file-system - let others test them for you. One thing to consider is how long it takes to recover from a crash - you can run PostgreSQL on ext2, but checking a large disk can take hours after a crash. That's the real benefit of journalling for PG - speed of recovery. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Tue Feb 1 09:14:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0F5098B9CFB for ; Tue, 1 Feb 2005 09:14:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37641-08 for ; Tue, 1 Feb 2005 09:14:15 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 7D4588B9BF5 for ; Tue, 1 Feb 2005 09:14:15 +0000 (GMT) Received: (qmail 22824 invoked from network); 1 Feb 2005 10:14:35 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 1 Feb 2005 10:14:35 +0100 To: alex@neteconomist.com, "Andrei Bintintan" Cc: pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <41EFCC5B.5010302@archonet.com> <33c6269f05012008391490448b@mail.gmail.com> <87y8eh1hy9.fsf@stark.xeocode.com> <015a01c5038f$73a70720$0b00a8c0@forge> <33c6269f05012605473319ef40@mail.gmail.com> Message-ID: Date: Tue, 01 Feb 2005 10:16:47 +0100 From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <33c6269f05012605473319ef40@mail.gmail.com> User-Agent: Opera M2/7.54 (Linux, build 751) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/11 X-Sequence-Number: 10340 > As I read the docs, a temp table doesn't solve our problem, as it does > not persist between sessions. With a web page there is no guarentee > that you will receive the same connection between requests, so a temp > table doesn't solve the problem. It looks like you either have to > create a real table (which is undesirable becuase it has to be > physicaly synced, and TTFB will be very poor) or create an application > tier in between the web tier and the database tier to allow data to > persist between requests tied to a unique session id. > > Looks like the solutions to this problem is not RDBMS IMHO. > > Alex Turner > NetEconomist Did you miss the proposal to store arrays of the found rows id's in a "cache" table ? Is 4 bytes per result row still too large ? If it's still too large, you can still implement the same cache in the filesystem ! If you want to fetch 100.000 rows containing just an integer, in my case (psycopy) it's a lot faster to use an array aggregate. Time to get the data in the application (including query) : select id from temp => 849 ms select int_array_aggregate(id) as ids from temp => 300 ms So you can always fetch the whole wuery results (in the form of an integer per row) and cache it in the filesystem. It won't work if you have 10 million rows though ! From pgsql-performance-owner@postgresql.org Tue Feb 1 10:01:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A48118B9B29 for ; Tue, 1 Feb 2005 10:01:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44627-03 for ; Tue, 1 Feb 2005 10:01:37 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by svr1.postgresql.org (Postfix) with ESMTP id 8C39A8B9D00 for ; Tue, 1 Feb 2005 10:01:28 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so737330wri for ; Tue, 01 Feb 2005 02:01:29 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:organization:message-id:mime-version:content-type:x-priority:x-msmail-priority:x-mailer:x-mimeole:importance; b=M0konl7x1LR3kr0UrPc10bmZJXkJ73osuKDdL3UVLW2zDIZymvUxMFPISA84LD2u7YbJx7Ln5TzBnkCP/eR8POl6/EoWOqo6dERwL7mIZdMTOljpX2xCfSkM4oA+aigqBI7BhiKLKMmzExj5TBceGquB2yvmdk4LcoxB+xiJZiQ= Received: by 10.54.21.28 with SMTP id 28mr323409wru; Tue, 01 Feb 2005 02:01:28 -0800 (PST) Received: from sbew318anc22 ([200.184.93.96]) by smtp.gmail.com with ESMTP id 35sm317610wra.2005.02.01.02.01.27; Tue, 01 Feb 2005 02:01:28 -0800 (PST) From: "Bruno Almeida do Lago" To: Subject: Very important choice Date: Tue, 1 Feb 2005 08:02:35 -0200 Organization: G&P Message-ID: <000701c50845$2953f1a0$e883f40a@br.gedasgrp> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0008_01C50834.65CB21A0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.126 tagged_above=0 required=5 tests=AWL, HTML_MESSAGE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/12 X-Sequence-Number: 10341 This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C50834.65CB21A0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sorry, I sent this mail message with wrong account and it has been = delayed by the mail system, so I'm resending it.=20 =20 Hello my friends, =20 I'd like to know (based on your experience and technical details) which = OS is recommended for running PostgreSQL keeping in mind 3 indicators: =20 1 - Performance (SO, Network and IO) 2 - SO Stability 3 - File System Integrity =20 Comparisons between Slackware, Gentoo and FreeBSD are welcome. =20 Which file system has the best performance and integrity: XFS (Linux) or = UFS (FreeBSD)?=20 *I've read that UFS is not a journaling FS. Is this right? How much this difference affects performance and integrity? =20 I don't have experience with FreeBSD so I'd like to know if it is = possible to run XFS on FreeBSD 5.3. =20 =20 Thank you, Bruno Almeida do Lago =20 ------=_NextPart_000_0008_01C50834.65CB21A0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Sorry, I sent this mail message with wrong account = and it has been delayed by the mail system, so I’m resending it. =

 

Hello my friends,

 

I'd like to know (based on your experience and = technical details) which OS is recommended for running PostgreSQL keeping in mind = 3 indicators:

 

1 - Performance (SO, Network and = IO)

2 - SO Stability

3 - File System Integrity

 

Comparisons between Slackware, Gentoo and FreeBSD are welcome.

 

Which file system has the best performance and = integrity: XFS (Linux) or UFS (FreeBSD)?

*I've read that UFS is not a journaling FS. Is this = right? How much this difference affects performance and = integrity?

 

I don't have experience with FreeBSD so I'd like to = know if it is possible to run XFS on FreeBSD 5.3.

 

 

Thank you,

Bruno Almeida do Lago

 

------=_NextPart_000_0008_01C50834.65CB21A0-- From pgsql-performance-owner@postgresql.org Tue Feb 1 11:27:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B462E8B9B27 for ; Tue, 1 Feb 2005 11:27:39 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56654-04 for ; Tue, 1 Feb 2005 11:27:27 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id 6184B8B9CEE for ; Tue, 1 Feb 2005 11:27:28 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 2C9E81C916; Tue, 1 Feb 2005 05:27:27 -0600 (CST) Date: Tue, 1 Feb 2005 05:27:27 -0600 From: "Jim C. Nasby" To: Cosimo Streppone Cc: Postgresql Performance list Subject: Re: High end server and storage for a PostgreSQL OLTP system Message-ID: <20050201112727.GF32356@decibel.org> References: <41FE97FC.3060106@streppone.it> <20050201045645.GC32356@decibel.org> <41FF2337.7070809@streppone.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41FF2337.7070809@streppone.it> X-Operating-System: FreeBSD 4.10-RELEASE-p3 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.023 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/13 X-Sequence-Number: 10342 On Tue, Feb 01, 2005 at 07:35:35AM +0100, Cosimo Streppone wrote: > >You might look at Opteron's, which theoretically have a higher data > >bandwidth. If you're doing anything data intensive, like a sort in > >memory, this could make a difference. > > Would Opteron systems need 64-bit postgresql (and os, gcc, ...) > build to have that advantage? Well, that would give you the most benefit, but the memory bandwidth is still greater than on a Xeon. There's really no issue with 64 bit if you're using open source software; it all compiles for 64 bits and you're good to go. http://stats.distributed.net runs on a dual opteron box running FreeBSD and I've had no issues. > >RAID10 will be faster than RAID1. > > Sorry Jim, by RAID10 you mean several raid1 arrays mounted on > different linux partitions? Or several raid1 arrays that > build up a raid0 array? In the latter case, who decides which > data goes in which raid1 array? Raid Adapter? You should take a look around online for a description of raid types. There's technically RAID0+1 and RAID1+0; one is a stripe of mirrored drives (a RAID 0 built out of RAID 1s), the other is a mirror of two RAID 0s. The former is much better; if you're lucky you can lose half your drives without any data loss (if each dead drive is part of a different mirror). Recovery is also faster. You'll almost certainly be much happier with hardware raid instead of software raid. stats.distributed.net runs a 3ware controller and SATA drives. -- Jim C. Nasby, Database Consultant decibel@decibel.org Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?" From pgsql-performance-owner@postgresql.org Thu Feb 3 05:53:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E200C8B9E61; Tue, 1 Feb 2005 11:39:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57985-06; Tue, 1 Feb 2005 11:39:28 +0000 (GMT) Received: from mx5.net.nih.gov (mx5.net.nih.gov [165.112.130.36]) by svr1.postgresql.org (Postfix) with ESMTP id DC7368B9CEE; Tue, 1 Feb 2005 11:39:28 +0000 (GMT) Received: from mx5.net.nih.gov (localhost [127.0.0.1]) by mx5.net.nih.gov (8.12.10/8.11.6) with ESMTP id j11Bc6ia014159; Tue, 1 Feb 2005 06:39:27 -0500 Received: from [128.231.145.14] (holmes.nhgri.nih.gov [128.231.145.14]) by mx5.net.nih.gov (8.12.10/8.11.6) with ESMTP id j11Bc6QO014154; Tue, 1 Feb 2005 06:38:06 -0500 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: , "Greg Stark" , "Andrei Bintintan" , , "Richard Huxton" , From: Sean Davis Subject: Re: [SQL] OFFSET impact on Performance??? Date: Tue, 1 Feb 2005 06:38:05 -0500 To: "Leeuw van der, Tim" X-Mailer: Apple Mail (2.619) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/50 X-Sequence-Number: 10379 On Jan 26, 2005, at 5:36 AM, Leeuw van der, Tim wrote: > Hi, > > What you could do is create a table containing all the fields from > your SELECT, plus a per-session unique ID. Then you can store the > query results in there, and use SELECT with OFFSET / LIMIT on that > table. The WHERE clause for this temp-results table only needs to > contain the per-session unique id. > This is what I do, but I use two columns for indexing the original query, a user_id (not session-id) and an index to the "query_id" that is unique within user. This "query_id" is a foreign key to another table that describes the query (often just a name). I allow the user only a fixed number of "stored" queries and recycle after hitting the maximum. You can timestamp your queries so that when you recycle you drop the oldest one first. If you don't need multiple stored query results, then using the user_id is probably adequate (assuming the user is not logged on in several locations simultaneously). > This of course gives you a new problem: cleaning stale data out of the > temp-results table. And another new problem is that users will not see > new data appear on their screen until somehow the query is re-run (... > but that might even be desirable, actually, depending on how your > users do their work and what their work is). > See above. The query refresh issue remains. > And of course better performance cannot be guaranteed until you try it. > For the standard operating procedure of perform query===>view results, I have found this to be a nice system. The user is accustomed to queries taking a bit of time to perform, but then wants to be able to manipulate and view data rather quickly; this paradigm is pretty well served by making a separate table of results, particularly if the original query is costly. > > Would such a scheme give you any hope of improved performance, or > would it be too much of a nightmare? > This question still applies.... Sean > > -----Original Message----- > From: pgsql-performance-owner@postgresql.org on behalf of Andrei > Bintintan > Sent: Wed 1/26/2005 11:11 AM > To: alex@neteconomist.com; Greg Stark > Cc: Richard Huxton; pgsql-sql@postgresql.org; > pgsql-performance@postgresql.org > Subject: Re: [PERFORM] [SQL] OFFSET impact on Performance??? > > The problems still stays open. > > The thing is that I have about 20 - 30 clients that are using that SQL > query > where the offset and limit are involved. So, I cannot create a temp > table, > because that means that I'll have to make a temp table for each > session... > which is a very bad ideea. Cursors somehow the same. In my application > the > Where conditions can be very different for each user(session) apart. > > The only solution that I see in the moment is to work at the query, or > to > write a more complex where function to limit the results output. So no > replace for Offset/Limit. > > Best regards, > Andy. From pgsql-performance-owner@postgresql.org Tue Feb 1 12:41:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 834718B9BD5 for ; Tue, 1 Feb 2005 12:41:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67889-02 for ; Tue, 1 Feb 2005 12:41:42 +0000 (GMT) Received: from web206.biz.mail.re2.yahoo.com (web206.biz.mail.re2.yahoo.com [68.142.224.168]) by svr1.postgresql.org (Postfix) with SMTP id 9CB0B8B9EA3 for ; Tue, 1 Feb 2005 12:41:43 +0000 (GMT) Message-ID: <20050201124143.43977.qmail@web206.biz.mail.re2.yahoo.com> Received: from [217.206.116.210] by web206.biz.mail.re2.yahoo.com via HTTP; Tue, 01 Feb 2005 04:41:43 PST Date: Tue, 1 Feb 2005 04:41:43 -0800 (PST) From: Andrew Mayo Subject: Performance of count(*) on large tables vs SQL Server To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/14 X-Sequence-Number: 10343 Doing some rather crude comparative performance tests between PG 8.0.1 on Windows XP and SQL Server 2000, PG whips SQL Server's ass on insert into junk (select * from junk) on a one column table defined as int. If we start with a 1 row table and repeatedly execute this command, PG can take the table from 500K rows to 1M rows in 20 seconds; SQL Server is at least twice as slow. BUT... SQL Server can do select count(*) on junk in almost no time at all, probably because this query can be optimised to go back and use catalogue statistics. PG, on the other hand, appears to do a full table scan to answer this question, taking nearly 4 seconds to process the query. Doing an ANALYZE on the table and also VACUUM did not seem to affect this. Can PG find a table's row count more efficiently?. This is not an unusual practice in commercial applications which assume that count(*) with no WHERE clause will be a cheap query - and use it to test if a table is empty, for instance. (because for Oracle/Sybase/SQL Server, count(*) is cheap). (sure, I appreciate there are other ways of doing this, but I am curious about the way PG works here). From pgsql-performance-owner@postgresql.org Tue Feb 1 13:01:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1B2EB8B9D02 for ; Tue, 1 Feb 2005 13:01:21 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70155-10 for ; Tue, 1 Feb 2005 13:01:03 +0000 (GMT) Received: from smtp.pspl.co.in (smtp.persistent.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 1735C8B9E22 for ; Tue, 1 Feb 2005 13:01:03 +0000 (GMT) Received: from ps0499.persistent.co.in (PS0499.intranet.pspl.co.in [192.168.10.204]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id j11D9JQ2010121; Tue, 1 Feb 2005 18:39:19 +0530 From: Shridhar Daithankar To: Andrew Mayo Subject: Re: Performance of count(*) on large tables vs SQL Server Date: Tue, 1 Feb 2005 18:32:56 +0530 User-Agent: KMail/1.7 Cc: pgsql-performance@postgresql.org References: <20050201124143.43977.qmail@web206.biz.mail.re2.yahoo.com> In-Reply-To: <20050201124143.43977.qmail@web206.biz.mail.re2.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502011832.56333.ghodechhap@ghodechhap.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.159 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/15 X-Sequence-Number: 10344 On Tuesday 01 Feb 2005 6:11 pm, Andrew Mayo wrote: > PG, on the other hand, appears to do a full table scan > to answer this question, taking nearly 4 seconds to > process the query. > > Doing an ANALYZE on the table and also VACUUM did not > seem to affect this. > > Can PG find a table's row count more efficiently?. > This is not an unusual practice in commercial > applications which assume that count(*) with no WHERE > clause will be a cheap query - and use it to test if > a table is empty, for instance. (because for > Oracle/Sybase/SQL Server, count(*) is cheap). First of all, such an assumption is no good. It should hit concurrency under heavy load but I know people do use it. For the specific question, after a vacuum analyze, you can use select reltuples from pg_class where relname='Foo'; Remember, you will get different results between 'analyze' and 'vacuum analyze', since later actually visit every page in the table and hence is expected to be more accurate. > (sure, I appreciate there are other ways of doing > this, but I am curious about the way PG works here). Answer is MVCC and PG's inability use index alone. This has been a FAQ for a loong time.. Furthermore PG has custom aggregates to complicate the matter.. Most of the pg developers/users think that unqualified select count(*) is of no use. You can search the archives for more details.. HTH Shridhar From pgsql-performance-owner@postgresql.org Tue Feb 1 13:19:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6E1B58B9EC5 for ; Tue, 1 Feb 2005 13:19:46 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72593-06 for ; Tue, 1 Feb 2005 13:19:38 +0000 (GMT) Received: from smtpout03-04.mesa1.secureserver.net (smtpout03-01.mesa1.secureserver.net [64.202.165.71]) by svr1.postgresql.org (Postfix) with SMTP id E85A48B9EA0 for ; Tue, 1 Feb 2005 13:19:39 +0000 (GMT) Received: (qmail 5142 invoked from network); 1 Feb 2005 13:19:39 -0000 Received: from unknown (64.231.136.13) by smtpout03-04.mesa1.secureserver.net (64.202.165.74) with ESMTP; 01 Feb 2005 13:19:39 -0000 Date: Tue, 1 Feb 2005 08:22:50 -0500 From: Stef To: Shridhar Daithankar Cc: Andrew Mayo , pgsql-performance@postgresql.org Subject: Re: Performance of count(*) on large tables vs SQL Server Message-ID: <20050201132250.GF32625@survivor.hades> References: <20050201124143.43977.qmail@web206.biz.mail.re2.yahoo.com> <200502011832.56333.ghodechhap@ghodechhap.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qM81t570OJUP5TU/" Content-Disposition: inline In-Reply-To: <200502011832.56333.ghodechhap@ghodechhap.net> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/16 X-Sequence-Number: 10345 --qM81t570OJUP5TU/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Andrew, Everything that Shridhar says makes perfect sense, and, speaking from experience in dealing with this type of 'problem', everything you say does as=20 well. Such is life really :) I would not be at -all- surprised if Sybase and Oracle did query re-writing behind the scene's to send un-defined count's to a temporary table which holds the row count. For an example of such done in postgreSQL (using triggers and a custom procedure) look into the 'General Bits' newsletter. Specifically http://www.varlena.com/varlena/GeneralBits/49.php I know, giving a URL as an answer 'sucks', but, well, it simply repeats my experience. Triggers and Procedures. Regards Steph On Tue, Feb 01, 2005 at 06:32:56PM +0530, Shridhar Daithankar wrote: > On Tuesday 01 Feb 2005 6:11 pm, Andrew Mayo wrote: > > PG, on the other hand, appears to do a full table scan > > to answer this question, taking nearly 4 seconds to > > process the query. > > > > Doing an ANALYZE on the table and also VACUUM did not > > seem to affect this. > > > > Can PG find a table's row count more efficiently?. > > This is not an unusual practice in commercial > > applications which assume that count(*) with no WHERE > > clause will be a cheap query - and use it to test if > > a table is empty, for instance. (because for > > Oracle/Sybase/SQL Server, count(*) is cheap). >=20 > First of all, such an assumption is no good. It should hit concurrency un= der=20 > heavy load but I know people do use it. >=20 > For the specific question, after a vacuum analyze, you can use=20 >=20 > select reltuples from pg_class where relname=3D'Foo'; >=20 > Remember, you will get different results between 'analyze' and 'vacuum=20 > analyze', since later actually visit every page in the table and hence is= =20 > expected to be more accurate. >=20 > > (sure, I appreciate there are other ways of doing > > this, but I am curious about the way PG works here). >=20 > Answer is MVCC and PG's inability use index alone. This has been a FAQ fo= r a=20 > loong time.. Furthermore PG has custom aggregates to complicate the matte= r.. >=20 > Most of the pg developers/users think that unqualified select count(*) is= of=20 > no use. You can search the archives for more details.. >=20 > HTH >=20 > Shridhar >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? >=20 > http://archives.postgresql.org >=20 --qM81t570OJUP5TU/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQFB/4KqjI9jiT2RxJQRAhw1AJ9XU9JWwKWJNjmXfXABlhbPi80g2gCfaA0v rZkYFoz9xMx1pQAzIBje1cU= =omgh -----END PGP SIGNATURE----- --qM81t570OJUP5TU/-- From pgsql-performance-owner@postgresql.org Tue Feb 1 13:34:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6C70E8B9CA0 for ; Tue, 1 Feb 2005 13:34:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74116-07 for ; Tue, 1 Feb 2005 13:33:54 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 3791B8B9CD1 for ; Tue, 1 Feb 2005 13:33:56 +0000 (GMT) Received: (qmail 3390 invoked from network); 1 Feb 2005 14:34:17 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 1 Feb 2005 14:34:17 +0100 To: "Andrew Mayo" , pgsql-performance@postgresql.org Subject: Re: Performance of count(*) on large tables vs SQL Server References: <20050201124143.43977.qmail@web206.biz.mail.re2.yahoo.com> Message-ID: Date: Tue, 01 Feb 2005 14:36:30 +0100 From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <20050201124143.43977.qmail@web206.biz.mail.re2.yahoo.com> User-Agent: Opera M2/7.54 (Linux, build 751) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/17 X-Sequence-Number: 10346 > clause will be a cheap query - and use it to test if > a table is empty, for instance. (because for > Oracle/Sybase/SQL Server, count(*) is cheap). To test if a table is empty, use a SELECT EXISTS or whatever SELECT with a LIMIT 1... From pgsql-performance-owner@postgresql.org Tue Feb 1 13:58:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 70C888B9E64 for ; Tue, 1 Feb 2005 13:58:47 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76591-04 for ; Tue, 1 Feb 2005 13:58:37 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 2D5548B9CF9 for ; Tue, 1 Feb 2005 13:58:39 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so1020613wra for ; Tue, 01 Feb 2005 05:58:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=ed6UQ91oOP0GD0oM8VQTcXFJ/Zkt0nPG1Vvs75kpaOoZw7rgBzcWESv0zRwnswY9bJyIy872Peaj1sn33S1ijb4FVEajDs8q5abyyI941YZ8+dKMCGrkltSVEFlMhEy2m+DLsy3r5JyeaMYP/1T8xyB0weTHT1OeeKJIppADCg4= Received: by 10.54.26.74 with SMTP id 74mr302341wrz; Tue, 01 Feb 2005 05:58:34 -0800 (PST) Received: by 10.54.18.59 with HTTP; Tue, 1 Feb 2005 05:58:34 -0800 (PST) Message-ID: <33c6269f05020105585b25794b@mail.gmail.com> Date: Tue, 1 Feb 2005 08:58:34 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: "Jim C. Nasby" Subject: Re: High end server and storage for a PostgreSQL OLTP system Cc: Cosimo Streppone , Postgresql Performance list In-Reply-To: <20050201112727.GF32356@decibel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41FE97FC.3060106@streppone.it> <20050201045645.GC32356@decibel.org> <41FF2337.7070809@streppone.it> <20050201112727.GF32356@decibel.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/18 X-Sequence-Number: 10347 To be honest I've used compaq, dell and LSI SCSI RAID controllers and got pretty pathetic benchmarks from all of them. The best system I have is the one I just built: 2xOpteron 242, Tyan S2885 MoBo, 4GB Ram, 14xSATA WD Raptor drives: 2xRaid 1, 1x4 disk Raid 10, 1x6 drive Raid 10. 2x3ware (now AMCC) Escalade 9500S-8MI. This system with fsync on has managed 2500 insert transactions/sec (granted they are simple transactions, but still). RAID 10 is a stripe of mirrors. RAID 10 give you the best read and write performance combined. RAID 5 gives very bad write perfomance, but good read performance. With RAID 5 you can only loose a single drive and rebuild times are slow. RAID 10 can loose up to have the array depending on which drives without loosing data. I would be interested in starting a site listing RAID benchmarks under linux. If anyone is interested let me know. I would be interested in at least some bonnie++ benchmarks, and perhaps other if people would like. Alex Turner NetEconomist On Tue, 1 Feb 2005 05:27:27 -0600, Jim C. Nasby wrote: > On Tue, Feb 01, 2005 at 07:35:35AM +0100, Cosimo Streppone wrote: > > >You might look at Opteron's, which theoretically have a higher data > > >bandwidth. If you're doing anything data intensive, like a sort in > > >memory, this could make a difference. > > > > Would Opteron systems need 64-bit postgresql (and os, gcc, ...) > > build to have that advantage? > > Well, that would give you the most benefit, but the memory bandwidth is > still greater than on a Xeon. There's really no issue with 64 bit if > you're using open source software; it all compiles for 64 bits and > you're good to go. http://stats.distributed.net runs on a dual opteron > box running FreeBSD and I've had no issues. > > > >RAID10 will be faster than RAID1. > > > > Sorry Jim, by RAID10 you mean several raid1 arrays mounted on > > different linux partitions? Or several raid1 arrays that > > build up a raid0 array? In the latter case, who decides which > > data goes in which raid1 array? Raid Adapter? > > You should take a look around online for a description of raid types. > > There's technically RAID0+1 and RAID1+0; one is a stripe of mirrored > drives (a RAID 0 built out of RAID 1s), the other is a mirror of two > RAID 0s. The former is much better; if you're lucky you can lose half > your drives without any data loss (if each dead drive is part of a > different mirror). Recovery is also faster. > > You'll almost certainly be much happier with hardware raid instead of > software raid. stats.distributed.net runs a 3ware controller and SATA > drives. > -- > Jim C. Nasby, Database Consultant decibel@decibel.org > Give your computer some brain candy! www.distributed.net Team #1828 > > Windows: "Where do you want to go today?" > Linux: "Where do you want to go tomorrow?" > FreeBSD: "Are you guys coming, or what?" > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From pgsql-performance-owner@postgresql.org Tue Feb 1 15:31:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D0A988B9B31 for ; Tue, 1 Feb 2005 15:31:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85081-02 for ; Tue, 1 Feb 2005 15:31:48 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 04B3F8B9B3A for ; Tue, 1 Feb 2005 15:31:51 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: High end server and storage for a PostgreSQL OLTP system Date: Tue, 1 Feb 2005 10:30:59 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75FE@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High end server and storage for a PostgreSQL OLTP system Thread-Index: AcUH1lEHBhOEhUfJSuucusaaDnUxTgAm8zJg From: "Merlin Moncure" To: "Cosimo Streppone" Cc: "Postgresql Performance list" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/19 X-Sequence-Number: 10348 > Hi all, > 1) What kind of performance gain can I expect switching from > 7.1 to 7.4 (or 8.0)? Obviously I'm doing my own testing, > but I'm not very impressed by 8.0 speed, may be I'm doing > testing on a low end server... 8.0 gives you savepoints. While this may not seem like a big deal at first, the ability to handle exceptions inside pl/pgsql functions gives you much more flexibility to move code into the server. Also, recent versions of pl/pgsql give you more flexibility with cursors, incuding returning them outside of the function. Corollary: use pl/pgsql. It can be 10 times or more faster than query by query editing. You also have the parse/bind interface. This may not be so easily to implement in your app, but if you are machine gunning your server with queries, use parameterized prepared queries and reap 50% + performance, meaning lower load and quicker transaction turnaround time. Merlin From pgsql-performance-owner@postgresql.org Thu Feb 3 05:33:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 11B7A8B9B58 for ; Tue, 1 Feb 2005 16:38:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90531-01 for ; Tue, 1 Feb 2005 16:38:16 +0000 (GMT) Received: from auscorpex-1.austin.messageone.com (auscorpex-1.austin.messageone.com [66.219.55.10]) by svr1.postgresql.org (Postfix) with ESMTP id 2F3BF8B9B37 for ; Tue, 1 Feb 2005 16:38:15 +0000 (GMT) X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5087C.6C40A21D" Subject: Effect of database encoding on performance Date: Tue, 1 Feb 2005 10:38:13 -0600 Message-ID: <46F30BC04EC6364695BC07D4A57AAD2C627208@auscorpex-1.austin.messageone.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Effect of database encoding on performance Thread-Index: AcUIfGvxwECngI02QNSTgOSoSPriXQ== From: "Igor Postelnik" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.377 tagged_above=0 required=5 tests=DNS_FROM_RFC_POST, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200502/49 X-Sequence-Number: 10378 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5087C.6C40A21D Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable What's the effect of different encodings on database performance?=20 =20 We're looking to switch encoding of our database from SQL_ASCII to UTF-8 to better handle international data. I expect that at least 90% of our data will be in the ASCII range with a few characters that need double-byte encoding. Has anyone done extensive comparison of the performance of different encodings? =20 -Igor =20 =20 ------_=_NextPart_001_01C5087C.6C40A21D Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

What’s the effect of different encodings on = database performance?

 

We’re looking to switch encoding of our = database from SQL_ASCII to UTF-8 to better handle international data. I expect that at = least 90% of our data will be in the ASCII range with a few characters that = need double-byte encoding. Has anyone done extensive comparison of the = performance of different encodings?

 

-Igor

 

 

------_=_NextPart_001_01C5087C.6C40A21D-- From pgsql-performance-owner@postgresql.org Tue Feb 1 18:55:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0ABDD8B9BD0 for ; Tue, 1 Feb 2005 18:55:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02439-02 for ; Tue, 1 Feb 2005 18:55:04 +0000 (GMT) Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id B0C238B9C6C for ; Tue, 1 Feb 2005 18:55:03 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Why the difference in query plan and performance pg 7.4.6? Date: Tue, 1 Feb 2005 19:55:01 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Why the difference in query plan and performance pg 7.4.6? Thread-Index: AcUIj4kLyDYPVpSvRwSsTkubZirX9Q== From: "Joost Kraaijeveld" To: "Pgsql-Performance (E-mail)" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.09 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/20 X-Sequence-Number: 10349 Hi all, I have a freshly vacuumed table with 1104379 records with a index on = zipcode. Can anyone explain why the queries go as they go, and why the = performance differs so much (1 second versus 64 seconds, or stated = differently, 10000 records per second versus 1562 records per second) = and why the query plan of query 2 ignores the index? For completeness sake I also did a select ordernumber without any = ordering. That only took 98 second for 1104379 record (11222 record per = second, compariable with the first query as I would have expected).=20 Query 1: select a.ordernumer from orders a order by a.zipcode limit 10000 Explain:=20 QUERY PLAN Limit (cost=3D0.00..39019.79 rows=3D10000 width=3D14) -> Index Scan using orders_postcode on orders a = (cost=3D0.00..4309264.07 rows=3D1104379 width=3D14) Running time: 1 second Query 2: select a.ordernumer from orders a order by a.zipcode limit 100000 Explain: QUERY PLAN Limit (cost=3D207589.75..207839.75 rows=3D100000 width=3D14) -> Sort (cost=3D207589.75..210350.70 rows=3D1104379 width=3D14) Sort Key: postcode -> Seq Scan on orders a (cost=3D0.00..46808.79 rows=3D1104379 = width=3D14) Running time: 64 seconds Query 3: select a.ordernumer from orders a QUERY PLAN Seq Scan on orders a (cost=3D0.00..46808.79 rows=3D1104379 width=3D4) Running time: 98 seconds Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl=20 From pgsql-performance-owner@postgresql.org Tue Feb 1 20:07:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C58CB8B9D05 for ; Tue, 1 Feb 2005 20:07:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08497-04 for ; Tue, 1 Feb 2005 20:06:52 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 64EB18B9D03 for ; Tue, 1 Feb 2005 20:06:52 +0000 (GMT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.2/8.12.9) with ESMTP id j11K6nAa011174; (envelope-from ) Tue, 1 Feb 2005 14:06:49 -0600 (CST) Received: from [192.168.1.103] (65-100-23-112.cdrr.qwest.net [65.100.23.112]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j11K6kwv011081 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Tue, 1 Feb 2005 14:06:48 -0600 (CST) Message-ID: <41FFE157.8000708@arbash-meinel.com> Date: Tue, 01 Feb 2005 14:06:47 -0600 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joost Kraaijeveld , pgsql-performance@postgresql.org Subject: Re: Why the difference in query plan and performance pg References: In-Reply-To: X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig27EAD94C1E9C3FD9BAF566F0" X-Virus-Scanned: ClamAV 0.80/682/Mon Jan 24 12:53:43 2005 clamav-milter version 0.80j on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV 0.80/685/Wed Jan 26 03:08:24 2005, clamav-milter version 0.75 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/21 X-Sequence-Number: 10350 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig27EAD94C1E9C3FD9BAF566F0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Joost Kraaijeveld wrote: >Hi all, > >I have a freshly vacuumed table with 1104379 records with a index on zipcode. Can anyone explain why the queries go as they go, and why the performance differs so much (1 second versus 64 seconds, or stated differently, 10000 records per second versus 1562 records per second) and why the query plan of query 2 ignores the index? > > > > Indexes are generally only faster if you are grabbing <10% of the table. Otherwise you have the overhead of loading the index into memory, and then paging through it looking for the entries. With 100,000 entries a sequential scan is actually likely to be faster than an indexed one. If you try: select a.ordernumer from orders a order by a.zipcode how long does it take? You can also try disabling sequential scan to see how long Query 2 would be if you used indexing. Remember, though, that because of caching, a repeated index scan may seem faster, but in actual production, that index may not be cached, depending on what other queries are done. John =:-> >For completeness sake I also did a select ordernumber without any ordering. That only took 98 second for 1104379 record (11222 record per second, compariable with the first query as I would have expected). > >Query 1: >select a.ordernumer from orders a order by a.zipcode limit 10000 >Explain: >QUERY PLAN >Limit (cost=0.00..39019.79 rows=10000 width=14) > -> Index Scan using orders_postcode on orders a (cost=0.00..4309264.07 rows=1104379 width=14) >Running time: 1 second > >Query 2: >select a.ordernumer from orders a order by a.zipcode limit 100000 >Explain: >QUERY PLAN >Limit (cost=207589.75..207839.75 rows=100000 width=14) > -> Sort (cost=207589.75..210350.70 rows=1104379 width=14) > Sort Key: postcode > -> Seq Scan on orders a (cost=0.00..46808.79 rows=1104379 width=14) >Running time: 64 seconds > >Query 3: >select a.ordernumer from orders a >QUERY PLAN >Seq Scan on orders a (cost=0.00..46808.79 rows=1104379 width=4) >Running time: 98 seconds > >Groeten, > >Joost Kraaijeveld >Askesis B.V. >Molukkenstraat 14 >6524NB Nijmegen >tel: 024-3888063 / 06-51855277 >fax: 024-3608416 >e-mail: J.Kraaijeveld@Askesis.nl >web: www.askesis.nl > >---------------------------(end of broadcast)--------------------------- >TIP 8: explain analyze is your friend > > --------------enig27EAD94C1E9C3FD9BAF566F0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB/+FaJdeBCYSNAAMRApOCAJ9Vf8IkMqSS57zDUJOSDoO6gIs7owCgthS8 icNY9AFDdVyLmptZjaM4djE= =Lhu1 -----END PGP SIGNATURE----- --------------enig27EAD94C1E9C3FD9BAF566F0-- From pgsql-performance-owner@postgresql.org Tue Feb 1 21:01:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 42BED8B9B83 for ; Tue, 1 Feb 2005 21:01:18 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12686-04 for ; Tue, 1 Feb 2005 21:01:02 +0000 (GMT) Received: from smtp0.libero.it (smtp0.libero.it [193.70.192.33]) by svr1.postgresql.org (Postfix) with ESMTP id 1EE528B9D15 for ; Tue, 1 Feb 2005 21:01:00 +0000 (GMT) Received: from localhost (172.16.1.79) by smtp0.libero.it (7.0.027-DD01) id 41BDA86900A98799; Tue, 1 Feb 2005 22:00:57 +0100 Received: from [62.98.81.87] (62.98.81.87) by smtp3.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41FF66430009F81D; Tue, 1 Feb 2005 22:00:57 +0100 Message-ID: <41FFEE02.3080605@streppone.it> Date: Tue, 01 Feb 2005 22:00:50 +0100 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Merlin Moncure Cc: Postgresql Performance list Subject: Re: High end server and storage for a PostgreSQL OLTP system References: <6EE64EF3AB31D5448D0007DD34EEB3412A75FE@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75FE@Herge.rcsinc.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at libero.it serv1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/22 X-Sequence-Number: 10351 Merlin Moncure wrote: > Corollary: use pl/pgsql. It can be 10 times or more faster than query > by query editing. Merlin, thanks for your good suggestions. By now, our system has never used "stored procedures" approach, due to the fact that we're staying on the minimum common SQL features that are supported by most db engines. I realize though that it would provide an heavy performance boost. > You also have the parse/bind interface This is something I have already engineered in our core classes (that use DBI + DBD::Pg), so that switching to 8.0 should automatically enable the "single-prepare, multiple-execute" behavior, saving a lot of query planner processing, if I understand correctly. -- Cosimo From pgsql-performance-owner@postgresql.org Tue Feb 1 21:11:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B3DBC8B9D08 for ; Tue, 1 Feb 2005 21:11:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13339-10 for ; Tue, 1 Feb 2005 21:11:31 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 031068B9C99 for ; Tue, 1 Feb 2005 21:11:32 +0000 (GMT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j11LBBo24809; Tue, 1 Feb 2005 16:11:11 -0500 (EST) From: Bruce Momjian Message-Id: <200502012111.j11LBBo24809@candle.pha.pa.us> Subject: Re: Ideal disk setup for Postgresql 7.4? In-Reply-To: <200501251903.09734.josh@agliodbs.com> To: Josh Berkus Date: Tue, 1 Feb 2005 16:11:11 -0500 (EST) Cc: pgsql-performance@postgresql.org, Steve Poe X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/23 X-Sequence-Number: 10352 Josh Berkus wrote: > Steve, > > > I help manage an animal hospital of 100-employees Linux servers. I am > > new to database setup and tuning, I was hoping I could get some > > direction on a setting up drive array we're considering moving our > > database to. > > Check what I have to say at http://www.powerpostgresql.com/PerfList > Added to our FAQ. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Tue Feb 1 21:11:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 29B9B8B9C9A for ; Tue, 1 Feb 2005 21:11:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13447-08 for ; Tue, 1 Feb 2005 21:11:46 +0000 (GMT) Received: from smtp1.libero.it (smtp1.libero.it [193.70.192.51]) by svr1.postgresql.org (Postfix) with ESMTP id DB8618B9B83 for ; Tue, 1 Feb 2005 21:11:47 +0000 (GMT) Received: from localhost (172.16.1.84) by smtp1.libero.it (7.0.027-DD01) id 41BDB2AB00A91669; Tue, 1 Feb 2005 22:11:38 +0100 Received: from [62.98.81.87] (62.98.81.87) by smtp0.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41BF5F48037CEA14; Tue, 1 Feb 2005 22:11:41 +0100 Message-ID: <41FFF082.2070306@streppone.it> Date: Tue, 01 Feb 2005 22:11:30 +0100 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: alex@neteconomist.com Cc: Postgresql Performance list Subject: Re: High end server and storage for a PostgreSQL OLTP system References: <41FE97FC.3060106@streppone.it> <20050201045645.GC32356@decibel.org> <41FF2337.7070809@streppone.it> <20050201112727.GF32356@decibel.org> <33c6269f05020105585b25794b@mail.gmail.com> In-Reply-To: <33c6269f05020105585b25794b@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at libero.it serv5 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/24 X-Sequence-Number: 10353 Alex Turner wrote: > To be honest I've used compaq, dell and LSI SCSI RAID controllers and > got pretty pathetic benchmarks from all of them. I also have seen average-low results for LSI (at least the 1020 card). > 2xOpteron 242, Tyan S2885 MoBo, 4GB Ram, 14xSATA WD Raptor drives: > 2xRaid 1, 1x4 disk Raid 10, 1x6 drive Raid 10. 2x3ware (now AMCC) > Escalade 9500S-8MI. Thanks, this is precious information. > I would be interested in starting a site listing RAID benchmarks under > linux. If anyone is interested let me know. I would be interested in > at least some bonnie++ benchmarks, and perhaps other if people would > like. I have used also tiobench [http://tiobench.sourceforge.net/] Any experience with it? -- Cosimo From pgsql-performance-owner@postgresql.org Wed Feb 2 00:16:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 768498B9B53 for ; Wed, 2 Feb 2005 00:16:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29167-06 for ; Wed, 2 Feb 2005 00:16:19 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id D35F38B9B49 for ; Wed, 2 Feb 2005 00:16:18 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id CE84531DAA; Wed, 2 Feb 2005 01:16:17 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: horizontal partition Date: Wed, 02 Feb 2005 01:16:17 +0100 Organization: PYRENET Midi-pyrenees Provider Lines: 113 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/25 X-Sequence-Number: 10354 Hi all, I have a big table with ~ 10 Milion rows, and is a very pain administer it, so after years I convinced my self to partition it and replace the table usage ( only for reading ) with a view. Now my user_logs table is splitted in 4: user_logs user_logs_2002 user_logs_2003 user_logs_2004 and the view v_user_logs is builded on top of these tables: CREATE OR REPLACE VIEW v_user_logs AS SELECT * FROM user_logs UNION ALL SELECT * FROM user_logs_2002 UNION ALL SELECT * FROM user_logs_2003 UNION ALL SELECT * FROM user_logs_2004 ; the view is performing really well: empdb=# explain analyze select * from v_user_logs where id_user = sp_id_user('kalman'); QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- Subquery Scan v_user_logs (cost=0.00..895.45 rows=645 width=88) (actual time=17.039..2345.388 rows=175 loops=1) -> Append (cost=0.00..892.23 rows=645 width=67) (actual time=17.030..2344.195 rows=175 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..120.70 rows=60 width=67) (actual time=17.028..17.036 rows=1 loops=1) -> Index Scan using idx_user_user_logs on user_logs (cost=0.00..120.40 rows=60 width=67) (actual time=17.012..17.018 rows=1 loops=1) Index Cond: (id_user = 4185) -> Subquery Scan "*SELECT* 2" (cost=0.00..475.44 rows=316 width=67) (actual time=49.406..1220.400 rows=79 loops=1) -> Index Scan using idx_user_user_logs_2004 on user_logs_2004 (cost=0.00..473.86 rows=316 width=67) (actual time=49.388..1219.386 rows=79 loops=1) Index Cond: (id_user = 4185) -> Subquery Scan "*SELECT* 3" (cost=0.00..204.33 rows=188 width=67) (actual time=59.375..1068.806 rows=95 loops=1) -> Index Scan using idx_user_user_logs_2003 on user_logs_2003 (cost=0.00..203.39 rows=188 width=67) (actual time=59.356..1067.934 rows=95 loops=1) Index Cond: (id_user = 4185) -> Subquery Scan "*SELECT* 4" (cost=0.00..91.75 rows=81 width=67) (actual time=37.623..37.623 rows=0 loops=1) -> Index Scan using idx_user_user_logs_2002 on user_logs_2002 (cost=0.00..91.35 rows=81 width=67) (actual time=37.618..37.618 rows=0 loops=1) Index Cond: (id_user = 4185) Total runtime: 2345.917 ms (15 rows) the problem is now if this view is used in others views like this: CREATE OR REPLACE VIEW v_ua_user_login_logout_tmp AS SELECT u.login, ul.* FROM user_login u, v_user_logs ul WHERE u.id_user = ul.id_user ; empdb=# explain analyze select * from v_ua_user_login_logout_tmp where login = 'kalman'; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=4.01..228669.81 rows=173 width=100) (actual time=1544.784..116490.363 rows=175 loops=1) Hash Cond: ("outer".id_user = "inner".id_user) -> Subquery Scan ul (cost=0.00..193326.71 rows=7067647 width=88) (actual time=5.677..108190.096 rows=7067831 loops=1) -> Append (cost=0.00..157988.47 rows=7067647 width=67) (actual time=5.669..77109.995 rows=7067831 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..8158.48 rows=362548 width=67) (actual time=5.666..3379.178 rows=362862 loops=1) -> Seq Scan on user_logs (cost=0.00..6345.74 rows=362548 width=67) (actual time=5.645..1395.673 rows=362862 loops=1) -> Subquery Scan "*SELECT* 2" (cost=0.00..93663.88 rows=4191588 width=67) (actual time=9.149..35094.798 rows=4191580 loops=1) -> Seq Scan on user_logs_2004 (cost=0.00..72705.94 rows=4191588 width=67) (actual time=9.117..16531.486 rows=4191580 loops=1) -> Subquery Scan "*SELECT* 3" (cost=0.00..44875.33 rows=2008233 width=67) (actual time=0.562..24017.680 rows=2008190 loops=1) -> Seq Scan on user_logs_2003 (cost=0.00..34834.17 rows=2008233 width=67) (actual time=0.542..13224.265 rows=2008190 loops=1) -> Subquery Scan "*SELECT* 4" (cost=0.00..11290.78 rows=505278 width=67) (actual time=7.100..3636.163 rows=505199 loops=1) -> Seq Scan on user_logs_2002 (cost=0.00..8764.39 rows=505278 width=67) (actual time=6.446..1474.709 rows=505199 loops=1) -> Hash (cost=4.00..4.00 rows=1 width=16) (actual time=0.083..0.083 rows=0 loops=1) -> Index Scan using user_login_login_key on user_login u (cost=0.00..4.00 rows=1 width=16) (actual time=0.064..0.066 rows=1 loops=1) Index Cond: ((login)::text = 'kalman'::text) Total runtime: 116491.056 ms (16 rows) as you can see the index scan is not used anymore. Do you see any problem on this approach ? Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Wed Feb 2 04:25:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 38FD18B9C1E for ; Wed, 2 Feb 2005 04:25:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50162-08 for ; Wed, 2 Feb 2005 04:25:17 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id BCD5D8B9BD8 for ; Wed, 2 Feb 2005 04:25:16 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 3DE613198C; Wed, 2 Feb 2005 05:25:15 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: High end server and storage for a PostgreSQL OLTP system Date: Tue, 01 Feb 2005 20:25:09 -0800 Organization: Hub.Org Networking Services Lines: 29 Message-ID: References: <41FE97FC.3060106@streppone.it> <20050201045645.GC32356@decibel.org> <41FF2337.7070809@streppone.it> <20050201112727.GF32356@decibel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <20050201112727.GF32356@decibel.org> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/26 X-Sequence-Number: 10355 Jim C. Nasby wrote: > On Tue, Feb 01, 2005 at 07:35:35AM +0100, Cosimo Streppone wrote: > >>>You might look at Opteron's, which theoretically have a higher data >>>bandwidth. If you're doing anything data intensive, like a sort in >>>memory, this could make a difference. >> >>Would Opteron systems need 64-bit postgresql (and os, gcc, ...) >>build to have that advantage? > > > Well, that would give you the most benefit, but the memory bandwidth is > still greater than on a Xeon. There's really no issue with 64 bit if > you're using open source software; it all compiles for 64 bits and > you're good to go. http://stats.distributed.net runs on a dual opteron > box running FreeBSD and I've had no issues. You can get 64-bit Xeons also but it takes hit in the I/O department due to the lack of a hardware I/O MMU which limits DMA transfers to addresses below 4GB. This has a two-fold impact: 1) transfering data to >4GB require first a transfer to <4GB and then a copy to the final destination. 2) You must allocate real memory 2X the address space of the devices to act as bounce buffers. This is especially problematic for workstations because if you put a 512MB Nvidia card in your computer for graphics work -- you've just lost 1GB of memory. (I dunno how much the typical SCSI/NIC/etc take up.) From pgsql-performance-owner@postgresql.org Wed Feb 2 04:50:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 12F858B9BB9 for ; Wed, 2 Feb 2005 04:47:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52311-04 for ; Wed, 2 Feb 2005 04:47:32 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id E04408B9D16 for ; Wed, 2 Feb 2005 04:47:32 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so16694wra for ; Tue, 01 Feb 2005 20:47:31 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=irAs2Xj42rbjuXyEjs/CQ+84AOiPKlzJM2UTfVOVEcE4ftNPgf1YRKhhgYRFZRldGvIyP+GQZWrk7qwKPpGjxOUWfMOeA+nVyb6a8n0x/v5u0uTZIA4IAm5g82wvBMdSmYmk3JFziMFOSk4D2o4eyTckZ3vRl7kMlbxRVr/FeoY= Received: by 10.54.33.17 with SMTP id g17mr86291wrg; Tue, 01 Feb 2005 20:47:31 -0800 (PST) Received: by 10.54.18.59 with HTTP; Tue, 1 Feb 2005 20:47:31 -0800 (PST) Message-ID: <33c6269f050201204751fa4af0@mail.gmail.com> Date: Tue, 1 Feb 2005 23:47:31 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Cosimo Streppone Subject: Re: High end server and storage for a PostgreSQL OLTP system Cc: Postgresql Performance list In-Reply-To: <41FFF082.2070306@streppone.it> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41FE97FC.3060106@streppone.it> <20050201045645.GC32356@decibel.org> <41FF2337.7070809@streppone.it> <20050201112727.GF32356@decibel.org> <33c6269f05020105585b25794b@mail.gmail.com> <41FFF082.2070306@streppone.it> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/27 X-Sequence-Number: 10356 None - but I'll definately take a look.. Alex Turner NetEconomist On Tue, 01 Feb 2005 22:11:30 +0100, Cosimo Streppone wrote: > Alex Turner wrote: > > > To be honest I've used compaq, dell and LSI SCSI RAID controllers and > > got pretty pathetic benchmarks from all of them. > > I also have seen average-low results for LSI (at least the 1020 card). > > > 2xOpteron 242, Tyan S2885 MoBo, 4GB Ram, 14xSATA WD Raptor drives: > > 2xRaid 1, 1x4 disk Raid 10, 1x6 drive Raid 10. 2x3ware (now AMCC) > > Escalade 9500S-8MI. > > Thanks, this is precious information. > > > I would be interested in starting a site listing RAID benchmarks under > > linux. If anyone is interested let me know. I would be interested in > > at least some bonnie++ benchmarks, and perhaps other if people would > > like. > > I have used also tiobench [http://tiobench.sourceforge.net/] > Any experience with it? > > -- > Cosimo > > From pgsql-novice-owner@postgresql.org Wed Feb 2 10:02:42 2005 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 077E08B9C21; Wed, 2 Feb 2005 10:02:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86958-01; Wed, 2 Feb 2005 10:02:34 +0000 (GMT) Received: from ew.mimos.my (ew.mimos.my [192.228.129.34]) by svr1.postgresql.org (Postfix) with ESMTP id 3B97E8B9C0C; Wed, 2 Feb 2005 10:02:35 +0000 (GMT) Received: from mimos.my (mcg189.nat.mimos.my [10.1.18.189]) by ew.mimos.my (8.12.9p2/8.12.9) with ESMTP id j12A2Xdp050568; Wed, 2 Feb 2005 18:02:33 +0800 (MYT) (envelope-from hasnulfadhly.h@mimos.my) Message-ID: <4200A534.3030405@mimos.my> Date: Wed, 02 Feb 2005 18:02:28 +0800 From: Hasnul Fadhly bin Hasan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org, pgsql-novice@postgresql.org Subject: Accessing insert values in triggers Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.061 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/21 X-Sequence-Number: 12260 Hi, I am trying to build a function that would extend the trigger in general tid bits that would only track count changes for table rows. The one i am trying to build would check which column and value should be tracked. e.g. below would be the tracker. CREATE TABLE "public"."aaaa" ( "tables" TEXT, "columns" TEXT[], "values" TEXT[], "counts" BIGINT ) WITH OIDS; The column array is the column name and the values array would be the values matching the columns array defined. if columns has {group,item} then values has {1,'basket'} so if the data inserted matches the values defined, it will be tracked. When new data is inserted, we have to use new.xxxx to access the data. Is there another way to access the data that would be more generic like value[1] and so on? This way, the tracker is independant of any tables. i believe tg_argv is only for data being updated. I'm have not done any functions in C, but for those who has, it is more possible to do it in C? If those who has used it say i can access the data easier in C, then i'll have to read up and learn it. I was looking through the examples in the doc on creating triggers in C. I believe the data i'm looking for is in tg_trigtuple but i am not sure how it is supposed to be accessed. Anyone knows of any links i can refer to or anyones has simple codes showing how to access the data? Thanks for any info. Hasnul From pgsql-performance-owner@postgresql.org Wed Feb 2 15:56:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 25CD98B9C6C for ; Wed, 2 Feb 2005 15:55:02 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13394-08 for ; Wed, 2 Feb 2005 15:54:52 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 9EE5F8B9C0E for ; Wed, 2 Feb 2005 15:54:52 +0000 (GMT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j12Fsos02151; Wed, 2 Feb 2005 10:54:50 -0500 (EST) From: Bruce Momjian Message-Id: <200502021554.j12Fsos02151@candle.pha.pa.us> Subject: Re: Swapping on Solaris In-Reply-To: <20050127213659.GC6355@phlogiston.dyndns.org> To: Andrew Sullivan Date: Wed, 2 Feb 2005 10:54:50 -0500 (EST) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/29 X-Sequence-Number: 10358 Andrew Sullivan wrote: > On Wed, Jan 19, 2005 at 10:42:26AM -0500, Alan Stange wrote: > > > > I'm fairly sure that the pi and po numbers include file IO in Solaris, > > because of the unified VM and file systems. > > That's correct. I have seen cases on BSDs where 'pi' includes page-faulting in the executables from the file system, but Solaris actually has 'po' as filesystem I/O. That is a new one to me. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Wed Feb 2 16:14:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8DB8A8B9CCB for ; Wed, 2 Feb 2005 16:08:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15144-04 for ; Wed, 2 Feb 2005 16:08:22 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id CF83F8B9CA9 for ; Wed, 2 Feb 2005 16:08:18 +0000 (GMT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j12G89M04048; Wed, 2 Feb 2005 11:08:09 -0500 (EST) From: Bruce Momjian Message-Id: <200502021608.j12G89M04048@candle.pha.pa.us> Subject: Re: Bitmap indexes In-Reply-To: To: PFC Date: Wed, 2 Feb 2005 11:08:09 -0500 (EST) Cc: PostgreSQL Perfomance X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/30 X-Sequence-Number: 10359 PFC wrote: > > There's a great deal about this in the list archives (probably more in > > pgsql-hackers than in -performance). Most of the current interest has > > to do with building in-memory bitmaps on the fly, as a way of decoupling > > index and heap scan processing. Which is not quite what you're talking > > about but should be pretty effective for low-cardinality cases. In > > particular it'd allow AND and OR combination of multiple indexes, which > > we do poorly or not at all at the moment. > > Is this called a star join ? > > It would also allow to access the data pages in a more sequential order > if the rows are not required to be retrieved in index order, which would > potentially be a large speedup for index scans concerning more than the > usual very small percentage of rows in a table : if several rows to be > retrieved are on the same page, it would visit this page only once. Please see the TODO list for a summary of previous discussions and directions. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Wed Feb 2 17:23:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 76E9A8B9B7D for ; Wed, 2 Feb 2005 17:22:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24794-05 for ; Wed, 2 Feb 2005 17:21:58 +0000 (GMT) Received: from mail.logi-track.com (burro.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id DEAB48B9DD6 for ; Wed, 2 Feb 2005 17:21:46 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J0661.j.pppool.de [85.74.6.97]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id 88835306BE; Wed, 2 Feb 2005 18:21:48 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id E2F3216DFC7; Wed, 2 Feb 2005 18:21:41 +0100 (CET) Message-ID: <42010C24.90301@logi-track.com> Date: Wed, 02 Feb 2005 18:21:40 +0100 From: Markus Schaber Reply-To: PostgreSQL Performance List User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: PostgreSQL Performance List , PostGIS Users Discussion Subject: Bad query optimizer misestimation because of TOAST tables X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/31 X-Sequence-Number: 10360 [This mail goes as X-Post to both pgsql-perform and postgis-users because postgis users may suffer from this problem, but I would prefer to keep the Discussion on pgsql-performance as it is a general TOAST problem and not specific to PostGIS alone.] Hello, Running PostGIS 0.8.1 under PostgreSQL 7.4.6-7 (Debian), I struggled over the following problem: logigis=# explain analyze SELECT geom FROM adminbndy1 WHERE geom && setsrid('BOX3D(9.4835390946502 47.39365740740741,9.5164609053498 47.40634259259259)'::box3d,4326); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Seq Scan on adminbndy1 (cost=0.00..4.04 rows=1 width=121) (actual time=133.591..7947.546 rows=5 loops=1) Filter: (geom && 'SRID=4326;BOX3D(9.4835390946502 47.3936574074074 0,9.5164609053498 47.4063425925926 0)'::geometry) Total runtime: 7947.669 ms (3 Zeilen) logigis=# set enable_seqscan to off; SET logigis=# explain analyze SELECT geom FROM adminbndy1 WHERE geom && setsrid('BOX3D(9.4835390946502 47.39365740740741,9.5164609053498 47.40634259259259)'::box3d,4326); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ Index Scan using adminbndy1_geom_idx on adminbndy1 (cost=0.00..4.44 rows=1 width=121) (actual time=26.902..27.066 rows=5 loops=1) Index Cond: (geom && 'SRID=4326;BOX3D(9.4835390946502 47.3936574074074 0,9.5164609053498 47.4063425925926 0)'::geometry) Total runtime: 27.265 ms (3 Zeilen) So the query planner choses to ignore the index, although it is appropriate. My first idea was that the statistics, but that turned out not to be the problem. As the above output shows, the query optimizer already guesses a rowcount of 1 which is even smaller than the actual number of 5 fetched rows, so this should really make the query planner use the index. Some amount of increasingly random tries later, I did the following: logigis=# vacuum full freeze analyze verbose adminbndy1; INFO: vacuuming "public.adminbndy1" INFO: "adminbndy1": found 0 removable, 83 nonremovable row versions in 3 pages DETAIL: 0 dead row versions cannot be removed yet. Nonremovable row versions range from 128 to 1968 bytes long. There were 1 unused item pointers. Total free space (including removable row versions) is 5024 bytes. 0 pages are or will become empty, including 0 at the end of the table. 3 pages containing 5024 free bytes are potential move destinations. CPU 0.00s/0.00u sec elapsed 0.01 sec. INFO: index "adminbndy1_geom_idx" now contains 83 row versions in 1 pages DETAIL: 0 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: "adminbndy1": moved 0 row versions, truncated 3 to 3 pages DETAIL: CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: vacuuming "pg_toast.pg_toast_19369" INFO: "pg_toast_19369": found 0 removable, 32910 nonremovable row versions in 8225 pages DETAIL: 0 dead row versions cannot be removed yet. Nonremovable row versions range from 37 to 2034 bytes long. There were 0 unused item pointers. Total free space (including removable row versions) is 167492 bytes. 0 pages are or will become empty, including 0 at the end of the table. 66 pages containing 67404 free bytes are potential move destinations. CPU 0.67s/0.04u sec elapsed 2.76 sec. INFO: index "pg_toast_19369_index" now contains 32910 row versions in 127 pages DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.01s/0.00u sec elapsed 0.14 sec. INFO: "pg_toast_19369": moved 0 row versions, truncated 8225 to 8225 pages DETAIL: CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: analyzing "public.adminbndy1" INFO: "adminbndy1": 3 pages, 83 rows sampled, 83 estimated total rows VACUUM logigis=# IMHO, this tells the reason. The query planner has a table size of 3 pages, which clearly is a case for a seqscan. But during the seqscan, the database has to fetch an additional amount of 8225 toast pages and 127 toast index pages, and rebuild the geometries contained therein. And the total number of 8355 pages = 68MB is a rather huge amount of data to fetch. I think this problem bites every user that has rather large columns that get stored in the TOAST table, when querying on those column. As a small workaround, I could imagine to add a small additional column in the table that contains the geometry's bbox, and which I use the && operator against. This should avoid touching the TOAST for the skipped rows. But the real fix should be to add the toast pages to the query planners estimation for the sequential scan. What do you think about it? Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z�rich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com From pgsql-performance-owner@postgresql.org Wed Feb 2 17:37:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 347B88B9BBB for ; Wed, 2 Feb 2005 17:37:39 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26347-09 for ; Wed, 2 Feb 2005 17:37:29 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id A96C98B9B60 for ; Wed, 2 Feb 2005 17:37:28 +0000 (GMT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j12HbAW26543; Wed, 2 Feb 2005 12:37:10 -0500 (EST) From: Bruce Momjian Message-Id: <200502021737.j12HbAW26543@candle.pha.pa.us> Subject: Re: High end server and storage for a PostgreSQL OLTP system In-Reply-To: To: William Yu Date: Wed, 2 Feb 2005 12:37:10 -0500 (EST) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/32 X-Sequence-Number: 10361 William Yu wrote: > > Well, that would give you the most benefit, but the memory bandwidth is > > still greater than on a Xeon. There's really no issue with 64 bit if > > you're using open source software; it all compiles for 64 bits and > > you're good to go. http://stats.distributed.net runs on a dual opteron > > box running FreeBSD and I've had no issues. > > You can get 64-bit Xeons also but it takes hit in the I/O department due > to the lack of a hardware I/O MMU which limits DMA transfers to > addresses below 4GB. This has a two-fold impact: > > 1) transfering data to >4GB require first a transfer to <4GB and then a > copy to the final destination. > > 2) You must allocate real memory 2X the address space of the devices to > act as bounce buffers. This is especially problematic for workstations > because if you put a 512MB Nvidia card in your computer for graphics > work -- you've just lost 1GB of memory. (I dunno how much the typical > SCSI/NIC/etc take up.) I thought Intel was copying AMD's 64-bit API. Is Intel's implementation as poor as you description? Does Intel have any better 64-bit offering other than the Itanium/Itanic? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Wed Feb 2 17:44:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B95688B9B49 for ; Wed, 2 Feb 2005 17:44:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27400-05 for ; Wed, 2 Feb 2005 17:44:34 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 973F38B9B19 for ; Wed, 2 Feb 2005 17:44:34 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j12HiWFa000189; Wed, 2 Feb 2005 12:44:32 -0500 (EST) To: PostgreSQL Performance List Cc: PostGIS Users Discussion Subject: Re: Bad query optimizer misestimation because of TOAST tables In-reply-to: <42010C24.90301@logi-track.com> References: <42010C24.90301@logi-track.com> Comments: In-reply-to Markus Schaber message dated "Wed, 02 Feb 2005 18:21:40 +0100" Date: Wed, 02 Feb 2005 12:44:32 -0500 Message-ID: <188.1107366272@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/33 X-Sequence-Number: 10362 Markus Schaber writes: > IMHO, this tells the reason. The query planner has a table size of 3 > pages, which clearly is a case for a seqscan. But during the seqscan, > the database has to fetch an additional amount of 8225 toast pages and > 127 toast index pages, and rebuild the geometries contained therein. I don't buy this analysis at all. The toasted columns are not those in the index (because we don't support out-of-line-toasted index entries), so a WHERE clause that only touches indexed columns isn't going to need to fetch anything from the toast table. The only stuff it would fetch is in rows that passed the WHERE and need to be returned to the client --- and those costs are going to be the same either way. I'm not entirely sure where the time is going, but I do not think you have proven your theory about it. I'd suggest building the backend with -pg and getting some gprof evidence. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Feb 2 18:19:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 760958B9CA9 for ; Wed, 2 Feb 2005 18:19:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31231-05 for ; Wed, 2 Feb 2005 18:19:35 +0000 (GMT) Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) by svr1.postgresql.org (Postfix) with ESMTP id BA6958B9C21 for ; Wed, 2 Feb 2005 18:19:34 +0000 (GMT) Received: from [192.168.0.100] (c-24-5-74-176.client.comcast.net[24.5.74.176]) by comcast.net (rwcrmhc13) with ESMTP id <20050202181930015009l1hqe>; Wed, 2 Feb 2005 18:19:31 +0000 Message-ID: <4201195B.6000203@talisys.com> Date: Wed, 02 Feb 2005 10:18:03 -0800 From: William Yu User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bruce Momjian Cc: pgsql-performance@postgresql.org Subject: Re: High end server and storage for a PostgreSQL OLTP system References: <200502021737.j12HbAW26543@candle.pha.pa.us> In-Reply-To: <200502021737.j12HbAW26543@candle.pha.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/34 X-Sequence-Number: 10363 >>You can get 64-bit Xeons also but it takes hit in the I/O department due >>to the lack of a hardware I/O MMU which limits DMA transfers to >>addresses below 4GB. This has a two-fold impact: >> >>1) transfering data to >4GB require first a transfer to <4GB and then a >>copy to the final destination. >> >>2) You must allocate real memory 2X the address space of the devices to >>act as bounce buffers. This is especially problematic for workstations >>because if you put a 512MB Nvidia card in your computer for graphics >>work -- you've just lost 1GB of memory. (I dunno how much the typical >>SCSI/NIC/etc take up.) > > > I thought Intel was copying AMD's 64-bit API. Is Intel's > implementation as poor as you description? Does Intel have any better > 64-bit offering other than the Itanium/Itanic? Unfortunately, there's no easy way for Intel to have implemented a 64-bit IOMMU under their current restrictions. The memory controller resides on the chipset and to upgrade the functionality significantly, it would probably require changing the bus protocol. It's not that they couldn't do it -- it would just require all Intel chipset/MB vendors/partners to go through the process of creating & validating totally new products. A way lengthier process than just producing 64-bit CPUs that drop into current motherboards. From pgsql-performance-owner@postgresql.org Wed Feb 2 18:25:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A08D18B9E03 for ; Wed, 2 Feb 2005 18:25:23 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31917-01 for ; Wed, 2 Feb 2005 18:25:20 +0000 (GMT) Received: from mail.logi-track.com (www.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id 5C3B28B9D07 for ; Wed, 2 Feb 2005 18:25:19 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J0661.j.pppool.de [85.74.6.97]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id 65737306BE; Wed, 2 Feb 2005 19:25:22 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id 8F18A16DFC7; Wed, 2 Feb 2005 19:25:16 +0100 (CET) Message-ID: <42011B0B.2050305@logi-track.com> Date: Wed, 02 Feb 2005 19:25:15 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Tom Lane Cc: PostgreSQL Performance List , PostGIS Users Discussion Subject: Re: Bad query optimizer misestimation because of TOAST References: <42010C24.90301@logi-track.com> <188.1107366272@sss.pgh.pa.us> In-Reply-To: <188.1107366272@sss.pgh.pa.us> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig666ED6B9EA036D49DE2E7C31" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/35 X-Sequence-Number: 10364 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig666ED6B9EA036D49DE2E7C31 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Hi, Tom, Tom Lane schrieb: >>IMHO, this tells the reason. The query planner has a table size of 3 >>pages, which clearly is a case for a seqscan. But during the seqscan, >>the database has to fetch an additional amount of 8225 toast pages and >>127 toast index pages, and rebuild the geometries contained therein. > > I don't buy this analysis at all. The toasted columns are not those in > the index (because we don't support out-of-line-toasted index entries), > so a WHERE clause that only touches indexed columns isn't going to need > to fetch anything from the toast table. The only stuff it would fetch > is in rows that passed the WHERE and need to be returned to the client > --- and those costs are going to be the same either way. > > I'm not entirely sure where the time is going, but I do not think you > have proven your theory about it. I'd suggest building the backend > with -pg and getting some gprof evidence. The column is a PostGIS column, and the index was created using GIST. Those are lossy indices that do not store the whole geometry, but only the bounding box corners of the Geometry (2 Points). Without using the index, the && Operator (which tests for bbox overlapping) has to load the whole geometry from disk, and extract the bbox therein (as it cannot make use of partial fetch). Some little statistics: logigis=# select max(mem_size(geom)), avg(mem_size(geom))::int, max(npoints(geom)) from adminbndy1; max | avg | max ----------+---------+-------- 20998856 | 1384127 | 873657 (1 Zeile) So the geometries use are about 1.3 MB average size, and have a maximum size of 20Mb. I'm pretty shure this cannot be stored without TOASTing. Additionally, my suggested workaround using a separate bbox column really works: logigis=# alter table adminbndy1 ADD column bbox geometry; ALTER TABLE logigis=# update adminbndy1 set bbox = setsrid(box3d(geom)::geometry, 4326); UPDATE 83 logigis=# explain analyze SELECT geom FROM adminbndy1 WHERE bbox && setsrid('BOX3D(9.4835390946502 47.39365740740741,9.5164609053498 47.40634259259259)'::box3d,4326); QUERY PLAN --------------------------------------------------------------------------------------------------------------------------- Seq Scan on adminbndy1 (cost=100000000.00..100000022.50 rows=1 width=32) (actual time=0.554..0.885 rows=5 loops=1) Filter: (bbox && 'SRID=4326;BOX3D(9.4835390946502 47.3936574074074 0,9.5164609053498 47.4063425925926 0)'::geometry) Total runtime: 0.960 ms (3 Zeilen) Here, the seqential scan matching exactly the same 5 rows only needs about 1/8000th of time, because it does not have to touch the TOAST pages at all. logigis=# \o /dev/null logigis=# \timing Zeitmessung ist an. logigis=# SELECT geom FROM adminbndy1 WHERE geom && setsrid('BOX3D(9.4835390946502 47.39365740740741,9.5164609053498 47.40634259259259)'::box3d,4326); Zeit: 11224,185 ms logigis=# SELECT geom FROM adminbndy1 WHERE bbox && setsrid('BOX3D(9.4835390946502 47.39365740740741,9.5164609053498 47.40634259259259)'::box3d,4326); Zeit: 7689,720 ms So you can see that, when actually detoasting the 5 rows and deserializing the geometries to WKT format (their canonical text representation), the time relation gets better, but there's still a noticeable difference. Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z�rich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com --------------enig666ED6B9EA036D49DE2E7C31 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCARsLOVWsnapT9i0RAm92AJsFEDP2P32Ve9iyhJ97r73BCyo6EQCg9NoM 1Kpco9K8qEj/J6nlobHIZUk= =sx0u -----END PGP SIGNATURE----- --------------enig666ED6B9EA036D49DE2E7C31-- From pgsql-performance-owner@postgresql.org Wed Feb 2 18:35:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E36358B9E35 for ; Wed, 2 Feb 2005 18:35:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32572-06 for ; Wed, 2 Feb 2005 18:35:23 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 750468B9D02 for ; Wed, 2 Feb 2005 18:35:22 +0000 (GMT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j12IZKA04787; Wed, 2 Feb 2005 13:35:20 -0500 (EST) From: Bruce Momjian Message-Id: <200502021835.j12IZKA04787@candle.pha.pa.us> Subject: Re: High end server and storage for a PostgreSQL OLTP system In-Reply-To: <4201195B.6000203@talisys.com> To: William Yu Date: Wed, 2 Feb 2005 13:35:20 -0500 (EST) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/36 X-Sequence-Number: 10365 William Yu wrote: > >>You can get 64-bit Xeons also but it takes hit in the I/O department due > >>to the lack of a hardware I/O MMU which limits DMA transfers to > >>addresses below 4GB. This has a two-fold impact: > >> > >>1) transfering data to >4GB require first a transfer to <4GB and then a > >>copy to the final destination. > >> > >>2) You must allocate real memory 2X the address space of the devices to > >>act as bounce buffers. This is especially problematic for workstations > >>because if you put a 512MB Nvidia card in your computer for graphics > >>work -- you've just lost 1GB of memory. (I dunno how much the typical > >>SCSI/NIC/etc take up.) When you say "allocate real memory 2X" are you saying that if you have 16GB of RAM only 8GB is actually usable and the other 8GB is for bounce buffers, or is it just address space being used up? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Wed Feb 2 18:55:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9F0088B9E18 for ; Wed, 2 Feb 2005 18:49:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33896-07 for ; Wed, 2 Feb 2005 18:49:41 +0000 (GMT) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) by svr1.postgresql.org (Postfix) with ESMTP id B53648B9D02 for ; Wed, 2 Feb 2005 18:49:40 +0000 (GMT) Received: from [192.168.0.100] (c-24-5-74-176.client.comcast.net[24.5.74.176]) by comcast.net (rwcrmhc12) with ESMTP id <20050202184939014003d6t4e>; Wed, 2 Feb 2005 18:49:39 +0000 Message-ID: <420120BF.5050208@talisys.com> Date: Wed, 02 Feb 2005 10:49:35 -0800 From: William Yu User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bruce Momjian Cc: pgsql-performance@postgresql.org Subject: Re: High end server and storage for a PostgreSQL OLTP system References: <200502021835.j12IZKA04787@candle.pha.pa.us> In-Reply-To: <200502021835.j12IZKA04787@candle.pha.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/38 X-Sequence-Number: 10367 Bruce Momjian wrote: > William Yu wrote: > >>>>You can get 64-bit Xeons also but it takes hit in the I/O department due >>>>to the lack of a hardware I/O MMU which limits DMA transfers to >>>>addresses below 4GB. This has a two-fold impact: >>>> >>>>1) transfering data to >4GB require first a transfer to <4GB and then a >>>>copy to the final destination. >>>> >>>>2) You must allocate real memory 2X the address space of the devices to >>>>act as bounce buffers. This is especially problematic for workstations >>>>because if you put a 512MB Nvidia card in your computer for graphics >>>>work -- you've just lost 1GB of memory. (I dunno how much the typical >>>>SCSI/NIC/etc take up.) > > > When you say "allocate real memory 2X" are you saying that if you have > 16GB of RAM only 8GB is actually usable and the other 8GB is for > bounce buffers, or is it just address space being used up? > It's 2x the memory space of the devices. E.g. a Nvidia Graphics card w/ 512MB of RAM would require 1GB of memory to act as bounce buffers. And it has to be real chunks of memory in 64-bit mode since DMA transfer must drop it into real memory in order to then be copied to > 4GB. From pgsql-performance-owner@postgresql.org Wed Feb 2 18:53:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1C01F8B9E2F for ; Wed, 2 Feb 2005 18:51:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34344-01 for ; Wed, 2 Feb 2005 18:51:00 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 059D08B9E19 for ; Wed, 2 Feb 2005 18:50:59 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: High end server and storage for a PostgreSQL OLTP system Date: Wed, 2 Feb 2005 13:50:59 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A7603@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] High end server and storage for a PostgreSQL OLTP system Thread-Index: AcUIoSGXAzq5WaxCQq+T7nxdNn+9tQAtWiJA From: "Merlin Moncure" To: "Cosimo Streppone" Cc: "Postgresql Performance list" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/37 X-Sequence-Number: 10366 > By now, our system has never used "stored procedures" approach, > due to the fact that we're staying on the minimum common SQL features > that are supported by most db engines. > I realize though that it would provide an heavy performance boost. I feel your pain. Well, sometimes you have to bite the bullet and do a couple of implementation specific hacks in especially time sensitive components. > > You also have the parse/bind interface >=20 > This is something I have already engineered in our core classes > (that use DBI + DBD::Pg), so that switching to 8.0 should > automatically enable the "single-prepare, multiple-execute" behavior, > saving a lot of query planner processing, if I understand correctly. Yes. You save the planning step (which adds up, even for trivial plans). The 'ExexPrepared' variant of prepared statement execution also provides substantial savings (on server cpu load and execution time) because the statement does not have to be parsed. Oh, and network traffic is reduced correspondingly. =20 I know that the perl people were pushing for certain features into the libpq library (describing prepared statements, IIRC). I think this stuff made it into 8.0...have no clue about DBD::pg. If everything is working the way it's supposed to, 8.0 should be faster than 7.1 (like, twice faster) for what you are probably trying to do. If it isn't, something else is wrong and it's very likely a solvable problem. In short, in pg 8.0, statement by statement query execution is highly optimizeable at the driver level, much more so than 7.1. Law of Unintended Consequences aside, this will translate into direct benefits into your app if it uses this application programming model. Merlin From pgsql-performance-owner@postgresql.org Wed Feb 2 20:09:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BD67C8B9C8C for ; Wed, 2 Feb 2005 20:09:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39927-04 for ; Wed, 2 Feb 2005 20:09:36 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 46BE58B9CE2 for ; Wed, 2 Feb 2005 20:09:36 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6982097; Wed, 02 Feb 2005 12:11:19 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: Gaetano Mendola Subject: Re: horizontal partition Date: Wed, 2 Feb 2005 12:09:06 -0800 User-Agent: KMail/1.6.2 Cc: pgsql-performance@postgresql.org References: In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200502021209.06878.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/39 X-Sequence-Number: 10368 Gaetano, > I have a big table with ~ 10 Milion rows, and is a very > pain administer it, so after years I convinced my self > to partition it and replace the table usage ( only for reading ) > with a view. > > Now my user_logs table is splitted in 4: > > user_logs > user_logs_2002 > user_logs_2003 > user_logs_2004 Any reason you didn't use inheritance? -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Feb 2 21:23:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 827E38B9D70 for ; Wed, 2 Feb 2005 21:23:05 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44606-08 for ; Wed, 2 Feb 2005 21:22:54 +0000 (GMT) Received: from smtp0.libero.it (smtp0.libero.it [193.70.192.33]) by svr1.postgresql.org (Postfix) with ESMTP id B0A9C8B9BCC for ; Wed, 2 Feb 2005 21:22:54 +0000 (GMT) Received: from localhost (172.16.1.83) by smtp0.libero.it (7.0.027-DD01) id 41BDA86900ADFFF8; Wed, 2 Feb 2005 22:22:52 +0100 Received: from [62.98.83.93] (62.98.83.93) by smtp2.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41BF65E4038E00F9; Wed, 2 Feb 2005 22:10:29 +0100 Message-ID: <420141A8.2090800@streppone.it> Date: Wed, 02 Feb 2005 22:10:00 +0100 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Merlin Moncure Cc: Postgresql Performance list Subject: Re: High end server and storage for a PostgreSQL OLTP system References: <6EE64EF3AB31D5448D0007DD34EEB3412A7603@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A7603@Herge.rcsinc.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at libero.it serv4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.916 tagged_above=0 required=5 tests=AWL, RCVD_IN_BL_SPAMCOP_NET X-Spam-Level: X-Archive-Number: 200502/40 X-Sequence-Number: 10369 Merlin Moncure wrote: > > [...] > > (...DBI + DBD::Pg), so that switching to 8.0 should > > automatically enable the "single-prepare, multiple-execute" behavior, > > saving a lot of query planner processing, if I understand correctly. > > [...] > > I know that the perl people were pushing for certain features into the > libpq library (describing prepared statements, IIRC). I think this > stuff made it into 8.0...have no clue about DBD::pg. For the record: yes, DBD::Pg in CVS (> 1.32) has support for server prepared statements. > If everything is working the way it's supposed to, 8.0 should be faster > than 7.1 (like, twice faster) for what you are probably trying to do. In the next days I will be testing the entire application with the same database only changing the backend from 7.1 to 8.0, so this is a somewhat perfect condition to have a "real-world" benchmark of Pg 8.0 vs 7.1.x performances. -- Cosimo From pgsql-performance-owner@postgresql.org Wed Feb 2 23:14:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CD71E8B9E74 for ; Wed, 2 Feb 2005 23:14:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51643-03 for ; Wed, 2 Feb 2005 23:13:55 +0000 (GMT) Received: from omnis-mail.omnis.com (omnis-mail.omnis.com [216.239.128.28]) by svr1.postgresql.org (Postfix) with ESMTP id 8DA6C8B9E63 for ; Wed, 2 Feb 2005 23:13:56 +0000 (GMT) Received: from [216.239.128.141] (daniel.omnis.com [216.239.128.141]) by omnis-mail.omnis.com (Postfix) with ESMTP id 2B11F1BDC4 for ; Wed, 2 Feb 2005 15:13:56 -0800 (PST) Message-ID: <42015FCD.9090200@omnis.com> Date: Wed, 02 Feb 2005 15:18:37 -0800 From: Daniel Ceregatti Organization: Omnis Network User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041230 MultiZilla/1.6.3.1a X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Bitmap indexes References: <33c6269f0501280739344f6a18@mail.gmail.com> In-Reply-To: X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.051 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/41 X-Sequence-Number: 10370 PFC wrote: > > contrib/intarray has an index type which could be what you need. > I've used intarray for a site that requires that I match multiple low cardinality attributes with multiple search criteria. Here's an (abridged) example: The table: \d person_attributes Table "dm.person_attributes" Column | Type | Modifiers ----------------+--------------------------+-------------------- attributes | integer[] | not null personid | integer | not null Indexes: "person_attributes_pk" PRIMARY KEY, btree (personid) "person_attributes_gist_attributes_index" gist (attributes) This table has about 1.1 million rows. The index: create index person_attributes_gist_attributes_index on person_attributes using gist ((attributes) gist__int_ops); The query: select personid from person_attributes where attributes @@ '(1|3)&(900)&(902)&(1002)&(9002)&(11003)&(12002|12003)&(13003|13004|13005|13006|13007|13008|13009|13010)'::query_int The explain analyze: Index Scan using person_attributes_gist_search_index on person_attributes pa (cost=0.00..1221.26 rows=602 width=4) (actual time=0.725..628.994 rows=1659 loops=1) Index Cond: (search @@ '( 1 | 3 ) & 900 & 902 & 1002 & 9002 & 11003 & ( 12002 | 12003 ) & ( ( ( ( ( ( ( 13003 | 13004 ) | 13005 ) | 13006 ) | 13007 ) | 13008 ) | 13009 ) | 13010 )'::query_int) Total runtime: 431.843 ms The query_int and what each number means: 1|3 means, only gather the people in site id 1 or 3. 900 is an arbitrary flag that means they are searchable. 902 is another arbitrary flag that means they have photos. 1002 is the flag for "don't drink". 9002 is the flag for "don't smoke". 11003 is the flag for "female". 12002|12003 are the flags for straight|bisexual. 13003 through 13010 represent the age range 18 through 25. In plain English: select all females who are straight or bisexual, between the ages of 18 and 25 inclusive, that don't drink, that don't smoke, who are searchable, who have photos, and belong to sites 1 or 3. As you can see by the explain, this query is relatively fast, given the number of criteria and data that has to be searched. This site's predecessor used oracle, and I used bitmap indexes for performing these searches in oracle. This intarray method is the closest I've come to being able to reproduce the same functionality at the required speed in postgres. The only problems I've run into with this method are: the non-concurrent nature of gist indexes, which makes doing any sort of bulk DML on them extremely time consuming (I usually have to drop the index, perform the bulk DML, then re-create the index), dealing with intarray methods to select particular attributes so I can then order by them, and dealing with intarray methods for updating the attributes column. All of these methods are detailed in the intarray README. I'm happy with the performance in production so far. I've yet to see any gist concurrency issues affect performance with normal rates of DML. Daniel -- Daniel Ceregatti - Programmer Omnis Network, LLC Real Programmers don't eat quiche. They eat Twinkies and Szechwan food. From pgsql-performance-owner@postgresql.org Wed Feb 2 23:51:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0632B8B9B30 for ; Wed, 2 Feb 2005 23:49:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53236-06 for ; Wed, 2 Feb 2005 23:49:30 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7CAB18B9E94 for ; Wed, 2 Feb 2005 23:49:31 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j12NnDJ6009502; Wed, 2 Feb 2005 18:49:13 -0500 (EST) To: Markus Schaber Cc: PostgreSQL Performance List , PostGIS Users Discussion Subject: Re: Bad query optimizer misestimation because of TOAST In-reply-to: <42011B0B.2050305@logi-track.com> References: <42010C24.90301@logi-track.com> <188.1107366272@sss.pgh.pa.us> <42011B0B.2050305@logi-track.com> Comments: In-reply-to Markus Schaber message dated "Wed, 02 Feb 2005 19:25:15 +0100" Date: Wed, 02 Feb 2005 18:49:13 -0500 Message-ID: <9501.1107388153@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/42 X-Sequence-Number: 10371 Markus Schaber writes: > Tom Lane schrieb: >> I don't buy this analysis at all. The toasted columns are not those in >> the index (because we don't support out-of-line-toasted index entries), >> so a WHERE clause that only touches indexed columns isn't going to need >> to fetch anything from the toast table. > The column is a PostGIS column, and the index was created using GIST. > Those are lossy indices that do not store the whole geometry, but only > the bounding box corners of the Geometry (2 Points). > Without using the index, the && Operator (which tests for bbox > overlapping) has to load the whole geometry from disk, and extract the > bbox therein (as it cannot make use of partial fetch). Ah, I see; I forgot to consider the GIST "storage" option, which allows the index contents to be something different from the represented column. Hmm ... What I would be inclined to do is to extend ANALYZE to make an estimate of the extent of toasting of every toastable column, and then modify cost_qual_eval to charge a nonzero cost for evaluation of Vars that are potentially toasted. This implies an initdb-forcing change in pg_statistic, which might or might not be allowed for 8.1 ... we are still a bit up in the air on what our release policy will be for 8.1. My first thought about what stat ANALYZE ought to collect is "average number of out-of-line TOAST chunks per value". Armed with that number and size information about the TOAST table, it'd be relatively simple for costsize.c to estimate the average cost of fetching such values. I'm not sure if it's worth trying to model the cost of decompression of compressed values. Surely that's a lot cheaper than fetching out-of-line values, so maybe we can just ignore it. If we did want to model it then we'd also need to make ANALYZE note the fraction of values that require decompression, and maybe something about their sizes. This approach would overcharge for operations that are able to work with partially fetched values, but it's probably not reasonable to expect the planner to account for that with any accuracy. Given this we'd have a pretty accurate computation of the true cost of the seqscan alternative, but what of indexscans? The current implementation charges one evaluation of the index qual(s) per indexscan, which is not really right because actually the index component is never evaluated at all. This didn't matter when the index component was a Var with zero eval cost, but if we're charging some eval cost it might. But ... since it's charging only one eval per scan ... the error is probably down in the noise in practice, and it may not be worth trying to get it exactly right. A bigger concern is "what about lossy indexes"? We currently ignore the costs of rechecking qual expressions for fetched rows, but this might be too inaccurate for situations like yours. I'm hesitant to mess with it though. For one thing, to get it right we'd need to understand how many rows will be returned by the raw index search (which is the number of times we'd need to recheck). At the moment the only info we have is the number that will pass the recheck, which could be a lot less ... and of course, even that is probably a really crude estimate when we are dealing with this sort of operator. Seems like a bit of a can of worms ... regards, tom lane From pgsql-performance-owner@postgresql.org Thu Feb 3 01:10:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D351D8B9B16 for ; Thu, 3 Feb 2005 01:10:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58773-06 for ; Thu, 3 Feb 2005 01:10:14 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1C2818B9E02 for ; Thu, 3 Feb 2005 01:10:16 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id A42CF31DD1; Thu, 3 Feb 2005 02:10:15 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: horizontal partition Date: Thu, 03 Feb 2005 02:10:15 +0100 Organization: PYRENET Midi-pyrenees Provider Lines: 35 Message-ID: References: <200502021209.06878.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr User-Agent: Mozilla Thunderbird 0.6+ (Windows/20050201) X-Accept-Language: en-us, en In-Reply-To: <200502021209.06878.josh@agliodbs.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/43 X-Sequence-Number: 10372 Josh Berkus wrote: > Gaetano, > > >>I have a big table with ~ 10 Milion rows, and is a very >>pain administer it, so after years I convinced my self >>to partition it and replace the table usage ( only for reading ) >>with a view. >> >>Now my user_logs table is splitted in 4: >> >>user_logs >>user_logs_2002 >>user_logs_2003 >>user_logs_2004 > > > Any reason you didn't use inheritance? I did in that way just to not use postgresql specific feature. I can give it a try and I let you know, however the question remain, why the index usage is lost if used in that way ? Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Thu Feb 3 03:16:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 315488B9E4A for ; Thu, 3 Feb 2005 03:16:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67416-06 for ; Thu, 3 Feb 2005 03:16:38 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 184C98B9E46 for ; Thu, 3 Feb 2005 03:16:41 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6982989; Wed, 02 Feb 2005 19:18:23 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: Gaetano Mendola Subject: Re: horizontal partition Date: Wed, 2 Feb 2005 19:16:08 -0800 User-Agent: KMail/1.6.2 Cc: pgsql-performance@postgresql.org References: <200502021209.06878.josh@agliodbs.com> In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200502021916.08960.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/44 X-Sequence-Number: 10373 Gaetano, > I did in that way just to not use postgresql specific feature. > I can give it a try and I let you know, however the question remain, > why the index usage is lost if used in that way ? Because PostgreSQL is materializing the entire UNION data set in the subselect. What Postgres version are you using? I thought this was fixed in 7.4, but maybe not ... -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Feb 3 03:30:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 477DE8B9E4A for ; Thu, 3 Feb 2005 03:30:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68633-01 for ; Thu, 3 Feb 2005 03:30:17 +0000 (GMT) Received: from mailhub2.une.edu.au (mailhub.une.edu.au [129.180.1.142]) by svr1.postgresql.org (Postfix) with ESMTP id 48F828B9E43 for ; Thu, 3 Feb 2005 03:30:19 +0000 (GMT) Received: from icarus.une.edu.au (icarus.une.edu.au [129.180.47.120]) by mailhub2.une.edu.au (Postfix) with ESMTP id 48DD37F69; Thu, 3 Feb 2005 14:30:18 +1100 (EST) Received: from kgb ([129.180.47.225]) by icarus.une.edu.au (8.12.8/8.12.8) with SMTP id j133UHT4002666; Thu, 3 Feb 2005 14:30:17 +1100 Date: Thu, 03 Feb 2005 14:31:35 +1100 From: Klint Gore To: Gaetano Mendola Cc: pgsql-performance@postgresql.org Subject: Re: horizontal partition In-Reply-To: References: <200502021209.06878.josh@agliodbs.com> Message-Id: <42019B1735F.1271KG@129.180.47.120> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver 1.25.06 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/45 X-Sequence-Number: 10374 On Thu, 03 Feb 2005 02:10:15 +0100, Gaetano Mendola wrote: > why the index usage is lost if used in that way ? This is how I interpret it (if anyone wants to set me straight or improve on it feel free) Views are implemented as rules. Rules are pretty much just a macro to the query builder. When it sees the view, it replaces it with the implementation of the view. When you join a view to a table, it generates a subselect of the implementation and joins that to the other table. So the subselect will generate the entire set of data from the view before it can use the join to eliminate rows. I would like a way to make this work better as well. One of my views is 32 joins of the same table (to get tree like data for reports). klint. +---------------------------------------+-----------------+ : Klint Gore : "Non rhyming : : EMail : kg@kgb.une.edu.au : slang - the : : Snail : A.B.R.I. : possibilities : : Mail University of New England : are useless" : : Armidale NSW 2351 Australia : L.J.J. : : Fax : +61 2 6772 5376 : : +---------------------------------------+-----------------+ From pgsql-performance-owner@postgresql.org Thu Feb 3 03:52:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D7A0B8B9E50 for ; Thu, 3 Feb 2005 03:51:59 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69737-03 for ; Thu, 3 Feb 2005 03:51:47 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 462F38B9E68 for ; Thu, 3 Feb 2005 03:51:50 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 89CE231DD1; Thu, 3 Feb 2005 04:51:51 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: High end server and storage for a PostgreSQL OLTP system Date: Wed, 02 Feb 2005 22:35:19 -0500 Organization: cbbrowne Computing Inc Lines: 40 Message-ID: References: <200502021737.j12HbAW26543@candle.pha.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:fCAHGh6JCL0WiKKomUrSInnpLzA= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.073 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/46 X-Sequence-Number: 10375 pgman@candle.pha.pa.us (Bruce Momjian) wrote: > William Yu wrote: >> > Well, that would give you the most benefit, but the memory >> > bandwidth is still greater than on a Xeon. There's really no >> > issue with 64 bit if you're using open source software; it all >> > compiles for 64 bits and you're good to >> > go. http://stats.distributed.net runs on a dual opteron box >> > running FreeBSD and I've had no issues. >> >> You can get 64-bit Xeons also but it takes hit in the I/O >> department due to the lack of a hardware I/O MMU which limits DMA >> transfers to addresses below 4GB. This has a two-fold impact: >> >> 1) transfering data to >4GB require first a transfer to <4GB and >> then a copy to the final destination. >> >> 2) You must allocate real memory 2X the address space of the >> devices to act as bounce buffers. This is especially problematic >> for workstations because if you put a 512MB Nvidia card in your >> computer for graphics work -- you've just lost 1GB of memory. (I >> dunno how much the typical SCSI/NIC/etc take up.) > > I thought Intel was copying AMD's 64-bit API. Is Intel's > implementation as poor as you description? Does Intel have any better > 64-bit offering other than the Itanium/Itanic? From what I can see, the resulting "copy of AMD64" amounts to little more than rushing together a project to glue a bag on the side of a Xeon chip with some 64 bit parts in it. I see no reason to expect what is only billed as an "extension technology" to alleviate the deeply rooted memory bandwidth problems seen on Xeon. -- let name="cbbrowne" and tld="acm.org" in name ^ "@" ^ tld;; http://cbbrowne.com/info/advocacy.html Q: What does the function NULL do? A: The function NULL tests whether or not its argument is NIL or not. If its argument is NIL the value of NULL is NIL. -- Ken Tracton, Programmer's Guide to Lisp, page 73. From pgsql-performance-owner@postgresql.org Thu Feb 3 04:55:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 14B878B9E1E for ; Thu, 3 Feb 2005 04:55:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76649-10 for ; Thu, 3 Feb 2005 04:55:19 +0000 (GMT) Received: from morework.geizhals.at (home.geizhals.at [213.229.14.34]) by svr1.postgresql.org (Postfix) with ESMTP id ABFC98B9E8F for ; Thu, 3 Feb 2005 04:55:17 +0000 (GMT) Received: from localhost (morework [127.0.0.1]) by morework.geizhals.at (Postfix) with ESMTP id 0A8B8DEE2B for ; Thu, 3 Feb 2005 05:55:14 +0100 (CET) Received: from [192.168.0.2] (chello080110242194.117.11.tuwien.teleweb.at [80.110.242.194]) by morework.geizhals.at (Postfix) with ESMTP for ; Thu, 3 Feb 2005 05:55:13 +0100 (CET) Message-ID: <4201AEB1.4000504@geizhals.at> Date: Thu, 03 Feb 2005 05:55:13 +0100 From: "Marinos J. Yannikos" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: GiST indexes and concurrency (tsearch2) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 at geizhals.at X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/47 X-Sequence-Number: 10376 Hi, according to http://www.postgresql.org/docs/8.0/interactive/limitations.html , concurrent access to GiST indexes isn't possible at the moment. I haven't read the thesis mentioned there, but I presume that concurrent read access is also impossible. Is there any workaround for this, esp. if the index is usually only read and not written to? It seems to be a big problem with tsearch2, when multiple clients are hammering the db (we have a quad opteron box here that stays 75% idle despite an apachebench with concurrency 10 stressing the php script that uses tsearch2, with practically no disk accesses) Regards, Marinos -- Dipl.-Ing. Marinos Yannikos, CEO Preisvergleich Internet Services AG Obere Donaustra�e 63/2, A-1020 Wien Tel./Fax: (+431) 5811609-52/-55 From pgsql-performance-owner@postgresql.org Thu Feb 3 05:31:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7FFFC8B9E71 for ; Thu, 3 Feb 2005 05:26:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79976-06 for ; Thu, 3 Feb 2005 05:26:19 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7FBC48B9EA5 for ; Thu, 3 Feb 2005 05:26:18 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j135QG0x011990; Thu, 3 Feb 2005 00:26:16 -0500 (EST) To: "Marinos J. Yannikos" Cc: pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) In-reply-to: <4201AEB1.4000504@geizhals.at> References: <4201AEB1.4000504@geizhals.at> Comments: In-reply-to "Marinos J. Yannikos" message dated "Thu, 03 Feb 2005 05:55:13 +0100" Date: Thu, 03 Feb 2005 00:26:16 -0500 Message-ID: <11989.1107408376@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/48 X-Sequence-Number: 10377 "Marinos J. Yannikos" writes: > according to > http://www.postgresql.org/docs/8.0/interactive/limitations.html , > concurrent access to GiST indexes isn't possible at the moment. I > haven't read the thesis mentioned there, but I presume that concurrent > read access is also impossible. You presume wrong ... regards, tom lane From pgsql-performance-owner@postgresql.org Thu Feb 3 06:42:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 353978B9BF5 for ; Thu, 3 Feb 2005 06:42:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92775-07 for ; Thu, 3 Feb 2005 06:42:31 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id B23798B9B9A for ; Thu, 3 Feb 2005 06:42:30 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6983725; Wed, 02 Feb 2005 22:44:13 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: Klint Gore Subject: Re: horizontal partition Date: Wed, 2 Feb 2005 22:41:57 -0800 User-Agent: KMail/1.6.2 Cc: Gaetano Mendola , pgsql-performance@postgresql.org References: <200502021209.06878.josh@agliodbs.com> <42019B1735F.1271KG@129.180.47.120> In-Reply-To: <42019B1735F.1271KG@129.180.47.120> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200502022241.57799.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/51 X-Sequence-Number: 10380 Klint, > This is how I interpret it (if anyone wants to set me straight or > improve on it feel free) > > Views are implemented as rules. > > Rules are pretty much just a macro to the query builder. When it sees > the view, it replaces it with the implementation of the view. Right so far. > > When you join a view to a table, it generates a subselect of the > implementation and joins that to the other table. More or less. A join set and a subselect are not really different in the planner. > So the subselect will generate the entire set of data from the view > before it can use the join to eliminate rows. Well, not exactly. That's what's happening in THIS query, but it doesn't happen in most queries, no matter how many view levels you nest (well, up to the number FROM_COLLAPSE_LIMIT, anyway). The issue here is that the planner is capable of "pushing down" the WHERE criteria into the first view, but not into the second, "nested" view, and so postgres materializes the UNIONed data set before perfoming the join. Thing is, I seem to recall that this particular issue was something Tom fixed a while ago. Which is why I wanted to know what version Gaetano is using. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Feb 3 06:55:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4BAF08B9E1E for ; Thu, 3 Feb 2005 06:55:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95190-02 for ; Thu, 3 Feb 2005 06:55:40 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 471688B9E02 for ; Thu, 3 Feb 2005 06:55:40 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j136tSOQ012897; Thu, 3 Feb 2005 01:55:28 -0500 (EST) To: Josh Berkus Cc: Klint Gore , Gaetano Mendola , pgsql-performance@postgresql.org Subject: Re: horizontal partition In-reply-to: <200502022241.57799.josh@agliodbs.com> References: <200502021209.06878.josh@agliodbs.com> <42019B1735F.1271KG@129.180.47.120> <200502022241.57799.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Wed, 02 Feb 2005 22:41:57 -0800" Date: Thu, 03 Feb 2005 01:55:28 -0500 Message-ID: <12896.1107413728@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/52 X-Sequence-Number: 10381 Josh Berkus writes: > The issue here is that the planner is capable of "pushing down" the WHERE > criteria into the first view, but not into the second, "nested" view, and so > postgres materializes the UNIONed data set before perfoming the join. > Thing is, I seem to recall that this particular issue was something Tom fixed > a while ago. Which is why I wanted to know what version Gaetano is using. It's still true that we can't generate a nestloop-with-inner-indexscan join plan if the inner side is anything more complex than a single table scan. Since that's the only plan that gives you any chance of not scanning the whole partitioned table, it's rather a hindrance :-( It might be possible to fix this by treating the nestloop's join conditions as "push down-able" criteria, instead of the present rather ad hoc method for generating nestloop/indexscan plans. It'd be quite a deal of work though, and I'm concerned about how slow the planner might run if we did do it like that. regards, tom lane From pgsql-novice-owner@postgresql.org Thu Feb 3 08:02:11 2005 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9864A8B9EE0; Thu, 3 Feb 2005 08:01:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07007-08; Thu, 3 Feb 2005 08:01:53 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id BDAF68B9E02; Thu, 3 Feb 2005 08:01:54 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id j1381hbU010669 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 3 Feb 2005 01:01:45 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id j1381hec047470; Thu, 3 Feb 2005 01:01:43 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j1381gWi047469; Thu, 3 Feb 2005 01:01:42 -0700 (MST) (envelope-from mfuhr) Date: Thu, 3 Feb 2005 01:01:42 -0700 From: Michael Fuhr To: Hasnul Fadhly bin Hasan Cc: pgsql-performance@postgresql.org, pgsql-novice@postgresql.org Subject: Re: [PERFORM] Accessing insert values in triggers Message-ID: <20050203080142.GA47411@winnie.fuhr.org> References: <4200A534.3030405@mimos.my> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4200A534.3030405@mimos.my> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/54 X-Sequence-Number: 12293 On Wed, Feb 02, 2005 at 06:02:28PM +0800, Hasnul Fadhly bin Hasan wrote: > When new data is inserted, we have to use new.xxxx to access the data. > Is there another way to access the data that would be more generic > like value[1] and so on? This way, the tracker is independant of any > tables. Procedural languages like PL/Perl, PL/Tcl, and PL/Python can access NEW and OLD columns without knowing the column names in advance. http://www.postgresql.org/docs/8.0/static/plperl-triggers.html http://www.postgresql.org/docs/8.0/static/pltcl-trigger.html http://www.postgresql.org/docs/8.0/static/plpython-trigger.html -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Thu Feb 3 09:30:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B8B268B9CE6 for ; Thu, 3 Feb 2005 09:30:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12367-10 for ; Thu, 3 Feb 2005 09:30:06 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id F23408B9F30 for ; Thu, 3 Feb 2005 09:30:07 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j1397vah032853; Thu, 3 Feb 2005 09:07:57 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.8.4]); Thu, 03 Feb 2005 09:28:52 +0000 Message-ID: <4201EED4.60606@familyhealth.com.au> Date: Thu, 03 Feb 2005 09:28:52 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Marinos J. Yannikos" Cc: pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) References: <4201AEB1.4000504@geizhals.at> In-Reply-To: <4201AEB1.4000504@geizhals.at> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.016 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/54 X-Sequence-Number: 10383 > It seems to be a big problem with tsearch2, when multiple clients are > hammering the db (we have a quad opteron box here that stays 75% idle > despite an apachebench with concurrency 10 stressing the php script that > uses tsearch2, with practically no disk accesses) Concurrency with READs is fine - but you can only have one WRITE going at once. Chris From pgsql-performance-owner@postgresql.org Thu Feb 3 09:52:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CB6D08B9EF7 for ; Thu, 3 Feb 2005 09:52:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14352-06 for ; Thu, 3 Feb 2005 09:52:34 +0000 (GMT) Received: from mail.idilis.net (mail.idilis.net [217.156.85.2]) by svr1.postgresql.org (Postfix) with ESMTP id 22B628B9EC6 for ; Thu, 3 Feb 2005 09:52:34 +0000 (GMT) Received: from [82.76.81.98] (helo=adi) by mail.idilis.net with asmtp id 1Cwdf7-0001xY-00 for pgsql-performance@postgresql.org; Thu, 03 Feb 2005 11:52:33 +0200 To: pgsql-performance@postgresql.org Subject: Tunning postgresql on linux (fedora core 3) Date: Thu, 03 Feb 2005 11:55:04 +0200 From: Din Adrian Organization: Om Computer & Software Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: User-Agent: Opera M2/7.50 (Win32, build 3778) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/55 X-Sequence-Number: 10384 Hello, I have a little time and I decided to improve the performance of my server(s). I have found on google many 'tips' in tuning linux kernel and postgresql database ... but I can't decide wich 'how-to' is better ... :( So the question is: where to find a 'easy' and complete documentation about this tweaks ... ? thank you, Adrian Din -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/ From pgsql-performance-owner@postgresql.org Thu Feb 3 09:58:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4E5508B9EF5 for ; Thu, 3 Feb 2005 09:58:02 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15105-04 for ; Thu, 3 Feb 2005 09:57:51 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8216B8B9BD6 for ; Thu, 3 Feb 2005 09:57:45 +0000 (GMT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.12.10/8.12.10) with ESMTP id j139vb5Q022046; Thu, 3 Feb 2005 12:57:37 +0300 (MSK) Date: Thu, 3 Feb 2005 12:57:37 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: "Marinos J. Yannikos" Cc: pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) In-Reply-To: <4201AEB1.4000504@geizhals.at> Message-ID: References: <4201AEB1.4000504@geizhals.at> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.357 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/56 X-Sequence-Number: 10385 On Thu, 3 Feb 2005, Marinos J. Yannikos wrote: > Hi, > > according to http://www.postgresql.org/docs/8.0/interactive/limitations.html > , concurrent access to GiST indexes isn't possible at the moment. I haven't > read the thesis mentioned there, but I presume that concurrent read access is > also impossible. Is there any workaround for this, esp. if the index is > usually only read and not written to? there are should no problem with READ access. > > It seems to be a big problem with tsearch2, when multiple clients are > hammering the db (we have a quad opteron box here that stays 75% idle despite > an apachebench with concurrency 10 stressing the php script that uses > tsearch2, with practically no disk accesses) I'm willing to see some details: version, query, explain analyze. > > Regards, > Marinos > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 From pgsql-performance-owner@postgresql.org Thu Feb 3 10:30:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A25DC8B9C8E for ; Thu, 3 Feb 2005 10:30:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17631-10 for ; Thu, 3 Feb 2005 10:30:47 +0000 (GMT) Received: from mail.logi-track.com (www.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id CDEF98B9C34 for ; Thu, 3 Feb 2005 10:30:47 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J2904.j.pppool.de [85.74.41.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id 904A9308DA; Thu, 3 Feb 2005 11:30:44 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id 6D2B3AB3FA; Thu, 3 Feb 2005 11:30:39 +0100 (CET) Message-ID: <4201FD48.3050703@logi-track.com> Date: Thu, 03 Feb 2005 11:30:32 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Tom Lane Cc: PostgreSQL Performance List , PostGIS Users Discussion Subject: Re: Bad query optimizer misestimation because of TOAST References: <42010C24.90301@logi-track.com> <188.1107366272@sss.pgh.pa.us> <42011B0B.2050305@logi-track.com> <9501.1107388153@sss.pgh.pa.us> In-Reply-To: <9501.1107388153@sss.pgh.pa.us> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9BEB63B927E417A567366F4D" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/57 X-Sequence-Number: 10386 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9BEB63B927E417A567366F4D Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Hi, Tom, Tom Lane schrieb: > What I would be inclined to do is to extend ANALYZE to make an estimate > of the extent of toasting of every toastable column, and then modify > cost_qual_eval to charge a nonzero cost for evaluation of Vars that are > potentially toasted. I currently do not have any internal knowledge of the query planner, but that sounds good in my ears :-) My (simpler) alternative would have been to simply add the number of toast pages to the table size when estimating sequential scan costs. This would clearly help in my case, but I now realize that it would give rather bad misestimations when the TOASTed columns are never touched. > This implies an initdb-forcing change in pg_statistic, which might or > might not be allowed for 8.1 ... we are still a bit up in the air on > what our release policy will be for 8.1. Is it possible to add metadata table columns to an existing database? At least when the database is offline (no postmaster running on it)? You could make the query optimizer code work with the old and new statistic schema (at least during the 8.x series). Thus users could upgrade as normal (without dump/restore, and withut benefiting from this change), and then manually change the schema to benefit (maybe using some offline tool or special command). Of course, this should be clearly documented. ANALYZE could spit out a warning message about the missing columns. The most convenient method might be to make ANALYZE automatically add those columns, but'm somehow reluctant to accept such unexpected side effects (metadata schema changes) . > My first thought about what stat ANALYZE ought to collect is "average > number of out-of-line TOAST chunks per value". Armed with that number > and size information about the TOAST table, it'd be relatively simple > for costsize.c to estimate the average cost of fetching such values. This sounds good. > I'm not sure if it's worth trying to model the cost of decompression of > compressed values. Surely that's a lot cheaper than fetching > out-of-line values, so maybe we can just ignore it. If we did want to > model it then we'd also need to make ANALYZE note the fraction of values > that require decompression, and maybe something about their sizes. Well, the first step is to generate those statistics (they may be of interest for administrators and developers, too), and as we are already changing the metadata schema, I would vote to add those columns, even in case the query optimizer does not exploit them yet. > This approach would overcharge for operations that are able to work with > partially fetched values, but it's probably not reasonable to expect the > planner to account for that with any accuracy. I think it is impossible to give accurate statistics for this. We could give some hints in "CREATE OPERATOR" to tell the query planner whether the operator could make use of partial fetches, but this could never be really accurate, as the amount of fetched data may vary wildly depending on the value itself. > A bigger concern is "what about lossy indexes"? We currently ignore the > costs of rechecking qual expressions for fetched rows, but this might be > too inaccurate for situations like yours. I'm hesitant to mess with it > though. For one thing, to get it right we'd need to understand how many > rows will be returned by the raw index search (which is the number of > times we'd need to recheck). At the moment the only info we have is the > number that will pass the recheck, which could be a lot less ... and of > course, even that is probably a really crude estimate when we are > dealing with this sort of operator. I do not know whether PostGIS actually rechecks against the real geometry. If the app needs the bbox check (&& operator), then the lossy index contains just all the information. If a real intersection is needed, PostGIS users usually use "(column && bbox_of_reference) AND intersects(column, reference)". This uses the bbox based index for efficient candidate selection, and then uses the rather expensive geometric intersection algorithm for real decision. But maybe there'll be a real intersection Operator in the future, that makes use of the bbox index in the first stage. > Seems like a bit of a can of worms ... Sorry :-) I did not really expect the problem to be so complicated when I posted my problem, I merely thought about a 10-liner patch to the query estimator that I could backport and aply to my 7.4.6. Seems that my personal problem-size estimator has some serious bugs, too... Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z�rich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com --------------enig9BEB63B927E417A567366F4D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCAf1OOVWsnapT9i0RAmIjAJ9J6RYGpzGN6/fNS4EMU27h1qLRyACgylqh pFyW/okmgrlApwZFsbk0OBk= =rb/l -----END PGP SIGNATURE----- --------------enig9BEB63B927E417A567366F4D-- From pgsql-performance-owner@postgresql.org Thu Feb 3 10:40:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D78D48B9D0D for ; Thu, 3 Feb 2005 10:40:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18668-02 for ; Thu, 3 Feb 2005 10:40:18 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id CD3438B9D09 for ; Thu, 3 Feb 2005 10:40:20 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 57BDC31DD1; Thu, 3 Feb 2005 11:40:20 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: horizontal partition Date: Thu, 03 Feb 2005 11:40:20 +0100 Organization: PYRENET Midi-pyrenees Provider Lines: 22 Message-ID: <4201FF94.5090900@bigfoot.com> References: <200502021209.06878.josh@agliodbs.com> <200502021916.08960.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr To: Josh Berkus User-Agent: Mozilla Thunderbird 1.0 (Windows/20050202) X-Accept-Language: en-us, en In-Reply-To: <200502021916.08960.josh@agliodbs.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/58 X-Sequence-Number: 10387 Josh Berkus wrote: > Gaetano, > > >>I did in that way just to not use postgresql specific feature. >>I can give it a try and I let you know, however the question remain, >>why the index usage is lost if used in that way ? > > > Because PostgreSQL is materializing the entire UNION data set in the > subselect. What Postgres version are you using? I thought this was fixed > in 7.4, but maybe not ... > Yes, I'm using with 7.4.x, so it was not fixed... Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Thu Feb 3 10:54:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 759738B9BD0 for ; Thu, 3 Feb 2005 10:54:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19117-07 for ; Thu, 3 Feb 2005 10:54:07 +0000 (GMT) Received: from anchor-post-36.mail.demon.net (anchor-post-36.mail.demon.net [194.217.242.86]) by svr1.postgresql.org (Postfix) with ESMTP id DBD818B9BBD for ; Thu, 3 Feb 2005 10:54:09 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-36.mail.demon.net with esmtp (Exim 4.42) id 1Cwecj-0002dI-KY; Thu, 03 Feb 2005 10:54:09 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id A39C5170F1; Thu, 3 Feb 2005 10:54:08 +0000 (GMT) Message-ID: <420202D0.7070602@archonet.com> Date: Thu, 03 Feb 2005 10:54:08 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Din Adrian Cc: pgsql-performance@postgresql.org Subject: Re: Tunning postgresql on linux (fedora core 3) References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.068 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/59 X-Sequence-Number: 10388 Din Adrian wrote: > Hello, > I have a little time and I decided to improve the performance of my > server(s). I have found on google many 'tips' in tuning linux kernel > and postgresql database ... but I can't decide wich 'how-to' is better > ... :( > So the question is: where to find a 'easy' and complete documentation > about this tweaks ... ? Try the "performance tuning" article linked from this page: http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Feb 3 11:04:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C18068B9E43 for ; Thu, 3 Feb 2005 11:04:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20048-07 for ; Thu, 3 Feb 2005 11:04:29 +0000 (GMT) Received: from morework.geizhals.at (home.geizhals.at [213.229.14.34]) by svr1.postgresql.org (Postfix) with ESMTP id A913A8B9E06 for ; Thu, 3 Feb 2005 11:04:30 +0000 (GMT) Received: from localhost (morework [127.0.0.1]) by morework.geizhals.at (Postfix) with ESMTP id 21157DEE11; Thu, 3 Feb 2005 12:04:28 +0100 (CET) Received: from [192.168.0.2] (chello080110242194.117.11.tuwien.teleweb.at [80.110.242.194]) by morework.geizhals.at (Postfix) with ESMTP; Thu, 3 Feb 2005 12:04:27 +0100 (CET) Message-ID: <4202053B.10207@geizhals.at> Date: Thu, 03 Feb 2005 12:04:27 +0100 From: "Marinos J. Yannikos" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Oleg Bartunov Cc: pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) References: <4201AEB1.4000504@geizhals.at> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 at geizhals.at X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/60 X-Sequence-Number: 10389 Oleg Bartunov wrote: > On Thu, 3 Feb 2005, Marinos J. Yannikos wrote: >> concurrent access to GiST indexes isn't possible at the moment. I [...] > > there are should no problem with READ access. OK, thanks everyone (perhaps it would make sense to clarify this in the manual). > I'm willing to see some details: version, query, explain analyze. 8.0.0 Query while the box is idle: explain analyze select count(*) from fr_offer o, fr_merchant m where idxfti @@ to_tsquery('ranz & mc') and eur >= 70 and m.m_id=o.m_id; Aggregate (cost=2197.48..2197.48 rows=1 width=0) (actual time=88.052..88.054 rows=1 loops=1) -> Merge Join (cost=2157.42..2196.32 rows=461 width=0) (actual time=88.012..88.033 rows=3 loops=1) Merge Cond: ("outer".m_id = "inner".m_id) -> Index Scan using fr_merchant_pkey on fr_merchant m (cost=0.00..29.97 rows=810 width=4) (actual time=0.041..1.233 rows=523 loops=1) -> Sort (cost=2157.42..2158.57 rows=461 width=4) (actual time=85.779..85.783 rows=3 loops=1) Sort Key: o.m_id -> Index Scan using idxfti_idx on fr_offer o (cost=0.00..2137.02 rows=461 width=4) (actual time=77.957..85.754 rows=3 loops=1) Index Cond: (idxfti @@ '\'ranz\' & \'mc\''::tsquery) Filter: (eur >= 70::double precision) Total runtime: 88.131 ms now, while using apachebench (-c10), "top" says this: Cpu0 : 15.3% us, 10.0% sy, 0.0% ni, 74.7% id, 0.0% wa, 0.0% hi, 0.0% si Cpu1 : 13.3% us, 11.6% sy, 0.0% ni, 75.1% id, 0.0% wa, 0.0% hi, 0.0% si Cpu2 : 16.9% us, 9.6% sy, 0.0% ni, 73.4% id, 0.0% wa, 0.0% hi, 0.0% si Cpu3 : 18.7% us, 14.0% sy, 0.0% ni, 67.0% id, 0.0% wa, 0.0% hi, 0.3% si (this is with shared_buffers = 2000; a larger setting makes almost no difference for overall performance: although according to "top" system time goes to ~0 and user time to ~25%, the system still stays 70-75% idle) vmstat: r b swpd free buff cache si so bi bo in cs us sy id wa 2 0 0 8654316 64908 4177136 0 0 56 35 279 286 5 1 94 0 2 0 0 8646188 64908 4177136 0 0 0 0 1156 2982 15 10 75 0 2 0 0 8658412 64908 4177136 0 0 0 0 1358 3098 19 11 70 0 1 0 0 8646508 64908 4177136 0 0 0 104 1145 2070 13 12 75 0 so the script's execution speed is apparently not limited by the CPUs. The query execution times go up like this while apachebench is running (and the system is 75% idle): Aggregate (cost=2197.48..2197.48 rows=1 width=0) (actual time=952.661..952.663 rows=1 loops=1) -> Merge Join (cost=2157.42..2196.32 rows=461 width=0) (actual time=952.621..952.641 rows=3 loops=1) Merge Cond: ("outer".m_id = "inner".m_id) -> Index Scan using fr_merchant_pkey on fr_merchant m (cost=0.00..29.97 rows=810 width=4) (actual time=2.078..3.338 rows=523 loops=1) -> Sort (cost=2157.42..2158.57 rows=461 width=4) (actual time=948.345..948.348 rows=3 loops=1) Sort Key: o.m_id -> Index Scan using idxfti_idx on fr_offer o (cost=0.00..2137.02 rows=461 width=4) (actual time=875.643..948.301 rows=3 loops=1) Index Cond: (idxfti @@ '\'ranz\' & \'mc\''::tsquery) Filter: (eur >= 70::double precision) Total runtime: 952.764 ms I can't seem to find out where the bottleneck is, but it doesn't seem to be CPU or disk. "top" shows that postgres processes are frequently in this state: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ WCHAN COMMAND 6701 postgres 16 0 204m 58m 56m S 9.3 0.2 0:06.96 semtimedo ^^^^^^^^^ postmaste Any hints are appreciated... Regards, Marinos -- Dipl.-Ing. Marinos Yannikos, CEO Preisvergleich Internet Services AG Obere Donaustra�e 63/2, A-1020 Wien Tel./Fax: (+431) 5811609-52/-55 From pgsql-performance-owner@postgresql.org Thu Feb 3 11:11:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 235448B9B58 for ; Thu, 3 Feb 2005 11:11:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20625-06 for ; Thu, 3 Feb 2005 11:11:01 +0000 (GMT) Received: from gizmo02ps.bigpond.com (gizmo02ps.bigpond.com [144.140.71.12]) by svr1.postgresql.org (Postfix) with SMTP id C90F18B9E3E for ; Thu, 3 Feb 2005 11:11:00 +0000 (GMT) Received: (qmail 1436 invoked from network); 3 Feb 2005 11:10:54 -0000 Received: from unknown (HELO psmam11.bigpond.com) (144.135.25.100) by gizmo02ps.bigpond.com with SMTP; 3 Feb 2005 11:10:54 -0000 Received: from cpe-203-45-190-81.qld.bigpond.net.au ([203.45.190.81]) by psmam11.bigpond.com(MAM REL_3_4_2a 225/65318643) with SMTP id 65318643; Thu, 03 Feb 2005 21:10:54 +1000 Message-ID: <420206AD.8040206@bigpond.net.au> Date: Thu, 03 Feb 2005 21:10:37 +1000 From: David Brown User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Planner really hates nested loops Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.992 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200502/61 X-Sequence-Number: 10390 I'm hoping someone can shed some light on these results. The 'factor' compares the ratios of cost to actual for different plans. Perhaps nested loops should be given a discount in the planner? The estimates seem to be out by one and a half orders of magnitude. :( ========== QUERY ========== SELECT sum(L.Extended) FROM sord H JOIN sordln L USING (OrderNo) [ WHERE H.OrderDate between '2003-01-01' and '2003-03-16' ] [ WHERE H.OrderDate between '2003-01-01' and '2003-09-02' ] ========== SUMMARY ========== Join Cost Cache Factor Disk Factor ------------------------------------------------------------ 10% ROWS Hash 40085 4.9s 1.0 12.8s 1.0 Merge 63338 4.1s 1.9 23.1s 0.9 Hash Idx 65386 5.5s 1.5 30.7s 0.7 Nest 257108 0.8s 39.3 2.7s 30.4 33% ROWS Hash 43646 5.8s 1.0 13.6s 1.0 Merge 67153 6.0s 1.5 30.7s 0.7 Hash Idx 68946 6.5s 1.4 Nest 868642 2.8s 41.2 10.2s 26.5 ALL ROWS Hash 53458 8.9s 1.0 14.3s 1.0 Merge 76156 9.4s 1.3 35.2s 0.6 Nest 2594934 9.2s 47.0 33.8s 20.5 ========== 10% CACHE ROWS ========== QUERY PLAN (Hash Join on <10% cache rows, indexed + sequential) Aggregate (cost=40085.14..40085.14 rows=1 width=8) (actual time=4907.000..4907.000 rows=1 loops=1) -> Hash Join (cost=145.11..39814.32 rows=108324 width=8) (actual time=3844.000..4735.000 rows=96183 loops=1) Hash Cond: ("outer".orderno = "inner".orderno) -> Seq Scan on sordln l (cost=0.00..33118.98 rows=1093398 width=12) (actual time=0.000..2313.000 rows=1093398 loops=1) -> Hash (cost=138.48..138.48 rows=2655 width=4) (actual time=16.000..16.000 rows=0 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..138.48 rows=2655 width=4) (actual time=0.000..0.000 rows=2646 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-03-16'::date)) Total runtime: 4907.000 ms QUERY PLAN (Merge Join on <10% cache rows, indexed only) Aggregate (cost=63338.43..63338.43 rows=1 width=8) (actual time=4141.000..4141.000 rows=1 loops=1) -> Merge Join (cost=289.47..63067.62 rows=108324 width=8) (actual time=3000.000..3896.000 rows=96183 loops=1) Merge Cond: ("outer".orderno = "inner".orderno) -> Index Scan using sordln_pkey on sordln l (cost=0.00..58419.79 rows=1093398 width=12) (actual time=0.000..2058.000 rows=737827 loops=1) -> Sort (cost=289.47..296.11 rows=2655 width=4) (actual time=16.000..127.000 rows=96174 loops=1) Sort Key: h.orderno -> Index Scan using sord_date on sord h (cost=0.00..138.48 rows=2655 width=4) (actual time=0.000..0.000 rows=2646 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-03-16'::date)) Total runtime: 4141.000 ms QUERY PLAN (Hash Join on <10% cache rows, indexed only) Aggregate (cost=65385.95..65385.95 rows=1 width=8) (actual time=5516.000..5516.000 rows=1 loops=1) -> Hash Join (cost=145.11..65115.13 rows=108324 width=8) (actual time=3031.000..5376.000 rows=96183 loops=1) Hash Cond: ("outer".orderno = "inner".orderno) -> Index Scan using sordln_pkey on sordln l (cost=0.00..58419.79 rows=1093398 width=12) (actual time=0.000..3091.000 rows=1093398 loops=1) -> Hash (cost=138.48..138.48 rows=2655 width=4) (actual time=0.000..0.000 rows=0 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..138.48 rows=2655 width=4) (actual time=0.000..0.000 rows=2646 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-03-16'::date)) Total runtime: 5516.000 ms QUERY PLAN (Nested Loop on <10% cache rows, indexed only) Aggregate (cost=257108.11..257108.11 rows=1 width=8) (actual time=781.000..781.000 rows=1 loops=1) -> Nested Loop (cost=0.00..256837.30 rows=108324 width=8) (actual time=0.000..610.000 rows=96183 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..138.48 rows=2655 width=4) (actual time=0.000..0.000 rows=2646 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-03-16'::date)) -> Index Scan using sordln_pkey on sordln l (cost=0.00..96.01 rows=54 width=12) (actual time=0.000..0.118 rows=36 loops=2646) Index Cond: ("outer".orderno = l.orderno) Total runtime: 781.000 ms ========== 33% CACHE ROWS ========== QUERY PLAN (Hash Join on >33% cache rows, indexed + sequential) Aggregate (cost=43645.62..43645.62 rows=1 width=8) (actual time=5828.000..5828.000 rows=1 loops=1) -> Hash Join (cost=484.94..42730.67 rows=365976 width=8) (actual time=2391.000..5078.000 rows=352856 loops=1) Hash Cond: ("outer".orderno = "inner".orderno) -> Seq Scan on sordln l (cost=0.00..33118.98 rows=1093398 width=12) (actual time=0.000..2234.000 rows=1093398 loops=1) -> Hash (cost=462.52..462.52 rows=8970 width=4) (actual time=47.000..47.000 rows=0 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..462.52 rows=8970 width=4) (actual time=0.000..0.000 rows=8934 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-09-02'::date)) Total runtime: 5828.000 ms QUERY PLAN (Merge Join on >33% cache rows, indexed only) Aggregate (cost=67153.04..67153.04 rows=1 width=8) (actual time=5985.000..5985.000 rows=1 loops=1) -> Merge Join (cost=0.00..66238.09 rows=365976 width=8) (actual time=2953.000..5281.000 rows=352856 loops=1) Merge Cond: ("outer".orderno = "inner".orderno) -> Index Scan using sord_pkey on sord h (cost=0.00..1402.78 rows=8970 width=4) (actual time=31.000..46.000 rows=8934 loops=1) Filter: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-09-02'::date)) -> Index Scan using sordln_pkey on sordln l (cost=0.00..58419.79 rows=1093398 width=12) (actual time=0.000..2485.000 rows=994500 loops=1) Total runtime: 5985.000 ms QUERY PLAN (Hash Join on >33% cache rows, indexed only) Aggregate (cost=68946.43..68946.43 rows=1 width=8) (actual time=6531.000..6531.000 rows=1 loops=1) -> Hash Join (cost=484.94..68031.48 rows=365976 width=8) (actual time=3031.000..5765.000 rows=352856 loops=1) Hash Cond: ("outer".orderno = "inner".orderno) -> Index Scan using sordln_pkey on sordln l (cost=0.00..58419.79 rows=1093398 width=12) (actual time=0.000..3075.000 rows=1093398 loops=1) -> Hash (cost=462.52..462.52 rows=8970 width=4) (actual time=46.000..46.000 rows=0 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..462.52 rows=8970 width=4) (actual time=0.000..16.000 rows=8934 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-09-02'::date)) Total runtime: 6531.000 ms QUERY PLAN (Nested Loop on >33% cache rows, indexed only) Aggregate (cost=868642.40..868642.40 rows=1 width=8) (actual time=2828.000..2828.000 rows=1 loops=1) -> Nested Loop (cost=0.00..867727.46 rows=365976 width=8) (actual time=0.000..2171.000 rows=352856 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..462.52 rows=8970 width=4) (actual time=0.000..0.000 rows=8934 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-09-02'::date)) -> Index Scan using sordln_pkey on sordln l (cost=0.00..96.01 rows=54 width=12) (actual time=0.012..0.125 rows=39 loops=8934) Index Cond: ("outer".orderno = l.orderno) Total runtime: 2828.000 ms ========== ALL CACHE ROWS ========== QUERY PLAN (Hash Join on all cache rows, sequential only) Aggregate (cost=53458.44..53458.44 rows=1 width=8) (actual time=8906.000..8906.000 rows=1 loops=1) -> Hash Join (cost=1204.99..50724.94 rows=1093398 width=8) (actual time=141.000..7089.000 rows=1093397 loops=1) Hash Cond: ("outer".orderno = "inner".orderno) -> Seq Scan on sordln l (cost=0.00..33118.98 rows=1093398 width=12) (actual time=0.000..2629.000 rows=1093398 loops=1) -> Hash (cost=1137.99..1137.99 rows=26799 width=4) (actual time=141.000..141.000 rows=0 loops=1) -> Seq Scan on sord h (cost=0.00..1137.99 rows=26799 width=4) (actual time=0.000..79.000 rows=26799 loops=1) Total runtime: 8906.000 ms QUERY PLAN (Merge Join on all cache rows, indexed only) Aggregate (cost=76156.45..76156.45 rows=1 width=8) (actual time=9422.000..9422.000 rows=1 loops=1) -> Merge Join (cost=0.00..73422.95 rows=1093398 width=8) (actual time=0.000..6835.000 rows=1093397 loops=1) Merge Cond: ("outer".orderno = "inner".orderno) -> Index Scan using sord_pkey on sord h (cost=0.00..1268.79 rows=26799 width=4) (actual time=0.000..94.000 rows=26799 loops=1) -> Index Scan using sordln_pkey on sordln l (cost=0.00..58419.79 rows=1093398 width=12) (actual time=0.000..2773.000 rows=1093398 loops=1) Total runtime: 9422.000 ms QUERY PLAN (Nested Loop on all cache rows, Sequential + indexed) Aggregate (cost=2594934.26..2594934.26 rows=1 width=8) (actual time=9234.000..9234.000 rows=1 loops=1) -> Nested Loop (cost=0.00..2592200.76 rows=1093398 width=8) (actual time=0.000..6966.000 rows=1093397 loops=1) -> Seq Scan on sord h (cost=0.00..1137.99 rows=26799 width=4) (actual time=0.000..110.000 rows=26799 loops=1) -> Index Scan using sordln_pkey on sordln l (cost=0.00..96.01 rows=54 width=12) (actual time=0.011..0.104 rows=41 loops=26799) Index Cond: ("outer".orderno = l.orderno) Total runtime: 9234.000 ms ========== 10% DISK ROWS ========== QUERY PLAN (Hash Join on <10% disk rows, indexed + sequential) Aggregate (cost=40085.14..40085.14 rows=1 width=8) (actual time=12813.000..12813.000 rows=1 loops=1) -> Hash Join (cost=145.11..39814.32 rows=108324 width=8) (actual time=11188.000..12592.000 rows=96183 loops=1) Hash Cond: ("outer".orderno = "inner".orderno) -> Seq Scan on sordln l (cost=0.00..33118.98 rows=1093398 width=12) (actual time=31.000..9985.000 rows=1093398 loops=1) -> Hash (cost=138.48..138.48 rows=2655 width=4) (actual time=172.000..172.000 rows=0 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..138.48 rows=2655 width=4) (actual time=47.000..156.000 rows=2646 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-03-16'::date)) Total runtime: 12813.000 ms QUERY PLAN (Merge Join on <10% disk rows, indexed only) Aggregate (cost=63338.43..63338.43 rows=1 width=8) (actual time=23078.000..23078.000 rows=1 loops=1) -> Merge Join (cost=289.47..63067.62 rows=108324 width=8) (actual time=20375.000..22874.000 rows=96183 loops=1) Merge Cond: ("outer".orderno = "inner".orderno) -> Index Scan using sordln_pkey on sordln l (cost=0.00..58419.79 rows=1093398 width=12) (actual time=63.000..20657.000 rows=737827 loops=1) -> Sort (cost=289.47..296.11 rows=2655 width=4) (actual time=171.000..297.000 rows=96174 loops=1) Sort Key: h.orderno -> Index Scan using sord_date on sord h (cost=0.00..138.48 rows=2655 width=4) (actual time=31.000..171.000 rows=2646 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-03-16'::date)) Total runtime: 23078.000 ms QUERY PLAN (Hash Join on <10% disk rows, indexed only) Aggregate (cost=65385.95..65385.95 rows=1 width=8) (actual time=30734.000..30734.000 rows=1 loops=1) -> Hash Join (cost=145.11..65115.13 rows=108324 width=8) (actual time=19546.000..30593.000 rows=96183 loops=1) Hash Cond: ("outer".orderno = "inner".orderno) -> Index Scan using sordln_pkey on sordln l (cost=0.00..58419.79 rows=1093398 width=12) (actual time=47.000..27711.000 rows=1093398 loops=1) -> Hash (cost=138.48..138.48 rows=2655 width=4) (actual time=187.000..187.000 rows=0 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..138.48 rows=2655 width=4) (actual time=46.000..171.000 rows=2646 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-03-16'::date)) Total runtime: 30734.000 ms QUERY PLAN (Nested Loop on <10% disk rows, indexed only) Aggregate (cost=257108.11..257108.11 rows=1 width=8) (actual time=2704.000..2704.000 rows=1 loops=1) -> Nested Loop (cost=0.00..256837.30 rows=108324 width=8) (actual time=94.000..2529.000 rows=96183 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..138.48 rows=2655 width=4) (actual time=32.000..93.000 rows=2646 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-03-16'::date)) -> Index Scan using sordln_pkey on sordln l (cost=0.00..96.01 rows=54 width=12) (actual time=0.041..0.814 rows=36 loops=2646) Index Cond: ("outer".orderno = l.orderno) Total runtime: 2704.000 ms ========== 33% DISK ROWS ========== QUERY PLAN (Hash Join on >33% disk rows, indexed + sequential) Aggregate (cost=43645.62..43645.62 rows=1 width=8) (actual time=13562.000..13562.000 rows=1 loops=1) -> Hash Join (cost=484.94..42730.67 rows=365976 width=8) (actual time=8687.000..12985.000 rows=352856 loops=1) Hash Cond: ("outer".orderno = "inner".orderno) -> Seq Scan on sordln l (cost=0.00..33118.98 rows=1093398 width=12) (actual time=31.000..10106.000 rows=1093398 loops=1) -> Hash (cost=462.52..462.52 rows=8970 width=4) (actual time=375.000..375.000 rows=0 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..462.52 rows=8970 width=4) (actual time=47.000..375.000 rows=8934 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-09-02'::date)) Total runtime: 13562.000 ms QUERY PLAN (Merge Join on >33% disk rows, indexed only) Aggregate (cost=67153.04..67153.04 rows=1 width=8) (actual time=30672.000..30672.000 rows=1 loops=1) -> Merge Join (cost=0.00..66238.09 rows=365976 width=8) (actual time=20297.000..29823.000 rows=352856 loops=1) Merge Cond: ("outer".orderno = "inner".orderno) -> Index Scan using sord_pkey on sord h (cost=0.00..1402.78 rows=8970 width=4) (actual time=578.000..670.000 rows=8934 loops=1) Filter: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-09-02'::date)) -> Index Scan using sordln_pkey on sordln l (cost=0.00..58419.79 rows=1093398 width=12) (actual time=47.000..26509.000 rows=994500 loops=1) Total runtime: 30672.000 ms QUERY PLAN (Nested Loop on >33% disk rows, indexed only) Aggregate (cost=868642.40..868642.40 rows=1 width=8) (actual time=10235.000..10235.000 rows=1 loops=1) -> Nested Loop (cost=0.00..867727.46 rows=365976 width=8) (actual time=78.000..9496.000 rows=352856 loops=1) -> Index Scan using sord_date on sord h (cost=0.00..462.52 rows=8970 width=4) (actual time=32.000..126.000 rows=8934 loops=1) Index Cond: ((orderdate >= '2003-01-01'::date) AND (orderdate <= '2003-09-02'::date)) -> Index Scan using sordln_pkey on sordln l (cost=0.00..96.01 rows=54 width=12) (actual time=0.035..0.912 rows=39 loops=8934) Index Cond: ("outer".orderno = l.orderno) Total runtime: 10235.000 ms ========== ALL DISK ROWS ========== QUERY PLAN (Hash Join on all disk rows, sequential only) Aggregate (cost=53458.44..53458.44 rows=1 width=8) (actual time=14281.000..14281.000 rows=1 loops=1) -> Hash Join (cost=1204.99..50724.94 rows=1093398 width=8) (actual time=719.000..12096.000 rows=1093397 loops=1) Hash Cond: ("outer".orderno = "inner".orderno) -> Seq Scan on sordln l (cost=0.00..33118.98 rows=1093398 width=12) (actual time=16.000..7389.000 rows=1093398 loops=1) -> Hash (cost=1137.99..1137.99 rows=26799 width=4) (actual time=703.000..703.000 rows=0 loops=1) -> Seq Scan on sord h (cost=0.00..1137.99 rows=26799 width=4) (actual time=0.000..657.000 rows=26799 loops=1) Total runtime: 14281.000 ms QUERY PLAN (Merge Join on all disk rows, indexed only) Aggregate (cost=76156.45..76156.45 rows=1 width=8) (actual time=35235.000..35235.000 rows=1 loops=1) -> Merge Join (cost=0.00..73422.95 rows=1093398 width=8) (actual time=94.000..33050.000 rows=1093397 loops=1) Merge Cond: ("outer".orderno = "inner".orderno) -> Index Scan using sord_pkey on sord h (cost=0.00..1268.79 rows=26799 width=4) (actual time=47.000..141.000 rows=26799 loops=1) -> Index Scan using sordln_pkey on sordln l (cost=0.00..58419.79 rows=1093398 width=12) (actual time=47.000..28250.000 rows=1093398 loops=1) Total runtime: 35235.000 ms QUERY PLAN (Nested Loop on all disk rows, indexed + sequential) Aggregate (cost=2594934.26..2594934.26 rows=1 width=8) (actual time=33797.000..33797.000 rows=1 loops=1) -> Nested Loop (cost=0.00..2592200.76 rows=1093398 width=8) (actual time=63.000..31744.000 rows=1093397 loops=1) -> Seq Scan on sord h (cost=0.00..1137.99 rows=26799 width=4) (actual time=16.000..79.000 rows=26799 loops=1) -> Index Scan using sordln_pkey on sordln l (cost=0.00..96.01 rows=54 width=12) (actual time=0.039..1.041 rows=41 loops=26799) Index Cond: ("outer".orderno = l.orderno) Total runtime: 33797.000 ms ========== ENVIRONMENT ========== Athlon XP2500, 768MB, 80GB ATA HDD PostgreSQL 8.0rc2 on Win2k shared_buffers = 1000 work_mem = 32768 random_page_cost = 2 sord = 27000 rows, 7MB, pkey = int4, Stats = 100 on OrderDate sordln = 1 million rows, 173MB, pkey = int4 + int2 From pgsql-performance-owner@postgresql.org Thu Feb 3 12:08:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DB9AA8B9EED for ; Thu, 3 Feb 2005 12:08:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23521-10 for ; Thu, 3 Feb 2005 12:08:27 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 92C4F8B9EB8 for ; Thu, 3 Feb 2005 12:08:28 +0000 (GMT) Received: (qmail 28150 invoked from network); 3 Feb 2005 13:08:51 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 3 Feb 2005 13:08:51 +0100 To: "Marinos J. Yannikos" , "Oleg Bartunov" Cc: pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> Message-ID: From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Thu, 03 Feb 2005 13:11:12 +0100 In-Reply-To: <4202053B.10207@geizhals.at> User-Agent: Opera M2/7.54 (Linux, build 751) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/62 X-Sequence-Number: 10391 Do you have anything performing any updates or inserts to this table, even if it does not update the gist column, even if it does not update anything ? From pgsql-performance-owner@postgresql.org Thu Feb 3 12:16:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D70FF8B9E3E for ; Thu, 3 Feb 2005 12:16:21 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25008-07 for ; Thu, 3 Feb 2005 12:16:13 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id 726BB8B9D95 for ; Thu, 3 Feb 2005 12:16:08 +0000 (GMT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.12.10/8.12.10) with ESMTP id j13CG05Q025521; Thu, 3 Feb 2005 15:16:00 +0300 (MSK) Date: Thu, 3 Feb 2005 15:16:00 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: "Marinos J. Yannikos" Cc: pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) In-Reply-To: <4202053B.10207@geizhals.at> Message-ID: References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.356 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/63 X-Sequence-Number: 10392 Marinos, what if you construct "apachebench & Co" free script and see if the issue still exists. There are could be many issues doesn't connected to postgresql and tsearch2. Oleg On Thu, 3 Feb 2005, Marinos J. Yannikos wrote: > Oleg Bartunov wrote: >> On Thu, 3 Feb 2005, Marinos J. Yannikos wrote: >>> concurrent access to GiST indexes isn't possible at the moment. I [...] >> >> there are should no problem with READ access. > > OK, thanks everyone (perhaps it would make sense to clarify this in the > manual). > >> I'm willing to see some details: version, query, explain analyze. > > 8.0.0 > > Query while the box is idle: > > explain analyze select count(*) from fr_offer o, fr_merchant m where idxfti > @@ to_tsquery('ranz & mc') and eur >= 70 and m.m_id=o.m_id; > > Aggregate (cost=2197.48..2197.48 rows=1 width=0) (actual time=88.052..88.054 > rows=1 loops=1) > -> Merge Join (cost=2157.42..2196.32 rows=461 width=0) (actual > time=88.012..88.033 rows=3 loops=1) > Merge Cond: ("outer".m_id = "inner".m_id) > -> Index Scan using fr_merchant_pkey on fr_merchant m > (cost=0.00..29.97 rows=810 width=4) (actual time=0.041..1.233 rows=523 > loops=1) > -> Sort (cost=2157.42..2158.57 rows=461 width=4) (actual > time=85.779..85.783 rows=3 loops=1) > Sort Key: o.m_id > -> Index Scan using idxfti_idx on fr_offer o > (cost=0.00..2137.02 rows=461 width=4) (actual time=77.957..85.754 rows=3 > loops=1) > Index Cond: (idxfti @@ '\'ranz\' & \'mc\''::tsquery) > Filter: (eur >= 70::double precision) > > Total runtime: 88.131 ms > > now, while using apachebench (-c10), "top" says this: > > Cpu0 : 15.3% us, 10.0% sy, 0.0% ni, 74.7% id, 0.0% wa, 0.0% hi, 0.0% si > Cpu1 : 13.3% us, 11.6% sy, 0.0% ni, 75.1% id, 0.0% wa, 0.0% hi, 0.0% si > Cpu2 : 16.9% us, 9.6% sy, 0.0% ni, 73.4% id, 0.0% wa, 0.0% hi, 0.0% si > Cpu3 : 18.7% us, 14.0% sy, 0.0% ni, 67.0% id, 0.0% wa, 0.0% hi, 0.3% si > > (this is with shared_buffers = 2000; a larger setting makes almost no > difference for overall performance: although according to "top" system time > goes to ~0 and user time to ~25%, the system still stays 70-75% idle) > > vmstat: > > r b swpd free buff cache si so bi bo in cs us sy id > wa > 2 0 0 8654316 64908 4177136 0 0 56 35 279 286 5 1 94 > 0 > 2 0 0 8646188 64908 4177136 0 0 0 0 1156 2982 15 10 75 > 0 > 2 0 0 8658412 64908 4177136 0 0 0 0 1358 3098 19 11 70 > 0 > 1 0 0 8646508 64908 4177136 0 0 0 104 1145 2070 13 12 75 > 0 > > so the script's execution speed is apparently not limited by the CPUs. > > The query execution times go up like this while apachebench is running (and > the system is 75% idle): > > Aggregate (cost=2197.48..2197.48 rows=1 width=0) (actual > time=952.661..952.663 rows=1 loops=1) > -> Merge Join (cost=2157.42..2196.32 rows=461 width=0) (actual > time=952.621..952.641 rows=3 loops=1) > Merge Cond: ("outer".m_id = "inner".m_id) > -> Index Scan using fr_merchant_pkey on fr_merchant m > (cost=0.00..29.97 rows=810 width=4) (actual time=2.078..3.338 rows=523 > loops=1) > -> Sort (cost=2157.42..2158.57 rows=461 width=4) (actual > time=948.345..948.348 rows=3 loops=1) > Sort Key: o.m_id > -> Index Scan using idxfti_idx on fr_offer o > (cost=0.00..2137.02 rows=461 width=4) (actual time=875.643..948.301 rows=3 > loops=1) > Index Cond: (idxfti @@ '\'ranz\' & \'mc\''::tsquery) > Filter: (eur >= 70::double precision) > Total runtime: 952.764 ms > > I can't seem to find out where the bottleneck is, but it doesn't seem to be > CPU or disk. "top" shows that postgres processes are frequently in this > state: > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ WCHAN COMMAND > 6701 postgres 16 0 204m 58m 56m S 9.3 0.2 0:06.96 semtimedo > ^^^^^^^^^ > postmaste > > Any hints are appreciated... > > Regards, > Marinos > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 From pgsql-performance-owner@postgresql.org Thu Feb 3 13:16:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3E9EE8B9D95 for ; Thu, 3 Feb 2005 13:16:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30715-06 for ; Thu, 3 Feb 2005 13:15:49 +0000 (GMT) Received: from morework.geizhals.at (home.geizhals.at [213.229.14.34]) by svr1.postgresql.org (Postfix) with ESMTP id E14D88B9E89 for ; Thu, 3 Feb 2005 13:15:50 +0000 (GMT) Received: from localhost (morework [127.0.0.1]) by morework.geizhals.at (Postfix) with ESMTP id 857C4DEBC1; Thu, 3 Feb 2005 14:15:50 +0100 (CET) Received: from [192.168.0.2] (chello080110242194.117.11.tuwien.teleweb.at [80.110.242.194]) by morework.geizhals.at (Postfix) with ESMTP; Thu, 3 Feb 2005 14:15:50 +0100 (CET) Message-ID: <42022406.1050400@geizhals.at> Date: Thu, 03 Feb 2005 14:15:50 +0100 From: "Marinos J. Yannikos" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Oleg Bartunov Cc: pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 at geizhals.at X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/64 X-Sequence-Number: 10393 Oleg Bartunov wrote: > Marinos, > > what if you construct "apachebench & Co" free script and see if > the issue still exists. There are could be many issues doesn't > connected to postgresql and tsearch2. > Yes, the problem persists - I wrote a small perl script that forks 10 chils processes and executes the same queries in parallel without any php/apachebench involved: --- 8< --- #!/usr/bin/perl use DBI; $n=10; $nq=100; $sql="select count(*) from fr_offer o, fr_merchant m where idxfti @@ to_tsquery('ranz & mc') and eur >= 70 and m.m_id=o.m_id;"; sub reaper { my $waitedpid = wait; $running--; $SIG{CHLD} = \&reaper; } $SIG{CHLD} = \&reaper; for $i (1..$n) { if (fork() > 0) { $running++; } else { my $dbh=DBI->connect('dbi:Pg:host=daedalus;dbname=','root','',{ AutoCommit => 1 }) || die "!db"; for my $j (1..$nq) { my $sth=$dbh->prepare($sql); $r=$sth->execute() or print STDERR $dbh->errstr(); } exit 0; } } while ($running > 0) { sleep 1; print "Running: $running\n"; } --- >8 --- Result (now with shared_buffers = 20000, hence less system and more user time): Cpu0 : 25.1% us, 0.0% sy, 0.0% ni, 74.9% id, 0.0% wa, 0.0% hi, 0.0% si Cpu1 : 18.3% us, 0.0% sy, 0.0% ni, 81.7% id, 0.0% wa, 0.0% hi, 0.0% si Cpu2 : 27.8% us, 0.3% sy, 0.0% ni, 71.9% id, 0.0% wa, 0.0% hi, 0.0% si Cpu3 : 23.5% us, 0.3% sy, 0.0% ni, 75.9% id, 0.0% wa, 0.0% hi, 0.3% si PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ WCHAN COMMAND 7571 postgres 16 0 204m 62m 61m R 10.6 0.2 0:01.97 - postmaste 7583 postgres 16 0 204m 62m 61m S 9.6 0.2 0:02.06 semtimedo postmaste 7586 postgres 16 0 204m 62m 61m S 9.6 0.2 0:02.00 semtimedo postmaste 7575 postgres 16 0 204m 62m 61m S 9.3 0.2 0:02.12 semtimedo postmaste 7578 postgres 16 0 204m 62m 61m R 9.3 0.2 0:02.05 - postmaste i.e., virtually no difference. With 1000 queries and 10 in parallel, the apachebench run takes 60.674 seconds and the perl script 59.392 seconds. Regards, Marinos -- Dipl.-Ing. Marinos Yannikos, CEO Preisvergleich Internet Services AG Obere Donaustra�e 63/2, A-1020 Wien Tel./Fax: (+431) 5811609-52/-55 From pgsql-performance-owner@postgresql.org Thu Feb 3 13:57:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4BD548B9D95 for ; Thu, 3 Feb 2005 13:57:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32968-03 for ; Thu, 3 Feb 2005 13:56:51 +0000 (GMT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id 447F68B9E4F for ; Thu, 3 Feb 2005 13:56:53 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-33.mail.demon.net with esmtp (Exim 4.42) id 1CwhTZ-0009yP-AV; Thu, 03 Feb 2005 13:56:53 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 291CE158FE; Thu, 3 Feb 2005 13:56:52 +0000 (GMT) Message-ID: <42022DA2.3040000@archonet.com> Date: Thu, 03 Feb 2005 13:56:50 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Din Adrian Cc: 'Postgresql Performance' Subject: Re: Tunning postgresql on linux (fedora core 3) References: <420202D0.7070602@archonet.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.068 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/65 X-Sequence-Number: 10394 Please CC the mailing list as well as replying to me, so that others can help too. Din Adrian wrote: > yes I have read this as well ... > > One question about this option: > fsync = true / false > a) I have Raid and UPS - it is safe to turn this off ... (' But be > very aware that any unexpected database shutdown will force you to > restore the database from your last backup.' - from my last backup if > the server goes down ??? why ? just at 'any unexpected database > shutdown' ? ....!!!!!!!!!!!) Because fsync=true flushes transaction details to disk (the Write Ahead Log). That way if (say) the power-supply in your server fails you can check the WAL and compare it to the main database files to make sure everything is in a known state. > b) in docs say that after 7.2 seting this to false does'n turn off the > wall ...!? wich option does? The docs don't say that, as far as I can see. It doesn't make sense to turn off the WAL. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Feb 3 13:59:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 143158B9E8F for ; Thu, 3 Feb 2005 13:59:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32903-04 for ; Thu, 3 Feb 2005 13:59:27 +0000 (GMT) Received: from mail.logi-track.com (www.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id 5F8838B9EE5 for ; Thu, 3 Feb 2005 13:59:29 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J2904.j.pppool.de [85.74.41.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id DF5F2308DA; Thu, 3 Feb 2005 14:59:31 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id 3F9E0AB3FA; Thu, 3 Feb 2005 14:59:26 +0100 (CET) Message-ID: <42022E3D.80108@logi-track.com> Date: Thu, 03 Feb 2005 14:59:25 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: PostgreSQL Performance List , PostGIS Users Discussion Subject: Re: [postgis-users] Bad query optimizer misestimation because of References: <42010C24.90301@logi-track.com> In-Reply-To: <42010C24.90301@logi-track.com> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig19C3F8ACA0CD6AA10E7375B7" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/66 X-Sequence-Number: 10395 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig19C3F8ACA0CD6AA10E7375B7 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Hi, all, Markus Schaber schrieb: > As a small workaround, I could imagine to add a small additional column > in the table that contains the geometry's bbox, and which I use the && > operator against. This should avoid touching the TOAST for the skipped rows. For your personal amusement: I just noticed that, after adding the additional column containing the bbox and running VACUUM FULL, the table now has a size of 4 pages, and that's enough for the query optimizer to choose an index scan. At least that saves us from modifying and redeploying a bunch of applications to use the && bbox query:-) Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z�rich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com --------------enig19C3F8ACA0CD6AA10E7375B7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCAi49OVWsnapT9i0RAvpIAKDEGb4dF+YbWpC4Zr/P2JkfotCWIgCgjV1c F8uwjDcR5hnQ0yKt+Dfgch0= =WWJZ -----END PGP SIGNATURE----- --------------enig19C3F8ACA0CD6AA10E7375B7-- From pgsql-performance-owner@postgresql.org Thu Feb 3 14:52:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 397FB8B9EDD for ; Thu, 3 Feb 2005 14:52:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37192-03 for ; Thu, 3 Feb 2005 14:52:03 +0000 (GMT) Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP id EEC2C8B9EA9 for ; Thu, 3 Feb 2005 14:52:06 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-32.mail.demon.net with esmtp (Exim 4.42) id 1CwiKz-000HGl-93; Thu, 03 Feb 2005 14:52:06 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 5F7D616238; Thu, 3 Feb 2005 14:52:04 +0000 (GMT) Message-ID: <42023A94.5040904@archonet.com> Date: Thu, 03 Feb 2005 14:52:04 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Din Adrian Cc: 'Postgresql Performance' Subject: Re: Tunning postgresql on linux (fedora core 3) References: <420202D0.7070602@archonet.com> <42022DA2.3040000@archonet.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.068 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/67 X-Sequence-Number: 10396 I'll repeat myself: Please CC the mailing list as well as replying to me, so that others can help too. Din Adrian wrote: > > On Thu, 03 Feb 2005 13:56:50 +0000, Richard Huxton > wrote: > >> Please CC the mailing list as well as replying to me, so that others >> can help too. >> >> >>> b) in docs say that after 7.2 seting this to false does'n turn off >>> the wall ...!? wich option does? >> >> >> The docs don't say that, as far as I can see. It doesn't make sense >> to turn off the WAL. > > > hmm this is the doc about ... > > ' NOTE: Since 7.2, turning fsync off does NOT stop WAL. It does stop > checkpointing, however. This is a change in the notes that follow Turn > WAL off (fsync=false) only for a read-only database or one where the > database can be regenerated from external software. While RAID plus > UPSes can do a lot to protect your data, turning off fsync means that > you will be restoring from backup in the event of hardware or power > failure.' I don't know what this is, and you don't give a URL, but it DOES NOT appear to be in the manuals. You should probably read the sections of the manuals regarding "run-time configuration" and "write ahead logs". The manuals are quite extensive, are available online at http://www.postgresql.org/ and also in most distributions. This is probably a good place to start. http://www.postgresql.org/docs/8.0/interactive/runtime-config.html#RUNTIME-CONFIG-WAL > If you turn it off you should have more speed ... !!!??? Basically, as I said in my last email - fsync=true makes sure transaction details are safely stored on disk. If you turn this off, the database doesn't have to wait for the data to physically be written to the disk. But, if power fails then data might be in OS or disk cache and so lost when you restart the machine. Please CC the mailing list if you reply to this message. -- Richard Huxton Archonet Ltd From pgsql-sql-owner@postgresql.org Thu Feb 3 15:15:47 2005 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B7B238B9CE6 for ; Thu, 3 Feb 2005 15:15:41 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39272-02 for ; Thu, 3 Feb 2005 15:15:35 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id BA5298B9BD0 for ; Thu, 3 Feb 2005 15:15:38 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) id 1Cwihh-0000Ox-EK; Thu, 03 Feb 2005 15:15:37 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 43D9F15D01; Thu, 3 Feb 2005 15:15:32 +0000 (GMT) Message-ID: <42024014.2030901@archonet.com> Date: Thu, 03 Feb 2005 15:15:32 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Din Adrian Cc: pgsql-sql@postgresql.org Subject: Re: [PERFORM] Tunning postgresql on linux (fedora core 3) References: <420202D0.7070602@archonet.com> <42022DA2.3040000@archonet.com> <42023A94.5040904@archonet.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.068 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/64 X-Sequence-Number: 20175 Din Adrian wrote: > sorry about cc ... > this is the site: > http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html > but I gues is not right ... hmm It's not that it's incorrect, just that you should always use the manuals as a starting point. > On Thu, 03 Feb 2005 14:52:04 +0000, Richard Huxton > wrote: > >> I'll repeat myself: >> >> >> >> >> Please CC the mailing list as well as replying to me, so that others >> can help too. >> >> >> >> >> Din Adrian wrote: >> >>> On Thu, 03 Feb 2005 13:56:50 +0000, Richard Huxton >>> wrote: >>> >>>> Please CC the mailing list as well as replying to me, so that >>>> others can help too. >>>> >>>> >>>>> b) in docs say that after 7.2 seting this to false does'n turn >>>>> off the wall ...!? wich option does? >>>> >>>> >>>> >>>> The docs don't say that, as far as I can see. It doesn't make sense >>>> to turn off the WAL. >>> >>> hmm this is the doc about ... >>> ' NOTE: Since 7.2, turning fsync off does NOT stop WAL. It does >>> stop checkpointing, however. This is a change in the notes that >>> follow Turn WAL off (fsync=false) only for a read-only database or >>> one where the database can be regenerated from external software. >>> While RAID plus UPSes can do a lot to protect your data, turning >>> off fsync means that you will be restoring from backup in the event >>> of hardware or power failure.' >> >> >> I don't know what this is, and you don't give a URL, but it DOES NOT >> appear to be in the manuals. >> >> You should probably read the sections of the manuals regarding >> "run-time configuration" and "write ahead logs". The manuals are >> quite extensive, are available online at http://www.postgresql.org/ >> and also in most distributions. >> >> This is probably a good place to start. >> http://www.postgresql.org/docs/8.0/interactive/runtime-config.html#RUNTIME-CONFIG-WAL >> >> >>> If you turn it off you should have more speed ... !!!??? >> >> >> Basically, as I said in my last email - fsync=true makes sure >> transaction details are safely stored on disk. If you turn this off, >> the database doesn't have to wait for the data to physically be >> written to the disk. But, if power fails then data might be in OS or >> disk cache and so lost when you restart the machine. >> >> Please CC the mailing list if you reply to this message. >> -- >> Richard Huxton >> Archonet Ltd >> > > > -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Feb 3 16:25:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E5F258B9F4B for ; Thu, 3 Feb 2005 16:25:48 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46535-07 for ; Thu, 3 Feb 2005 16:25:37 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id B40B68B9F61 for ; Thu, 3 Feb 2005 16:25:37 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j13GPVL6016695; Thu, 3 Feb 2005 11:25:31 -0500 (EST) To: David Brown Cc: pgsql-performance@postgresql.org Subject: Re: Planner really hates nested loops In-reply-to: <420206AD.8040206@bigpond.net.au> References: <420206AD.8040206@bigpond.net.au> Comments: In-reply-to David Brown message dated "Thu, 03 Feb 2005 21:10:37 +1000" Date: Thu, 03 Feb 2005 11:25:31 -0500 Message-ID: <16694.1107447931@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/68 X-Sequence-Number: 10397 David Brown writes: > I'm hoping someone can shed some light on these results. Not without a lot more detail on how you *got* the results. What exactly did you do to force the various plan choices? (I see some ridiculous choices of indexscans, for instance, suggesting improper use of enable_seqscan in some cases.) And what's the "cache rows" and "disk rows" stuff, and how do you know that what you were measuring is actually what you think it is? I have zero confidence in Windows-atop-ATA as a platform for measuring disk-related behaviors, because I don't think you can control or even know what caching is going on. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Feb 3 16:27:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 58A888B9F4B for ; Thu, 3 Feb 2005 16:27:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47235-04 for ; Thu, 3 Feb 2005 16:27:42 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3E0828B9F6A for ; Thu, 3 Feb 2005 16:27:41 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j13GRcxZ016720; Thu, 3 Feb 2005 11:27:38 -0500 (EST) To: "Marinos J. Yannikos" Cc: Oleg Bartunov , pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) In-reply-to: <4202053B.10207@geizhals.at> References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> Comments: In-reply-to "Marinos J. Yannikos" message dated "Thu, 03 Feb 2005 12:04:27 +0100" Date: Thu, 03 Feb 2005 11:27:38 -0500 Message-ID: <16719.1107448058@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/69 X-Sequence-Number: 10398 "Marinos J. Yannikos" writes: > I can't seem to find out where the bottleneck is, but it doesn't seem to > be CPU or disk. "top" shows that postgres processes are frequently in > this state: > 6701 postgres 16 0 204m 58m 56m S 9.3 0.2 0:06.96 semtimedo > ^^^^^^^^^ What's the platform exactly (hardware and OS)? regards, tom lane From pgsql-performance-owner@postgresql.org Thu Feb 3 16:42:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D8CA8B9E06 for ; Thu, 3 Feb 2005 16:41:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49207-05 for ; Thu, 3 Feb 2005 16:41:40 +0000 (GMT) Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 00A568B9F5B for ; Thu, 3 Feb 2005 16:41:39 +0000 (GMT) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 379D68F285; Thu, 3 Feb 2005 17:41:38 +0100 (CET) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Planner really hates nested loops Date: Thu, 3 Feb 2005 17:41:37 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE4767B0@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Planner really hates nested loops Thread-Index: AcUKDorcJ6T0xf4cR4CYESZEe8MsWAAAHjKA From: "Magnus Hagander" To: "Tom Lane" , "David Brown" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.058 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/70 X-Sequence-Number: 10399 > > I'm hoping someone can shed some light on these results. >=20 > Not without a lot more detail on how you *got* the results. =20 > What exactly did you do to force the various plan choices? =20 > (I see some ridiculous choices of indexscans, for instance,=20 > suggesting improper use of enable_seqscan in some cases.) =20 > And what's the "cache rows" and "disk rows" stuff, and how do=20 > you know that what you were measuring is actually what you=20 > think it is? I have zero confidence in Windows-atop-ATA as a=20 > platform for measuring disk-related behaviors, because I=20 > don't think you can control or even know what caching is going on. You can control the writeback-cache from Device Manager->(the disk)->Policies. And if that is turned off, fsync definitly should write through, just as on *nix. (write-cache is on by default, no surprise) AFAIK, you can't control what is cached for reading. //Magnus From pgsql-sql-owner@postgresql.org Thu Feb 3 14:57:15 2005 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1F0DF8B9E8E for ; Thu, 3 Feb 2005 14:57:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37245-09 for ; Thu, 3 Feb 2005 14:57:07 +0000 (GMT) Received: from mail.idilis.net (mail.idilis.net [217.156.85.2]) by svr1.postgresql.org (Postfix) with ESMTP id 58DF58B9D1C for ; Thu, 3 Feb 2005 14:57:09 +0000 (GMT) Received: from [82.76.81.98] (helo=adi) by mail.idilis.net with asmtp id 1CwiPr-0008OI-00; Thu, 03 Feb 2005 16:57:07 +0200 To: "Richard Huxton" Cc: pgsql-sql@postgresql.org Subject: Re: [PERFORM] Tunning postgresql on linux (fedora core 3) References: <420202D0.7070602@archonet.com> <42022DA2.3040000@archonet.com> <42023A94.5040904@archonet.com> Message-ID: Date: Thu, 03 Feb 2005 18:59:40 +0200 From: Din Adrian Organization: Om Computer & SoftWare Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <42023A94.5040904@archonet.com> User-Agent: Opera M2/7.54 (Linux, build 751) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/63 X-Sequence-Number: 20174 sorry about cc ... this is the site: http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html but I gues is not right ... hmm Adrian Din On Thu, 03 Feb 2005 14:52:04 +0000, Richard Huxton wrote: > I'll repeat myself: > > > > > Please CC the mailing list as well as replying to me, so that others > can help too. > > > > > Din Adrian wrote: >> On Thu, 03 Feb 2005 13:56:50 +0000, Richard Huxton >> wrote: >> >>> Please CC the mailing list as well as replying to me, so that others >>> can help too. >>> >>> >>>> b) in docs say that after 7.2 seting this to false does'n turn off >>>> the wall ...!? wich option does? >>> >>> >>> The docs don't say that, as far as I can see. It doesn't make sense >>> to turn off the WAL. >> hmm this is the doc about ... >> ' NOTE: Since 7.2, turning fsync off does NOT stop WAL. It does stop >> checkpointing, however. This is a change in the notes that follow Turn >> WAL off (fsync=false) only for a read-only database or one where the >> database can be regenerated from external software. While RAID plus >> UPSes can do a lot to protect your data, turning off fsync means that >> you will be restoring from backup in the event of hardware or power >> failure.' > > I don't know what this is, and you don't give a URL, but it DOES NOT > appear to be in the manuals. > > You should probably read the sections of the manuals regarding "run-time > configuration" and "write ahead logs". The manuals are quite extensive, > are available online at http://www.postgresql.org/ and also in most > distributions. > > This is probably a good place to start. > http://www.postgresql.org/docs/8.0/interactive/runtime-config.html#RUNTIME-CONFIG-WAL > >> If you turn it off you should have more speed ... !!!??? > > Basically, as I said in my last email - fsync=true makes sure > transaction details are safely stored on disk. If you turn this off, the > database doesn't have to wait for the data to physically be written to > the disk. But, if power fails then data might be in OS or disk cache and > so lost when you restart the machine. > > Please CC the mailing list if you reply to this message. > -- > Richard Huxton > Archonet Ltd > -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/ From pgsql-performance-owner@postgresql.org Thu Feb 3 17:10:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 549C38B9F66 for ; Thu, 3 Feb 2005 17:10:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53366-09 for ; Thu, 3 Feb 2005 17:10:16 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id EDC6C8B9E7A for ; Thu, 3 Feb 2005 17:10:13 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: Planner really hates nested loops Date: Thu, 3 Feb 2005 12:10:12 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A760E@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Planner really hates nested loops Thread-Index: AcUKDorcJ6T0xf4cR4CYESZEe8MsWAAAHjKAAADMY8A= From: "Merlin Moncure" To: "Magnus Hagander" Cc: "Tom Lane" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.055 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/71 X-Sequence-Number: 10400 Magnus wrote: > > > I'm hoping someone can shed some light on these results. > > > > Not without a lot more detail on how you *got* the results. > > What exactly did you do to force the various plan choices? > > (I see some ridiculous choices of indexscans, for instance, > > suggesting improper use of enable_seqscan in some cases.) > > And what's the "cache rows" and "disk rows" stuff, and how do > > you know that what you were measuring is actually what you > > think it is? I have zero confidence in Windows-atop-ATA as a > > platform for measuring disk-related behaviors, because I > > don't think you can control or even know what caching is going on. >=20 > You can control the writeback-cache from Device Manager->(the > disk)->Policies. And if that is turned off, fsync definitly should write > through, just as on *nix. (write-cache is on by default, no surprise) There is some truth to what Tom is saying, we just can't seem to get our development server to *quit* syncing with fsync=3Don, even though we = have the Promise raid controller (yeah, I know) configured to cache writes. IOW, with certain configurations I just can't seem to delegate sync responsibility to the raid controller. It is a matter of record that certain crappy drives lie about caching but, IMO this is more of a driver issue than a O/S issue. (aside: I have become quite a believer in Western Digital parts, lately!) Merlin From pgsql-performance-owner@postgresql.org Thu Feb 3 19:09:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 764BA8B9F14 for ; Thu, 3 Feb 2005 19:06:19 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74057-06 for ; Thu, 3 Feb 2005 19:06:08 +0000 (GMT) Received: from morework.geizhals.at (home.geizhals.at [213.229.14.34]) by svr1.postgresql.org (Postfix) with ESMTP id 3FC3F8B9F08 for ; Thu, 3 Feb 2005 19:06:08 +0000 (GMT) Received: from localhost (morework [127.0.0.1]) by morework.geizhals.at (Postfix) with ESMTP id 36EA4DEE5B; Thu, 3 Feb 2005 20:06:05 +0100 (CET) Received: from [10.0.0.33] (mjy.ghoffice [10.0.0.33]) by morework.geizhals.at (Postfix) with ESMTP; Thu, 3 Feb 2005 20:06:05 +0100 (CET) Message-ID: <42027622.4080800@geizhals.at> Date: Thu, 03 Feb 2005 20:06:10 +0100 From: "Marinos J. Yannikos" User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Oleg Bartunov , pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> <16719.1107448058@sss.pgh.pa.us> In-Reply-To: <16719.1107448058@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 at geizhals.at X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/72 X-Sequence-Number: 10401 Tom Lane schrieb: > What's the platform exactly (hardware and OS)? Hardware: http://www.appro.com/product/server_1142h.asp - SCSI version, 2 x 146GB 10k rpm disks in software RAID-1 - 32GB RAM OS: Linux 2.6.10-rc3, x86_64, debian GNU/Linux distribution - CONFIG_K8_NUMA is currently turned off (no change, but now all CPUs have ~25% load, previously one was 100% busy and the others idle) - CONFIG_GART_IOMMU=y (but no change, tried both settings) [other kernel options didn't seem to be relevant for tweaking at the moment, mostly they're "safe defaults"] The PostgreSQL data directory is on an ext2 filesystem. Regards, Marinos -- Dipl.-Ing. Marinos Yannikos, CEO Preisvergleich Internet Services AG Obere Donaustrasse 63, A-1020 Wien Tel./Fax: (+431) 5811609-52/-55 From pgsql-performance-owner@postgresql.org Thu Feb 3 19:51:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6ECB38B9F2C for ; Thu, 3 Feb 2005 19:51:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81994-05 for ; Thu, 3 Feb 2005 19:51:12 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id D24C68B9EFB for ; Thu, 3 Feb 2005 19:51:01 +0000 (GMT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.12.10/8.12.10) with ESMTP id j13Jor5Q004623; Thu, 3 Feb 2005 22:50:53 +0300 (MSK) Date: Thu, 3 Feb 2005 22:50:53 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Tom Lane Cc: "Marinos J. Yannikos" , pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) In-Reply-To: <16719.1107448058@sss.pgh.pa.us> Message-ID: References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> <16719.1107448058@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.356 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/73 X-Sequence-Number: 10402 On Thu, 3 Feb 2005, Tom Lane wrote: > "Marinos J. Yannikos" writes: >> I can't seem to find out where the bottleneck is, but it doesn't seem to >> be CPU or disk. "top" shows that postgres processes are frequently in >> this state: > >> 6701 postgres 16 0 204m 58m 56m S 9.3 0.2 0:06.96 semtimedo >> ^^^^^^^^^ > > What's the platform exactly (hardware and OS)? > it should be 'semtimedop' > regards, tom lane > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 From pgsql-performance-owner@postgresql.org Thu Feb 3 23:24:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C7F0C8B9E3F for ; Thu, 3 Feb 2005 23:23:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17554-04 for ; Thu, 3 Feb 2005 23:23:02 +0000 (GMT) Received: from gizmo08ps.bigpond.com (gizmo08ps.bigpond.com [144.140.71.18]) by svr1.postgresql.org (Postfix) with SMTP id 86BA88B9E23 for ; Thu, 3 Feb 2005 23:23:02 +0000 (GMT) Received: (qmail 11604 invoked from network); 3 Feb 2005 23:22:56 -0000 Received: from unknown (HELO psmam11.bigpond.com) (144.135.25.100) by gizmo08ps.bigpond.com with SMTP; 3 Feb 2005 23:22:56 -0000 Received: from cpe-203-45-190-81.qld.bigpond.net.au ([203.45.190.81]) by psmam11.bigpond.com(MAM REL_3_4_2a 225/65786981) with SMTP id 65786981; Fri, 04 Feb 2005 09:22:56 +1000 Message-ID: <4202B23F.5080604@bigpond.net.au> Date: Fri, 04 Feb 2005 09:22:39 +1000 From: David Brown User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Planner really hates nested loops References: <420206AD.8040206@bigpond.net.au> <16694.1107447931@sss.pgh.pa.us> In-Reply-To: <16694.1107447931@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.906 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200502/74 X-Sequence-Number: 10403 Tom Lane wrote: >What exactly did you do to force the various plan choices? (I see some >ridiculous choices of indexscans, for instance, suggesting improper use >of enable_seqscan in some cases.) > Except for forcing a hash with indexes (to show that increased use of indexes is not necessarily good), the "ridiculous choices of indexscans" are straight from the planner, i.e. I did not use enable_seqscan. Obviously, the alternative join methods were obtained by disabling hash joins and merge joins. > And what's the "cache rows" and "disk >rows" stuff, and how do you know that what you were measuring is >actually what you think it is? I have zero confidence in >Windows-atop-ATA as a platform for measuring disk-related behaviors, >because I don't think you can control or even know what caching is >going on. > > The terms are just abbreviated headings to make it easier to check what you're looking at. "Cache" refers to repeated runs without disk I/O. "Disk" refers to a completely initialized system with no PostgreSQL data in the OS cache (i.e. after a reboot - this is Benchmarking 101). All results were verified with *at least* two runs at different times. This is not to say the "disk" results are an accurate or absolute benchmark, but they're useful as a reference when looking at the cached results. In any case, I can get the same "cached" results by increasing buffers to take up most of the memory and thereby make them the defacto cache. With respect, could we please focus on the point of this thread? I've spent a great deal of time experimenting with PostgreSQL over the last couple of months, including reading every known web page regarding tuning and following every post in this list in that period. I'm confident that my results here are what most people will experience when trying PostgreSQL, and I'd like to help in a constructive way. From pgsql-performance-owner@postgresql.org Fri Feb 4 04:40:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 030B78B9F81 for ; Fri, 4 Feb 2005 04:39:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59538-04 for ; Fri, 4 Feb 2005 04:39:50 +0000 (GMT) Received: from candle.pha.pa.us (pcp01723101pcs.malvrn01.pa.comcast.net [68.83.105.173]) by svr1.postgresql.org (Postfix) with ESMTP id 514F18B9FC2 for ; Fri, 4 Feb 2005 04:39:49 +0000 (GMT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j144dj528565; Thu, 3 Feb 2005 23:39:45 -0500 (EST) From: Bruce Momjian Message-Id: <200502040439.j144dj528565@candle.pha.pa.us> Subject: Re: Planner really hates nested loops In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE4767B0@algol.sollentuna.se> To: Magnus Hagander Date: Thu, 3 Feb 2005 23:39:44 -0500 (EST) Cc: Tom Lane , David Brown , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.394 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: * X-Archive-Number: 200502/75 X-Sequence-Number: 10404 Magnus Hagander wrote: > > > I'm hoping someone can shed some light on these results. > > > > Not without a lot more detail on how you *got* the results. > > What exactly did you do to force the various plan choices? > > (I see some ridiculous choices of indexscans, for instance, > > suggesting improper use of enable_seqscan in some cases.) > > And what's the "cache rows" and "disk rows" stuff, and how do > > you know that what you were measuring is actually what you > > think it is? I have zero confidence in Windows-atop-ATA as a > > platform for measuring disk-related behaviors, because I > > don't think you can control or even know what caching is going on. > > You can control the writeback-cache from Device Manager->(the > disk)->Policies. And if that is turned off, fsync definitly should write > through, just as on *nix. (write-cache is on by default, no surprise) > > AFAIK, you can't control what is cached for reading. Are you saying that fsync() doesn't write to the platters by default on Win32? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Fri Feb 4 17:48:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B025B8B9FBB for ; Fri, 4 Feb 2005 17:48:47 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33663-03 for ; Fri, 4 Feb 2005 17:48:45 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 8BBCC8B9FB4 for ; Fri, 4 Feb 2005 17:48:44 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: Flattening a kind of 'dynamic' table Date: Fri, 4 Feb 2005 12:48:43 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A7611@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Flattening a kind of 'dynamic' table Thread-Index: AcUFV5l70w9CNdhYRiSAnqYNL5Tp/gFiK1+w From: "Merlin Moncure" To: "Joe Conway" Cc: "PERFORM" , "Alexandre Leclerc" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.055 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/76 X-Sequence-Number: 10405 > Alexandre Leclerc wrote: > Sorry for jumping in on this thread so late -- I haven't been able to > select * from crosstab( > 'select product_id, department_id, req_time > from product_department_time order by 1', > 'select ''A'' union all select ''C'' union all select ''D''' > ) as (product_id int, a int, c int, d int); I forgot you could do this...This would certainly be easier than parsing array values returned from array_accum. It will probably be faster as well...but with the array approach the query would not have to be modified each time a new department was added. That said, a crosstab based query could be built easily enough from a department query on the client and then you have the best of both worlds. Merlin From pgsql-performance-owner@postgresql.org Wed Feb 9 06:03:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BB21B8B9DFA for ; Fri, 4 Feb 2005 19:29:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40860-08 for ; Fri, 4 Feb 2005 19:29:37 +0000 (GMT) Received: from web53508.mail.yahoo.com (web53508.mail.yahoo.com [206.190.37.69]) by svr1.postgresql.org (Postfix) with SMTP id 83EA58B9D10 for ; Fri, 4 Feb 2005 19:29:37 +0000 (GMT) Received: (qmail 55986 invoked by uid 60001); 4 Feb 2005 19:29:37 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=QWPVXp+d7WOBhZyuPLEuqFBAwqViSh2ZidDQ7iotKvuMbOHcDVMU68t3sHR7YxpqaCeypJXWRzA9ks5Wx532AdqFGIZeVrKGBULh7JgugWYojBJUN9iMGuqGmBOe1F7fa8tppCaQ1iLQXcH1x9NMRnSOCLPM3gIzS3J2Rj8Z3O0= ; Message-ID: <20050204192937.55984.qmail@web53508.mail.yahoo.com> Received: from [146.6.92.192] by web53508.mail.yahoo.com via HTTP; Fri, 04 Feb 2005 11:29:36 PST Date: Fri, 4 Feb 2005 11:29:36 -0800 (PST) From: Sanketh Indarapu Subject: Postgres odbc performance on windows To: pgsql-performance@postgresql.org Cc: sanketh_indarapu@yahoo.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/131 X-Sequence-Number: 10460 Hi all, I am using a (MFC based) recordset to read in 25M records of a table. I use a cursor to prevent complete loading of all records. However, currently performance is limited by the number of times the odbc driver loads in the rows. The tuple cache is set to 5M. I am unable to increase it beyond this owing to "out of memory for tuple cache". This is not because of my RAM because there is atleast 1G of free RAM. Any ideas? This is on Windows, Postgresql 8.0. Please make sure to reply-all as I am not subscribed to the list. - Sanketh __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From pgsql-performance-owner@postgresql.org Fri Feb 4 20:09:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 87F848B9D10 for ; Fri, 4 Feb 2005 20:09:07 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44243-02 for ; Fri, 4 Feb 2005 20:08:56 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by svr1.postgresql.org (Postfix) with ESMTP id 6FBFE8B9B2B for ; Fri, 4 Feb 2005 20:08:56 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so391199wri for ; Fri, 04 Feb 2005 12:08:56 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=J5chiblqovliYEfJ0NjwrEbxr0VhKsvhMwhZY7MSdaa1hbAcjbznuurScxGjzkbvlJDYhl2JMfOpmzJY5JquD78mF+go8fgbisvKX16VtZgydbOJrMSiKVygFJQUmuwbrNlTVQNpkmdgz8un7l6hwvV7yFX9ejG+qsx4aiSekCw= Received: by 10.54.59.37 with SMTP id h37mr188618wra; Fri, 04 Feb 2005 12:08:56 -0800 (PST) Received: by 10.54.20.47 with HTTP; Fri, 4 Feb 2005 12:08:56 -0800 (PST) Message-ID: <1dc7f0e305020412085bef5611@mail.gmail.com> Date: Fri, 4 Feb 2005 15:08:56 -0500 From: Alexandre Leclerc Reply-To: Alexandre Leclerc To: Merlin Moncure Subject: Re: Flattening a kind of 'dynamic' table Cc: Joe Conway , PERFORM In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A7611@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A7611@Herge.rcsinc.local> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/77 X-Sequence-Number: 10406 On Fri, 4 Feb 2005 12:48:43 -0500, Merlin Moncure wrote: > > Alexandre Leclerc wrote: > > Sorry for jumping in on this thread so late -- I haven't been able to > > select * from crosstab( > > 'select product_id, department_id, req_time > > from product_department_time order by 1', > > 'select ''A'' union all select ''C'' union all select ''D''' > > ) as (product_id int, a int, c int, d int); > > I forgot you could do this...This would certainly be easier than parsing > array values returned from array_accum. It will probably be faster as > well...but with the array approach the query would not have to be > modified each time a new department was added. That said, a crosstab > based query could be built easily enough from a department query on the > client and then you have the best of both worlds. Hello Merlin, Well, I'm glad because with all this i've learn a lot of new things. Finally, the crosstab solution is very fast and is simple for me to use. I get my super-bug-jumbo-dbkiller-query run in about 210ms (seeking many tables and so). I had a score of 2480ms before. (This is a much more complex query; the cross table thing had to be included in this one.) This is much better! :) In all, thanks for your help. Regards. -- Alexandre Leclerc From pgsql-performance-owner@postgresql.org Sat Feb 5 13:02:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F2BBA8B9EBC for ; Sat, 5 Feb 2005 13:02:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16200-04 for ; Sat, 5 Feb 2005 13:01:44 +0000 (GMT) Received: from morework.geizhals.at (home.geizhals.at [213.229.14.34]) by svr1.postgresql.org (Postfix) with ESMTP id 0D73B8B9E26 for ; Sat, 5 Feb 2005 13:01:45 +0000 (GMT) Received: from localhost (morework [127.0.0.1]) by morework.geizhals.at (Postfix) with ESMTP id 27ECADEE05; Sat, 5 Feb 2005 14:01:41 +0100 (CET) Received: from [172.16.42.238] (unknown [172.16.42.238]) by morework.geizhals.at (Postfix) with ESMTP; Sat, 5 Feb 2005 14:01:40 +0100 (CET) Message-ID: <4204C3B4.1050209@geizhals.at> Date: Sat, 05 Feb 2005 14:01:40 +0100 From: Marinos Yannikos User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Oleg Bartunov Cc: pgsql-performance@postgresql.org, Tom Lane Subject: Re: GiST indexes and concurrency (tsearch2) References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 at geizhals.at X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/78 X-Sequence-Number: 10407 Oleg Bartunov schrieb: > Marinos, > > what if you construct "apachebench & Co" free script and see if > the issue still exists. There are could be many issues doesn't > connected to postgresql and tsearch2. > Some more things I tried: - data directory on ramdisk (tmpfs) - no effect - database connections either over Unix domain sockets or TCP - no effect - CLUSTER on gist index - approx. 20% faster queries, but CPU usage still hovers around 25% (75% idle) - preemptible kernel - no effect This is really baffling me, it looks like a kernel issue of some sort (I'm only guessing though). I found this old posting: http://archives.postgresql.org/pgsql-general/2001-12/msg00836.php - is this still applicable? I don't see an unusually high number of context switches, but the processes seem to be spending some time in "semtimedop" (even though the TAS assembly macros are definetely being compiled-in). If you are interested, I can probably provide an account on one of our identically configured boxes by Monday afternoon (GMT+1) with the same database and benchmarking utility. Regards, Marinos From pgsql-performance-owner@postgresql.org Fri Oct 27 08:46:30 2006 Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 43C709FB3B1 for ; Fri, 27 Oct 2006 08:46:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 61675-01 for ; Fri, 27 Oct 2006 11:44:49 +0000 (UTC) X-Greylist: delayed 00:32:10.203006 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 43DC49FB440 for ; Fri, 27 Oct 2006 08:44:23 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de [83.236.156.26]) by svr4.postgresql.org (Postfix) with ESMTP id B95165AF031 for ; Fri, 27 Oct 2006 11:12:10 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.aeccom.com (Postfix) with ESMTP id 2EDD01CCF7; Fri, 27 Oct 2006 13:12:07 +0200 (CEST) Received: from mail.aeccom.com ([127.0.0.1]) by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 32238-03-29; Fri, 27 Oct 2006 13:12:05 +0200 (CEST) Received: from cayambe.core.aeccom.com (cayambe.core.aeccom.com [192.168.2.120]) by mail.aeccom.com (Postfix) with ESMTP id 596B51CCFC; Fri, 27 Oct 2006 13:11:44 +0200 (CEST) Received: by cayambe.core.aeccom.com (Postfix, from userid 500) id DE9163ECE; Sat, 5 Feb 2005 18:25:52 +0100 (CET) From: Dirk Lutzebaeck To: pgsql-performance@postgresql.org Subject: query produces 1 GB temp file Message-Id: <20061027111142.DE9163ECE@cayambe.core.aeccom.com> Date: Sat, 5 Feb 2005 18:25:52 +0100 (CET) X-Virus-Scanned: amavisd-new at aeccom.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.155 tagged_above=0 required=5 tests=DATE_IN_PAST_96_XX, FORGED_RCVD_HELO X-Spam-Level: ** X-Archive-Number: 200610/574 X-Sequence-Number: 21703 Hi, here is a query which produces over 1G temp file in pgsql_tmp. This is on pgsql 7.4.2, RHEL 3.0, XEON MP machine with 32GB RAM, 300MB sort_mem and 320MB shared_mem. Below is the query and results for EXPLAIN and EXPLAIN ANALYZE. All tables have been analyzed before. Can some please explain why the temp file is so huge? I understand there are a lot of rows. All relevant indices seem to be used. Thanks in advance, Dirk EXPLAIN SELECT DISTINCT ON (ft.val_9, ft.created, ft.flatid) ft.docstart, ft.flatobj, bi.oid, bi.en FROM bi, en, df AS ft, es WHERE bi.rc=130170467 AND bi.en=ft.en AND bi.co=117305223 AND bi.hide=FALSE AND ft.en=en.oid AND es.en=bi.en AND es.co=bi.co AND es.spec=122293729 AND (ft.val_2='DG' OR ft.val_2='SK') AND ft.docstart=1 ORDER BY ft.val_9 ASC, ft.created DESC LIMIT 1000 OFFSET 0; Limit (cost=8346.75..8346.78 rows=3 width=1361) -> Unique (cost=8346.75..8346.78 rows=3 width=1361) -> Sort (cost=8346.75..8346.76 rows=3 width=1361) Sort Key: ft.val_9, ft.created, ft.flatid -> Nested Loop (cost=0.00..8346.73 rows=3 width=1361) -> Nested Loop (cost=0.00..5757.17 rows=17 width=51) -> Nested Loop (cost=0.00..5606.39 rows=30 width=42) -> Index Scan using es_sc_index on es (cost=0.00..847.71 rows=301 width=8) Index Cond: ((spec = 122293729) AND (co = 117305223::oid)) -> Index Scan using bi_env_index on bi (cost=0.00..15.80 rows=1 width=42) Index Cond: ("outer".en = bi.en) Filter: ((rc = 130170467::oid) AND (co = 117305223::oid) AND (hide = false)) -> Index Scan using en_oid_index on en (cost=0.00..5.01 rows=1 width=9) Index Cond: ("outer".en = en.oid) -> Index Scan using df_en on df ft (cost=0.00..151.71 rows=49 width=1322) Index Cond: ("outer".en = ft.en) Filter: (((val_2 = 'DG'::text) OR (val_2 = 'SK'::text)) AND (docstart = 1)) (17 rows) -------------- EXPLAIN ANALYZE gives: Limit (cost=8346.75..8346.78 rows=3 width=1361) (actual time=75357.465..75679.964 rows=1000 loops=1) -> Unique (cost=8346.75..8346.78 rows=3 width=1361) (actual time=75357.459..75675.371 rows=1000 loops=1) -> Sort (cost=8346.75..8346.76 rows=3 width=1361) (actual time=75357.448..75499.263 rows=22439 loops=1) Sort Key: ft.val_9, ft.created, ft.flatid -> Nested Loop (cost=0.00..8346.73 rows=3 width=1361) (actual time=34.104..18016.005 rows=703677 loops=1) -> Nested Loop (cost=0.00..5757.17 rows=17 width=51) (actual time=0.467..3216.342 rows=48563 loops=1) -> Nested Loop (cost=0.00..5606.39 rows=30 width=42) (actual time=0.381..1677.014 rows=48563 loops=1) -> Index Scan using es_sc_index on es (cost=0.00..847.71 rows=301 width=8) (actual time=0.184..46.519 rows=5863 loops=1) Index Cond: ((spec = 122293729) AND (co = 117305223::oid)) -> Index Scan using bi_env_index on bi (cost=0.00..15.80 rows=1 width=42) (actual time=0.052..0.218 rows=8 loops=5863) Index Cond: ("outer".en = bi.en) Filter: ((rc = 130170467::oid) AND (co = 117305223::oid) AND (hide = false)) -> Index Scan using en_oid_index on en (cost=0.00..5.01 rows=1 width=9) (actual time=0.015..0.019 rows=1 loops=48563) Index Cond: ("outer".en = en.oid) -> Index Scan using df_en on df ft (cost=0.00..151.71 rows=49 width=1322) (actual time=0.038..0.148 rows=14 loops=48563) Index Cond: ("outer".en = ft.en) Filter: (((val_2 = 'DG'::text) OR (val_2 = 'SK'::text)) AND (docstart = 1)) Total runtime: 81782.052 ms (18 rows) From pgsql-performance-owner@postgresql.org Sat Feb 5 18:21:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8F4448B9D23 for ; Sat, 5 Feb 2005 18:21:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38160-02 for ; Sat, 5 Feb 2005 18:21:21 +0000 (GMT) Received: from mail2.aeccom.com (port-212-202-101-158.static.qsc.de [212.202.101.158]) by svr1.postgresql.org (Postfix) with ESMTP id 0F0D18B9EF7 for ; Sat, 5 Feb 2005 18:21:20 +0000 (GMT) Received: by mail2.aeccom.com (Postfix, from userid 500) id 0125074; Sat, 5 Feb 2005 19:21:17 +0100 (CET) From: Dirk Lutzebaeck To: pgsql-performance@postgresql.org Subject: query produces 1 GB temp file Message-Id: <20050205182117.0125074@mail2.aeccom.com> Date: Sat, 5 Feb 2005 19:21:17 +0100 (CET) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/79 X-Sequence-Number: 10408 Hi, here is a query which produces over 1G temp file in pgsql_tmp. This is on pgsql 7.4.2, RHEL 3.0, XEON MP machine with 32GB RAM, 300MB sort_mem and 320MB shared_mem. Below is the query and results for EXPLAIN and EXPLAIN ANALYZE. All tables have been analyzed before. Can some please explain why the temp file is so huge? I understand there are a lot of rows. Thanks in advance, Dirk EXPLAIN SELECT DISTINCT ON (ft.val_9, ft.created, ft.flatid) ft.docstart, ft.docindex, ft.flatobj, bi.oid, bi.en FROM bi, en, df AS ft, es WHERE bi.rc=130170467 AND bi.en=ft.en AND bi.co=117305223 AND bi.hide=FALSE AND ft.en=en.oid AND es.en=bi.en AND es.co=bi.co AND es.spec=122293729 AND (ft.val_2='DG' OR ft.val_2='SK') AND ft.docstart=1 ORDER BY ft.val_9 ASC, ft.created DESC LIMIT 1000 OFFSET 0; Limit (cost=8346.75..8346.78 rows=3 width=1361) -> Unique (cost=8346.75..8346.78 rows=3 width=1361) -> Sort (cost=8346.75..8346.76 rows=3 width=1361) Sort Key: ft.val_9, ft.created, ft.flatid -> Nested Loop (cost=0.00..8346.73 rows=3 width=1361) -> Nested Loop (cost=0.00..5757.17 rows=17 width=51) -> Nested Loop (cost=0.00..5606.39 rows=30 width=42) -> Index Scan using es_sc_index on es (cost=0.00..847.71 rows=301 width=8) Index Cond: ((spec = 122293729) AND (co = 117305223::oid)) -> Index Scan using bi_env_index on bi (cost=0.00..15.80 rows=1 width=42) Index Cond: ("outer".en = bi.en) Filter: ((rc = 130170467::oid) AND (co = 117305223::oid) AND (hide = false)) -> Index Scan using en_oid_index on en (cost=0.00..5.01 rows=1 width=9) Index Cond: ("outer".en = en.oid) -> Index Scan using df_en on df ft (cost=0.00..151.71 rows=49 width=1322) Index Cond: ("outer".en = ft.en) Filter: (((val_2 = 'DG'::text) OR (val_2 = 'SK'::text)) AND (docstart = 1)) (17 rows) -------------- EXPLAIN ANALYZE gives: Limit (cost=8346.75..8346.78 rows=3 width=1361) (actual time=75357.465..75679.964 rows=1000 loops=1) -> Unique (cost=8346.75..8346.78 rows=3 width=1361) (actual time=75357.459..75675.371 rows=1000 loops=1) -> Sort (cost=8346.75..8346.76 rows=3 width=1361) (actual time=75357.448..75499.263 rows=22439 loops=1) Sort Key: ft.val_9, ft.created, ft.flatid -> Nested Loop (cost=0.00..8346.73 rows=3 width=1361) (actual time=34.104..18016.005 rows=703677 loops=1) -> Nested Loop (cost=0.00..5757.17 rows=17 width=51) (actual time=0.467..3216.342 rows=48563 loops=1) -> Nested Loop (cost=0.00..5606.39 rows=30 width=42) (actual time=0.381..1677.014 rows=48563 loops=1) -> Index Scan using es_sc_index on es (cost=0.00..847.71 rows=301 width=8) (actual time=0.184..46.519 rows=5863 loops=1) Index Cond: ((spec = 122293729) AND (co = 117305223::oid)) -> Index Scan using bi_env_index on bi (cost=0.00..15.80 rows=1 width=42) (actual time=0.052..0.218 rows=8 loops=5863) Index Cond: ("outer".en = bi.en) Filter: ((rc = 130170467::oid) AND (co = 117305223::oid) AND (hide = false)) -> Index Scan using en_oid_index on en (cost=0.00..5.01 rows=1 width=9) (actual time=0.015..0.019 rows=1 loops=48563) Index Cond: ("outer".en = en.oid) -> Index Scan using df_en on df ft (cost=0.00..151.71 rows=49 width=1322) (actual time=0.038..0.148 rows=14 loops=48563) Index Cond: ("outer".en = ft.en) Filter: (((val_2 = 'DG'::text) OR (val_2 = 'SK'::text)) AND (docstart = 1)) Total runtime: 81782.052 ms (18 rows) From pgsql-performance-owner@postgresql.org Sat Feb 5 19:01:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 637728B9C75 for ; Sat, 5 Feb 2005 19:01:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41131-01 for ; Sat, 5 Feb 2005 19:01:35 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7AA748B9C1D for ; Sat, 5 Feb 2005 19:01:35 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j15J1X4r024849; Sat, 5 Feb 2005 14:01:33 -0500 (EST) To: Marinos Yannikos Cc: Oleg Bartunov , pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) In-reply-to: <4204C3B4.1050209@geizhals.at> References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> <4204C3B4.1050209@geizhals.at> Comments: In-reply-to Marinos Yannikos message dated "Sat, 05 Feb 2005 14:01:40 +0100" Date: Sat, 05 Feb 2005 14:01:32 -0500 Message-ID: <24848.1107630092@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/80 X-Sequence-Number: 10409 Marinos Yannikos writes: > This is really baffling me, it looks like a kernel issue of some sort > (I'm only guessing though). I found this old posting: > http://archives.postgresql.org/pgsql-general/2001-12/msg00836.php - is > this still applicable? That seems to be an early report of what we now recognize as the "context swap storm" problem, and no we don't have a solution yet. I'm not completely convinced that you're seeing the same thing, but if you're seeing a whole lot of semops then it could well be. I set up a test case consisting of two backends running the same tsearch2 query over and over --- nothing fancy, just one of the ones from the tsearch2 regression test: SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); I used gdb to set breakpoints at PGSemaphoreLock and PGSemaphoreTryLock, which are the only two functions that can possibly block on a semop call. On a single-processor machine, I saw maybe one hit every couple of seconds, all coming from contention for the BufMgrLock or sometimes the LockMgrLock. So unless I've missed something, there's not anything in tsearch2 or gist per se that is causing lock conflicts. You said you're testing a quad-processor machine, so it could be that you're seeing the same lock contention issues that we've been trying to figure out for the past year ... regards, tom lane From pgsql-performance-owner@postgresql.org Sat Feb 5 19:26:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BEEA08B9C8D for ; Sat, 5 Feb 2005 19:26:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43010-04 for ; Sat, 5 Feb 2005 19:26:17 +0000 (GMT) Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu [129.255.60.186]) by svr1.postgresql.org (Postfix) with ESMTP id 162638B9B6C for ; Sat, 5 Feb 2005 19:26:16 +0000 (GMT) Received: from [192.168.1.11] (12-217-241-0.client.mchsi.com [12.217.241.0]) by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id j15JQB327678; Sat, 5 Feb 2005 13:26:11 -0600 Message-ID: <42051DD1.7020802@arbash-meinel.com> Date: Sat, 05 Feb 2005 13:26:09 -0600 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dirk Lutzebaeck Cc: pgsql-performance@postgresql.org Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> In-Reply-To: <20050205182117.0125074@mail2.aeccom.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigC860ACFC206C9176765D21DA" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/81 X-Sequence-Number: 10410 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigC860ACFC206C9176765D21DA Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Dirk Lutzebaeck wrote: >Hi, > >here is a query which produces over 1G temp file in pgsql_tmp. This >is on pgsql 7.4.2, RHEL 3.0, XEON MP machine with 32GB RAM, 300MB >sort_mem and 320MB shared_mem. > >Below is the query and results for EXPLAIN and EXPLAIN ANALYZE. All >tables have been analyzed before. > >Can some please explain why the temp file is so huge? I understand >there are a lot of rows. > >Thanks in advance, > >Dirk > > ... > -> Nested Loop (cost=0.00..8346.73 rows=3 width=1361) (actual time=34.104..18016.005 rows=703677 loops=1) > > Well, there is this particular query where it thinks there will only be 3 rows, but in fact there are 703,677 of them. And the previous line: > -> Sort (cost=8346.75..8346.76 rows=3 width=1361) (actual time=75357.448..75499.263 rows=22439 loops=1) > > Seem to indicate that after sorting you still have 22,439 rows, which then gets pared down again down to 1000. I'm assuming that the sort you are trying to do is extremely expensive. You are sorting 700k rows, which takes up too much memory (1GB), which forces it to create a temporary table, and write it out to disk. I didn't analyze it a lot, but you might get a lot better performance from doing a subselect, rather than the query you wrote. You are joining 4 tables (bi, en, df AS ft, es) I don't know which tables are what size. In the end, though, you don't really care about the en table or es tables (they aren't in your output). So maybe one of you subselects could be: where bi.en = (select en from es where es.co = bi.co and es.spec=122293729); I'm pretty sure the reason you need 1GB of temp space is because at one point you have 700k rows. Is it possible to rewrite the query so that it does more filtering earlier? Your distinct criteria seems to filter it down to 20k rows. So maybe it's possible to do some sort of a distinct in part of the subselect, before you start joining against other tables. If you have that much redundancy, you might also need to think of doing a different normalization. Just some thoughts. Also, I thought using the "oid" column wasn't really recommended, since in *high* volume databases they aren't even guaranteed to be unique. (I think it is a 32-bit number that rolls over.) Also on a database dump and restore, they don't stay the same, unless you take a lot of extra care that they are included in both the dump and the restore. I believe it is better to create your own "id" per table (say SERIAL or BIGSERIAL). John =:-> --------------enigC860ACFC206C9176765D21DA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCBR3RJdeBCYSNAAMRAnJZAJ0bLab3EDS1v+wFzGP5bUKe8nYziACfcI7x 2Hnvwgpm8Na6rjAaWuGjeKU= =QyLG -----END PGP SIGNATURE----- --------------enigC860ACFC206C9176765D21DA-- From pgsql-performance-owner@postgresql.org Sat Feb 5 19:42:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5EA088B9C8D for ; Sat, 5 Feb 2005 19:42:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44754-08 for ; Sat, 5 Feb 2005 19:42:36 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8FE728B9C6C for ; Sat, 5 Feb 2005 19:42:36 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j15JgYTM028978; Sat, 5 Feb 2005 14:42:35 -0500 (EST) To: Marinos Yannikos Cc: Oleg Bartunov , pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) In-reply-to: <4204C3B4.1050209@geizhals.at> References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> <4204C3B4.1050209@geizhals.at> Comments: In-reply-to Marinos Yannikos message dated "Sat, 05 Feb 2005 14:01:40 +0100" Date: Sat, 05 Feb 2005 14:42:34 -0500 Message-ID: <28977.1107632554@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/82 X-Sequence-Number: 10411 Marinos Yannikos writes: > Some more things I tried: You might try the attached patch (which I just applied to HEAD). It cuts down the number of acquisitions of the BufMgrLock by merging adjacent bufmgr calls during a GIST index search. I'm not hugely hopeful that this will help, since I did something similar to btree last spring without much improvement for context swap storms involving btree searches ... but it seems worth trying. regards, tom lane *** src/backend/access/gist/gistget.c.orig Fri Dec 31 17:45:27 2004 --- src/backend/access/gist/gistget.c Sat Feb 5 14:19:52 2005 *************** *** 60,69 **** BlockNumber blk; IndexTuple it; b = ReadBuffer(s->indexRelation, GISTP_ROOT); p = BufferGetPage(b); po = (GISTPageOpaque) PageGetSpecialPointer(p); - so = (GISTScanOpaque) s->opaque; for (;;) { --- 60,70 ---- BlockNumber blk; IndexTuple it; + so = (GISTScanOpaque) s->opaque; + b = ReadBuffer(s->indexRelation, GISTP_ROOT); p = BufferGetPage(b); po = (GISTPageOpaque) PageGetSpecialPointer(p); for (;;) { *************** *** 75,86 **** while (n < FirstOffsetNumber || n > maxoff) { ! ReleaseBuffer(b); ! if (so->s_stack == NULL) return false; ! stk = so->s_stack; ! b = ReadBuffer(s->indexRelation, stk->gs_blk); p = BufferGetPage(b); po = (GISTPageOpaque) PageGetSpecialPointer(p); maxoff = PageGetMaxOffsetNumber(p); --- 76,89 ---- while (n < FirstOffsetNumber || n > maxoff) { ! stk = so->s_stack; ! if (stk == NULL) ! { ! ReleaseBuffer(b); return false; + } ! b = ReleaseAndReadBuffer(b, s->indexRelation, stk->gs_blk); p = BufferGetPage(b); po = (GISTPageOpaque) PageGetSpecialPointer(p); maxoff = PageGetMaxOffsetNumber(p); *************** *** 89,94 **** --- 92,98 ---- n = OffsetNumberPrev(stk->gs_child); else n = OffsetNumberNext(stk->gs_child); + so->s_stack = stk->gs_parent; pfree(stk); *************** *** 116,123 **** it = (IndexTuple) PageGetItem(p, PageGetItemId(p, n)); blk = ItemPointerGetBlockNumber(&(it->t_tid)); ! ReleaseBuffer(b); ! b = ReadBuffer(s->indexRelation, blk); p = BufferGetPage(b); po = (GISTPageOpaque) PageGetSpecialPointer(p); } --- 120,126 ---- it = (IndexTuple) PageGetItem(p, PageGetItemId(p, n)); blk = ItemPointerGetBlockNumber(&(it->t_tid)); ! b = ReleaseAndReadBuffer(b, s->indexRelation, blk); p = BufferGetPage(b); po = (GISTPageOpaque) PageGetSpecialPointer(p); } *************** *** 137,142 **** --- 140,147 ---- BlockNumber blk; IndexTuple it; + so = (GISTScanOpaque) s->opaque; + blk = ItemPointerGetBlockNumber(&(s->currentItemData)); n = ItemPointerGetOffsetNumber(&(s->currentItemData)); *************** *** 148,154 **** b = ReadBuffer(s->indexRelation, blk); p = BufferGetPage(b); po = (GISTPageOpaque) PageGetSpecialPointer(p); - so = (GISTScanOpaque) s->opaque; for (;;) { --- 153,158 ---- *************** *** 157,176 **** while (n < FirstOffsetNumber || n > maxoff) { ! ReleaseBuffer(b); ! if (so->s_stack == NULL) return false; ! stk = so->s_stack; ! b = ReadBuffer(s->indexRelation, stk->gs_blk); p = BufferGetPage(b); - maxoff = PageGetMaxOffsetNumber(p); po = (GISTPageOpaque) PageGetSpecialPointer(p); if (ScanDirectionIsBackward(dir)) n = OffsetNumberPrev(stk->gs_child); else n = OffsetNumberNext(stk->gs_child); so->s_stack = stk->gs_parent; pfree(stk); --- 161,183 ---- while (n < FirstOffsetNumber || n > maxoff) { ! stk = so->s_stack; ! if (stk == NULL) ! { ! ReleaseBuffer(b); return false; + } ! b = ReleaseAndReadBuffer(b, s->indexRelation, stk->gs_blk); p = BufferGetPage(b); po = (GISTPageOpaque) PageGetSpecialPointer(p); + maxoff = PageGetMaxOffsetNumber(p); if (ScanDirectionIsBackward(dir)) n = OffsetNumberPrev(stk->gs_child); else n = OffsetNumberNext(stk->gs_child); + so->s_stack = stk->gs_parent; pfree(stk); *************** *** 198,205 **** it = (IndexTuple) PageGetItem(p, PageGetItemId(p, n)); blk = ItemPointerGetBlockNumber(&(it->t_tid)); ! ReleaseBuffer(b); ! b = ReadBuffer(s->indexRelation, blk); p = BufferGetPage(b); po = (GISTPageOpaque) PageGetSpecialPointer(p); --- 205,211 ---- it = (IndexTuple) PageGetItem(p, PageGetItemId(p, n)); blk = ItemPointerGetBlockNumber(&(it->t_tid)); ! b = ReleaseAndReadBuffer(b, s->indexRelation, blk); p = BufferGetPage(b); po = (GISTPageOpaque) PageGetSpecialPointer(p); From pgsql-performance-owner@postgresql.org Wed Feb 9 06:05:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2C9D08B9D95 for ; Sat, 5 Feb 2005 19:46:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44894-08 for ; Sat, 5 Feb 2005 19:46:25 +0000 (GMT) Received: from mailout08.sul.t-online.com (mailout08.sul.t-online.com [194.25.134.20]) by svr1.postgresql.org (Postfix) with ESMTP id 4370E8B9D07 for ; Sat, 5 Feb 2005 19:46:25 +0000 (GMT) Received: from fwd03.aul.t-online.de by mailout08.sul.t-online.com with smtp id 1CxVsr-0002v9-04; Sat, 05 Feb 2005 20:46:21 +0100 Received: from [192.168.0.70] (JlG-omZ6ZeIjhA16u0yapA4ogU9wdIN84nmqPoYLFvvJnwxyPze3YE@[217.224.237.187]) by fwd03.sul.t-online.com with esmtp id 1CxVsq-0Mh5G40; Sat, 5 Feb 2005 20:46:20 +0100 Message-ID: <4205228C.3060601@aeccom.com> Date: Sat, 05 Feb 2005 20:46:20 +0100 From: Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) Reply-To: lutzeb@aeccom.com User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John A Meinel Cc: pgsql-performance@postgresql.org Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <42051DD1.7020802@arbash-meinel.com> In-Reply-To: <42051DD1.7020802@arbash-meinel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: JlG-omZ6ZeIjhA16u0yapA4ogU9wdIN84nmqPoYLFvvJnwxyPze3YE X-TOI-MSGID: 4de9f8cf-0834-4d7a-8103-c5166e907b50 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.103 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/132 X-Sequence-Number: 10461 Hi John, thanks very much for your analysis. I'll probably need to reorganize some things. Regards, Dirk John A Meinel wrote: > Dirk Lutzebaeck wrote: > >> Hi, >> >> here is a query which produces over 1G temp file in pgsql_tmp. This >> is on pgsql 7.4.2, RHEL 3.0, XEON MP machine with 32GB RAM, 300MB >> sort_mem and 320MB shared_mem. >> >> Below is the query and results for EXPLAIN and EXPLAIN ANALYZE. All >> tables have been analyzed before. >> >> Can some please explain why the temp file is so huge? I understand >> there are a lot of rows. >> >> Thanks in advance, >> >> Dirk >> >> > ... > >> -> Nested Loop (cost=0.00..8346.73 rows=3 width=1361) >> (actual time=34.104..18016.005 rows=703677 loops=1) >> >> > Well, there is this particular query where it thinks there will only > be 3 rows, but in fact there are 703,677 of them. And the previous line: > >> -> Sort (cost=8346.75..8346.76 rows=3 width=1361) (actual >> time=75357.448..75499.263 rows=22439 loops=1) >> >> > Seem to indicate that after sorting you still have 22,439 rows, which > then gets pared down again down to 1000. > > I'm assuming that the sort you are trying to do is extremely > expensive. You are sorting 700k rows, which takes up too much memory > (1GB), which forces it to create a temporary table, and write it out > to disk. > > I didn't analyze it a lot, but you might get a lot better performance > from doing a subselect, rather than the query you wrote. > > You are joining 4 tables (bi, en, df AS ft, es) I don't know which > tables are what size. In the end, though, you don't really care about > the en table or es tables (they aren't in your output). > > So maybe one of you subselects could be: > > where bi.en = (select en from es where es.co = bi.co and > es.spec=122293729); > > I'm pretty sure the reason you need 1GB of temp space is because at > one point you have 700k rows. Is it possible to rewrite the query so > that it does more filtering earlier? Your distinct criteria seems to > filter it down to 20k rows. So maybe it's possible to do some sort of > a distinct in part of the subselect, before you start joining against > other tables. > > If you have that much redundancy, you might also need to think of > doing a different normalization. > > Just some thoughts. > > Also, I thought using the "oid" column wasn't really recommended, > since in *high* volume databases they aren't even guaranteed to be > unique. (I think it is a 32-bit number that rolls over.) Also on a > database dump and restore, they don't stay the same, unless you take a > lot of extra care that they are included in both the dump and the > restore. I believe it is better to create your own "id" per table (say > SERIAL or BIGSERIAL). > > John > =:-> > From pgsql-performance-owner@postgresql.org Sat Feb 5 22:10:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5381D8B9E85 for ; Sat, 5 Feb 2005 22:10:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51793-02 for ; Sat, 5 Feb 2005 22:09:51 +0000 (GMT) Received: from stark.xeocode.com (unknown [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 600428B9E3B for ; Sat, 5 Feb 2005 20:24:21 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1CxWSC-0005C5-00; Sat, 05 Feb 2005 15:22:52 -0500 To: Dirk Lutzebaeck Cc: pgsql-performance@postgresql.org Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> In-Reply-To: <20050205182117.0125074@mail2.aeccom.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 05 Feb 2005 15:22:52 -0500 Message-ID: <87y8e2kb8j.fsf@stark.xeocode.com> Lines: 56 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.031 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/83 X-Sequence-Number: 10412 Dirk Lutzebaeck writes: > Below is the query and results for EXPLAIN and EXPLAIN ANALYZE. All > tables have been analyzed before. Really? A lot of the estimates are very far off. If you really just analyzed these tables immediately prior to the query then perhaps you should try raising the statistics target on spec and co. Or is the problem that there's a correlation between those two columns? > -> Nested Loop (cost=0.00..8346.73 rows=3 width=1361) (actual time=34.104..18016.005 rows=703677 loops=1) > -> Nested Loop (cost=0.00..5757.17 rows=17 width=51) (actual time=0.467..3216.342 rows=48563 loops=1) > -> Nested Loop (cost=0.00..5606.39 rows=30 width=42) (actual time=0.381..1677.014 rows=48563 loops=1) > -> Index Scan using es_sc_index on es (cost=0.00..847.71 rows=301 width=8) (actual time=0.184..46.519 rows=5863 loops=1) > Index Cond: ((spec = 122293729) AND (co = 117305223::oid)) The root of your problem,. The optimizer is off by a factor of 20. It thinks these two columns are much more selective than they are. > -> Index Scan using bi_env_index on bi (cost=0.00..15.80 rows=1 width=42) (actual time=0.052..0.218 rows=8 loops=5863) > Index Cond: ("outer".en = bi.en) > Filter: ((rc = 130170467::oid) AND (co = 117305223::oid) AND (hide = false)) It also thinks these three columns are much more selective than they are. How accurate are its estimates if you just do these? explain analyze select * from es where spec = 122293729 explain analyze select * from es where co = 117305223::oid explain analyze select * from bi where rc = 130170467::oid explain analyze select * from bi where co = 117305223 explain analyze select * from bi where hide = false If they're individually accurate then you've run into the familiar problem of needing cross-column statistics. If they're individually inaccurate then you should try raising the targets on those columns with: ALTER TABLE [ ONLY ] name [ * ] ALTER [ COLUMN ] column SET STATISTICS integer and reanalyzing. Dirk Lutzebaeck writes: > Can some please explain why the temp file is so huge? I understand > there are a lot of rows. Well that I can't explain. 22k rows of width 1361 doesn't sound so big to me either. The temporary table does need to store three copies of the records at a given time, but still it sounds like an awful lot. -- greg From pgsql-performance-owner@postgresql.org Sat Feb 5 22:43:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B953C8B9E9C for ; Sat, 5 Feb 2005 22:43:07 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55556-03 for ; Sat, 5 Feb 2005 22:42:50 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 772CE8B9E19 for ; Sat, 5 Feb 2005 22:41:34 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j15MfO9Y029930; Sat, 5 Feb 2005 17:41:25 -0500 (EST) To: Greg Stark Cc: Dirk Lutzebaeck , pgsql-performance@postgresql.org Subject: Re: query produces 1 GB temp file In-reply-to: <87y8e2kb8j.fsf@stark.xeocode.com> References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark message dated "05 Feb 2005 15:22:52 -0500" Date: Sat, 05 Feb 2005 17:41:24 -0500 Message-ID: <29929.1107643284@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/84 X-Sequence-Number: 10413 Greg Stark writes: > Dirk Lutzebaeck writes: >> Can some please explain why the temp file is so huge? I understand >> there are a lot of rows. > Well that I can't explain. 22k rows of width 1361 doesn't sound so big to me > either. It was 700k rows to sort, not 22k. The Unique/Limit superstructure only demanded 22k rows out from the sort, but we still had to sort 'em all to figure out which ones were the first 22k. > The temporary table does need to store three copies of the records at > a given time, but still it sounds like an awful lot. Huh? regards, tom lane From pgsql-performance-owner@postgresql.org Sat Feb 5 22:50:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2AA288B9CF4 for ; Sat, 5 Feb 2005 22:50:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55841-10 for ; Sat, 5 Feb 2005 22:50:24 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 9E7338B9CAF for ; Sat, 5 Feb 2005 22:50:25 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1CxYkn-0005h8-00; Sat, 05 Feb 2005 17:50:13 -0500 To: Tom Lane Cc: Greg Stark , Dirk Lutzebaeck , pgsql-performance@postgresql.org Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <29929.1107643284@sss.pgh.pa.us> In-Reply-To: <29929.1107643284@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 05 Feb 2005 17:50:13 -0500 Message-ID: <87mzuik4ey.fsf@stark.xeocode.com> Lines: 16 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/85 X-Sequence-Number: 10414 Tom Lane writes: > It was 700k rows to sort, not 22k. Oops, missed that. > > The temporary table does need to store three copies of the records at > > a given time, but still it sounds like an awful lot. > > Huh? Am I wrong? I thought the disk sort algorithm was the polyphase tape sort from Knuth which is always reading two tapes and writing to a third. -- greg From pgsql-performance-owner@postgresql.org Sat Feb 5 23:01:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D271B8B9B8A for ; Sat, 5 Feb 2005 23:01:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57036-08 for ; Sat, 5 Feb 2005 23:01:20 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id BEDD28B9B19 for ; Sat, 5 Feb 2005 23:01:21 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j15N14tq000191; Sat, 5 Feb 2005 18:01:04 -0500 (EST) To: Greg Stark Cc: Dirk Lutzebaeck , pgsql-performance@postgresql.org Subject: Re: query produces 1 GB temp file In-reply-to: <87mzuik4ey.fsf@stark.xeocode.com> References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <29929.1107643284@sss.pgh.pa.us> <87mzuik4ey.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark message dated "05 Feb 2005 17:50:13 -0500" Date: Sat, 05 Feb 2005 18:01:03 -0500 Message-ID: <190.1107644463@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/86 X-Sequence-Number: 10415 Greg Stark writes: > Am I wrong? I thought the disk sort algorithm was the polyphase tape sort from > Knuth which is always reading two tapes and writing to a third. It is a polyphase sort, but we recycle the input "tapes" as fast as we use them, so that the maximum disk space usage is about as much as the data volume to sort. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Feb 9 05:53:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8AA908B9B31 for ; Sun, 6 Feb 2005 13:28:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16596-08 for ; Sun, 6 Feb 2005 13:27:48 +0000 (GMT) Received: from mailout01.sul.t-online.com (mailout01.sul.t-online.com [194.25.134.80]) by svr1.postgresql.org (Postfix) with ESMTP id CFDA18B9CF6 for ; Sun, 6 Feb 2005 13:27:50 +0000 (GMT) Received: from fwd11.aul.t-online.de by mailout01.sul.t-online.com with smtp id 1CxmRx-0006ZN-03; Sun, 06 Feb 2005 14:27:41 +0100 Received: from [192.168.0.70] (XRxwZTZbgebKFThmyVt8O8U2Taz5Rk4Ei5k2NTeDN96c-fdf+ew4Y4@[217.86.175.49]) by fwd11.sul.t-online.com with esmtp id 1CxmRa-0EgBsm0; Sun, 6 Feb 2005 14:27:18 +0100 Message-ID: <42061B35.6000306@aeccom.com> Date: Sun, 06 Feb 2005 14:27:17 +0100 From: Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) Reply-To: lutzeb@aeccom.com User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Greg Stark Cc: pgsql-performance@postgresql.org, tgl@sss.pgh.pa.us, john@arbash-meinel.com Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> In-Reply-To: <87y8e2kb8j.fsf@stark.xeocode.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-ID: XRxwZTZbgebKFThmyVt8O8U2Taz5Rk4Ei5k2NTeDN96c-fdf+ew4Y4 X-TOI-MSGID: 885621ba-0e76-4034-bc41-6c24ba59b301 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/128 X-Sequence-Number: 10457 Greg, Thanks for your analysis. But I dont get any better after bumping STATISTICS target from 10 to 200. explain analyze shows that the optimizer is still way off estimating the rows. Is this normal? It still produces a 1 GB temp file. I simplified the query a bit, now only two tables are involved (bi, df). I also vacuumed. alter table bi alter rc set statistics 200; alter table bi alter hide set statistics 200; alter table bi alter co set statistics 200; alter table bi alter en set statistics 200; analyze bi; alter table df alter en set statistics 200; alter table df alter val_2 set statistics 200; analyze df; EXPLAIN ANALYZE SELECT DISTINCT ON (df.val_9, df.created, df.flatid) df.docindex, df.flatobj, bi.oid, bi.en FROM bi,df WHERE bi.rc=130170467 AND bi.en=df.en AND bi.co=117305223 AND bi.hide=FALSE AND (df.val_2='DG' OR df.val_2='SK') AND df.docstart=1 ORDER BY df.val_9 ASC, df.created DESC LIMIT 1000 OFFSET 0 ; Limit (cost=82470.09..82480.09 rows=1000 width=646) (actual time=71768.685..72084.622 rows=1000 loops=1) -> Unique (cost=82470.09..82643.71 rows=17362 width=646) (actual time=71768.679..72079.987 rows=1000 loops=1) -> Sort (cost=82470.09..82513.50 rows=17362 width=646) (actual time=71768.668..71905.138 rows=22439 loops=1) Sort Key: df.val_9, df.created, df.flatid -> Merge Join (cost=80422.51..81247.49 rows=17362 width=646) (actual time=7657.872..18486.551 rows=703677 loops=1) Merge Cond: ("outer".en = "inner".en) -> Sort (cost=55086.74..55340.18 rows=101378 width=8) (actual time=5606.137..6672.630 rows=471871 loops=1) Sort Key: bi.en -> Seq Scan on bi (cost=0.00..46657.47 rows=101378 width=8) (actual time=0.178..3715.109 rows=472320 loops=1) Filter: ((rc = 130170467::oid) AND (co = 117305223::oid) AND (hide = false)) -> Sort (cost=25335.77..25408.23 rows=28982 width=642) (actual time=2048.039..3677.140 rows=706482 loops=1) Sort Key: df.en -> Seq Scan on df (cost=0.00..23187.79 rows=28982 width=642) (actual time=0.112..1546.580 rows=71978 loops=1) Filter: (((val_2 = 'DG'::text) OR (val_2 = 'SK'::text)) AND (docstart = 1)) explain analyze select * from bi where rc=130170467; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Seq Scan on bi (cost=0.00..41078.76 rows=190960 width=53) (actual time=0.157..3066.028 rows=513724 loops=1) Filter: (rc = 130170467::oid) Total runtime: 4208.663 ms (3 rows) explain analyze select * from bi where co=117305223; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Seq Scan on bi (cost=0.00..41078.76 rows=603988 width=53) (actual time=0.021..3692.238 rows=945487 loops=1) Filter: (co = 117305223::oid) Total runtime: 5786.268 ms (3 rows) Greg Stark wrote: >Dirk Lutzebaeck writes: > > > >>Below is the query and results for EXPLAIN and EXPLAIN ANALYZE. All >>tables have been analyzed before. >> >> > >Really? A lot of the estimates are very far off. If you really just analyzed >these tables immediately prior to the query then perhaps you should try >raising the statistics target on spec and co. Or is the problem that there's a >correlation between those two columns? > > > >> -> Nested Loop (cost=0.00..8346.73 rows=3 width=1361) (actual time=34.104..18016.005 rows=703677 loops=1) >> -> Nested Loop (cost=0.00..5757.17 rows=17 width=51) (actual time=0.467..3216.342 rows=48563 loops=1) >> -> Nested Loop (cost=0.00..5606.39 rows=30 width=42) (actual time=0.381..1677.014 rows=48563 loops=1) >> -> Index Scan using es_sc_index on es (cost=0.00..847.71 rows=301 width=8) (actual time=0.184..46.519 rows=5863 loops=1) >> Index Cond: ((spec = 122293729) AND (co = 117305223::oid)) >> >> > >The root of your problem,. The optimizer is off by a factor of 20. It thinks >these two columns are much more selective than they are. > > > >> -> Index Scan using bi_env_index on bi (cost=0.00..15.80 rows=1 width=42) (actual time=0.052..0.218 rows=8 loops=5863) >> Index Cond: ("outer".en = bi.en) >> Filter: ((rc = 130170467::oid) AND (co = 117305223::oid) AND (hide = false)) >> >> > >It also thinks these three columns are much more selective than they are. > >How accurate are its estimates if you just do these? > >explain analyze select * from es where spec = 122293729 >explain analyze select * from es where co = 117305223::oid >explain analyze select * from bi where rc = 130170467::oid >explain analyze select * from bi where co = 117305223 >explain analyze select * from bi where hide = false > >If they're individually accurate then you've run into the familiar problem of >needing cross-column statistics. If they're individually inaccurate then you >should try raising the targets on those columns with: > >ALTER TABLE [ ONLY ] name [ * ] > ALTER [ COLUMN ] column SET STATISTICS integer > >and reanalyzing. > > >Dirk Lutzebaeck writes: > > > >>Can some please explain why the temp file is so huge? I understand >>there are a lot of rows. >> >> > >Well that I can't explain. 22k rows of width 1361 doesn't sound so big to me >either. The temporary table does need to store three copies of the records at >a given time, but still it sounds like an awful lot. > > > > From pgsql-performance-owner@postgresql.org Sun Feb 6 15:19:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D1CC48B9E5F for ; Sun, 6 Feb 2005 15:19:39 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25649-07 for ; Sun, 6 Feb 2005 15:19:24 +0000 (GMT) Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu [129.255.60.186]) by svr1.postgresql.org (Postfix) with ESMTP id 542F18B9B31 for ; Sun, 6 Feb 2005 15:19:24 +0000 (GMT) Received: from [192.168.1.11] (12-217-241-0.client.mchsi.com [12.217.241.0]) by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id j16FJE310793; Sun, 6 Feb 2005 09:19:14 -0600 Message-ID: <4206356C.9060308@arbash-meinel.com> Date: Sun, 06 Feb 2005 09:19:08 -0600 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: lutzeb@aeccom.com Cc: Greg Stark , pgsql-performance@postgresql.org, tgl@sss.pgh.pa.us Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <42061B35.6000306@aeccom.com> In-Reply-To: <42061B35.6000306@aeccom.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3F92F2BCD0AF6B1A96F413FE" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/87 X-Sequence-Number: 10416 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3F92F2BCD0AF6B1A96F413FE Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Dirk Lutzebaeck wrote: > Greg, > > Thanks for your analysis. But I dont get any better after bumping > STATISTICS target from 10 to 200. > explain analyze shows that the optimizer is still way off estimating > the rows. Is this normal? It still produces a 1 GB temp file. > I simplified the query a bit, now only two tables are involved (bi, > df). I also vacuumed. Are you just doing VACUUM? Or are you doing VACUUM ANALYZE? You might also try VACUUM ANALYZE FULL (in the case that you have too many dead tuples in the table). VACUUM cleans up, but doesn't adjust any planner statistics without ANALYZE. John =:-> --------------enig3F92F2BCD0AF6B1A96F413FE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCBjVwJdeBCYSNAAMRAnRoAKCRdqa1y+To3TusqiejEFGqDjLMJwCgkuF4 UsCJ5jrsQBBMWZOHqHEVD6M= =41zs -----END PGP SIGNATURE----- --------------enig3F92F2BCD0AF6B1A96F413FE-- From pgsql-performance-owner@postgresql.org Sun Feb 6 15:53:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4CF638B9C8A for ; Sun, 6 Feb 2005 15:53:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28389-06 for ; Sun, 6 Feb 2005 15:53:19 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id A653E8B9CE7 for ; Sun, 6 Feb 2005 15:53:21 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9450831DD9; Sun, 6 Feb 2005 16:53:22 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: horizontal partition Date: Sun, 06 Feb 2005 16:50:08 +0100 Organization: PYRENET Midi-pyrenees Provider Lines: 96 Message-ID: References: <200502021209.06878.josh@agliodbs.com> <42019B1735F.1271KG@129.180.47.120> <200502022241.57799.josh@agliodbs.com> <12896.1107413728@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <12896.1107413728@sss.pgh.pa.us> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/88 X-Sequence-Number: 10417 Tom Lane wrote: > Josh Berkus writes: > >>The issue here is that the planner is capable of "pushing down" the WHERE >>criteria into the first view, but not into the second, "nested" view, and so >>postgres materializes the UNIONed data set before perfoming the join. > > >>Thing is, I seem to recall that this particular issue was something Tom fixed >>a while ago. Which is why I wanted to know what version Gaetano is using. > > > It's still true that we can't generate a nestloop-with-inner-indexscan > join plan if the inner side is anything more complex than a single table > scan. Since that's the only plan that gives you any chance of not > scanning the whole partitioned table, it's rather a hindrance :-( > > It might be possible to fix this by treating the nestloop's join > conditions as "push down-able" criteria, instead of the present rather > ad hoc method for generating nestloop/indexscan plans. It'd be quite > a deal of work though, and I'm concerned about how slow the planner > might run if we did do it like that. > I don't know if this will help my attempt to perform an horizontal partition, if it do I think that it can solve lot of problems out there, I tried the inheritance technique too: The table user_logs is the original one, I created two tables extending this one: CREATE TABLE user_logs_2003_h () inherits (user_logs); CREATE TABLE user_logs_2002_h () inherits (user_logs); I defined on this table the index already defined on user_logs. And this is the result: empdb=# explain analyze select * from user_logs where id_user = sp_id_user('kalman'); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Result (cost=0.00..426.33 rows=335 width=67) (actual time=20.891..129.218 rows=98 loops=1) -> Append (cost=0.00..426.33 rows=335 width=67) (actual time=20.871..128.643 rows=98 loops=1) -> Index Scan using idx_user_user_logs on user_logs (cost=0.00..133.11 rows=66 width=67) (actual time=20.864..44.594 rows=3 loops=1) Index Cond: (id_user = 4185) -> Index Scan using idx_user_user_logs_2003_h on user_logs_2003_h user_logs (cost=0.00..204.39 rows=189 width=67) (actual time=1.507..83.662 rows=95 loops=1) Index Cond: (id_user = 4185) -> Index Scan using idx_user_user_logs_2002_h on user_logs_2002_h user_logs (cost=0.00..88.83 rows=80 width=67) (actual time=0.206..0.206 rows=0 loops=1) Index Cond: (id_user = 4185) Total runtime: 129.500 ms (9 rows) that is good, but now look what happen in a view like this one: create view to_delete AS SELECT v.login, u.* from user_login v, user_logs u where v.id_user = u.id_user; empdb=# explain analyze select * from to_delete where login = 'kalman'; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ Hash Join (cost=4.01..65421.05 rows=143 width=79) (actual time=1479.738..37121.511 rows=98 loops=1) Hash Cond: ("outer".id_user = "inner".id_user) -> Append (cost=0.00..50793.17 rows=2924633 width=67) (actual time=21.391..33987.363 rows=2927428 loops=1) -> Seq Scan on user_logs u (cost=0.00..7195.22 rows=411244 width=67) (actual time=21.385..5641.307 rows=414039 loops=1) -> Seq Scan on user_logs_2003_h u (cost=0.00..34833.95 rows=2008190 width=67) (actual time=0.024..18031.218 rows=2008190 loops=1) -> Seq Scan on user_logs_2002_h u (cost=0.00..8764.00 rows=505199 width=67) (actual time=0.005..5733.554 rows=505199 loops=1) -> Hash (cost=4.00..4.00 rows=2 width=16) (actual time=0.195..0.195 rows=0 loops=1) -> Index Scan using user_login_login_key on user_login v (cost=0.00..4.00 rows=2 width=16) (actual time=0.155..0.161 rows=1 loops=1) Index Cond: ((login)::text = 'kalman'::text) Total runtime: 37122.069 ms (10 rows) and how you can see this path is not applicable too :-( Any other suggestion ? Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Sun Feb 6 15:58:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D9AF98B9C8A for ; Sun, 6 Feb 2005 15:58:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28887-05 for ; Sun, 6 Feb 2005 15:57:54 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id D416A8B9E5C for ; Sun, 6 Feb 2005 15:57:58 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1CxonE-0000oN-00; Sun, 06 Feb 2005 10:57:48 -0500 To: lutzeb@aeccom.com Cc: Greg Stark , pgsql-performance@postgresql.org, tgl@sss.pgh.pa.us, john@arbash-meinel.com Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <42061B35.6000306@aeccom.com> In-Reply-To: <42061B35.6000306@aeccom.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 06 Feb 2005 10:57:48 -0500 Message-ID: <876515k7er.fsf@stark.xeocode.com> Lines: 9 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/89 X-Sequence-Number: 10418 I gave a bunch of "explain analyze select" commands to test estimates for individual columns. What results do they come up with? If those are inaccurate then raising the statistics target is a good route. If those are accurate individually but the combination is inaccurate then you have a more difficult problem. -- greg From pgsql-performance-owner@postgresql.org Wed Feb 9 05:56:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4C2AF8B9CD1 for ; Sun, 6 Feb 2005 16:04:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28998-09 for ; Sun, 6 Feb 2005 16:04:30 +0000 (GMT) Received: from mailout09.sul.t-online.com (mailout09.sul.t-online.com [194.25.134.84]) by svr1.postgresql.org (Postfix) with ESMTP id 6FCB68B9E2E for ; Sun, 6 Feb 2005 16:04:29 +0000 (GMT) Received: from fwd08.aul.t-online.de by mailout09.sul.t-online.com with smtp id 1CxotW-0004nf-05; Sun, 06 Feb 2005 17:04:18 +0100 Received: from [192.168.0.70] (bKcSHaZVoexvEPeq-IFG2y0ErodEif9vosxSFUQ0EFnHaFBA4awrwH@[217.86.175.49]) by fwd08.sul.t-online.com with esmtp id 1CxotK-18wtN20; Sun, 6 Feb 2005 17:04:06 +0100 Message-ID: <42063FF5.9040707@aeccom.com> Date: Sun, 06 Feb 2005 17:04:05 +0100 From: Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) Reply-To: lutzeb@aeccom.com User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John A Meinel Cc: Greg Stark , pgsql-performance@postgresql.org, tgl@sss.pgh.pa.us Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <42061B35.6000306@aeccom.com> <4206356C.9060308@arbash-meinel.com> In-Reply-To: <4206356C.9060308@arbash-meinel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: bKcSHaZVoexvEPeq-IFG2y0ErodEif9vosxSFUQ0EFnHaFBA4awrwH X-TOI-MSGID: 82ed85ff-db8a-497e-a6b9-8c2a522036b2 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/129 X-Sequence-Number: 10458 John, I'm doing VACUUM ANALYZE once a night. Before the tests I did VACUUM and then ANALYZE. Dirk John A Meinel wrote: > Dirk Lutzebaeck wrote: > >> Greg, >> >> Thanks for your analysis. But I dont get any better after bumping >> STATISTICS target from 10 to 200. >> explain analyze shows that the optimizer is still way off estimating >> the rows. Is this normal? It still produces a 1 GB temp file. >> I simplified the query a bit, now only two tables are involved (bi, >> df). I also vacuumed. > > > > Are you just doing VACUUM? Or are you doing VACUUM ANALYZE? You might > also try VACUUM ANALYZE FULL (in the case that you have too many dead > tuples in the table). > > VACUUM cleans up, but doesn't adjust any planner statistics without > ANALYZE. > > John > =:-> > From pgsql-performance-owner@postgresql.org Wed Feb 9 05:59:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 384F08B9CE7 for ; Sun, 6 Feb 2005 16:12:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30020-08 for ; Sun, 6 Feb 2005 16:12:39 +0000 (GMT) Received: from mailout09.sul.t-online.com (mailout09.sul.t-online.com [194.25.134.84]) by svr1.postgresql.org (Postfix) with ESMTP id 3B01F8B9E60 for ; Sun, 6 Feb 2005 16:12:35 +0000 (GMT) Received: from fwd01.aul.t-online.de by mailout09.sul.t-online.com with smtp id 1Cxp1P-0006Sv-04; Sun, 06 Feb 2005 17:12:27 +0100 Received: from [192.168.0.70] (Z2qdcTZXre5mKVsmgGrjxL+D7SLWB0s7Eu7Xfo8Gt8umMQLsdaHskY@[217.86.175.49]) by fwd01.sul.t-online.com with esmtp id 1Cxp1H-0Spvzk0; Sun, 6 Feb 2005 17:12:19 +0100 Message-ID: <420641E3.10505@aeccom.com> Date: Sun, 06 Feb 2005 17:12:19 +0100 From: Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) Reply-To: lutzeb@aeccom.com User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Greg Stark Cc: pgsql-performance@postgresql.org, tgl@sss.pgh.pa.us, john@arbash-meinel.com Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <42061B35.6000306@aeccom.com> <876515k7er.fsf@stark.xeocode.com> In-Reply-To: <876515k7er.fsf@stark.xeocode.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: Z2qdcTZXre5mKVsmgGrjxL+D7SLWB0s7Eu7Xfo8Gt8umMQLsdaHskY X-TOI-MSGID: e7942f6b-4d83-4cca-9626-b06bc431a275 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/130 X-Sequence-Number: 10459 Greg Stark wrote: >I gave a bunch of "explain analyze select" commands to test estimates for >individual columns. What results do they come up with? If those are inaccurate >then raising the statistics target is a good route. If those are accurate >individually but the combination is inaccurate then you have a more difficult >problem. > > > After setting the new statistics target to 200 they did slightly better but not accurate. The results were attached to my last post. Here is a copy: explain analyze select * from bi where rc=130170467; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Seq Scan on bi (cost=0.00..41078.76 rows=190960 width=53) (actual time=0.157..3066.028 rows=513724 loops=1) Filter: (rc = 130170467::oid) Total runtime: 4208.663 ms (3 rows) explain analyze select * from bi where co=117305223; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Seq Scan on bi (cost=0.00..41078.76 rows=603988 width=53) (actual time=0.021..3692.238 rows=945487 loops=1) Filter: (co = 117305223::oid) Total runtime: 5786.268 ms (3 rows) Here is the distribution of the data in bi: select count(*) from bi; 1841966 select count(*) from bi where rc=130170467::oid; 513732 select count(*) from bi where co=117305223::oid; 945503 From pgsql-performance-owner@postgresql.org Sun Feb 6 16:43:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0E7E88B9EA0 for ; Sun, 6 Feb 2005 16:43:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32571-01 for ; Sun, 6 Feb 2005 16:43:05 +0000 (GMT) Received: from smtp106.mail.sc5.yahoo.com (smtp106.mail.sc5.yahoo.com [66.163.169.226]) by svr1.postgresql.org (Postfix) with SMTP id 5F63A8B9E09 for ; Sun, 6 Feb 2005 16:43:04 +0000 (GMT) Received: from unknown (HELO jupiter.black-lion.info) (janwieck@68.80.245.191 with login) by smtp106.mail.sc5.yahoo.com with SMTP; 6 Feb 2005 16:43:02 -0000 Received: from [172.21.8.128] ([192.168.192.101]) (authenticated bits=0) by jupiter.black-lion.info (8.12.10/8.12.9) with ESMTP id j16GglL3022148; Sun, 6 Feb 2005 11:42:52 -0500 (EST) (envelope-from JanWieck@Yahoo.com) Message-ID: <42064901.7000702@Yahoo.com> Date: Sun, 06 Feb 2005 11:42:41 -0500 From: Jan Wieck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jean-Max Reymond Cc: =?ISO-8859-1?Q?Herv=E9_Piedvache?= , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <4b09a0c05012006236b40489d@mail.gmail.com> In-Reply-To: <4b09a0c05012006236b40489d@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.321 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/90 X-Sequence-Number: 10419 On 1/20/2005 9:23 AM, Jean-Max Reymond wrote: > On Thu, 20 Jan 2005 15:03:31 +0100, Herv� Piedvache wrote: > >> We were at this moment thinking about a Cluster solution ... We saw on the >> Internet many solution talking about Cluster solution using MySQL ... but >> nothing about PostgreSQL ... the idea is to use several servers to make a >> sort of big virtual server using the disk space of each server as one, and >> having the ability to use the CPU and RAM of each servers in order to >> maintain good service performance ...one can imagin it is like a GFS but >> dedicated to postgreSQL... >> > > forget mysql cluster for now. Sorry for the late reply. I'd second that. I was just on the Solutions Linux in Paris and spoke with MySQL people. There were some questions I had around the new NDB cluster tables and I stopped by at their booth. My question if there are any plans to add foreign key support to NDB cluster tables got answered with "it will definitely be in the next version, which is the one containing NDB cluster, so yes, it will support foreign key from the start". Back home I found some more time to investigate and found this forum article http://lists.mysql.com/cluster/1442 posted by a MySQL AB senior software architect, where he says exactly the opposite. I don't know about your application, but trust me that maintaining proper referential integrity on the application level against a multimaster clustered database isn't that easy. So this is in fact a very important question. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # From pgsql-performance-owner@postgresql.org Sun Feb 6 16:46:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2C3678B9CD1 for ; Sun, 6 Feb 2005 16:46:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32572-03 for ; Sun, 6 Feb 2005 16:46:19 +0000 (GMT) Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu [129.255.60.186]) by svr1.postgresql.org (Postfix) with ESMTP id 615588B9E40 for ; Sun, 6 Feb 2005 16:46:18 +0000 (GMT) Received: from [192.168.1.11] (12-217-241-0.client.mchsi.com [12.217.241.0]) by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id j16Gk8311255; Sun, 6 Feb 2005 10:46:08 -0600 Message-ID: <420649CE.5030101@arbash-meinel.com> Date: Sun, 06 Feb 2005 10:46:06 -0600 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: lutzeb@aeccom.com Cc: Greg Stark , pgsql-performance@postgresql.org, tgl@sss.pgh.pa.us Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <42061B35.6000306@aeccom.com> <876515k7er.fsf@stark.xeocode.com> <420641E3.10505@aeccom.com> In-Reply-To: <420641E3.10505@aeccom.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9BEA0CE258001EF29A2B0E12" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/91 X-Sequence-Number: 10420 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9BEA0CE258001EF29A2B0E12 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Dirk Lutzebaeck wrote: > Greg Stark wrote: > >> I gave a bunch of "explain analyze select" commands to test estimates >> for >> individual columns. What results do they come up with? If those are >> inaccurate >> then raising the statistics target is a good route. If those are >> accurate >> individually but the combination is inaccurate then you have a more >> difficult >> problem. >> >> >> > After setting the new statistics target to 200 they did slightly > better but not accurate. The results were attached to my last post. > Here is a copy: > > It does seem that setting the statistics to a higher value would help. Since rc=130170467 seems to account for almost 1/3 of the data. Probably you have other values that are much less common. So setting a high statistics target would help the planner realize that this value occurs at a different frequency from the other ones. Can you try other numbers and see what the counts are? I assume you did do a vacuum analyze after adjusting the statistics target. Also interesting that in the time it took you to place these queries, you had received 26 new rows. And finally, what is the row count if you do explain analyze select * from bi where rc=130170467::oid and co=117305223::oid; If this is a lot less than say 500k, then probably you aren't going to be helped a lot. The postgresql statistics engine doesn't generate cross column statistics. It always assumes random distribution of data. So if two columns are correlated (or anti-correlated), it won't realize that. Even so, your original desire was to reduce the size of the intermediate step (where you have 700k rows). So you need to try and design a subselect on bi which is as restrictive as possible, so that you don't get all of these rows. With any luck, the planner will realize ahead of time that there won't be that many rows, and can use indexes, etc. But even if it doesn't use an index scan, if you have a query that doesn't use a lot of rows, then you won't need a lot of disk space. John =:-> > > explain analyze select * from bi where rc=130170467; > QUERY PLAN > ------------------------------------------------------------------------------------------------------------------- > > Seq Scan on bi (cost=0.00..41078.76 rows=190960 width=53) (actual > time=0.157..3066.028 rows=513724 loops=1) > Filter: (rc = 130170467::oid) > Total runtime: 4208.663 ms > (3 rows) > > > explain analyze select * from bi where co=117305223; > QUERY PLAN > ------------------------------------------------------------------------------------------------------------------- > > Seq Scan on bi (cost=0.00..41078.76 rows=603988 width=53) (actual > time=0.021..3692.238 rows=945487 loops=1) > Filter: (co = 117305223::oid) > Total runtime: 5786.268 ms > (3 rows) > > Here is the distribution of the data in bi: > select count(*) from bi; > > 1841966 > > > select count(*) from bi where rc=130170467::oid; > > 513732 > > > select count(*) from bi where co=117305223::oid; > > 945503 > > > --------------enig9BEA0CE258001EF29A2B0E12 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCBknOJdeBCYSNAAMRAvedAKCr+93G7Nn4sEmb+vrsv9T2m1AKpACfU+TZ hLEmJ2K7cyl/uH6DsbuGp78= =59Zj -----END PGP SIGNATURE----- --------------enig9BEA0CE258001EF29A2B0E12-- From pgsql-performance-owner@postgresql.org Sun Feb 6 17:16:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4E7C88B9E85 for ; Sun, 6 Feb 2005 17:16:41 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34759-07 for ; Sun, 6 Feb 2005 17:16:17 +0000 (GMT) Received: from e2.ny.us.ibm.com (e2.ny.us.ibm.com [32.97.182.142]) by svr1.postgresql.org (Postfix) with ESMTP id CBEFF8B9B2B for ; Sun, 6 Feb 2005 17:16:16 +0000 (GMT) Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e2.ny.us.ibm.com (8.12.10/8.12.10) with ESMTP id j16HGF7J001968 for ; Sun, 6 Feb 2005 12:16:15 -0500 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j16HGFhD166190 for ; Sun, 6 Feb 2005 12:16:15 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j16HGF3F016960 for ; Sun, 6 Feb 2005 12:16:15 -0500 Received: from d01ml255.pok.ibm.com (d01ml255.pok.ibm.com [9.56.227.128]) by d01av04.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j16HGFJV016957 for ; Sun, 6 Feb 2005 12:16:15 -0500 Subject: Are JOINs allowed with DELETE FROM To: pgsql-performance@postgresql.org X-Mailer: Lotus Notes Release 6.0.2CF1 June 9, 2003 Message-ID: From: Steven Rosenstein Date: Sun, 6 Feb 2005 12:16:13 -0500 X-MIMETrack: Serialize by Router on D01ML255/01/M/IBM(Release 6.53HF103 | November 15, 2004) at 02/06/2005 12:16:14 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.262 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/92 X-Sequence-Number: 10421 This is probably a very trivial question and I feel foolish in even posting it, but I cannot seem to get it to work. SCENARIO (abstracted): Two tables, "summary" and "detail". The schema of summary looks like: id int serial sequential record id collect_date date date the detail events were collected The schema of detail looks like: id int serial sequential record id sum_id int the id of the parent record in the summary table details text a particular event's details The relationship is obvious. If I want to extract all the detail records for a particular date (2/5/05), I construct a query as follows: SELECT * FROM detail JOIN summary ON (summary.id=detail.sum_id) WHERE collect_date='2005-02-05'; Now... I want to *delete* all the detail records for a particular date, I tried: DELETE FROM detail JOIN summary ON (summary.id=detail.sum_id) WHERE collect_date='2005-02-05'; But I keep getting a parser error. Am I not allowed to use JOINs in a DELETE statement, or am I just fat-fingering the SQL text somewhere. If I'm *not* allowed to use a JOIN with a DELETE, what is the best workaround? I want to delete just the records in the detail table, and not its parent summary record. Thanks in advance for your help, --- Steve ___________________________________________________________________________________ Steven Rosenstein IT Architect/Developer | IBM Virtual Server Administration Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 Text Messaging: 6463456978 @ mobile.mycingular.com Email: srosenst @ us.ibm.com "Learn from the mistakes of others because you can't live long enough to make them all yourself." -- Eleanor Roosevelt From pgsql-performance-owner@postgresql.org Sun Feb 6 17:17:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 121508B9E98 for ; Sun, 6 Feb 2005 17:17:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34547-10 for ; Sun, 6 Feb 2005 17:17:07 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D2CEE8B9E40 for ; Sun, 6 Feb 2005 17:17:06 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j16HGsNe004860; Sun, 6 Feb 2005 12:16:55 -0500 (EST) To: lutzeb@aeccom.com Cc: Greg Stark , pgsql-performance@postgresql.org, john@arbash-meinel.com Subject: Re: query produces 1 GB temp file In-reply-to: <42061B35.6000306@aeccom.com> References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <42061B35.6000306@aeccom.com> Comments: In-reply-to Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) message dated "Sun, 06 Feb 2005 14:27:17 +0100" Date: Sun, 06 Feb 2005 12:16:54 -0500 Message-ID: <4859.1107710214@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/93 X-Sequence-Number: 10422 Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) writes: > SELECT DISTINCT ON (df.val_9, df.created, df.flatid) df.docindex, > df.flatobj, bi.oid, bi.en > FROM bi,df > WHERE bi.rc=130170467 > ... > ORDER BY df.val_9 ASC, df.created DESC > LIMIT 1000 OFFSET 0 Just out of curiosity, what is this query supposed to *do* exactly? It looks to me like it will give indeterminate results. Practical uses of DISTINCT ON generally specify more ORDER BY columns than there are DISTINCT ON columns, because the extra columns determine which rows have priority to survive the DISTINCT filter. With the above query, you have absolutely no idea which row will be output for a given combination of val_9/created/flatid. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Feb 9 06:07:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C16208B9CCC for ; Sun, 6 Feb 2005 17:19:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35343-03 for ; Sun, 6 Feb 2005 17:19:03 +0000 (GMT) Received: from mailout01.sul.t-online.com (mailout01.sul.t-online.com [194.25.134.80]) by svr1.postgresql.org (Postfix) with ESMTP id E51D88B9CD1 for ; Sun, 6 Feb 2005 17:19:00 +0000 (GMT) Received: from fwd05.aul.t-online.de by mailout01.sul.t-online.com with smtp id 1Cxq3d-0000Zn-02; Sun, 06 Feb 2005 18:18:49 +0100 Received: from [192.168.0.70] (G-FLXkZ6ge7CFIsf+76u2-0t88YBEQxuem4tWdGjU0HLbRp-FRAN8Z@[217.86.175.49]) by fwd05.sul.t-online.com with esmtp id 1Cxq3P-0LQiJs0; Sun, 6 Feb 2005 18:18:35 +0100 Message-ID: <4206516B.9010704@aeccom.com> Date: Sun, 06 Feb 2005 18:18:35 +0100 From: Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) Reply-To: lutzeb@aeccom.com User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John A Meinel Cc: Greg Stark , pgsql-performance@postgresql.org, tgl@sss.pgh.pa.us Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <42061B35.6000306@aeccom.com> <876515k7er.fsf@stark.xeocode.com> <420641E3.10505@aeccom.com> <420649CE.5030101@arbash-meinel.com> In-Reply-To: <420649CE.5030101@arbash-meinel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: G-FLXkZ6ge7CFIsf+76u2-0t88YBEQxuem4tWdGjU0HLbRp-FRAN8Z X-TOI-MSGID: 629f237d-3cfb-4dd1-a886-f0f966cc4b3e X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/133 X-Sequence-Number: 10462 John A Meinel wrote: > Dirk Lutzebaeck wrote: > >> Greg Stark wrote: >> >>> I gave a bunch of "explain analyze select" commands to test >>> estimates for >>> individual columns. What results do they come up with? If those are >>> inaccurate >>> then raising the statistics target is a good route. If those are >>> accurate >>> individually but the combination is inaccurate then you have a more >>> difficult >>> problem. >>> >>> >>> >> After setting the new statistics target to 200 they did slightly >> better but not accurate. The results were attached to my last post. >> Here is a copy: >> >> > It does seem that setting the statistics to a higher value would help. > Since rc=130170467 seems to account for almost 1/3 of the data. > Probably you have other values that are much less common. So setting a > high statistics target would help the planner realize that this value > occurs at a different frequency from the other ones. Can you try other > numbers and see what the counts are? There is not much effect when increasing statistics target much higher. I guess this is because rc=130170467 takes a large portion of the column distribution. > I assume you did do a vacuum analyze after adjusting the statistics > target. Yes. > Also interesting that in the time it took you to place these queries, > you had received 26 new rows. Yes, it's a live system... > And finally, what is the row count if you do > explain analyze select * from bi where rc=130170467::oid and > co=117305223::oid; explain analyze select * from bi where rc=130170467::oid and co=117305223::oid; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Seq Scan on bi (cost=0.00..43866.19 rows=105544 width=51) (actual time=0.402..3724.222 rows=513732 loops=1) Filter: ((rc = 130170467::oid) AND (co = 117305223::oid)) Well both columns data take about 1/4 of the whole table. There is not much distributed data. So it needs to do full scans... > If this is a lot less than say 500k, then probably you aren't going to > be helped a lot. The postgresql statistics engine doesn't generate > cross column statistics. It always assumes random distribution of > data. So if two columns are correlated (or anti-correlated), it won't > realize that. 105k, that seems to be may problem. No much random data. Does 8.0 address this problem? > Even so, your original desire was to reduce the size of the > intermediate step (where you have 700k rows). So you need to try and > design a subselect on bi which is as restrictive as possible, so that > you don't get all of these rows. With any luck, the planner will > realize ahead of time that there won't be that many rows, and can use > indexes, etc. But even if it doesn't use an index scan, if you have a > query that doesn't use a lot of rows, then you won't need a lot of > disk space. I'll try that. What I have already noticed it that one of my output column is quite large so that's why it uses so much temp space. I'll probably need to sort without that output column and read it in afterwards using a subselect on the limted result. Thanks for your help, Dirk > > John > =:-> > >> >> explain analyze select * from bi where rc=130170467; >> QUERY PLAN >> ------------------------------------------------------------------------------------------------------------------- >> >> Seq Scan on bi (cost=0.00..41078.76 rows=190960 width=53) (actual >> time=0.157..3066.028 rows=513724 loops=1) >> Filter: (rc = 130170467::oid) >> Total runtime: 4208.663 ms >> (3 rows) >> >> >> explain analyze select * from bi where co=117305223; >> QUERY PLAN >> ------------------------------------------------------------------------------------------------------------------- >> >> Seq Scan on bi (cost=0.00..41078.76 rows=603988 width=53) (actual >> time=0.021..3692.238 rows=945487 loops=1) >> Filter: (co = 117305223::oid) >> Total runtime: 5786.268 ms >> (3 rows) >> >> Here is the distribution of the data in bi: >> select count(*) from bi; >> >> 1841966 >> >> >> select count(*) from bi where rc=130170467::oid; >> >> 513732 >> >> >> select count(*) from bi where co=117305223::oid; >> >> 945503 >> >> >> > From pgsql-performance-owner@postgresql.org Wed Feb 9 06:09:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CBF188B9E98 for ; Sun, 6 Feb 2005 17:26:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36040-02 for ; Sun, 6 Feb 2005 17:26:45 +0000 (GMT) Received: from mailout04.sul.t-online.com (mailout04.sul.t-online.com [194.25.134.18]) by svr1.postgresql.org (Postfix) with ESMTP id 617658B9E8C for ; Sun, 6 Feb 2005 17:26:44 +0000 (GMT) Received: from fwd04.aul.t-online.de by mailout04.sul.t-online.com with smtp id 1CxqB8-0001Wr-03; Sun, 06 Feb 2005 18:26:34 +0100 Received: from [192.168.0.70] (TWwQ2oZ1re3UuZi3w+KeX0zWBja7Er6STGej4ttrQtGQDtMfSYZtrj@[217.86.175.49]) by fwd04.sul.t-online.com with esmtp id 1CxqB4-1p0pCy0; Sun, 6 Feb 2005 18:26:30 +0100 Message-ID: <42065346.7000400@aeccom.com> Date: Sun, 06 Feb 2005 18:26:30 +0100 From: Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) Reply-To: lutzeb@aeccom.com User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Greg Stark , pgsql-performance@postgresql.org, john@arbash-meinel.com Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <42061B35.6000306@aeccom.com> <4859.1107710214@sss.pgh.pa.us> In-Reply-To: <4859.1107710214@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: TWwQ2oZ1re3UuZi3w+KeX0zWBja7Er6STGej4ttrQtGQDtMfSYZtrj X-TOI-MSGID: 830e8a0d-69a0-4130-98eb-190fd8d31faf X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/134 X-Sequence-Number: 10463 Tom, the orginal query has more output columns. I reduced it for readability. Specifically it returns a persitent object (flatobj column) which needs to be processed by the application as the returned result. The problem of the huge sort space usage seems to be that the flatobj is part of the row, so it used always copied in the sort algorithm I guess. When I drop the flatobj from the output columns the size of the temp space file drops dramatically. So I'll probably need to read flatobj after the sorting from the limited return result in a subselect. Regards, Dirk Tom Lane wrote: >Dirk.Lutzebaeck@t-online.de (Dirk Lutzebaeck) writes: > > >>SELECT DISTINCT ON (df.val_9, df.created, df.flatid) df.docindex, >>df.flatobj, bi.oid, bi.en >>FROM bi,df >>WHERE bi.rc=130170467 >>... >>ORDER BY df.val_9 ASC, df.created DESC >>LIMIT 1000 OFFSET 0 >> >> > >Just out of curiosity, what is this query supposed to *do* exactly? >It looks to me like it will give indeterminate results. Practical >uses of DISTINCT ON generally specify more ORDER BY columns than >there are DISTINCT ON columns, because the extra columns determine >which rows have priority to survive the DISTINCT filter. With the >above query, you have absolutely no idea which row will be output >for a given combination of val_9/created/flatid. > > regards, tom lane > > > From pgsql-performance-owner@postgresql.org Sun Feb 6 17:39:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 023E38B9EA3 for ; Sun, 6 Feb 2005 17:39:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36600-09 for ; Sun, 6 Feb 2005 17:39:19 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id A29608B9CF6 for ; Sun, 6 Feb 2005 17:39:19 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 173CB31DD9; Sun, 6 Feb 2005 18:39:19 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: Are JOINs allowed with DELETE FROM Date: Sun, 06 Feb 2005 18:36:03 +0100 Organization: PYRENET Midi-pyrenees Provider Lines: 17 Message-ID: <42065583.6010304@bigfoot.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr To: Steven Rosenstein User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.11 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200502/94 X-Sequence-Number: 10423 Steven Rosenstein wrote: > DELETE FROM detail JOIN summary ON (summary.id=detail.sum_id) WHERE > collect_date='2005-02-05'; DELETE FROM detail WHERE detail.sum_id in ( select id from summary ) AND collect_date='2005-02-05'; Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Sun Feb 6 17:51:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 524518B9E89 for ; Sun, 6 Feb 2005 17:51:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37983-07 for ; Sun, 6 Feb 2005 17:50:37 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 9BCBD8B9B2B for ; Sun, 6 Feb 2005 17:50:34 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id j16HoTdw015619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 6 Feb 2005 10:50:32 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id j16HoTGH089157; Sun, 6 Feb 2005 10:50:29 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j16HoTVk089156; Sun, 6 Feb 2005 10:50:29 -0700 (MST) (envelope-from mfuhr) Date: Sun, 6 Feb 2005 10:50:29 -0700 From: Michael Fuhr To: Steven Rosenstein Cc: pgsql-performance@postgresql.org Subject: Re: Are JOINs allowed with DELETE FROM Message-ID: <20050206175029.GA89095@winnie.fuhr.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/95 X-Sequence-Number: 10424 On Sun, Feb 06, 2005 at 12:16:13PM -0500, Steven Rosenstein wrote: > > DELETE FROM detail JOIN summary ON (summary.id=detail.sum_id) WHERE > collect_date='2005-02-05'; > > But I keep getting a parser error. Am I not allowed to use JOINs in a > DELETE statement, or am I just fat-fingering the SQL text somewhere. See the documentation for DELETE: http://www.postgresql.org/docs/8.0/static/sql-delete.html If you intend to delete the date's record from the summary table, then the detail table could use a foreign key constraint defined with ON DELETE CASCADE. Deleting a record from summary would then automatically delete all associated records in detail. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Sun Feb 6 17:59:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D2D4E8B9E8C for ; Sun, 6 Feb 2005 17:59:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39541-02 for ; Sun, 6 Feb 2005 17:59:05 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 5287B8B9CFE for ; Sun, 6 Feb 2005 17:59:01 +0000 (GMT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.2/8.12.9) with ESMTP id j16HwqsJ000294; (envelope-from ) Sun, 6 Feb 2005 11:58:52 -0600 (CST) Received: from [192.168.1.100] (12-217-241-0.client.mchsi.com [12.217.241.0]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j16HwlUT023594 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Sun, 6 Feb 2005 11:58:51 -0600 (CST) Message-ID: <42065AD5.50001@arbash-meinel.com> Date: Sun, 06 Feb 2005 11:58:45 -0600 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gaetano Mendola Cc: Steven Rosenstein , pgsql-performance@postgresql.org Subject: Re: Are JOINs allowed with DELETE FROM References: <42065583.6010304@bigfoot.com> In-Reply-To: <42065583.6010304@bigfoot.com> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigA7AB0C7ACCAF7EFB054C9BC9" X-Virus-Scanned: ClamAV 0.80/682/Mon Jan 24 12:53:43 2005 clamav-milter version 0.80j on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV 0.80/685/Wed Jan 26 03:08:24 2005, clamav-milter version 0.75 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/96 X-Sequence-Number: 10425 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA7AB0C7ACCAF7EFB054C9BC9 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Gaetano Mendola wrote: > Steven Rosenstein wrote: > >> DELETE FROM detail JOIN summary ON (summary.id=detail.sum_id) WHERE >> collect_date='2005-02-05'; > > You have to tell it what table you are deleting from. Select * from A join B is both tables. What you want to do is fix the where clause. > DELETE FROM detail WHERE detail.sum_id in ( select id from summary ) > AND collect_date='2005-02-05'; > I'm guessing this should actually be DELETE FROM detail WHERE detail.sum_id in ( SELECT id FROM summary WHERE collect_date='2005-02-05' ); Otherwise you wouldn't really need the join. You have to come up with a plan that yields rows that are in the table you want to delete. The rows that result from select * from detail join summary, contain values from both tables. If you want to delete from both tables, I think this has to be 2 deletes. Probably best to be in a transaction. BEGIN; DELETE FROM detail WHERE ... DELETE FROM summary WHERE collect_date = '2005-02-05'; COMMIT; > > Regards > Gaetano Mendola > John =:-> --------------enigA7AB0C7ACCAF7EFB054C9BC9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCBlrZJdeBCYSNAAMRAr4qAKC96BZBGteuI+C4RjW3tsCms+dQxQCfQtXi sSRN12t0CIqGJMkkipw5QJI= =cu5M -----END PGP SIGNATURE----- --------------enigA7AB0C7ACCAF7EFB054C9BC9-- From pgsql-performance-owner@postgresql.org Sun Feb 6 19:33:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 575868B9CC3 for ; Sun, 6 Feb 2005 19:33:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47035-03 for ; Sun, 6 Feb 2005 19:33:22 +0000 (GMT) Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com [32.97.182.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3A4898B9B16 for ; Sun, 6 Feb 2005 19:33:22 +0000 (GMT) Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e4.ny.us.ibm.com (8.12.10/8.12.10) with ESMTP id j16JXIBA015921 for ; Sun, 6 Feb 2005 14:33:18 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j16JXIhD213734 for ; Sun, 6 Feb 2005 14:33:18 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j16JXI6W030383 for ; Sun, 6 Feb 2005 14:33:18 -0500 Received: from d01ml255.pok.ibm.com (d01ml255.pok.ibm.com [9.56.227.128]) by d01av02.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j16JXIrs030380 for ; Sun, 6 Feb 2005 14:33:18 -0500 In-Reply-To: <20050206175029.GA89095@winnie.fuhr.org> Subject: Re: Are JOINs allowed with DELETE FROM To: pgsql-performance@postgresql.org X-Mailer: Lotus Notes Release 6.0.2CF1 June 9, 2003 Message-ID: From: Steven Rosenstein Date: Sun, 6 Feb 2005 14:33:16 -0500 X-MIMETrack: Serialize by Router on D01ML255/01/M/IBM(Release 6.53HF103 | November 15, 2004) at 02/06/2005 14:33:17 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.267 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/97 X-Sequence-Number: 10426 Hi Michael, Thank you for the link to the documentation page. I forgot to mention that we're still using version 7.3. When I checked the 7.3 documentation for DELETE, there was no mention of being able to use fields from different tables in a WHERE clause. This feature must have been added in a subsequent release of PostgreSQL. Gaetano & John: I *did* try your suggestion. However, there were so many summary ID's returned (9810 to be exact) that the DELETE seemed to be taking forever. Here's an actual SELECT query that I ran as a test: vsa=# vacuum analyze verbose vsa.tbl_win_patch_scan; [This is the "summary" table from my abstracted example] INFO: --Relation vsa.tbl_win_patch_scan-- INFO: Pages 374: Changed 0, Empty 0; Tup 10485: Vac 0, Keep 0, UnUsed 0. Total CPU 0.01s/0.00u sec elapsed 0.00 sec. INFO: --Relation pg_toast.pg_toast_39384-- INFO: Pages 62679: Changed 0, Empty 0; Tup 254116: Vac 0, Keep 0, UnUsed 0. Total CPU 0.86s/0.21u sec elapsed 13.79 sec. INFO: Analyzing vsa.tbl_win_patch_scan VACUUM Time: 18451.32 ms vsa=# vacuum analyze verbose vsa.tbl_win_patch_scan_item; [This is the "detail" table from my abstracted example] INFO: --Relation vsa.tbl_win_patch_scan_item-- INFO: Pages 110455: Changed 0, Empty 0; Tup 752066: Vac 0, Keep 0, UnUsed 0. Total CPU 2.23s/0.45u sec elapsed 42.07 sec. INFO: --Relation pg_toast.pg_toast_39393-- INFO: Pages 2464: Changed 0, Empty 0; Tup 14780: Vac 0, Keep 0, UnUsed 0. Total CPU 0.02s/0.02u sec elapsed 2.31 sec. INFO: Analyzing vsa.tbl_win_patch_scan_item VACUUM Time: 62075.52 ms vsa=# explain analyze SELECT * FROM vsa.tbl_win_patch_scan_item WHERE win_patch_scan_id IN (SELECT id FROM vsa.tbl_win_patch_scan WHERE scan_datetime < '2004-09-01 00:00:00'); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------- Seq Scan on tbl_win_patch_scan_item (cost=0.00..379976970.68 rows=376033 width=1150) (actual time=11.50..27373.29 rows=62 loops=1) Filter: (subplan) SubPlan -> Materialize (cost=505.06..505.11 rows=4 width=4) (actual time=0.00..0.00 rows=2 loops=752066) -> Seq Scan on tbl_win_patch_scan (cost=0.00..505.06 rows=4 width=4) (actual time=0.03..11.16 rows=2 loops=1) Filter: (scan_datetime < '2004-09-01 00:00:00'::timestamp without time zone) Total runtime: 27373.65 msec (7 rows) Time: 27384.12 ms I put in a very early date (2004-09-01) because I knew there would be very few rows to look at (2 rows in vsa.tbl_win_patch_scan meet the date criteria, and a total of 62 rows in vsa.tbl_win_patch_scan_item match either of the two tbl_win_patch_scan ID's returned in the WHERE subquery). Can anyone see a way of optimizing this so that it runs faster? The real date I should be using is 2004-12-06 (~60 days retention), and when I do use it, the query seems to take forever. I ran a number explan analyzes with different scan_datetimes, and it seems that the execution time increases exponentially with the number of rows (ID's) returned by the subquery. Running top shows that the EXPLAIN is entirely CPU-bound. There is no disk I/O during any query execution: DATE=2004-09-01; SUMMARY ROWS=2; DETAIL ROWS=62; TIME=27.37 sec (Included initial query cache loading effect) vsa=# explain analyze SELECT * FROM vsa.tbl_win_patch_scan_item WHERE win_patch_scan_id IN (SELECT id FROM vsa.tbl_win_patch_scan WHERE scan_datetime < '2004-09-01 00:00:00'); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------- Seq Scan on tbl_win_patch_scan_item (cost=0.00..379976970.68 rows=376033 width=1150) (actual time=11.50..27373.29 rows=62 loops=1) Filter: (subplan) SubPlan -> Materialize (cost=505.06..505.11 rows=4 width=4) (actual time=0.00..0.00 rows=2 loops=752066) -> Seq Scan on tbl_win_patch_scan (cost=0.00..505.06 rows=4 width=4) (actual time=0.03..11.16 rows=2 loops=1) Filter: (scan_datetime < '2004-09-01 00:00:00'::timestamp without time zone) Total runtime: 27373.65 msec (7 rows) Time: 27384.12 ms DATE=2004-09-02; SUMMARY ROWS=2; DETAIL ROWS=62; TIME=8.26 sec vsa=# explain analyze SELECT * FROM vsa.tbl_win_patch_scan_item WHERE win_patch_scan_id IN (SELECT id FROM vsa.tbl_win_patch_scan WHERE scan_datetime < '2004-09-02 00:00:00'); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ Seq Scan on tbl_win_patch_scan_item (cost=0.00..380115740.80 rows=376033 width=1142) (actual time=10.42..8259.79 rows=62 loops=1) Filter: (subplan) SubPlan -> Materialize (cost=505.06..505.48 rows=41 width=4) (actual time=0.00..0.00 rows=2 loops=752066) -> Seq Scan on tbl_win_patch_scan (cost=0.00..505.06 rows=41 width=4) (actual time=0.02..10.08 rows=2 loops=1) Filter: (scan_datetime < '2004-09-02 00:00:00'::timestamp without time zone) Total runtime: 8259.91 msec (7 rows) Time: 8263.52 ms DATE=2004-09-05; SUMMARY ROWS=3; DETAIL ROWS=93; TIME=5.61 sec vsa=# explain analyze SELECT * FROM vsa.tbl_win_patch_scan_item WHERE win_patch_scan_id IN (SELECT id FROM vsa.tbl_win_patch_scan WHERE scan_datetime < '2004-09-05 00:00:00'); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ Seq Scan on tbl_win_patch_scan_item (cost=0.00..380531977.65 rows=376033 width=1142) (actual time=10.11..5616.68 rows=93 loops=1) Filter: (subplan) SubPlan -> Materialize (cost=505.06..506.58 rows=152 width=4) (actual time=0.00..0.00 rows=3 loops=752066) -> Seq Scan on tbl_win_patch_scan (cost=0.00..505.06 rows=152 width=4) (actual time=0.02..10.05 rows=3 loops=1) Filter: (scan_datetime < '2004-09-05 00:00:00'::timestamp without time zone) Total runtime: 5616.81 msec (7 rows) Time: 5617.87 ms DATE=2004-09-15; SUMMARY ROWS=16; DETAIL ROWS=674; TIME=18.03 sec vsa=# explain analyze SELECT * FROM vsa.tbl_win_patch_scan_item WHERE win_patch_scan_id IN (SELECT id FROM vsa.tbl_win_patch_scan WHERE scan_datetime < '2004-09-15 00:00:00'); QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- Seq Scan on tbl_win_patch_scan_item (cost=0.00..381919433.78 rows=376033 width=1142) (actual time=10.18..18032.25 rows=674 loops=1) Filter: (subplan) SubPlan -> Materialize (cost=505.06..510.27 rows=521 width=4) (actual time=0.00..0.01 rows=16 loops=752066) -> Seq Scan on tbl_win_patch_scan (cost=0.00..505.06 rows=521 width=4) (actual time=0.02..10.11 rows=16 loops=1) Filter: (scan_datetime < '2004-09-15 00:00:00'::timestamp without time zone) Total runtime: 18032.72 msec (7 rows) Time: 18033.78 ms DATE=2004-09-16; SUMMARY ROWS=25; DETAIL ROWS=1131; TIME=26.22 sec vsa=# explain analyze SELECT * FROM vsa.tbl_win_patch_scan_item WHERE win_patch_scan_id IN (SELECT id FROM vsa.tbl_win_patch_scan WHERE scan_datetime < '2004-09-16 00:00:00'); QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- Seq Scan on tbl_win_patch_scan_item (cost=0.00..382058179.39 rows=376033 width=1142) (actual time=6.14..26218.56 rows=1131 loops=1) Filter: (subplan) SubPlan -> Materialize (cost=505.06..510.64 rows=558 width=4) (actual time=0.00..0.01 rows=25 loops=752066) -> Seq Scan on tbl_win_patch_scan (cost=0.00..505.06 rows=558 width=4) (actual time=0.01..6.09 rows=25 loops=1) Filter: (scan_datetime < '2004-09-16 00:00:00'::timestamp without time zone) Total runtime: 26219.24 msec (7 rows) Time: 26220.44 ms DATE=2004-09-17; SUMMARY ROWS=34; DETAIL ROWS=1588; TIME=34.97 sec vsa=# explain analyze SELECT * FROM vsa.tbl_win_patch_scan_item WHERE win_patch_scan_id IN (SELECT id FROM vsa.tbl_win_patch_scan WHERE scan_datetime < '2004-09-17 00:00:00'); QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- Seq Scan on tbl_win_patch_scan_item (cost=0.00..382196925.01 rows=376033 width=1142) (actual time=10.25..34965.95 rows=1588 loops=1) Filter: (subplan) SubPlan -> Materialize (cost=505.06..511.01 rows=595 width=4) (actual time=0.00..0.02 rows=34 loops=752066) -> Seq Scan on tbl_win_patch_scan (cost=0.00..505.06 rows=595 width=4) (actual time=0.02..10.16 rows=34 loops=1) Filter: (scan_datetime < '2004-09-17 00:00:00'::timestamp without time zone) Total runtime: 34966.90 msec (7 rows) Time: 34967.95 ms What I may end up doing is using the scripting language PHP to solve the issue by running one query just to return the summary table ID's, and then DELETE all the rows matching each ID individually by looping through the ID's. I was looking for something more elegant, but this will work if its the only solution. Thank you all for your help with this. --- Steve ___________________________________________________________________________________ Steven Rosenstein IT Architect/Developer | IBM Virtual Server Administration Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 Text Messaging: 6463456978 @ mobile.mycingular.com Email: srosenst @ us.ibm.com "Learn from the mistakes of others because you can't live long enough to make them all yourself." -- Eleanor Roosevelt Michael Fuhr To 02/06/2005 12:50 Steven Rosenstein/New PM York/IBM@IBMUS cc pgsql-performance@postgresql.org Subject Re: [PERFORM] Are JOINs allowed with DELETE FROM On Sun, Feb 06, 2005 at 12:16:13PM -0500, Steven Rosenstein wrote: > > DELETE FROM detail JOIN summary ON (summary.id=detail.sum_id) WHERE > collect_date='2005-02-05'; > > But I keep getting a parser error. Am I not allowed to use JOINs in a > DELETE statement, or am I just fat-fingering the SQL text somewhere. See the documentation for DELETE: http://www.postgresql.org/docs/8.0/static/sql-delete.html If you intend to delete the date's record from the summary table, then the detail table could use a foreign key constraint defined with ON DELETE CASCADE. Deleting a record from summary would then automatically delete all associated records in detail. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Sun Feb 6 19:50:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0E8898B9ED2 for ; Sun, 6 Feb 2005 19:50:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48701-02 for ; Sun, 6 Feb 2005 19:50:14 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1624E8B9EF0 for ; Sun, 6 Feb 2005 19:49:59 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j16Jnw9F011562; Sun, 6 Feb 2005 14:49:58 -0500 (EST) To: Steven Rosenstein Cc: pgsql-performance@postgresql.org Subject: Re: Are JOINs allowed with DELETE FROM In-reply-to: References: Comments: In-reply-to Steven Rosenstein message dated "Sun, 06 Feb 2005 14:33:16 -0500" Date: Sun, 06 Feb 2005 14:49:57 -0500 Message-ID: <11561.1107719397@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/98 X-Sequence-Number: 10427 Steven Rosenstein writes: > Thank you for the link to the documentation page. I forgot to mention that > we're still using version 7.3. When I checked the 7.3 documentation for > DELETE, there was no mention of being able to use fields from different > tables in a WHERE clause. This feature must have been added in a > subsequent release of PostgreSQL. No, it's been there all along, if perhaps not well documented. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Feb 6 19:51:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 601868B9F03 for ; Sun, 6 Feb 2005 19:51:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48865-03 for ; Sun, 6 Feb 2005 19:51:34 +0000 (GMT) Received: from e5.ny.us.ibm.com (e5.ny.us.ibm.com [32.97.182.145]) by svr1.postgresql.org (Postfix) with ESMTP id 99A548B9B19 for ; Sun, 6 Feb 2005 19:50:59 +0000 (GMT) Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.12.10/8.12.10) with ESMTP id j16Jow3n028567 for ; Sun, 6 Feb 2005 14:50:58 -0500 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j16JowhD175332 for ; Sun, 6 Feb 2005 14:50:58 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j16Jow9v000583 for ; Sun, 6 Feb 2005 14:50:58 -0500 Received: from d01ml255.pok.ibm.com (d01ml255.pok.ibm.com [9.56.227.128]) by d01av04.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j16JowKb000578 for ; Sun, 6 Feb 2005 14:50:58 -0500 Subject: Can the V7.3 EXPLAIN ANALYZE be trusted? To: pgsql-performance@postgresql.org X-Mailer: Lotus Notes Release 6.0.2CF1 June 9, 2003 Message-ID: From: Steven Rosenstein Date: Sun, 6 Feb 2005 14:50:56 -0500 X-MIMETrack: Serialize by Router on D01ML255/01/M/IBM(Release 6.53HF103 | November 15, 2004) at 02/06/2005 14:50:57 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.27 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/99 X-Sequence-Number: 10428 While working on a previous question I posed to this group, I ran a number of EXPLAIN ANALYZE's to provide as examples. After sending up my last email, I ran the same query *without* EXPLAIN ANALYZE. The runtimes were vastly different. In the following example, I ran two identical queries one right after the other. The runtimes for both was very close (44.77 sec). I then immediately ran the exact same query, but without EXPLAIN ANALYZE. The same number of rows was returned, but the runtime was only 8.7 sec. I don't think EXPLAIN ANALYZE puts that much overhead on a query. Does anyone have any idea what is going on here? --- Steve vsa=# explain analyze SELECT id,win_patch_scan_id FROM vsa.tbl_win_patch_scan_item WHERE win_patch_scan_id IN (SELECT id FROM vsa.tbl_win_patch_scan WHERE scan_datetime < '2004-09-18 00:00:00'); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ Seq Scan on tbl_win_patch_scan_item (cost=0.00..382335670.62 rows=376033 width=8) (actual time=10.18..44773.22 rows=2045 loops=1) Filter: (subplan) SubPlan -> Materialize (cost=505.06..511.38 rows=632 width=4) (actual time=0.00..0.02 rows=43 loops=752066) -> Seq Scan on tbl_win_patch_scan (cost=0.00..505.06 rows=632 width=4) (actual time=0.02..10.09 rows=43 loops=1) Filter: (scan_datetime < '2004-09-18 00:00:00'::timestamp without time zone) Total runtime: 44774.49 msec (7 rows) Time: 44775.62 ms vsa=# explain analyze SELECT id,win_patch_scan_id FROM vsa.tbl_win_patch_scan_item WHERE win_patch_scan_id IN (SELECT id FROM vsa.tbl_win_patch_scan WHERE scan_datetime < '2004-09-18 00:00:00'); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ Seq Scan on tbl_win_patch_scan_item (cost=0.00..382335670.62 rows=376033 width=8) (actual time=10.18..44765.36 rows=2045 loops=1) Filter: (subplan) SubPlan -> Materialize (cost=505.06..511.38 rows=632 width=4) (actual time=0.00..0.02 rows=43 loops=752066) -> Seq Scan on tbl_win_patch_scan (cost=0.00..505.06 rows=632 width=4) (actual time=0.02..10.10 rows=43 loops=1) Filter: (scan_datetime < '2004-09-18 00:00:00'::timestamp without time zone) Total runtime: 44766.62 msec (7 rows) Time: 44767.71 ms vsa=# SELECT id,win_patch_scan_id FROM vsa.tbl_win_patch_scan_item WHERE win_patch_scan_id IN (SELECT id FROM vsa.tbl_win_patch_scan WHERE scan_datetime < '2004-09-18 00:00:00'); id | win_patch_scan_id --------+------------------- 1 | 1 2 | 1 3 | 1 4 | 1 5 | 1 ----------8< SNIP -------------- 211 | 7 212 | 7 213 | 7 214 | 7 215 | 7 216 | 7 217 | 7 692344 | 9276 692345 | 9276 692346 | 9276 692347 | 9276 692348 | 9276 ----------8< SNIP -------------- 694167 | 9311 694168 | 9311 694169 | 9311 694170 | 9311 694171 | 9311 (2045 rows) Time: 8703.56 ms vsa=# ___________________________________________________________________________________ Steven Rosenstein IT Architect/Developer | IBM Virtual Server Administration Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 Text Messaging: 6463456978 @ mobile.mycingular.com Email: srosenst @ us.ibm.com "Learn from the mistakes of others because you can't live long enough to make them all yourself." -- Eleanor Roosevelt From pgsql-performance-owner@postgresql.org Sun Feb 6 21:57:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E6DF28B9F04 for ; Sun, 6 Feb 2005 21:57:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59977-07 for ; Sun, 6 Feb 2005 21:57:45 +0000 (GMT) Received: from e6.ny.us.ibm.com (e6.ny.us.ibm.com [32.97.182.146]) by svr1.postgresql.org (Postfix) with ESMTP id 477D18B9E74 for ; Sun, 6 Feb 2005 21:57:46 +0000 (GMT) Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e6.ny.us.ibm.com (8.12.10/8.12.10) with ESMTP id j16LvkUZ012162 for ; Sun, 6 Feb 2005 16:57:46 -0500 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay04.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j16LvkhD226620 for ; Sun, 6 Feb 2005 16:57:46 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j16LvjSx016309 for ; Sun, 6 Feb 2005 16:57:45 -0500 Received: from d01ml255.pok.ibm.com (d01ml255.pok.ibm.com [9.56.227.128]) by d01av04.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j16LvjMG016302 for ; Sun, 6 Feb 2005 16:57:45 -0500 In-Reply-To: <11561.1107719397@sss.pgh.pa.us> Subject: Re: Are JOINs allowed with DELETE FROM To: pgsql-performance@postgresql.org X-Mailer: Lotus Notes Release 6.0.2CF1 June 9, 2003 Message-ID: From: Steven Rosenstein Date: Sun, 6 Feb 2005 16:57:44 -0500 X-MIMETrack: Serialize by Router on D01ML255/01/M/IBM(Release 6.53HF103 | November 15, 2004) at 02/06/2005 16:57:44 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.272 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/100 X-Sequence-Number: 10429 Many thanks to Gaetano Mendola and Tom Lane for the hints about using fields from other tables in a DELETE's WHERE clause. That was the magic bullet I needed, and my application is working as expected. --- Steve ___________________________________________________________________________________ Steven Rosenstein IT Architect/Developer | IBM Virtual Server Administration Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 Text Messaging: 6463456978 @ mobile.mycingular.com Email: srosenst @ us.ibm.com "Learn from the mistakes of others because you can't live long enough to make them all yourself." -- Eleanor Roosevelt Tom Lane To Sent by: Steven Rosenstein/New pgsql-performance York/IBM@IBMUS -owner@postgresql cc .org pgsql-performance@postgresql.org Subject Re: [PERFORM] Are JOINs allowed 02/06/2005 02:49 with DELETE FROM PM Steven Rosenstein writes: > Thank you for the link to the documentation page. I forgot to mention that > we're still using version 7.3. When I checked the 7.3 documentation for > DELETE, there was no mention of being able to use fields from different > tables in a WHERE clause. This feature must have been added in a > subsequent release of PostgreSQL. No, it's been there all along, if perhaps not well documented. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Sun Feb 6 22:10:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4FF608B9F00 for ; Sun, 6 Feb 2005 22:10:21 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62278-03 for ; Sun, 6 Feb 2005 22:10:04 +0000 (GMT) Received: from usbb-lacimss3.unisys.com (usbb-lacimss3.unisys.com [192.63.108.53]) by svr1.postgresql.org (Postfix) with ESMTP id D961A8B9BBB for ; Sun, 6 Feb 2005 22:10:02 +0000 (GMT) Received: from usbb-lacgw2.lac.uis.unisys.com ([129.226.160.22]unverified) by usbb-lacimss3 with InterScan Messaging Security Suite; Sun, 06 Feb 2005 17:17:16 -0500 Received: from usbb-lacgw2.lac.uis.unisys.com ([129.226.160.25]) by usbb-lacgw2.lac.uis.unisys.com with Microsoft SMTPSVC(6.0.3790.211); Sun, 6 Feb 2005 17:09:55 -0500 Received: from gbmk-eugw2.eu.uis.unisys.com ([129.221.133.27]) by usbb-lacgw2.lac.uis.unisys.com with Microsoft SMTPSVC(6.0.3790.211); Sun, 6 Feb 2005 17:09:55 -0500 Received: from nlshl-exch1.eu.uis.unisys.com ([192.39.239.20]) by gbmk-eugw2.eu.uis.unisys.com with Microsoft SMTPSVC(6.0.3790.211); Sun, 6 Feb 2005 22:09:53 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Can the V7.3 EXPLAIN ANALYZE be trusted? Date: Sun, 6 Feb 2005 23:09:52 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Can the V7.3 EXPLAIN ANALYZE be trusted? Thread-Index: AcUMhaM5jCVdu+eNQlSZ28tAIx5MHQAEstJg From: "Leeuw van der, Tim" To: "Steven Rosenstein" , X-OriginalArrivalTime: 06 Feb 2005 22:09:53.0566 (UTC) FILETIME=[95AD6BE0:01C50C98] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/101 X-Sequence-Number: 10430 -----Original Message----- From: pgsql-performance-owner@postgresql.org = [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Steven = Rosenstein Sent: Sunday, February 06, 2005 8:51 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] Can the V7.3 EXPLAIN ANALYZE be trusted? While working on a previous question I posed to this group, I ran a = number of EXPLAIN ANALYZE's to provide as examples. After sending up my last email, I ran the same query *without* EXPLAIN ANALYZE. The runtimes = were vastly different. In the following example, I ran two identical queries one right after the other. The runtimes for both was very close (44.77 sec). I then immediately ran the exact same query, but without EXPLAIN ANALYZE. The same number of rows was returned, but the runtime was only 8.7 sec. I don't think EXPLAIN ANALYZE puts that much overhead on a = query. Does anyone have any idea what is going on here? --- Steve Caching by the OS? (Did you try to *first* run the query w/o EXPLAIN ANALYZE, and then = with? What's the timing if you do that?) --Tim From pgsql-performance-owner@postgresql.org Sun Feb 6 22:35:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AF1F88B9E74 for ; Sun, 6 Feb 2005 22:35:05 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64354-07 for ; Sun, 6 Feb 2005 22:34:56 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 6A7308B9B56 for ; Sun, 6 Feb 2005 22:34:55 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1CxuzQ-0002Ft-00; Sun, 06 Feb 2005 17:34:48 -0500 To: "Leeuw van der, Tim" Cc: "Steven Rosenstein" , Subject: Re: Can the V7.3 EXPLAIN ANALYZE be trusted? References: In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 06 Feb 2005 17:34:47 -0500 Message-ID: <87lla1iago.fsf@stark.xeocode.com> Lines: 19 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/102 X-Sequence-Number: 10431 "Leeuw van der, Tim" writes: > I don't think EXPLAIN ANALYZE puts that much overhead on a query. EXPLAIN ANALYZE does indeed impose a significant overhead. What percentage of the time is overhead depends heavily on how much i/o the query is doing. For queries that are primarily cpu bound because they're processing data from the cache it can be substantial. If all the data is in the shared buffers then the gettimeofday calls for explain analyze can be just about the only syscalls being executed and they're executed a lot. It would be interesting to try to subtract out the profiling overhead from the data like most profilers do. But it's not an easy thing to do since the times are nested. -- greg From pgsql-performance-owner@postgresql.org Sun Feb 6 22:46:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 76BCF8B9EB9 for ; Sun, 6 Feb 2005 22:46:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64997-08 for ; Sun, 6 Feb 2005 22:46:05 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 490628B9E5B for ; Sun, 6 Feb 2005 22:46:06 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j16Mk6ZK017153; Sun, 6 Feb 2005 17:46:06 -0500 (EST) To: "Steven Rosenstein" Cc: pgsql-performance@postgresql.org Subject: Re: Can the V7.3 EXPLAIN ANALYZE be trusted? In-reply-to: References: Comments: In-reply-to "Leeuw van der, Tim" message dated "Sun, 06 Feb 2005 23:09:52 +0100" Date: Sun, 06 Feb 2005 17:46:05 -0500 Message-ID: <17152.1107729965@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/103 X-Sequence-Number: 10432 > From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Steven Rosenstein > >> I don't think EXPLAIN ANALYZE puts that much overhead on a query. I think you're being overly optimistic. The explain shows that the Materialize subnode is being entered upwards of 32 million times: -> Materialize (cost=505.06..511.38 rows=632 width=4) (actual time=0.00..0.02 rows=43 loops=752066) 43 * 752066 = 32338838. The instrumentation overhead is basically two gettimeofday() kernel calls per node entry. Doing the math shows that your machine is able to do gettimeofday() in about half a microsecond, which isn't stellar but it's not all that slow for a kernel call. (What's the platform here, anyway?) Nonetheless it's a couple of times larger than the actual time needed to pull a row from a materialized array ... The real answer to your question is "IN (subselect) sucks before PG 7.4; get a newer release". regards, tom lane From pgsql-performance-owner@postgresql.org Sun Feb 6 23:06:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0E3C08B9CFD for ; Sun, 6 Feb 2005 23:06:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66516-08 for ; Sun, 6 Feb 2005 23:06:25 +0000 (GMT) Received: from smtp111.mail.sc5.yahoo.com (smtp111.mail.sc5.yahoo.com [66.163.170.9]) by svr1.postgresql.org (Postfix) with SMTP id 855378B9E06 for ; Sun, 6 Feb 2005 23:06:26 +0000 (GMT) Received: from unknown (HELO jupiter.black-lion.info) (janwieck@68.80.245.191 with login) by smtp111.mail.sc5.yahoo.com with SMTP; 6 Feb 2005 23:06:26 -0000 Received: from [172.21.8.128] ([192.168.192.101]) (authenticated bits=0) by jupiter.black-lion.info (8.12.10/8.12.9) with ESMTP id j16N69L3026052; Sun, 6 Feb 2005 18:06:14 -0500 (EST) (envelope-from JanWieck@Yahoo.com) Message-ID: <4206A2DB.70102@Yahoo.com> Date: Sun, 06 Feb 2005 18:06:03 -0500 From: Jan Wieck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Browne Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <41EFBF05.6000509@familyhealth.com.au> <200501201536.08656.herve@elma.fr> <1106236978.35299.496.camel@home> <1106522910.5790.1.camel@fuji.krosing.net> <20050128153620.GE9076@phlogiston.dyndns.org> <60k6pxcp12.fsf@dba2.int.libertyrms.com> In-Reply-To: <60k6pxcp12.fsf@dba2.int.libertyrms.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.322 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/104 X-Sequence-Number: 10433 On 1/28/2005 2:49 PM, Christopher Browne wrote: > But there's nothing wrong with the idea of using "pg_dump --data-only" > against a subscriber node to get you the data without putting a load > on the origin. And then pulling the schema from the origin, which > oughtn't be terribly expensive there. And there is a script in the current CVS head that extracts the schema from the origin in a clean, slony-traces-removed state. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # From pgsql-performance-owner@postgresql.org Mon Feb 7 02:44:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9F12E8B9B2A for ; Mon, 7 Feb 2005 02:43:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83056-02 for ; Mon, 7 Feb 2005 02:43:10 +0000 (GMT) Received: from e1.ny.us.ibm.com (e1.ny.us.ibm.com [32.97.182.141]) by svr1.postgresql.org (Postfix) with ESMTP id 1871D8B9E46 for ; Mon, 7 Feb 2005 02:43:12 +0000 (GMT) Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e1.ny.us.ibm.com (8.12.10/8.12.10) with ESMTP id j172hCiQ022631 for ; Sun, 6 Feb 2005 21:43:12 -0500 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay04.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j172hChD226760 for ; Sun, 6 Feb 2005 21:43:12 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j172hCMa024903 for ; Sun, 6 Feb 2005 21:43:12 -0500 Received: from d01ml255.pok.ibm.com (d01ml255.pok.ibm.com [9.56.227.128]) by d01av01.pok.ibm.com (8.12.11/8.12.11) with ESMTP id j172hCNP024899 for ; Sun, 6 Feb 2005 21:43:12 -0500 In-Reply-To: <17152.1107729965@sss.pgh.pa.us> Subject: Re: Can the V7.3 EXPLAIN ANALYZE be trusted? To: Tom Lane Cc: pgsql-performance@postgresql.org X-Mailer: Lotus Notes Release 6.0.2CF1 June 9, 2003 Message-ID: From: Steven Rosenstein Date: Sun, 6 Feb 2005 21:43:09 -0500 X-MIMETrack: Serialize by Router on D01ML255/01/M/IBM(Release 6.53HF103 | November 15, 2004) at 02/06/2005 21:43:11 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.273 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/105 X-Sequence-Number: 10434 You're probably right about my being overly optimistic about the load imposed by EXPLAIN ANALYZE. It was just that in my previous experience with it, I'd never seen such a large runtime discrepancy before. I even allowed for a "caching effect" by making sure the server was all but quiescent, and then running the three queries as quickly after one another as I could. The server itself is an IBM x345 with dual Xeon 3ghz CPU's (hyperthreading turned off) and 2.5gb of RAM. O/S is RHEL3 Update 4. Disks are a ServeRAID of some flavor, I'm not sure what. Thanks for the heads-up about the performance of IN in 7.3. We're looking to migrate to 8.0 or 8.0.1 when they become GA, but some of our databases are in excess of 200gb-300gb, and we need to make sure we have a good migration plan in place (space to store the dump out of the 7.3 db) before we start. ___________________________________________________________________________________ Steven Rosenstein IT Architect/Developer | IBM Virtual Server Administration Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 Text Messaging: 6463456978 @ mobile.mycingular.com Email: srosenst @ us.ibm.com "Learn from the mistakes of others because you can't live long enough to make them all yourself." -- Eleanor Roosevelt Tom Lane To Steven Rosenstein/New 02/06/2005 05:46 York/IBM@IBMUS PM cc pgsql-performance@postgresql.org Subject Re: [PERFORM] Can the V7.3 EXPLAIN ANALYZE be trusted? > From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Steven Rosenstein > >> I don't think EXPLAIN ANALYZE puts that much overhead on a query. I think you're being overly optimistic. The explain shows that the Materialize subnode is being entered upwards of 32 million times: -> Materialize (cost=505.06..511.38 rows=632 width=4) (actual time=0.00..0.02 rows=43 loops=752066) 43 * 752066 = 32338838. The instrumentation overhead is basically two gettimeofday() kernel calls per node entry. Doing the math shows that your machine is able to do gettimeofday() in about half a microsecond, which isn't stellar but it's not all that slow for a kernel call. (What's the platform here, anyway?) Nonetheless it's a couple of times larger than the actual time needed to pull a row from a materialized array ... The real answer to your question is "IN (subselect) sucks before PG 7.4; get a newer release". regards, tom lane From pgsql-performance-owner@postgresql.org Mon Feb 7 09:07:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7D6138B9EE9 for ; Mon, 7 Feb 2005 09:07:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20441-07 for ; Mon, 7 Feb 2005 09:07:15 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) by svr1.postgresql.org (Postfix) with ESMTP id 0A1288B9E44 for ; Mon, 7 Feb 2005 09:07:16 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so859473wra for ; Mon, 07 Feb 2005 01:07:15 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=XfjS1UhET0g2/CKrjEAldVcxECJLrQm5sK+kE3SmQ39Mv/2JHQwW404V1vrAh3Q5wMVs9IuuNpMvi353NAfDI9tdjy2vZJxBkzTlCgubRxxGY76ku1XayBpuVolsdpLUyBOW6RVLYNZQtrJpsBxdpGsUzQAdL7bdamj7oYQLapY= Received: by 10.54.50.3 with SMTP id x3mr102185wrx; Mon, 07 Feb 2005 01:07:15 -0800 (PST) Received: by 10.54.31.32 with HTTP; Mon, 7 Feb 2005 01:07:15 -0800 (PST) Message-ID: <2989532e05020701073638ca4c@mail.gmail.com> Date: Mon, 7 Feb 2005 14:37:15 +0530 From: Antony Paul Reply-To: Antony Paul To: pgsql-performance@postgresql.org Subject: Index not used with or condition Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.54 tagged_above=0 required=5 tests=FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/106 X-Sequence-Number: 10435 Hi all, I am facing a strange problem when I run EXPLAIN against a table having more than 100000 records. The query have lot of OR conditions and when parts of the query is removed it is using index. To analyse it I created a table with a single column, inserted 100000 records(random number) in it created index and run a query which returns 1 record which have no or condition and it was using index. I added an OR conditon and is using sequential scan. I set the enable_seqscan to off. I ran the tests again and is using index scan. So which one I have to use. Is this any bug in Explain. rgds Antony Paul. From pgsql-performance-owner@postgresql.org Mon Feb 7 11:14:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 50E768B9B49 for ; Mon, 7 Feb 2005 11:14:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38977-06 for ; Mon, 7 Feb 2005 11:14:06 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 38AC38B9CA9 for ; Mon, 7 Feb 2005 11:14:08 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so870675wra for ; Mon, 07 Feb 2005 03:14:08 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=SgXgDbcKRgknK47ZYnz7kppmNitiPgCBLjPsCh42kgld1arZ1ba2Nn8vSyFI3Ic/mu1Z+WQTMz/7IPcMgAKSlKu6LppI8rpVQ3Hjq+TgJC6meGnZ9skYqRmchHQDyJY7AGGpTj8PP1a497v8eFX0/EiZ/+MzbX/sPWaOKMdYmCo= Received: by 10.54.37.58 with SMTP id k58mr208686wrk; Mon, 07 Feb 2005 03:14:07 -0800 (PST) Received: by 10.54.31.32 with HTTP; Mon, 7 Feb 2005 03:14:07 -0800 (PST) Message-ID: <2989532e0502070314402057cc@mail.gmail.com> Date: Mon, 7 Feb 2005 16:44:07 +0530 From: Antony Paul Reply-To: Antony Paul To: pgsql-performance@postgresql.org Subject: Re: Index not used with or condition In-Reply-To: <2989532e05020701073638ca4c@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <2989532e05020701073638ca4c@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.54 tagged_above=0 required=5 tests=FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/107 X-Sequence-Number: 10436 On more investigation I found that index scan is not used if the query have a function in it like lower() and an index exist for lower() column. rgds Antony Paul On Mon, 7 Feb 2005 14:37:15 +0530, Antony Paul wrote: > Hi all, > I am facing a strange problem when I run EXPLAIN against a table > having more than 100000 records. The query have lot of OR conditions > and when parts of the query is removed it is using index. To analyse > it I created a table with a single column, inserted 100000 > records(random number) in it created index and run a query which > returns 1 record which have no or condition and it was using index. I > added an OR conditon and is using sequential scan. I set the > enable_seqscan to off. I ran the tests again and is using index scan. > So which one I have to use. Is this any bug in Explain. > > rgds > Antony Paul. > From pgsql-performance-owner@postgresql.org Mon Feb 7 11:36:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1A8798B9B58 for ; Mon, 7 Feb 2005 11:36:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42788-08 for ; Mon, 7 Feb 2005 11:36:24 +0000 (GMT) Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 8CD8B8B9CA0 for ; Mon, 7 Feb 2005 11:36:25 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Is this possible / slow performance? Date: Mon, 7 Feb 2005 12:36:24 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Is this possible / slow performance? Thread-Index: AcUNCUDYUgcXrBKnRpSG4WaUf99few== From: "Joost Kraaijeveld" To: "Pgsql-Performance (E-mail)" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.084 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/108 X-Sequence-Number: 10437 Hi every one, Why does this take forever (each query is sub second when done = seperately)?=20 Is it because I cannot open two cursors in the same transaction? begin; declare SQL_CUR01 cursor for=20 SELECT A.ordernummer, B.klantnummer FROM "orders" A LEFT OUTER JOIN = "klt_alg" B ON A.Klantnummer=3DB.Klantnummer ORDER BY A.klantnummer; fetch 100 in SQL_CUR01; declare SQL_CUR02 cursor for=20 SELECT A.ordernummer, B.klantnummer FROM "orders" A LEFT OUTER JOIN = "klt_alg" B ON A.Klantnummer=3DB.Klantnummer ORDER BY A.klantnummer = desc; fetch 100 in SQL_CUR02; commit; TIA Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl=20 From pgsql-performance-owner@postgresql.org Mon Feb 7 11:46:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F2A4B8B9BC9 for ; Mon, 7 Feb 2005 11:46:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44505-06 for ; Mon, 7 Feb 2005 11:46:05 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 957848B9C6C for ; Mon, 7 Feb 2005 11:46:06 +0000 (GMT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1Cy7LB-0006nl-Jf for pgsql-performance@postgresql.org; Mon, 07 Feb 2005 12:46:05 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1Cy7LB-0007LP-00 for ; Mon, 07 Feb 2005 12:46:05 +0100 Date: Mon, 7 Feb 2005 12:46:05 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Index not used with or condition Message-ID: <20050207114605.GB27546@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <2989532e05020701073638ca4c@mail.gmail.com> <2989532e0502070314402057cc@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2989532e0502070314402057cc@mail.gmail.com> X-Operating-System: Linux 2.6.8.1 on a i686 User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/109 X-Sequence-Number: 10438 On Mon, Feb 07, 2005 at 04:44:07PM +0530, Antony Paul wrote: > On more investigation I found that index scan is not used if the query > have a function in it like lower() and an index exist for lower() > column. What version are you using? 8.0 had fixes for this situation. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Mon Feb 7 11:54:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 226D48B9E07 for ; Mon, 7 Feb 2005 11:54:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45413-09 for ; Mon, 7 Feb 2005 11:53:58 +0000 (GMT) Received: from termit.gingerall.cz (termit.gingerall.cz [213.195.208.132]) by svr1.postgresql.org (Postfix) with ESMTP id 2BC8A8B9DFA for ; Mon, 7 Feb 2005 11:53:57 +0000 (GMT) Received: from [213.195.208.156] (balvan.gingerall.cz [213.195.208.156]) (authenticated bits=0) by termit.gingerall.cz (8.12.11/8.12.11) with ESMTP id j17Bro1Z007781 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 7 Feb 2005 12:53:50 +0100 Message-ID: <420756BA.4080507@gingerall.cz> Date: Mon, 07 Feb 2005 12:53:30 +0100 From: Jan Poslusny User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041217 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Antony Paul Cc: pgsql-performance@postgresql.org Subject: Re: Index not used with or condition References: <2989532e05020701073638ca4c@mail.gmail.com> <2989532e0502070314402057cc@mail.gmail.com> In-Reply-To: <2989532e0502070314402057cc@mail.gmail.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/110 X-Sequence-Number: 10439 It depends on many circumstances, but, at first, simple question: Did you run vacuum analyze? I am satisfied with functional indexes - it works in my pg 7.4.x. Antony Paul wrote: >On more investigation I found that index scan is not used if the query >have a function in it like lower() and an index exist for lower() >column. > >rgds >Antony Paul > > >On Mon, 7 Feb 2005 14:37:15 +0530, Antony Paul wrote: > > >>Hi all, >> I am facing a strange problem when I run EXPLAIN against a table >>having more than 100000 records. The query have lot of OR conditions >>and when parts of the query is removed it is using index. To analyse >>it I created a table with a single column, inserted 100000 >>records(random number) in it created index and run a query which >>returns 1 record which have no or condition and it was using index. I >>added an OR conditon and is using sequential scan. I set the >>enable_seqscan to off. I ran the tests again and is using index scan. >> So which one I have to use. Is this any bug in Explain. >> >>rgds >>Antony Paul. >> >> >> > >---------------------------(end of broadcast)--------------------------- >TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > > From pgsql-performance-owner@postgresql.org Mon Feb 7 11:57:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D45ED8B9B39 for ; Mon, 7 Feb 2005 11:57:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45883-10 for ; Mon, 7 Feb 2005 11:57:13 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id 75B908B9DFA for ; Mon, 7 Feb 2005 11:57:15 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so875246wra for ; Mon, 07 Feb 2005 03:57:14 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=hr1+q4omysb+I61lydiPm7j1/jR1bTJ1xcyT2LW+5rIlMdWGa+Nkak5zOTbWi4ma0R6zSK7uK1SPYKw+9OyZ2XLxBMXfZnGIjM4TetSOOgePtVDo1THGNxpu3FeL2mt2W0ErFZq8i9+3iCKlQQCbNvOR77iJDgId4WnhhyP3qbY= Received: by 10.54.32.42 with SMTP id f42mr453439wrf; Mon, 07 Feb 2005 03:57:13 -0800 (PST) Received: by 10.54.31.32 with HTTP; Mon, 7 Feb 2005 03:57:13 -0800 (PST) Message-ID: <2989532e050207035716306f36@mail.gmail.com> Date: Mon, 7 Feb 2005 17:27:13 +0530 From: Antony Paul Reply-To: Antony Paul To: pgsql-performance@postgresql.org Subject: Re: Index not used with or condition In-Reply-To: <20050207114605.GB27546@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <2989532e05020701073638ca4c@mail.gmail.com> <2989532e0502070314402057cc@mail.gmail.com> <20050207114605.GB27546@uio.no> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.54 tagged_above=0 required=5 tests=FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/111 X-Sequence-Number: 10440 Sorry I forgot to mention it. I am using 7.3.3. I will try it in 8.0.0 rgds Antony Paul On Mon, 7 Feb 2005 12:46:05 +0100, Steinar H. Gunderson wrote: > On Mon, Feb 07, 2005 at 04:44:07PM +0530, Antony Paul wrote: > > On more investigation I found that index scan is not used if the query > > have a function in it like lower() and an index exist for lower() > > column. > > What version are you using? 8.0 had fixes for this situation. > > /* Steinar */ > -- > Homepage: http://www.sesse.net/ > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > From pgsql-performance-owner@postgresql.org Mon Feb 7 11:58:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 506398B9B39 for ; Mon, 7 Feb 2005 11:58:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46225-07 for ; Mon, 7 Feb 2005 11:58:12 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) by svr1.postgresql.org (Postfix) with ESMTP id DBA658B9D1A for ; Mon, 7 Feb 2005 11:58:13 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so875336wra for ; Mon, 07 Feb 2005 03:58:14 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=mAVhQDe1dY+dcl5wrMu3/nP8gEEg2S5ElH8NCVck/Ryc8L9S0fyRkh+50Z44fSe++W/pG1L/sa+k7xge5qFJ8Vp4FSngP3xuDXeeF+btVWz+vbk3H7LxhE/RNsVyd8lA7SD1rQSKC++WkkmRGQlUOk1b5JlAEbMiWD3OkbDiZLU= Received: by 10.54.32.55 with SMTP id f55mr181163wrf; Mon, 07 Feb 2005 03:58:14 -0800 (PST) Received: by 10.54.31.32 with HTTP; Mon, 7 Feb 2005 03:58:14 -0800 (PST) Message-ID: <2989532e05020703584989cd15@mail.gmail.com> Date: Mon, 7 Feb 2005 17:28:14 +0530 From: Antony Paul Reply-To: Antony Paul To: Jan Poslusny Subject: Re: Index not used with or condition Cc: pgsql-performance@postgresql.org In-Reply-To: <420756BA.4080507@gingerall.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <2989532e05020701073638ca4c@mail.gmail.com> <2989532e0502070314402057cc@mail.gmail.com> <420756BA.4080507@gingerall.cz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.54 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/112 X-Sequence-Number: 10441 I ran analyze; several times. rgds Antony Paul On Mon, 07 Feb 2005 12:53:30 +0100, Jan Poslusny wrote: > It depends on many circumstances, but, at first, simple question: Did > you run vacuum analyze? > I am satisfied with functional indexes - it works in my pg 7.4.x. > > Antony Paul wrote: > > >On more investigation I found that index scan is not used if the query > >have a function in it like lower() and an index exist for lower() > >column. > > > >rgds > >Antony Paul > > > > > >On Mon, 7 Feb 2005 14:37:15 +0530, Antony Paul wrote: > > > > > >>Hi all, > >> I am facing a strange problem when I run EXPLAIN against a table > >>having more than 100000 records. The query have lot of OR conditions > >>and when parts of the query is removed it is using index. To analyse > >>it I created a table with a single column, inserted 100000 > >>records(random number) in it created index and run a query which > >>returns 1 record which have no or condition and it was using index. I > >>added an OR conditon and is using sequential scan. I set the > >>enable_seqscan to off. I ran the tests again and is using index scan. > >> So which one I have to use. Is this any bug in Explain. > >> > >>rgds > >>Antony Paul. > >> > >> > >> > > > >---------------------------(end of broadcast)--------------------------- > >TIP 3: if posting/reading through Usenet, please send an appropriate > > subscribe-nomail command to majordomo@postgresql.org so that your > > message can get through to the mailing list cleanly > > > > > > > From pgsql-performance-owner@postgresql.org Mon Feb 7 14:08:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CFB7B8B9E5C for ; Mon, 7 Feb 2005 14:08:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65678-05 for ; Mon, 7 Feb 2005 14:07:47 +0000 (GMT) Received: from mail.logi-track.com (burro.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id 371E18B9CE7 for ; Mon, 7 Feb 2005 14:07:49 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J2bc5.j.pppool.de [85.74.43.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id BA21C306BE; Mon, 7 Feb 2005 15:07:50 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id EBCD1AB100; Mon, 7 Feb 2005 15:07:45 +0100 (CET) Message-ID: <42077630.5020802@logi-track.com> Date: Mon, 07 Feb 2005 15:07:44 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Tom Lane Cc: PostgreSQL Performance List , PostGIS Users Discussion Subject: Re: Bad query optimizer misestimation because of TOAST References: <42010C24.90301@logi-track.com> <188.1107366272@sss.pgh.pa.us> <42011B0B.2050305@logi-track.com> <9501.1107388153@sss.pgh.pa.us> In-Reply-To: <9501.1107388153@sss.pgh.pa.us> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig86AFC0EBCEDD40759EDB9C96" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/113 X-Sequence-Number: 10442 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig86AFC0EBCEDD40759EDB9C96 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Hi, Tom, Tom Lane schrieb: > Markus Schaber writes: >> [Query optimizer misestimation using lossy GIST on TOASTed columns] > > What I would be inclined to do is to extend ANALYZE to make an estimate > of the extent of toasting of every toastable column, and then modify > cost_qual_eval to charge a nonzero cost for evaluation of Vars that are > potentially toasted. What to do now? To fix this issue seems to be a rather long-term job. Is it enough to document workarounds (as in PostGIS), provided that there are such workarounds for other GIST users? Is there a bug tracking system we could file the problem, so it does not get lost? Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z�rich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com --------------enig86AFC0EBCEDD40759EDB9C96 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCB3YwOVWsnapT9i0RAkmrAJ469QuAqfurPu1dETeMGgFI4gvJcgCfdDJ+ ofT+SBni9zFI3iY/474TEjo= =wyhY -----END PGP SIGNATURE----- --------------enig86AFC0EBCEDD40759EDB9C96-- From pgsql-performance-owner@postgresql.org Mon Feb 7 14:39:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BD3CA8B9D52 for ; Mon, 7 Feb 2005 14:39:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69753-04 for ; Mon, 7 Feb 2005 14:39:19 +0000 (GMT) Received: from mail.logi-track.com (www.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id E126A8B9CF7 for ; Mon, 7 Feb 2005 14:39:22 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J2bc5.j.pppool.de [85.74.43.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id DE6EB306BE; Mon, 7 Feb 2005 15:39:25 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id 9065DAB100; Mon, 7 Feb 2005 15:39:19 +0100 (CET) Message-ID: <42077D93.4000104@logi-track.com> Date: Mon, 07 Feb 2005 15:39:15 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Steven Rosenstein Subject: Re: Can the V7.3 EXPLAIN ANALYZE be trusted? References: <87lla1iago.fsf@stark.xeocode.com> In-Reply-To: <87lla1iago.fsf@stark.xeocode.com> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3BA70A022021BBE579081ACF" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/114 X-Sequence-Number: 10443 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig3BA70A022021BBE579081ACF Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Hi, @all, Greg Stark schrieb: > "Leeuw van der, Tim" writes: > >>I don't think EXPLAIN ANALYZE puts that much overhead on a query. > > EXPLAIN ANALYZE does indeed impose a significant overhead. Additional note: In some rare cases, you can experience just the opposite effect, explain analyze can be quicker then the actual query. This is the case for rather expensive send/output functions, like the PostGIS ones: lwgeom=# \timing Zeitmessung ist an. lwgeom=# explain analyze select setsrid(geom,4326) from adminbndy1; QUERY PLAN ----------------------------------------------------------------------------------------------------------- Seq Scan on adminbndy1 (cost=0.00..4.04 rows=83 width=89) (actual time=11.793..2170.184 rows=83 loops=1) Total runtime: 2170.834 ms (2 Zeilen) Zeit: 2171,688 ms lwgeom=# \o /dev/null lwgeom=# select setsrid(geom,4326) from adminbndy1; Zeit: 9681,001 ms BTW: I use the cheap setsrid(geom,4326) to force deTOASTing of the geometry column. Not using it seems to ignore TOASTed columns in sequential scan simulation.) lwgeom=# explain analyze select geom from adminbndy1; QUERY PLAN ------------------------------------------------------------------------------------------------------- Seq Scan on adminbndy1 (cost=0.00..3.83 rows=83 width=89) (actual time=0.089..0.499 rows=83 loops=1) Total runtime: 0.820 ms (2 Zeilen) Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z�rich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com --------------enig3BA70A022021BBE579081ACF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCB32UOVWsnapT9i0RAs5RAJ9/5TukUze0SglIqboPhryqu4aohwCfQngV t/GQCGxd0Co1kmmVoAotU4M= =9jz5 -----END PGP SIGNATURE----- --------------enig3BA70A022021BBE579081ACF-- From pgsql-performance-owner@postgresql.org Mon Feb 7 16:38:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 859F98B9C50 for ; Mon, 7 Feb 2005 16:38:04 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82535-03 for ; Mon, 7 Feb 2005 16:37:57 +0000 (GMT) Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id CC98B8B9B86 for ; Mon, 7 Feb 2005 16:37:55 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Retry: Is this possible / slow performance? Date: Mon, 7 Feb 2005 17:37:53 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Is this possible / slow performance? Thread-Index: AcUNCUDYUgcXrBKnRpSG4WaUf99fewAJTbQQ From: "Joost Kraaijeveld" To: "Pgsql-Performance (E-mail)" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.082 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/115 X-Sequence-Number: 10444 Hi all, A retry of the question asked before. All tables freshly vacuumed an = analized.=20 Two queries: one with "set enable_seqscan =3D on" , the other with "set = enable_seqscan =3D off". The first query lasts 59403 ms, the second = query 31 ms ( the desc order variant has the same large difference: = 122494 ms vs. 1297 ms). (for the query plans see below). Can I, without changing the SQL (because it is generated by a tool) or = explicitely setting "set enable_seqscan =3D off" for this query, trick = PostgreSQL in taking the fast variant of the queryplan? TIA Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl ------------------------------- Query 1 begin; set enable_seqscan =3D on; declare SQL_CUR01 cursor for=20 SELECT A.ordernummer, B.klantnummer FROM "orders" A LEFT OUTER JOIN = "klt_alg" B ON A.Klantnummer=3DB.Klantnummer=20 ORDER BY A.klantnummer; fetch 100 in SQL_CUR01; commit; QUERY PLAN Sort (cost=3D259968.77..262729.72 rows=3D1104380 width=3D12) Sort Key: a.klantnummer, a.ordernummer -> Hash Left Join (cost=3D42818.43..126847.70 rows=3D1104380 = width=3D12) Hash Cond: ("outer".klantnummer =3D "inner".klantnummer) -> Seq Scan on orders a (cost=3D0.00..46530.79 rows=3D1104379 = width=3D8) -> Hash (cost=3D40635.14..40635.14 rows=3D368914 width=3D4) -> Seq Scan on klt_alg b (cost=3D0.00..40635.14 = rows=3D368914 width=3D4) Actual running time: 59403 ms. ------------------------------- Query 2 begin; set enable_seqscan =3D off; declare SQL_CUR01 cursor for=20 SELECT A.ordernummer, B.klantnummer FROM "orders" A LEFT OUTER JOIN = "klt_alg" B ON A.Klantnummer=3DB.Klantnummer=20 ORDER BY A.klantnummer; fetch 100 in SQL_CUR01; commit; QUERY PLAN Merge Left Join (cost=3D0.00..2586604.86 rows=3D1104380 width=3D12) Merge Cond: ("outer".klantnummer =3D "inner".klantnummer) -> Index Scan using orders_klantnummer on orders a = (cost=3D0.00..2435790.17 rows=3D1104379 width=3D8) -> Index Scan using klt_alg_klantnummer on klt_alg b = (cost=3D0.00..44909.11 rows=3D368914 width=3D4) Actual running time: 31 ms. From pgsql-performance-owner@postgresql.org Mon Feb 7 17:04:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1B99E8B9C51 for ; Mon, 7 Feb 2005 17:04:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85201-01 for ; Mon, 7 Feb 2005 17:04:04 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id B172B8B9B64 for ; Mon, 7 Feb 2005 17:03:59 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j17H3uvh027756; Mon, 7 Feb 2005 12:03:56 -0500 (EST) To: "Joost Kraaijeveld" Cc: "Pgsql-Performance (E-mail)" Subject: Re: Retry: Is this possible / slow performance? In-reply-to: References: Comments: In-reply-to "Joost Kraaijeveld" message dated "Mon, 07 Feb 2005 17:37:53 +0100" Date: Mon, 07 Feb 2005 12:03:56 -0500 Message-ID: <27755.1107795836@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/116 X-Sequence-Number: 10445 "Joost Kraaijeveld" writes: > Two queries: one with "set enable_seqscan = on" , the other with "set enable_seqscan = off". The first query lasts 59403 ms, the second query 31 ms ( the desc order variant has the same large difference: 122494 ms vs. 1297 ms). (for the query plans see below). The reason for the difference is that the mergejoin plan has a much lower startup cost than the hash plan, and since you're only fetching 100 rows the startup cost is dominant. IIRC the planner does make some allowance for this effect when preparing a DECLARE CURSOR plan (ie, it puts some weight on startup cost rather than considering only total cost) ... but it's not so optimistic as to assume that you only want 100 out of an estimated 1 million+ result rows. The best solution is probably to put a LIMIT into the DECLARE CURSOR, so that the planner can see how much you intend to fetch. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Feb 7 17:26:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 63E728B9B85 for ; Mon, 7 Feb 2005 17:26:05 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86675-03 for ; Mon, 7 Feb 2005 17:25:58 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9D5258B9B41 for ; Mon, 7 Feb 2005 17:25:58 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 60C5231DCA; Mon, 7 Feb 2005 18:25:57 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: Are JOINs allowed with DELETE FROM Date: Mon, 07 Feb 2005 18:22:50 +0100 Organization: PYRENET Midi-pyrenees Provider Lines: 34 Message-ID: <4207A3EA.5020902@bigfoot.com> References: <20050206175029.GA89095@winnie.fuhr.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@pyrenet.fr To: Steven Rosenstein User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/117 X-Sequence-Number: 10446 Steven Rosenstein wrote: > > > > Hi Michael, > > Thank you for the link to the documentation page. I forgot to mention that > we're still using version 7.3. When I checked the 7.3 documentation for > DELETE, there was no mention of being able to use fields from different > tables in a WHERE clause. This feature must have been added in a > subsequent release of PostgreSQL. > > Gaetano & John: I *did* try your suggestion. However, there were so many > summary ID's returned (9810 to be exact) that the DELETE seemed to be > taking forever. 7.3 is affected by bad performances if you use IN. Transform the IN in an EXIST construct. If it'is an option for you upgrade you DB engine. Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Mon Feb 7 18:13:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DB9B98B9B2E for ; Mon, 7 Feb 2005 18:13:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90682-07 for ; Mon, 7 Feb 2005 18:13:45 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 582C68B9E02 for ; Mon, 7 Feb 2005 18:13:42 +0000 (GMT) Received: (qmail 29398 invoked from network); 7 Feb 2005 19:14:07 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 7 Feb 2005 19:14:07 +0100 To: "Tom Lane" , "Joost Kraaijeveld" Cc: "Pgsql-Performance (E-mail)" Subject: Re: Retry: Is this possible / slow performance? References: <27755.1107795836@sss.pgh.pa.us> Message-ID: Date: Mon, 07 Feb 2005 19:16:47 +0100 From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <27755.1107795836@sss.pgh.pa.us> User-Agent: Opera M2/7.54u1 (Linux, build 892) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/118 X-Sequence-Number: 10447 Does the planner also take into account that the Hash Join will need a huge temporary space which will exist for the whole length of the cursor existence (which may be quite long if he intends to fetch everything), whereas the Merge Join should need very little space as it is sending the rows as it fetches them using the Indexes ? On Mon, 07 Feb 2005 12:03:56 -0500, Tom Lane wrote: > "Joost Kraaijeveld" writes: >> Two queries: one with "set enable_seqscan = on" , the other with "set >> enable_seqscan = off". The first query lasts 59403 ms, the second query >> 31 ms ( the desc order variant has the same large difference: 122494 ms >> vs. 1297 ms). (for the query plans see below). > > The reason for the difference is that the mergejoin plan has a much > lower startup cost than the hash plan, and since you're only fetching > 100 rows the startup cost is dominant. IIRC the planner does make some > allowance for this effect when preparing a DECLARE CURSOR plan (ie, > it puts some weight on startup cost rather than considering only total > cost) ... but it's not so optimistic as to assume that you only want 100 > out of an estimated 1 million+ result rows. > > The best solution is probably to put a LIMIT into the DECLARE CURSOR, > so that the planner can see how much you intend to fetch. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > From pgsql-performance-owner@postgresql.org Mon Feb 7 19:27:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 091D48B9DFC for ; Mon, 7 Feb 2005 19:27:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97654-07 for ; Mon, 7 Feb 2005 19:27:22 +0000 (GMT) Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 0186F8B9CEA for ; Mon, 7 Feb 2005 19:27:21 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Re: Retry: Is this possible / slow performance? Date: Mon, 7 Feb 2005 20:27:18 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Retry: Is this possible / slow performance? Thread-Index: AcUNQTR/UK6MJXAhRUCIYujEQZlTCwAApjig From: "Joost Kraaijeveld" To: "PFC" , "Tom Lane" Cc: "Pgsql-Performance (E-mail)" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.08 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/119 X-Sequence-Number: 10448 =20 >> The best solution is probably to put a LIMIT into the DECLARE CURSOR, >> so that the planner can see how much you intend to fetch. I assume that this limits the resultset to a LIMIT. That is not what I = was hoping for. I was hoping for a way to scrolll throught the whole = tables with orders. I have tested, and if one really wants the whole table the query with = "set enable_seqscan =3D on" lasts 137 secs, the query with "set = enable_seqscan =3D off" lasts 473 secs, so (alas), the planner is right. = I sure would like to have ISAM like behaviour once in a while. Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Mon Feb 7 19:53:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2E3108B9D5E for ; Mon, 7 Feb 2005 19:53:02 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00478-04 for ; Mon, 7 Feb 2005 19:52:54 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 10A918B9B41 for ; Mon, 7 Feb 2005 19:52:54 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: Retry: Is this possible / slow performance? Date: Mon, 7 Feb 2005 14:52:53 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A7613@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Retry: Is this possible / slow performance? Thread-Index: AcUNQTR/UK6MJXAhRUCIYujEQZlTCwAApjigAAKLBMA= From: "Merlin Moncure" To: "Joost Kraaijeveld" Cc: "Pgsql-Performance (E-mail)" , "Tom Lane" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/120 X-Sequence-Number: 10449 > >> The best solution is probably to put a LIMIT into the DECLARE CURSOR, > >> so that the planner can see how much you intend to fetch. > I assume that this limits the resultset to a LIMIT. That is not what I was > hoping for. I was hoping for a way to scrolll throught the whole tables > with orders. >=20 > I have tested, and if one really wants the whole table the query with "set > enable_seqscan =3D on" lasts 137 secs, the query with "set enable_seqscan =3D > off" lasts 473 secs, so (alas), the planner is right. >=20 > I sure would like to have ISAM like behaviour once in a while. Then stop using cursors. A few months back I detailed the relative merits of using Cursors v. Queries to provide ISAM like functionality and Queries win hands down. Right now I am using pg as an ISAM backend for a relatively old and large COBOL ERP via a C++ ISAM driver, for which a publicly available version of the source will be available Real Soon Now :-). Merlin From pgsql-performance-owner@postgresql.org Mon Feb 7 22:25:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 646F68B9EA7 for ; Mon, 7 Feb 2005 22:25:34 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13312-01 for ; Mon, 7 Feb 2005 22:25:18 +0000 (GMT) Received: from yellow.gradwell.net (www.gradwell.com [193.111.200.100]) by svr1.postgresql.org (Postfix) with ESMTP id C2C988B9E8C for ; Mon, 7 Feb 2005 22:25:18 +0000 (GMT) Received: from www.gradwell.com (yellow.gradwell.net [127.0.0.1]) by yellow.gradwell.net (8.11.6/8.11.6) with SMTP id j17MPHl01241 for ; Mon, 7 Feb 2005 22:25:17 GMT Received: from 81.134.31.64 (SquirrelMail authenticated user paul@pop3.oxton.com) by www.gradwell.com with HTTP; Mon, 7 Feb 2005 22:25:17 -0000 (GMT) Message-ID: <3834.81.134.31.64.1107815117.squirrel@www.gradwell.com> Date: Mon, 7 Feb 2005 22:25:17 -0000 (GMT) Subject: Solaris 9 tuning From: "Paul Johnson" To: pgsql-performance@postgresql.org Reply-To: paul@oxton.com User-Agent: SquirrelMail/1.4.2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200502/121 X-Sequence-Number: 10450 Hi all, we have an Sun E3500 running Solaris 9. It's got 6x336MHz CPU and 10GB RAM. I would like to know what /etc/system and postgresql_conf values are recommended to deliver as much system resource as possible to Postgres. We use this Sun box solely for single user Postgres data warehousing workloads. Changes made to /etc/system values are: set shmsys:shminfo_shmmax=0xffffffff set shmsys:shminfo_shmmni=256 set shmsys:shminfo_shmseg=256 set shmsys:shminfo_shmmin=1 set semsys:seminfo_semmap=256 set semsys:seminfo_semmni=512 set semsys:seminfo_semmns=512 set semsys:seminfo_semmsl=32 Changes made to postgresql.conf are: shared_buffers = 500000 sort_mem = 2097152 vacuum_mem = 1000000 Thanks. From pgsql-performance-owner@postgresql.org Tue Feb 8 02:25:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 570478B9E0F for ; Tue, 8 Feb 2005 02:23:46 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32897-01 for ; Tue, 8 Feb 2005 02:23:19 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id BE3388B9E28 for ; Tue, 8 Feb 2005 02:23:21 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7001057; Mon, 07 Feb 2005 18:25:06 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: paul@oxton.com Subject: Re: Solaris 9 tuning Date: Mon, 7 Feb 2005 18:22:42 -0800 User-Agent: KMail/1.6.2 Cc: pgsql-performance@postgresql.org References: <3834.81.134.31.64.1107815117.squirrel@www.gradwell.com> In-Reply-To: <3834.81.134.31.64.1107815117.squirrel@www.gradwell.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200502071822.42805.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/122 X-Sequence-Number: 10451 Paul, > I would like to know what /etc/system and postgresql_conf values are > recommended to deliver as much system resource as possible to Postgres. We > use this Sun box solely for single user Postgres data warehousing > workloads. What's your disk system? > shared_buffers = 500000 This is highly unlikely to be optimal. That's 3GB. On test linux systems up to 8GB, we've not seen useful values of shared buffers anywhere above 400mb. How did you arrive at that figure? > sort_mem = 2097152 > vacuum_mem = 1000000 These could be fine on a single-user system. sort_mem is per *sort* though, not per query, so you'd need to watch out for complex queries spillling into swap; perhaps set it a 0.5GB or 1GB? Otherwise, start with the config guide at www.powerpostgresql.com/PerfList -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Feb 8 18:24:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7F4508B9F81 for ; Tue, 8 Feb 2005 18:24:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41955-07 for ; Tue, 8 Feb 2005 18:24:00 +0000 (GMT) Received: from mail.etrials.com (mail.etrials.com [216.134.216.5]) by svr1.postgresql.org (Postfix) with ESMTP id 7AC568B9F74 for ; Tue, 8 Feb 2005 18:23:57 +0000 (GMT) Received: from pippin.int.etrials.com ([192.168.100.103]) by mail.etrials.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 8 Feb 2005 13:23:56 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Slow Restoration of a template1 Database (ALTER GROUP) Date: Tue, 8 Feb 2005 13:23:55 -0500 Message-ID: <41A1CBC76FDECC42B67946519C6677A901D301FB@pippin.int.etrials.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Slow Restoration of a template1 Database (ALTER GROUP) Thread-Index: AcUOC1kRSlqtzMqATaWTlV4kXpZhPg== From: "Ben Young" To: X-OriginalArrivalTime: 08 Feb 2005 18:23:56.0470 (UTC) FILETIME=[59D83D60:01C50E0B] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/123 X-Sequence-Number: 10452 All, When trying to restore my template1 database (7.3.4) I am=20 experiencing very long delays. For 600 users (pg_shadow)=20 and 4 groups (pg_group) it is taking 1hr and 17 minutes to=20 complete. All of the create user statements are processed in a=20 matter of seconds, but each alter groups statement takes=20 about 10 seconds to process. I have done a full vacuum,=20 reindex (contrib) and restart before my run, but this did=20 not have an impact on load times. I have also searched=20 the archives to no avail and modified my postgresql.conf=20 file as recommended General Bits on www.varlena.com One other thing to mention is that this restoration has=20 been occurring on our slave server every hour for the=20 last 3-4 months and seems to be getting progressively=20 worse even if new users are not created in our master server. DUMP: pg_dumpall -g > foo RESTORE: psql template1 < foo Cheers, Ben Young From pgsql-performance-owner@postgresql.org Tue Feb 8 18:58:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3235D8B9CCC for ; Tue, 8 Feb 2005 18:58:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44708-02 for ; Tue, 8 Feb 2005 18:57:41 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 95A508B9F4C for ; Tue, 8 Feb 2005 18:57:41 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j18IvevX009191; Tue, 8 Feb 2005 13:57:40 -0500 (EST) To: "Ben Young" Cc: pgsql-performance@postgresql.org Subject: Re: Slow Restoration of a template1 Database (ALTER GROUP) In-reply-to: <41A1CBC76FDECC42B67946519C6677A901D301FB@pippin.int.etrials.com> References: <41A1CBC76FDECC42B67946519C6677A901D301FB@pippin.int.etrials.com> Comments: In-reply-to "Ben Young" message dated "Tue, 08 Feb 2005 13:23:55 -0500" Date: Tue, 08 Feb 2005 13:57:40 -0500 Message-ID: <9190.1107889060@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/124 X-Sequence-Number: 10453 "Ben Young" writes: > When trying to restore my template1 database (7.3.4) I am > experiencing very long delays. For 600 users (pg_shadow) > and 4 groups (pg_group) it is taking 1hr and 17 minutes to > complete. All of the create user statements are processed in a > matter of seconds, but each alter groups statement takes > about 10 seconds to process. I tried doing 1000 ALTER GROUP ADD USER commands in 7.3, and didn't see any particular performance problem. Could we see the output of "VACUUM FULL VERBOSE pg_group"? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Feb 8 19:59:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 78AD38B9F8C for ; Tue, 8 Feb 2005 19:59:45 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61411-08 for ; Tue, 8 Feb 2005 19:59:30 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4BEB88B9FE8 for ; Tue, 8 Feb 2005 19:59:30 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j18JxUm8009640; Tue, 8 Feb 2005 14:59:30 -0500 (EST) To: "Ben Young" Cc: pgsql-performance@postgresql.org Subject: Re: Slow Restoration of a template1 Database (ALTER GROUP) In-reply-to: <41A1CBC76FDECC42B67946519C6677A901D301FD@pippin.int.etrials.com> References: <41A1CBC76FDECC42B67946519C6677A901D301FD@pippin.int.etrials.com> Comments: In-reply-to "Ben Young" message dated "Tue, 08 Feb 2005 14:49:29 -0500" Date: Tue, 08 Feb 2005 14:59:29 -0500 Message-ID: <9639.1107892769@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/125 X-Sequence-Number: 10454 "Ben Young" writes: > template1=# VACUUM FULL VERBOSE pg_group; > INFO: --Relation pg_catalog.pg_group-- > INFO: Pages 124: Changed 1, reaped 124, Empty 0, New 0; Tup 4: Vac 966, Keep/VTL 0/0, UnUsed 156, MinLen 92, MaxLen 136; Re-using: Free/Avail. Space 1008360/1008360; EndEmpty/Avail. Pages 0/124. > CPU 0.01s/0.00u sec elapsed 0.07 sec. > INFO: Index pg_group_name_index: Pages 19072; Tuples 4: Deleted 966. ^^^^^ > CPU 1.51s/0.25u sec elapsed 17.19 sec. > INFO: Index pg_group_sysid_index: Pages 4313; Tuples 4: Deleted 966. ^^^^ > CPU 0.48s/0.04u sec elapsed 6.06 sec. Whoa. Can you say "index bloat"? I think that the only way to fix this is to REINDEX pg_group, which IIRC in 7.3 requires stopping the postmaster and doing it in a standalone backend (check the REINDEX reference page for details). Make sure the toast table gets reindexed too, as its index is oversized as well. (Recent PG versions will automatically reindex the toast table when you reindex its parent table, but I forget whether 7.3 did so; you might have to explicitly "reindex pg_toast.pg_toast_1261".) regards, tom lane From pgsql-performance-owner@postgresql.org Tue Feb 8 20:09:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C187A8B9F06 for ; Tue, 8 Feb 2005 20:08:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73035-04 for ; Tue, 8 Feb 2005 20:08:50 +0000 (GMT) Received: from mail.etrials.com (mail.etrials.com [216.134.216.5]) by svr1.postgresql.org (Postfix) with ESMTP id 6F1FA8B9E89 for ; Tue, 8 Feb 2005 20:08:50 +0000 (GMT) Received: from pippin.int.etrials.com ([192.168.100.103]) by mail.etrials.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 8 Feb 2005 15:08:50 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Slow Restoration of a template1 Database (ALTER GROUP) Date: Tue, 8 Feb 2005 15:08:50 -0500 Message-ID: <41A1CBC76FDECC42B67946519C6677A901D301FE@pippin.int.etrials.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Slow Restoration of a template1 Database (ALTER GROUP) Thread-Index: AcUOGLP5gVwhUczjQRqWLMOF2AhMPwAAJzUQ From: "Ben Young" To: "Tom Lane" Cc: X-OriginalArrivalTime: 08 Feb 2005 20:08:50.0778 (UTC) FILETIME=[018B6BA0:01C50E1A] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/126 X-Sequence-Number: 10455 Tom, Is the "index bloat" prevented/reduced in newer versions of Postgres? Is there a way to prevent/reduce it with the current version of Postgres = I'm using? Many Thanks, Ben "Ben Young" writes: > template1=3D# VACUUM FULL VERBOSE pg_group; > INFO: --Relation pg_catalog.pg_group-- > INFO: Pages 124: Changed 1, reaped 124, Empty 0, New 0; Tup 4: Vac = 966, Keep/VTL 0/0, UnUsed 156, MinLen 92, MaxLen 136; Re-using: = Free/Avail. Space 1008360/1008360; EndEmpty/Avail. Pages 0/124. > CPU 0.01s/0.00u sec elapsed 0.07 sec. > INFO: Index pg_group_name_index: Pages 19072; Tuples 4: Deleted 966. ^^^^^ > CPU 1.51s/0.25u sec elapsed 17.19 sec. > INFO: Index pg_group_sysid_index: Pages 4313; Tuples 4: Deleted 966. ^^^^ > CPU 0.48s/0.04u sec elapsed 6.06 sec. Whoa. Can you say "index bloat"? I think that the only way to fix this is to REINDEX pg_group, which IIRC in 7.3 requires stopping the postmaster and doing it in a standalone backend (check the REINDEX reference page for details). Make sure the toast table gets reindexed too, as its index is oversized as well. (Recent PG versions will automatically reindex the toast table when you reindex its parent table, but I forget whether 7.3 did so; you might have to explicitly "reindex pg_toast.pg_toast_1261".) regards, tom lane From pgsql-performance-owner@postgresql.org Tue Feb 8 20:32:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DBFD68B9F02 for ; Tue, 8 Feb 2005 20:32:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74618-03 for ; Tue, 8 Feb 2005 20:32:15 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D4C8A8B9E00 for ; Tue, 8 Feb 2005 20:32:16 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j18KWFio009899; Tue, 8 Feb 2005 15:32:15 -0500 (EST) To: "Ben Young" Cc: pgsql-performance@postgresql.org Subject: Re: Slow Restoration of a template1 Database (ALTER GROUP) In-reply-to: <41A1CBC76FDECC42B67946519C6677A901D301FE@pippin.int.etrials.com> References: <41A1CBC76FDECC42B67946519C6677A901D301FE@pippin.int.etrials.com> Comments: In-reply-to "Ben Young" message dated "Tue, 08 Feb 2005 15:08:50 -0500" Date: Tue, 08 Feb 2005 15:32:14 -0500 Message-ID: <9898.1107894734@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/127 X-Sequence-Number: 10456 "Ben Young" writes: > Is the "index bloat" prevented/reduced in newer versions of Postgres? Depends on what's causing it. Have you been inventing alphabetically greater group names and getting rid of smaller names over time? If so, this is a known problem that should be fixed in 7.4. The 7.4 release notes say: In previous releases, B-tree index pages that were left empty because of deleted rows could only be reused by rows with index values similar to the rows originally indexed on that page. In 7.4, VACUUM records empty index pages and allows them to be reused for any future index rows. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Feb 9 09:16:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 888FC8BA059 for ; Wed, 9 Feb 2005 09:16:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69806-01 for ; Wed, 9 Feb 2005 09:16:34 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id ED6898B9E0F for ; Wed, 9 Feb 2005 09:16:32 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j199E5mu060220; Wed, 9 Feb 2005 09:14:06 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.305 [265.8.6]); Wed, 09 Feb 2005 09:14:49 +0000 Message-ID: <4209D489.8090402@familyhealth.com.au> Date: Wed, 09 Feb 2005 09:14:49 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: lutzeb@aeccom.com Cc: John A Meinel , Greg Stark , pgsql-performance@postgresql.org, tgl@sss.pgh.pa.us Subject: Re: query produces 1 GB temp file References: <20050205182117.0125074@mail2.aeccom.com> <87y8e2kb8j.fsf@stark.xeocode.com> <42061B35.6000306@aeccom.com> <4206356C.9060308@arbash-meinel.com> <42063FF5.9040707@aeccom.com> In-Reply-To: <42063FF5.9040707@aeccom.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.019 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/135 X-Sequence-Number: 10464 > I'm doing VACUUM ANALYZE once a night. Before the tests I did VACUUM and > then ANALYZE. I'd suggest once an hour on any resonably active database... Chris From pgsql-performance-owner@postgresql.org Wed Feb 9 14:26:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 02F448B9F83 for ; Wed, 9 Feb 2005 14:26:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00984-01 for ; Wed, 9 Feb 2005 14:26:43 +0000 (GMT) Received: from m-monitor.net (unknown [207.44.134.28]) by svr1.postgresql.org (Postfix) with ESMTP id EBEA98B9B26 for ; Wed, 9 Feb 2005 14:26:45 +0000 (GMT) Received: (qmail 18997 invoked from network); 9 Feb 2005 14:26:46 -0000 Received: from 203-173-49-188.dyn.iinet.net.au (HELO ?127.0.0.1?) (203.173.49.188) by ev1s-207-44-134-28.ev1servers.net with SMTP; 9 Feb 2005 14:26:45 -0000 Message-ID: <420A1D9B.1040801@meerkatsoft.com> Date: Thu, 10 Feb 2005 01:26:35 +1100 From: Alex User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: How can I make use of both CPUs in a dual processor machine Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/136 X-Sequence-Number: 10465 Hi, we just got a new dual processor machine and I wonder if there is a way to utilize both processors. Our DB server is basically fully dedicated to postgres. (its a dual amd with 4gb mem.) I have a batch job that periodically loads about 8 million records into a table. for this I drop the indices, truncate the table, use the copy to insert the data, recreate the indices (4 indices), vacuum the table. That is all done through a perl batch job. While I am doing this, I noticed that only one CPU is really used. So here are my questions: Is there a way to utilize both CPUs Is it possible to split up the import file and run 2 copy processes Is it possible to create 2 indices at the same time Would I actually gain anything from that, or is the bottleneck somewhere else ? (perl is a given here for the batch job) If anyone has some experience or ideas... any hints or help on this would be appreciated. Thanks Alex From pgsql-performance-owner@postgresql.org Wed Feb 9 14:49:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1F7E78B9F8B for ; Wed, 9 Feb 2005 14:49:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02261-06 for ; Wed, 9 Feb 2005 14:49:19 +0000 (GMT) Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu [129.255.60.186]) by svr1.postgresql.org (Postfix) with ESMTP id 7A5128B9B45 for ; Wed, 9 Feb 2005 14:49:21 +0000 (GMT) Received: from [192.168.1.11] (12-217-241-0.client.mchsi.com [12.217.241.0]) by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id j19EnI308152; Wed, 9 Feb 2005 08:49:18 -0600 Message-ID: <420A22E7.5010501@arbash-meinel.com> Date: Wed, 09 Feb 2005 08:49:11 -0600 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alex Cc: pgsql-performance@postgresql.org Subject: Re: How can I make use of both CPUs in a dual processor References: <420A1D9B.1040801@meerkatsoft.com> In-Reply-To: <420A1D9B.1040801@meerkatsoft.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig7F8F6929B0B4141D3353FB58" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/137 X-Sequence-Number: 10466 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7F8F6929B0B4141D3353FB58 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Alex wrote: > Hi, > we just got a new dual processor machine and I wonder if there is a > way to utilize both processors. > > Our DB server is basically fully dedicated to postgres. (its a dual > amd with 4gb mem.) > > I have a batch job that periodically loads about 8 million records > into a table. > for this I drop the indices, truncate the table, use the copy to > insert the data, recreate the indices (4 indices), vacuum the table. > > That is all done through a perl batch job. > > While I am doing this, I noticed that only one CPU is really used. > > So here are my questions: > > Is there a way to utilize both CPUs > For postgres, you get a max of 1 CPU per connection, so to use both, you need 2 CPU's. > Is it possible to split up the import file and run 2 copy processes > > Is it possible to create 2 indices at the same time > You'd want to be a little careful. Postgres uses work_mem for vacuum and index creation, so if you have 2 processes doing it, just make sure you aren't running out of RAM and going to swap. > Would I actually gain anything from that, or is the bottleneck > somewhere else ? > More likely, the bottleneck would be disk I/O. Simply because it is almost always disk I/O. However, without knowing your configuration, how much CPU is used during the operation, etc, it's hard to say. > (perl is a given here for the batch job) > > If anyone has some experience or ideas... any hints or help on this > would be appreciated. > > Thanks > Alex > Sorry I wasn't a lot of help. You should probably post your postgres version, and more information about how much CPU load there is while your load is running. John =:-> --------------enig7F8F6929B0B4141D3353FB58 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCCiLqJdeBCYSNAAMRAs57AJ0WrL7te9DXyN7wOckjgZ9XUzHpmgCePB7R eRHtE0baqplSoTel8EU8WKI= =HcWm -----END PGP SIGNATURE----- --------------enig7F8F6929B0B4141D3353FB58-- From pgsql-performance-owner@postgresql.org Wed Feb 9 15:00:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E49548B9F87 for ; Wed, 9 Feb 2005 15:00:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03000-09 for ; Wed, 9 Feb 2005 15:00:23 +0000 (GMT) Received: from m-monitor.net (unknown [207.44.134.28]) by svr1.postgresql.org (Postfix) with ESMTP id EBAF48B9D0A for ; Wed, 9 Feb 2005 15:00:25 +0000 (GMT) Received: (qmail 19445 invoked from network); 9 Feb 2005 15:00:26 -0000 Received: from 203-173-49-188.dyn.iinet.net.au (HELO ?127.0.0.1?) (203.173.49.188) by ev1s-207-44-134-28.ev1servers.net with SMTP; 9 Feb 2005 15:00:26 -0000 Message-ID: <420A2580.3040404@meerkatsoft.com> Date: Thu, 10 Feb 2005 02:00:16 +1100 From: Alex User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John A Meinel Cc: pgsql-performance@postgresql.org Subject: Re: How can I make use of both CPUs in a dual processor References: <420A1D9B.1040801@meerkatsoft.com> <420A22E7.5010501@arbash-meinel.com> In-Reply-To: <420A22E7.5010501@arbash-meinel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/138 X-Sequence-Number: 10467 Thanks John. Well as I mentioned. I have a Dual AMD Opteron 64 2.4ghz, 15k rpm SCSI Disks, 4GB of memory. Disks are pretty fast and memory should be more than enough. Currently we dont have many concurrent connections. I run PG 8.0.1 on Fedora Core 3 When I now run the batch job, one CPU runs in the 80-90% the other in 5-10% max. John A Meinel wrote: > Alex wrote: > >> Hi, >> we just got a new dual processor machine and I wonder if there is a >> way to utilize both processors. >> >> Our DB server is basically fully dedicated to postgres. (its a dual >> amd with 4gb mem.) >> >> I have a batch job that periodically loads about 8 million records >> into a table. >> for this I drop the indices, truncate the table, use the copy to >> insert the data, recreate the indices (4 indices), vacuum the table. >> >> That is all done through a perl batch job. >> >> While I am doing this, I noticed that only one CPU is really used. >> >> So here are my questions: >> >> Is there a way to utilize both CPUs >> > For postgres, you get a max of 1 CPU per connection, so to use both, > you need 2 CPU's. > >> Is it possible to split up the import file and run 2 copy processes >> >> Is it possible to create 2 indices at the same time >> > You'd want to be a little careful. Postgres uses work_mem for vacuum > and index creation, so if you have 2 processes doing it, just make > sure you aren't running out of RAM and going to swap. > >> Would I actually gain anything from that, or is the bottleneck >> somewhere else ? >> > More likely, the bottleneck would be disk I/O. Simply because it is > almost always disk I/O. However, without knowing your configuration, > how much CPU is used during the operation, etc, it's hard to say. > >> (perl is a given here for the batch job) >> >> If anyone has some experience or ideas... any hints or help on this >> would be appreciated. >> >> Thanks >> Alex >> > Sorry I wasn't a lot of help. You should probably post your postgres > version, and more information about how much CPU load there is while > your load is running. > > John > =:-> > From pgsql-performance-owner@postgresql.org Wed Feb 9 15:14:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B7B208B9B26 for ; Wed, 9 Feb 2005 15:14:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04079-05 for ; Wed, 9 Feb 2005 15:14:13 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 6F2038B9F87 for ; Wed, 9 Feb 2005 15:14:16 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: How can I make use of both CPUs in a dual processor Date: Wed, 9 Feb 2005 10:14:16 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A7614@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] How can I make use of both CPUs in a dual processor Thread-Index: AcUOuJUQ1rbYuI89Q0Chf9jHJ73J/AAAHenQ From: "Merlin Moncure" To: "Alex" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/139 X-Sequence-Number: 10468 > Thanks John. >=20 > Well as I mentioned. I have a Dual AMD Opteron 64 2.4ghz, 15k rpm SCSI > Disks, 4GB of memory. > Disks are pretty fast and memory should be more than enough. Currently > we dont have many concurrent connections. >=20 > I run PG 8.0.1 on Fedora Core 3 >=20 > When I now run the batch job, one CPU runs in the 80-90% the other in > 5-10% max. If possible, split up your job into two workloads that can be run concurrently. Open up two connections on the client, one for each workload. To be 100% sure they get delegated to separate processors, let the first connection start working before opening the second one (should be easy enough to test from the terminal)...this should pretty much guarantee your batch processes get delegated to different processors. The beauty of pg is that it lets the o/s handle things that should be the o/s's job...don't forget the bgwriter/stats collector processes are also in the mix. Your o/s is probably already doing a pretty good job delegating work already. Even with fast disks, batch data management jobs are rarely cpu bound, so you might not see much difference in the total run time (spitting your batch might actually increase the run time, or reduce responsiveness to other connections). Never hurts to test that though. Merlin From pgsql-performance-owner@postgresql.org Wed Feb 9 15:16:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 55A158B9B26 for ; Wed, 9 Feb 2005 15:16:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04177-07 for ; Wed, 9 Feb 2005 15:16:06 +0000 (GMT) Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu [129.255.60.186]) by svr1.postgresql.org (Postfix) with ESMTP id E1E8B8B9B45 for ; Wed, 9 Feb 2005 15:16:09 +0000 (GMT) Received: from [192.168.1.11] (12-217-241-0.client.mchsi.com [12.217.241.0]) by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id j19FG9308450; Wed, 9 Feb 2005 09:16:09 -0600 Message-ID: <420A2933.6060100@arbash-meinel.com> Date: Wed, 09 Feb 2005 09:16:03 -0600 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alex Cc: pgsql-performance@postgresql.org Subject: Re: How can I make use of both CPUs in a dual processor References: <420A1D9B.1040801@meerkatsoft.com> <420A22E7.5010501@arbash-meinel.com> <420A2580.3040404@meerkatsoft.com> In-Reply-To: <420A2580.3040404@meerkatsoft.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig87F4BAB39965BEEA6FB68C7A" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/140 X-Sequence-Number: 10469 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig87F4BAB39965BEEA6FB68C7A Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Alex wrote: > Thanks John. > > Well as I mentioned. I have a Dual AMD Opteron 64 2.4ghz, 15k rpm > SCSI Disks, 4GB of memory. > Disks are pretty fast and memory should be more than enough. Currently > we dont have many concurrent connections. > Well, you didn't mention Opteron before (it makes a difference against Xeons). How many disks and in what configuration? Do you have pg_xlog on a separate set of disks? Are your drives in RAID 10 (0+1) or RAID 5? If you have enough disks the recommended configuration is at least a RAID1 for the OS, RAID 10 for pg_xlog (4drives), and RAID 10 (the rest of the drives) for the actual data. If your dataset is read heavy, or you have more than 6 disks, you can get away with RAID 5 for the actual data. But since you are talking about loading 8million rows at once, it certainly sounds like you are write heavy. If you only have a few disks, it's still probably better to put pg_xlog on it's own RAID1 (2-drive) mirror. pg_xlog is pretty much append only, so if you dedicate a disk set to it, you eliminate a lot of seek times. > I run PG 8.0.1 on Fedora Core 3 > > When I now run the batch job, one CPU runs in the 80-90% the other in > 5-10% max. Anyway, it doesn't completely sound like you are CPU limited, but you might be able to get a little bit more if you spawn another process. Have you tried dropping the index, doing the copy, and then recreating the 4-indexes in separate processes? The simple test for this is to open 3-4 psql connections, have one of them drop the indexes and do the copy, in the other connections you can already have typed "CREATE INDEX ..." so when the copy is done and committed to the database, you just go to the other terminals and hit enter. Unfortunately you'll have to use wall clock time to see if this is faster. Though I think you could do the same thing with a bash script. The authentication should be in "trust" mode so that you don't take the time to type your password. #!/bin/bash psql -h -c "DROP INDEX ...; COPY FROM ..." psql -h -c "CREATE INDEX ..." & psql -h -c "CREATE INDEX ..." & psql -h -c "CREATE INDEX ..." & psql -h -c "CREATE INDEX ..." Now, I don't really know how to wait for all child processes in a bash script (I could give you the python for it, but you're a perl guy). But by not spawning the last INDEX, I'm hoping it takes longer than the rest. Try to put the most difficult index there. Then you could just run time loadscript.sh I'm sure you could do the equivalent in perl. Just open multiple connections to the DB, and have them ready. I'm guessing since you are on a dual processor machine, you won't get much better performance above 2 connections. You can also try doing 2 COPYs at the same time, but it seems like you would have issues. Do you have any serial columns that you expect to be in a certain order, or is all the information in the copy? If the latter, try it, let us know what you get. I can't tell you the perl for this, since I'm not a perl guy. John =:-> --------------enig87F4BAB39965BEEA6FB68C7A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCCikzJdeBCYSNAAMRAhf1AKC7JW14BGhCPvgqQVeLyN1uBSxv4gCdHKvb 1iuEAd6MTnPKuIVeZR1nCWg= =kJpx -----END PGP SIGNATURE----- --------------enig87F4BAB39965BEEA6FB68C7A-- From pgsql-performance-owner@postgresql.org Wed Feb 9 15:58:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DF75E8B9F5E for ; Wed, 9 Feb 2005 15:58:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07543-09 for ; Wed, 9 Feb 2005 15:58:00 +0000 (GMT) Received: from mail.informatik.hu-berlin.de (mail.informatik.hu-berlin.de [141.20.20.50]) by svr1.postgresql.org (Postfix) with ESMTP id A9B5D8B9EA8 for ; Wed, 9 Feb 2005 15:58:02 +0000 (GMT) Received: from informatik.hu-berlin.de (karotte [141.20.27.143]) (authenticated bits=0) by mail.informatik.hu-berlin.de (8.12.10/8.12.10/INF-2.0-MA-SOLARIS-2.8) with ESMTP id j19Fw109009543 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 9 Feb 2005 16:58:02 +0100 (MET) Message-ID: <420A3309.5040507@informatik.hu-berlin.de> Date: Wed, 09 Feb 2005 16:58:01 +0100 From: Silke Trissl User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.4) Gecko/20030624 X-Accept-Language: de-at, de, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Tell postgres which index to use? Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/141 X-Sequence-Number: 10470 Hi, is there a way to tell Postgres which index to use when a query is issued in 7.4.2? I have a query for which costwise a Hash-Join and no Index-Usage is the best, but timewise using the index and then do a NestedLoop join is much better (3 - 4 times). I have vacuumed before I started the comparison, so Postgres does its best. And I don't constantly want to switch on and off the hashjoin and mergejoin. Regards, Silke Trissl From pgsql-performance-owner@postgresql.org Wed Feb 9 17:43:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 143D28BA02B for ; Wed, 9 Feb 2005 17:42:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24489-09 for ; Wed, 9 Feb 2005 17:41:56 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 384928B9FE3 for ; Wed, 9 Feb 2005 17:41:56 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7007495; Wed, 09 Feb 2005 09:43:41 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: Silke Trissl Subject: Re: Tell postgres which index to use? Date: Wed, 9 Feb 2005 09:41:01 -0800 User-Agent: KMail/1.6.2 Cc: pgsql-performance@postgresql.org References: <420A3309.5040507@informatik.hu-berlin.de> In-Reply-To: <420A3309.5040507@informatik.hu-berlin.de> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200502090941.01447.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/142 X-Sequence-Number: 10471 Silke, > is there a way to tell Postgres which index to use when a query is > issued in 7.4.2? PostgreSQL adjusts usage through global parameters, statistics, and periodic ANALYZE. Please post an EXPLAIN ANALYZE (not just EXPLAIN) for your query and people on this list can help you with your specific problem. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Feb 9 17:58:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4477A8B9E42 for ; Wed, 9 Feb 2005 17:58:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26543-10 for ; Wed, 9 Feb 2005 17:58:10 +0000 (GMT) Received: from mail.informatik.hu-berlin.de (mail.informatik.hu-berlin.de [141.20.20.50]) by svr1.postgresql.org (Postfix) with ESMTP id 7FFD18B9C33 for ; Wed, 9 Feb 2005 17:58:09 +0000 (GMT) Received: from informatik.hu-berlin.de (karotte [141.20.27.143]) (authenticated bits=0) by mail.informatik.hu-berlin.de (8.12.10/8.12.10/INF-2.0-MA-SOLARIS-2.8) with ESMTP id j19Hw209024882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 9 Feb 2005 18:58:02 +0100 (MET) Message-ID: <420A4F2A.1060506@informatik.hu-berlin.de> Date: Wed, 09 Feb 2005 18:58:02 +0100 From: Silke Trissl User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.4) Gecko/20030624 X-Accept-Language: de-at, de, en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Tell postgres which index to use? References: <420A3309.5040507@informatik.hu-berlin.de> <200502090941.01447.josh@agliodbs.com> In-Reply-To: <200502090941.01447.josh@agliodbs.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/143 X-Sequence-Number: 10472 Sorry, > >>is there a way to tell Postgres which index to use when a query is >>issued in 7.4.2? > > > PostgreSQL adjusts usage through global parameters, statistics, and periodic > ANALYZE. Please post an EXPLAIN ANALYZE (not just EXPLAIN) for your query > and people on this list can help you with your specific problem. here are the plans, but still I would like to tell Postgres to use an index or the join method (like HINT in ORACLE). > First the vacuum db=# vacuum full analyze; VACUUM Then the query for the first time with analyze db=# EXPLAIN ANALYZE db-# SELECT chain.pdb_id, chain.id FROM PDB_ENTRY, CHAIN WHERE PDB_ENTRY.resolution > 0.0 and PDB_ENTRY.resolution < 1.7 AND PDB_ENTRY.id = CHAIN.pdb_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=1426.75..5210.52 rows=7533 width=8) (actual time=77.712..399.108 rows=5798 loops=1) Hash Cond: ("outer".pdb_id = "inner".id) -> Seq Scan on "chain" (cost=0.00..3202.11 rows=67511 width=8) (actual time=0.048..151.885 rows=67511 loops=1) -> Hash (cost=1418.68..1418.68 rows=3226 width=4) (actual time=77.062..77.062 rows=0 loops=1) -> Seq Scan on pdb_entry (cost=0.00..1418.68 rows=3226 width=4) (actual time=0.118..71.956 rows=3329 loops=1) Filter: ((resolution > 0::double precision) AND (resolution < 1.7::double precision)) Total runtime: 404.434 ms (7 rows) And then try to avoid the Hash Join db=# SET ENABLE_hashjoin = OFF; SET db=# EXPLAIN ANALYZE db-# SELECT chain.pdb_id, chain.id FROM PDB_ENTRY, CHAIN WHERE PDB_ENTRY.resolution > 0.0 and PDB_ENTRY.resolution < 1.7 AND PDB_ENTRY.id = CHAIN.pdb_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (cost=9163.85..11100.74 rows=7533 width=8) (actual time=606.505..902.740 rows=5798 loops=1) Merge Cond: ("outer".id = "inner".pdb_id) -> Index Scan using pdb_entry_pkey on pdb_entry (cost=0.00..1516.03 rows=3226 width=4) (actual time=0.440..102.912 rows=3329 loops=1) Filter: ((resolution > 0::double precision) AND (resolution < 1.7::double precision)) -> Sort (cost=9163.85..9332.63 rows=67511 width=8) (actual time=605.838..694.190 rows=67501 loops=1) Sort Key: "chain".pdb_id -> Seq Scan on "chain" (cost=0.00..3202.11 rows=67511 width=8) (actual time=0.064..225.859 rows=67511 loops=1) Total runtime: 911.024 ms (8 rows) And finally timewise the fastest method, but not costwise. Even for almost full table joins, this method is the fastest. db=# SET ENABLE_mergejoin = off; SET db=# EXPLAIN ANALYZE db-# SELECT chain.pdb_id, chain.id FROM PDB_ENTRY, CHAIN WHERE PDB_ENTRY.resolution > 0.0 and PDB_ENTRY.resolution < 1.7 AND PDB_ENTRY.id = CHAIN.pdb_id; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..23849.81 rows=7533 width=8) (actual time=0.341..198.162 rows=5798 loops=1) -> Seq Scan on pdb_entry (cost=0.00..1418.68 rows=3226 width=4) (actual time=0.145..78.177 rows=3329 loops=1) Filter: ((resolution > 0::double precision) AND (resolution < 1.7::double precision)) -> Index Scan using chain_pdb_id_ind on "chain" (cost=0.00..6.87 rows=6 width=8) (actual time=0.021..0.027 rows=2 loops=3329) Index Cond: ("outer".id = "chain".pdb_id) Total runtime: 204.105 ms (6 rows) From pgsql-performance-owner@postgresql.org Wed Feb 9 18:37:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CA46A8B9B26 for ; Wed, 9 Feb 2005 18:37:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29505-04 for ; Wed, 9 Feb 2005 18:36:53 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id C417B8B9B6B for ; Wed, 9 Feb 2005 18:36:53 +0000 (GMT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.2/8.12.9) with ESMTP id j19Iadu4000531; (envelope-from ) Wed, 9 Feb 2005 12:36:39 -0600 (CST) Received: from [192.168.1.100] (12-217-241-0.client.mchsi.com [12.217.241.0]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j19IaZki009707 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Wed, 9 Feb 2005 12:36:36 -0600 (CST) Message-ID: <420A5836.4080605@arbash-meinel.com> Date: Wed, 09 Feb 2005 12:36:38 -0600 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Silke Trissl Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Tell postgres which index to use? References: <420A3309.5040507@informatik.hu-berlin.de> <200502090941.01447.josh@agliodbs.com> <420A4F2A.1060506@informatik.hu-berlin.de> In-Reply-To: <420A4F2A.1060506@informatik.hu-berlin.de> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig83BCD2F57E60F342229BB473" X-Virus-Scanned: ClamAV 0.80/682/Mon Jan 24 12:53:43 2005 clamav-milter version 0.80j on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV 0.80/685/Wed Jan 26 03:08:24 2005, clamav-milter version 0.75 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/144 X-Sequence-Number: 10473 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig83BCD2F57E60F342229BB473 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Silke Trissl wrote: > Sorry, > >> >>> is there a way to tell Postgres which index to use when a query is >>> issued in 7.4.2? >> >> >> >> PostgreSQL adjusts usage through global parameters, statistics, and >> periodic ANALYZE. Please post an EXPLAIN ANALYZE (not just EXPLAIN) >> for your query and people on this list can help you with your >> specific problem. > > > here are the plans, but still I would like to tell Postgres to use an > index or the join method (like HINT in ORACLE). > >> > > First the vacuum > db=# vacuum full analyze; > VACUUM > > Then the query for the first time with analyze > db=# EXPLAIN ANALYZE > db-# SELECT chain.pdb_id, chain.id FROM PDB_ENTRY, CHAIN > WHERE PDB_ENTRY.resolution > 0.0 and PDB_ENTRY.resolution < 1.7 > AND PDB_ENTRY.id = CHAIN.pdb_id; > QUERY PLAN > ------------------------------------------------------------------------------------------------------------------------- > > Hash Join (cost=1426.75..5210.52 rows=7533 width=8) (actual > time=77.712..399.108 rows=5798 loops=1) > Hash Cond: ("outer".pdb_id = "inner".id) > -> Seq Scan on "chain" (cost=0.00..3202.11 rows=67511 width=8) > (actual time=0.048..151.885 rows=67511 loops=1) > -> Hash (cost=1418.68..1418.68 rows=3226 width=4) (actual > time=77.062..77.062 rows=0 loops=1) This seems to be at least one of the problems. The planner thinks there are going to be 3000+ rows, but in reality there are 0. > -> Seq Scan on pdb_entry (cost=0.00..1418.68 rows=3226 > width=4) (actual time=0.118..71.956 rows=3329 loops=1) > Filter: ((resolution > 0::double precision) AND > (resolution < 1.7::double precision)) > Total runtime: 404.434 ms > (7 rows) > > And then try to avoid the Hash Join > > db=# SET ENABLE_hashjoin = OFF; > SET > db=# EXPLAIN ANALYZE > db-# SELECT chain.pdb_id, chain.id FROM PDB_ENTRY, CHAIN > WHERE PDB_ENTRY.resolution > 0.0 and PDB_ENTRY.resolution < 1.7 > AND PDB_ENTRY.id = CHAIN.pdb_id; > QUERY > PLAN > ------------------------------------------------------------------------------------------------------------------------------------------- > > Merge Join (cost=9163.85..11100.74 rows=7533 width=8) (actual > time=606.505..902.740 rows=5798 loops=1) > Merge Cond: ("outer".id = "inner".pdb_id) > -> Index Scan using pdb_entry_pkey on pdb_entry > (cost=0.00..1516.03 rows=3226 width=4) (actual time=0.440..102.912 > rows=3329 loops=1) > Filter: ((resolution > 0::double precision) AND (resolution < > 1.7::double precision)) > -> Sort (cost=9163.85..9332.63 rows=67511 width=8) (actual > time=605.838..694.190 rows=67501 loops=1) > Sort Key: "chain".pdb_id > -> Seq Scan on "chain" (cost=0.00..3202.11 rows=67511 > width=8) (actual time=0.064..225.859 rows=67511 loops=1) > Total runtime: 911.024 ms > (8 rows) > > And finally timewise the fastest method, but not costwise. Even for > almost full table joins, this method is the fastest. > > db=# SET ENABLE_mergejoin = off; > SET > db=# EXPLAIN ANALYZE > db-# SELECT chain.pdb_id, chain.id FROM PDB_ENTRY, CHAIN > WHERE PDB_ENTRY.resolution > 0.0 and PDB_ENTRY.resolution < 1.7 > AND PDB_ENTRY.id = CHAIN.pdb_id; > QUERY PLAN > ----------------------------------------------------------------------------------------------------------------------------------- > > Nested Loop (cost=0.00..23849.81 rows=7533 width=8) (actual > time=0.341..198.162 rows=5798 loops=1) > -> Seq Scan on pdb_entry (cost=0.00..1418.68 rows=3226 width=4) > (actual time=0.145..78.177 rows=3329 loops=1) > Filter: ((resolution > 0::double precision) AND (resolution < > 1.7::double precision)) > -> Index Scan using chain_pdb_id_ind on "chain" (cost=0.00..6.87 > rows=6 width=8) (actual time=0.021..0.027 rows=2 loops=3329) > Index Cond: ("outer".id = "chain".pdb_id) > Total runtime: 204.105 ms > (6 rows) I'm guessing the filter is more selective than postgres thinks it is (0 <> 1.7). You might try increasing the statistics of that column, you might also try playing with your random_page_cost to make index scans relatively cheaper (than seq scans). It might be an issue that your effective_cache_size isn't quite right, which makes postgres think most things are on disk, when in reality they are in memory (which also makes index scans much cheaper). Also, this query may sort itself out in time. As the tables grow, the relative fraction that you desire probably decreases, which makes index scans more attractive. John =:-> --------------enig83BCD2F57E60F342229BB473 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCClg2JdeBCYSNAAMRAuaVAJ9GS5l2wZh5m/ZUvOPAjvcr+Dr5bQCcDudZ eORyEt3NZnE4fAIsrUxV3u8= =3hXx -----END PGP SIGNATURE----- --------------enig83BCD2F57E60F342229BB473-- From pgsql-performance-owner@postgresql.org Wed Feb 9 19:03:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7017E8B9E02 for ; Wed, 9 Feb 2005 19:03:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31360-08 for ; Wed, 9 Feb 2005 19:02:47 +0000 (GMT) Received: from yellow.gradwell.net (www.gradwell.com [193.111.200.100]) by svr1.postgresql.org (Postfix) with ESMTP id 17B8C8B9D5D for ; Wed, 9 Feb 2005 19:02:46 +0000 (GMT) Received: from www.gradwell.com (yellow.gradwell.net [127.0.0.1]) by yellow.gradwell.net (8.11.6/8.11.6) with SMTP id j19J2fl32296; Wed, 9 Feb 2005 19:02:42 GMT Received: from 80.5.160.4 (proxying for 213.106.154.123) (SquirrelMail authenticated user paul@pop3.oxton.com) by www.gradwell.com with HTTP; Wed, 9 Feb 2005 19:02:42 -0000 (GMT) Message-ID: <28097.80.5.160.4.1107975762.squirrel@www.gradwell.com> Date: Wed, 9 Feb 2005 19:02:42 -0000 (GMT) Subject: Re: Solaris 9 tuning From: "Paul Johnson" To: "Josh Berkus" Cc: pgsql-performance@postgresql.org Reply-To: paul@oxton.com User-Agent: SquirrelMail/1.4.2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal References: <3834.81.134.31.64.1107815117.squirrel@www.gradwell.com> <200502071822.42805.josh@agliodbs.com> In-Reply-To: <200502071822.42805.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200502/145 X-Sequence-Number: 10474 Hi Josh, there are 8 internal disks - all are 18GB@10,000 RPM, fibre connected. The O/S is on 2 mirrored disks, the Postgres cluster is on the /data1 filesystem that is striped across the other 6 disks. The shared_buffers value is a semi-educated guess based on having made 4GB shared memory available via /etc/system, and having read all we could find on various web sites. Should I knock it down to 400MB as you suggest? I'll check out that URL. Cheers, Paul. > Paul, >> I would like to know what /etc/system and postgresql_conf values are recommended to deliver as much system resource as possible to Postgres. We >> use this Sun box solely for single user Postgres data warehousing workloads. > What's your disk system? >> shared_buffers = 500000 > This is highly unlikely to be optimal. That's 3GB. On test linux systems > up to 8GB, we've not seen useful values of shared buffers anywhere above 400mb. How did you arrive at that figure? >> sort_mem = 2097152 >> vacuum_mem = 1000000 > These could be fine on a single-user system. sort_mem is per *sort* though, > not per query, so you'd need to watch out for complex queries spillling into > swap; perhaps set it a 0.5GB or 1GB? > Otherwise, start with the config guide at www.powerpostgresql.com/PerfList > -- > Josh Berkus > Aglio Database Solutions > San Francisco From pgsql-performance-owner@postgresql.org Thu Feb 10 05:45:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B2E7C8BA005 for ; Wed, 9 Feb 2005 19:24:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32990-05 for ; Wed, 9 Feb 2005 19:24:03 +0000 (GMT) Received: from mail.jobflash.com (oncallweb2.jobflash.com [64.62.211.41]) by svr1.postgresql.org (Postfix) with ESMTP id D96718B9FDE for ; Wed, 9 Feb 2005 19:24:02 +0000 (GMT) Received: from [192.168.2.22] (user-2ivfmqm.dialup.mindspring.com [165.247.219.86]) by mail.jobflash.com (Postfix) with ESMTP id 64843420C1; Wed, 9 Feb 2005 11:23:59 -0800 (PST) Message-ID: <420A6332.70207@jobflash.com> Date: Wed, 09 Feb 2005 11:23:30 -0800 From: Tom Arthurs User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: paul@oxton.com Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Solaris 9 tuning References: <3834.81.134.31.64.1107815117.squirrel@www.gradwell.com> <200502071822.42805.josh@agliodbs.com> <28097.80.5.160.4.1107975762.squirrel@www.gradwell.com> In-Reply-To: <28097.80.5.160.4.1107975762.squirrel@www.gradwell.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/168 X-Sequence-Number: 10497 Hi, Paul Josh helped my company with this issue -- PG doesn't use shared memory like Oracle, it depends more on the OS buffers. Making shared mem too large a fraction is disasterous and seriously impact performance. (though I find myself having to justify this to Oracle trained DBA's) :) What I found was the biggest performance improvement on the write side was to turn of file system journaling, and on the read side was to feed postgres as many CPU's as you can. What we found for a high use db (for example backending a web site) is that 8-400 g cpu's outperforms 2 or 4 fast cpus. The fast cpu's spend all of their time context switching as more connections are made. Also make sure your txlog is on another spindle -- it might even be worth taking one out of the stripe to do this. I am running solaris 9 on an e3500 also (though my disc setup is different) Here's what I have things set to -- it's probably a pretty good starting point for you: # - Memory - shared_buffers = 65536 # min 16, at least max_connections*2, 8KB each sort_mem = 12000 # min 64, size in KB vacuum_mem = 64000 # min 1024, size in KB # - Free Space Map - max_fsm_pages = 100000 # min max_fsm_relations*16, 6 bytes each #max_fsm_relations = 10000 # min 100, ~50 bytes each # - Kernel Resource Usage - #max_files_per_process = 1000 # min 25 #preload_libraries = '' ----------------------------------------------------------------------------------- and the tail end of /etc/system: * shared memory config for postgres set shmsys:shminfo_shmmax=0xFFFFFFFF set shmsys:shminfo_shmmin=1 set shmsys:shminfo_shmmni=256 set shmsys:shminfo_shmseg=256 set semsys:seminfo_semmap=256 set semsys:seminfo_semmni=512 set semsys:seminfo_semmsl=1000 set semsys:seminfo_semmns=512 * end of shared memory setting * Set the hme card to force 100 full duplex and not to autonegotiate * since hme does not play well with cisco * set hme:hme_adv_autoneg_cap=0 set hme:hme_adv_100fdx_cap=1 set hme:hme_adv_100hdx_cap=0 set hme:hme_adv_10fdx_cap=0 set hme:hme_adv_10hdx_cap=0 set hme:hme_adv_100T4_cap=0 Paul Johnson wrote: > Hi Josh, there are 8 internal disks - all are 18GB@10,000 RPM, fibre > connected. > > The O/S is on 2 mirrored disks, the Postgres cluster is on the /data1 > filesystem that is striped across the other 6 disks. > > The shared_buffers value is a semi-educated guess based on having made 4GB > shared memory available via /etc/system, and having read all we could find > on various web sites. > > Should I knock it down to 400MB as you suggest? > > I'll check out that URL. > > Cheers, > > Paul. > > >>Paul, >> >>>I would like to know what /etc/system and postgresql_conf values are > > recommended to deliver as much system resource as possible to Postgres. > We > >>>use this Sun box solely for single user Postgres data warehousing > > workloads. > >>What's your disk system? >> >>>shared_buffers = 500000 >> >>This is highly unlikely to be optimal. That's 3GB. On test linux > > systems > >>up to 8GB, we've not seen useful values of shared buffers anywhere above > > 400mb. How did you arrive at that figure? > >>>sort_mem = 2097152 >>>vacuum_mem = 1000000 >> >>These could be fine on a single-user system. sort_mem is per *sort* > > though, > >>not per query, so you'd need to watch out for complex queries spillling > > into > >>swap; perhaps set it a 0.5GB or 1GB? >>Otherwise, start with the config guide at > > www.powerpostgresql.com/PerfList > >>-- >>Josh Berkus >>Aglio Database Solutions >>San Francisco > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > > > From pgsql-performance-owner@postgresql.org Wed Feb 9 19:25:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 94DCA8B9FA5 for ; Wed, 9 Feb 2005 19:25:47 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32841-10 for ; Wed, 9 Feb 2005 19:25:40 +0000 (GMT) Received: from morework.geizhals.at (home.geizhals.at [213.229.14.34]) by svr1.postgresql.org (Postfix) with ESMTP id E1EA98B9EA8 for ; Wed, 9 Feb 2005 19:25:38 +0000 (GMT) Received: from localhost (morework [127.0.0.1]) by morework.geizhals.at (Postfix) with ESMTP id 702F4DEBAA; Wed, 9 Feb 2005 20:25:35 +0100 (CET) Received: from [10.0.0.33] (mjy.ghoffice [10.0.0.33]) by morework.geizhals.at (Postfix) with ESMTP; Wed, 9 Feb 2005 20:25:35 +0100 (CET) Message-ID: <420A63B0.5020802@geizhals.at> Date: Wed, 09 Feb 2005 20:25:36 +0100 From: "Marinos J. Yannikos" User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Oleg Bartunov , pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> <4204C3B4.1050209@geizhals.at> <28977.1107632554@sss.pgh.pa.us> In-Reply-To: <28977.1107632554@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 at geizhals.at X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/146 X-Sequence-Number: 10475 Tom Lane wrote: > You might try the attached patch (which I just applied to HEAD). > It cuts down the number of acquisitions of the BufMgrLock by merging > adjacent bufmgr calls during a GIST index search. [...] Thanks - I applied it successfully against 8.0.0, but it didn't seem to have a noticeable effect. I'm still seeing more or less exactly 25% CPU usage by postgres processes and identical query times (measured with the Perl script I posted earlier). Regards, Marinos -- Dipl.-Ing. Marinos Yannikos, CEO Preisvergleich Internet Services AG Obere Donaustrasse 63, A-1020 Wien Tel./Fax: (+431) 5811609-52/-55 From pgsql-performance-owner@postgresql.org Wed Feb 9 19:33:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 39B048B9FBF for ; Wed, 9 Feb 2005 19:32:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34148-06 for ; Wed, 9 Feb 2005 19:32:37 +0000 (GMT) Received: from mail.jobflash.com (oncallweb2.jobflash.com [64.62.211.41]) by svr1.postgresql.org (Postfix) with ESMTP id F3EF98BA01A for ; Wed, 9 Feb 2005 19:32:26 +0000 (GMT) Received: from [192.168.2.22] (user-2ivfmqm.dialup.mindspring.com [165.247.219.86]) by mail.jobflash.com (Postfix) with ESMTP id 28717420C1; Wed, 9 Feb 2005 11:32:25 -0800 (PST) Message-ID: <420A652C.70802@jobflash.com> Date: Wed, 09 Feb 2005 11:31:56 -0800 From: Tom Arthurs User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: paul@oxton.com Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Solaris 9 tuning References: <3834.81.134.31.64.1107815117.squirrel@www.gradwell.com> <200502071822.42805.josh@agliodbs.com> <28097.80.5.160.4.1107975762.squirrel@www.gradwell.com> In-Reply-To: <28097.80.5.160.4.1107975762.squirrel@www.gradwell.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/147 X-Sequence-Number: 10476 ... Trying again again with right email address -- list server rejected previous :) Hi, Paul Josh helped my company with this issue -- PG doesn't use shared memory like Oracle, it depends more on the OS buffers. Making shared mem too large a fraction is disasterous and seriously impact performance. (though I find myself having to justify this to Oracle trained DBA's) :) What I found was the biggest performance improvement on the write side was to turn of file system journaling, and on the read side was to feed postgres as many CPU's as you can. What we found for a high use db (for example backending a web site) is that 8-400 g cpu's outperforms 2 or 4 fast cpus. The fast cpu's spend all of their time context switching as more connections are made. Also make sure your txlog is on another spindle -- it might even be worth taking one out of the stripe to do this. I am running solaris 9 on an e3500 also (though my disc setup is different) Here's what I have things set to -- it's probably a pretty good starting point for you: # - Memory - shared_buffers = 65536 # min 16, at least max_connections*2, 8KB each sort_mem = 12000 # min 64, size in KB vacuum_mem = 64000 # min 1024, size in KB # - Free Space Map - max_fsm_pages = 100000 # min max_fsm_relations*16, 6 bytes each #max_fsm_relations = 10000 # min 100, ~50 bytes each # - Kernel Resource Usage - #max_files_per_process = 1000 # min 25 #preload_libraries = '' ----------------------------------------------------------------------------------- and the tail end of /etc/system: * shared memory config for postgres set shmsys:shminfo_shmmax=0xFFFFFFFF set shmsys:shminfo_shmmin=1 set shmsys:shminfo_shmmni=256 set shmsys:shminfo_shmseg=256 set semsys:seminfo_semmap=256 set semsys:seminfo_semmni=512 set semsys:seminfo_semmsl=1000 set semsys:seminfo_semmns=512 * end of shared memory setting * Set the hme card to force 100 full duplex and not to autonegotiate * since hme does not play well with cisco * set hme:hme_adv_autoneg_cap=0 set hme:hme_adv_100fdx_cap=1 set hme:hme_adv_100hdx_cap=0 set hme:hme_adv_10fdx_cap=0 set hme:hme_adv_10hdx_cap=0 set hme:hme_adv_100T4_cap=0 Paul Johnson wrote: > Hi Josh, there are 8 internal disks - all are 18GB@10,000 RPM, fibre > connected. > > The O/S is on 2 mirrored disks, the Postgres cluster is on the /data1 > filesystem that is striped across the other 6 disks. > > The shared_buffers value is a semi-educated guess based on having made 4GB > shared memory available via /etc/system, and having read all we could find > on various web sites. > > Should I knock it down to 400MB as you suggest? > > I'll check out that URL. > > Cheers, > > Paul. > > >>Paul, >> >>>I would like to know what /etc/system and postgresql_conf values are > > recommended to deliver as much system resource as possible to Postgres. > We > >>>use this Sun box solely for single user Postgres data warehousing > > workloads. > >>What's your disk system? >> >>>shared_buffers = 500000 >> >>This is highly unlikely to be optimal. That's 3GB. On test linux > > systems > >>up to 8GB, we've not seen useful values of shared buffers anywhere above > > 400mb. How did you arrive at that figure? > >>>sort_mem = 2097152 >>>vacuum_mem = 1000000 >> >>These could be fine on a single-user system. sort_mem is per *sort* > > though, > >>not per query, so you'd need to watch out for complex queries spillling > > into > >>swap; perhaps set it a 0.5GB or 1GB? >>Otherwise, start with the config guide at > > www.powerpostgresql.com/PerfList > >>-- >>Josh Berkus >>Aglio Database Solutions >>San Francisco > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > > > From pgsql-performance-owner@postgresql.org Wed Feb 9 20:01:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0FED38BA062 for ; Wed, 9 Feb 2005 20:01:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37011-07 for ; Wed, 9 Feb 2005 20:01:37 +0000 (GMT) Received: from greywolf.vistashare.net (www.vistashare.net [65.207.67.162]) by svr1.postgresql.org (Postfix) with ESMTP id 9B2D58BA066 for ; Wed, 9 Feb 2005 20:01:35 +0000 (GMT) Received: from [10.100.2.210] (phoenix.vistashare.net [10.100.2.210]) by greywolf.vistashare.net (Postfix) with ESMTP id 79390132C4 for ; Wed, 9 Feb 2005 15:01:34 -0500 (EST) From: Chris Kratz Organization: VistaShare To: pgsql-performance@postgresql.org Subject: Performance Tuning Date: Wed, 9 Feb 2005 15:01:31 -0500 User-Agent: KMail/1.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502091501.31447.chris.kratz@vistashare.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/148 X-Sequence-Number: 10477 Hello All, In contrast to what we hear from most others on this list, we find our database servers are mostly CPU bound. We are wondering if this is because we have postgres configured incorrectly in some way, or if we really need more powerfull processor(s) to gain more performance from postgres. We continue to tune our individual queries where we can, but it seems we still are waiting on the db a lot in our app. When we run most queries, top shows the postmaster running at 90%+ constantly during the duration of the request. The disks get touched occasionally, but not often. Our database on disk is around 2.6G and most of the working set remains cached in memory, hence the few disk accesses. All this seems to point to the need for faster processors. Our question is simply this, is it better to invest in a faster processor at this point, or are there configuration changes to make it faster? I've done some testing with with 4x SCSI 10k and the performance didn't improve, in fact it actually was slower the the sata drives marginally. One of our developers is suggesting we should compile postgres from scratch for this particular processor, and we may try that. Any other ideas? -Chris On this particular development server, we have: Athlon XP,3000 1.5G Mem 4x Sata drives in Raid 0 Postgresql 7.4.5 installed via RPM running on Linux kernel 2.6.8.1 Items changed in the postgresql.conf: tcpip_socket = true max_connections = 32 port = 5432 shared_buffers = 12288 # min 16, at least max_connections*2, 8KB each sort_mem=16384 vacuum_mem = 32768 # min 1024, size in KB max_fsm_pages = 60000 # min max_fsm_relations*16, 6 bytes each max_fsm_relations = 1000 # min 100, ~50 bytes each effective_cache_size = 115200 # typically 8KB each random_page_cost = 1 # units are one sequential page fetch cost From pgsql-performance-owner@postgresql.org Thu Feb 10 05:42:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B729A8B9F66 for ; Wed, 9 Feb 2005 20:28:34 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39018-05 for ; Wed, 9 Feb 2005 20:28:17 +0000 (GMT) Received: from server2.sitesell.com (server2.sitesell.com [216.95.221.3]) by svr1.postgresql.org (Postfix) with SMTP id 2921C8BA062 for ; Wed, 9 Feb 2005 20:28:18 +0000 (GMT) Received: (qmail 6407 invoked from network); 9 Feb 2005 20:28:17 -0000 Received: from dyn-68-127.tor.dsl.tht.net (134.22.68.127) by server2.sitesell.com with SMTP; 9 Feb 2005 20:28:17 -0000 Subject: Re: Performance Tuning From: Rod Taylor To: Chris Kratz Cc: Postgresql Performance In-Reply-To: <200502091501.31447.chris.kratz@vistashare.com> References: <200502091501.31447.chris.kratz@vistashare.com> Content-Type: text/plain Date: Wed, 09 Feb 2005 15:27:53 -0500 Message-Id: <1107980873.7553.41.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/167 X-Sequence-Number: 10496 On Wed, 2005-02-09 at 15:01 -0500, Chris Kratz wrote: > Hello All, > > In contrast to what we hear from most others on this list, we find our > database servers are mostly CPU bound. We are wondering if this is because > we have postgres configured incorrectly in some way, or if we really need > more powerfull processor(s) to gain more performance from postgres. Not necessarily. I had a very disk bound system, bought a bunch of higher end equipment (which focuses on IO) and now have a (faster) but CPU bound system. It's just the way the cookie crumbles. Some things to watch for are large calculations which are easy to move client side, such as queries that sort for display purposes. Or data types which aren't really required (using numeric where an integer would do). > We continue to tune our individual queries where we can, but it seems we still > are waiting on the db a lot in our app. When we run most queries, top shows > the postmaster running at 90%+ constantly during the duration of the request. Is this for the duration of a single request or 90% constantly? If it's a single request, odds are you're going through much more information than you need to. Lots of aggregate work (max / min) perhaps or count(*)'s where an approximation would do? > Our question is simply this, is it better to invest in a faster processor at > this point, or are there configuration changes to make it faster? I've done If it's for a single request, you cannot get single processors which are much faster than what you describe as having. Want to send us a few EXPLAIN ANALYZE's of your longer running queries? -- Rod Taylor From pgsql-performance-owner@postgresql.org Wed Feb 9 20:38:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7BC6B8BA056 for ; Wed, 9 Feb 2005 20:38:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39842-05 for ; Wed, 9 Feb 2005 20:38:22 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 686FA8B9EE9 for ; Wed, 9 Feb 2005 20:38:22 +0000 (GMT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.2/8.12.9) with ESMTP id j19KcMUm005454; (envelope-from ) Wed, 9 Feb 2005 14:38:22 -0600 (CST) Received: from [192.168.1.100] (12-217-241-0.client.mchsi.com [12.217.241.0]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j19KcI1g012126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Wed, 9 Feb 2005 14:38:21 -0600 (CST) Message-ID: <420A74BE.8010009@arbash-meinel.com> Date: Wed, 09 Feb 2005 14:38:22 -0600 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Chris Kratz Cc: pgsql-performance@postgresql.org Subject: Re: Performance Tuning References: <200502091501.31447.chris.kratz@vistashare.com> In-Reply-To: <200502091501.31447.chris.kratz@vistashare.com> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig957DD9393391C7D8B8EB4272" X-Virus-Scanned: ClamAV 0.80/682/Mon Jan 24 12:53:43 2005 clamav-milter version 0.80j on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV 0.80/685/Wed Jan 26 03:08:24 2005, clamav-milter version 0.75 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/149 X-Sequence-Number: 10478 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig957DD9393391C7D8B8EB4272 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Chris Kratz wrote: >Hello All, > >In contrast to what we hear from most others on this list, we find our >database servers are mostly CPU bound. We are wondering if this is because >we have postgres configured incorrectly in some way, or if we really need >more powerfull processor(s) to gain more performance from postgres. > > > If everything is cached in ram, it's pretty easy to be CPU bound. You very easily could be at this point if your database is only 2.6G and you don't touch all the tables often. I do believe that when CPU bound, the best thing to do is get faster CPUs. ... >Our question is simply this, is it better to invest in a faster processor at >this point, or are there configuration changes to make it faster? I've done >some testing with with 4x SCSI 10k and the performance didn't improve, in >fact it actually was slower the the sata drives marginally. One of our >developers is suggesting we should compile postgres from scratch for this >particular processor, and we may try that. Any other ideas? > >-Chris > >On this particular development server, we have: > >Athlon XP,3000 >1.5G Mem >4x Sata drives in Raid 0 > > > I'm very surprised you are doing RAID 0. You realize that if 1 drive goes out, your entire array is toast, right? I would recommend doing either RAID 10 (0+1), or even Raid 5 if you don't do a lot of writes. Probably most important, though is to look at the individual queries and see what they are doing. >Postgresql 7.4.5 installed via RPM running on Linux kernel 2.6.8.1 > >Items changed in the postgresql.conf: > >tcpip_socket = true >max_connections = 32 >port = 5432 >shared_buffers = 12288 # min 16, at least max_connections*2, 8KB each >sort_mem=16384 >vacuum_mem = 32768 # min 1024, size in KB >max_fsm_pages = 60000 # min max_fsm_relations*16, 6 bytes each >max_fsm_relations = 1000 # min 100, ~50 bytes each >effective_cache_size = 115200 # typically 8KB each >random_page_cost = 1 # units are one sequential page fetch cost > > Most of these seem okay to me, but random page cost is *way* too low. This should never be tuned below 2. I think this says "an index scan of *all* rows is as cheap as a sequential scan of all rows." and that should never be true. What could actually be happening is that you are getting index scans when a sequential scan would be faster. I don't know what you would see, but what does "explain analyze select count(*) from blah;" say. If it is an index scan, you have your machine mistuned. select count(*) always grabs every row, and this is always cheaper with a sequential scan. John =:-> --------------enig957DD9393391C7D8B8EB4272 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCCnS+JdeBCYSNAAMRAk88AJ9uqiM7XEfHC8VW8dqOSiHMcBRILACgka0R DQ8YLLNepAmU2firdlUeu88= =Iw6O -----END PGP SIGNATURE----- --------------enig957DD9393391C7D8B8EB4272-- From pgsql-performance-owner@postgresql.org Wed Feb 9 20:50:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4EE278BA058 for ; Wed, 9 Feb 2005 20:49:57 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39967-10 for ; Wed, 9 Feb 2005 20:49:48 +0000 (GMT) Received: from yellow.gradwell.net (www.gradwell.com [193.111.200.100]) by svr1.postgresql.org (Postfix) with ESMTP id 3C6718B9FB6 for ; Wed, 9 Feb 2005 20:49:48 +0000 (GMT) Received: from www.gradwell.com (yellow.gradwell.net [127.0.0.1]) by yellow.gradwell.net (8.11.6/8.11.6) with SMTP id j19Kngl02098; Wed, 9 Feb 2005 20:49:42 GMT Received: from 81.138.75.25 (SquirrelMail authenticated user paul@pop3.oxton.com) by www.gradwell.com with HTTP; Wed, 9 Feb 2005 20:49:43 -0000 (GMT) Message-ID: <4234.81.138.75.25.1107982183.squirrel@www.gradwell.com> In-Reply-To: <420A6332.70207@jobflash.com> References: <3834.81.134.31.64.1107815117.squirrel@www.gradwell.com> <200502071822.42805.josh@agliodbs.com> <28097.80.5.160.4.1107975762.squirrel@www.gradwell.com> <420A6332.70207@jobflash.com> Date: Wed, 9 Feb 2005 20:49:43 -0000 (GMT) Subject: Re: Solaris 9 tuning From: "Paul Johnson" To: "Tom Arthurs" Cc: "Josh Berkus" , pgsql-performance@postgresql.org Reply-To: paul@oxton.com User-Agent: SquirrelMail/1.4.2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200502/150 X-Sequence-Number: 10479 Hi Tom, I've made changes to postgresql.conf as recommended on Josh's site and this seems to be working well so far. Given your comments on shared memory, it would appear that the following entry in /etc/system is unnecessary: set shmsys:shminfo_shmmax=0xFFFFFFFF Ironically, we both have this identical setting! Given that most of our queries are single-user read-only, how do we take advantage of the 6 CPUs? I'm guessing we can't!?!?! Also, does this type of workload benefit from moving the txlog? I'll check our settings against yours given the Solaris 9/E3500 setup that we both run. Many thanks, Paul. > Hi, Paul > > Josh helped my company with this issue -- PG doesn't use shared memory > like Oracle, it depends more on the OS buffers. Making shared mem > too large a fraction is disasterous and seriously impact performance. > (though I find myself having to justify this to Oracle trained > DBA's) :) > > What I found was the biggest performance improvement on the write side was > to turn of file system journaling, and on the read side was > to feed postgres as many CPU's as you can. What we found for a high use > db (for example backending a web site) is that 8-400 g cpu's > outperforms 2 or 4 fast cpus. The fast cpu's spend all of their time > context switching as more connections are made. > > Also make sure your txlog is on another spindle -- it might even be worth > taking one out of the stripe to do this. > > I am running solaris 9 on an e3500 also (though my disc setup is > different) > > Here's what I have things set to -- it's probably a pretty good starting > point for you: > > # - Memory - > > shared_buffers = 65536 # min 16, at least max_connections*2, 8KB > each > sort_mem = 12000 # min 64, size in KB > vacuum_mem = 64000 # min 1024, size in KB > > # - Free Space Map - > > max_fsm_pages = 100000 # min max_fsm_relations*16, 6 bytes each > #max_fsm_relations = 10000 # min 100, ~50 bytes each > > # - Kernel Resource Usage - > > #max_files_per_process = 1000 # min 25 > #preload_libraries = '' > > ----------------------------------------------------------------------------------- > > and the tail end of /etc/system: > > * shared memory config for postgres > set shmsys:shminfo_shmmax=0xFFFFFFFF > set shmsys:shminfo_shmmin=1 > set shmsys:shminfo_shmmni=256 > set shmsys:shminfo_shmseg=256 > set semsys:seminfo_semmap=256 > set semsys:seminfo_semmni=512 > set semsys:seminfo_semmsl=1000 > set semsys:seminfo_semmns=512 > * end of shared memory setting > * Set the hme card to force 100 full duplex and not to autonegotiate > * since hme does not play well with cisco > * > set hme:hme_adv_autoneg_cap=0 > set hme:hme_adv_100fdx_cap=1 > set hme:hme_adv_100hdx_cap=0 > set hme:hme_adv_10fdx_cap=0 > set hme:hme_adv_10hdx_cap=0 > set hme:hme_adv_100T4_cap=0 > > > Paul Johnson wrote: > >> Hi Josh, there are 8 internal disks - all are 18GB@10,000 RPM, fibre >> connected. >> >> The O/S is on 2 mirrored disks, the Postgres cluster is on the /data1 >> filesystem that is striped across the other 6 disks. >> >> The shared_buffers value is a semi-educated guess based on having made >> 4GB >> shared memory available via /etc/system, and having read all we could >> find >> on various web sites. >> >> Should I knock it down to 400MB as you suggest? >> >> I'll check out that URL. >> >> Cheers, >> >> Paul. >> >> >>>Paul, >>> >>>>I would like to know what /etc/system and postgresql_conf values are >> >> recommended to deliver as much system resource as possible to Postgres. >> We >> >>>>use this Sun box solely for single user Postgres data warehousing >> >> workloads. >> >>>What's your disk system? >>> >>>>shared_buffers = 500000 >>> >>>This is highly unlikely to be optimal. That's 3GB. On test linux >> >> systems >> >>>up to 8GB, we've not seen useful values of shared buffers anywhere above >> >> 400mb. How did you arrive at that figure? >> >>>>sort_mem = 2097152 >>>>vacuum_mem = 1000000 >>> >>>These could be fine on a single-user system. sort_mem is per *sort* >> >> though, >> >>>not per query, so you'd need to watch out for complex queries spillling >> >> into >> >>>swap; perhaps set it a 0.5GB or 1GB? >>>Otherwise, start with the config guide at >> >> www.powerpostgresql.com/PerfList >> >>>-- >>>Josh Berkus >>>Aglio Database Solutions >>>San Francisco >> >> >> >> >> >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 6: Have you searched our list archives? >> >> http://archives.postgresql.org >> >> >> > From pgsql-performance-owner@postgresql.org Wed Feb 9 20:50:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EB0A78B9FE8 for ; Wed, 9 Feb 2005 20:50:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40534-05 for ; Wed, 9 Feb 2005 20:50:16 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id F1FF48B9F04 for ; Wed, 9 Feb 2005 20:50:17 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1Cyyml-0003rm-00; Wed, 09 Feb 2005 15:50:07 -0500 To: John Arbash Meinel Cc: Silke Trissl , Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Tell postgres which index to use? References: <420A3309.5040507@informatik.hu-berlin.de> <200502090941.01447.josh@agliodbs.com> <420A4F2A.1060506@informatik.hu-berlin.de> <420A5836.4080605@arbash-meinel.com> In-Reply-To: <420A5836.4080605@arbash-meinel.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 09 Feb 2005 15:50:06 -0500 Message-ID: <873bw5e9vl.fsf@stark.xeocode.com> Lines: 41 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/151 X-Sequence-Number: 10480 John Arbash Meinel writes: > > -> Hash (cost=1418.68..1418.68 rows=3226 width=4) (actual > > time=77.062..77.062 rows=0 loops=1) > > This seems to be at least one of the problems. The planner thinks there > are going to be 3000+ rows, but in reality there are 0. No, that's a red herring. Hash nodes always report 0 rows. > > Nested Loop (cost=0.00..23849.81 rows=7533 width=8) (actual time=0.341..198.162 rows=5798 loops=1) > > -> Seq Scan on pdb_entry (cost=0.00..1418.68 rows=3226 width=4) (actual time=0.145..78.177 rows=3329 loops=1) > > Filter: ((resolution > 0::double precision) AND (resolution < 1.7::double precision)) > > -> Index Scan using chain_pdb_id_ind on "chain" (cost=0.00..6.87 rows=6 width=8) (actual time=0.021..0.027 rows=2 loops=3329) > > Index Cond: ("outer".id = "chain".pdb_id) The actual number of records is pretty close to the estimated number. And the difference seems to come primarily from selectivity of the join where it thinks an average of 6 rows will match every row whereas in fact an average of about 2 rows matches. So it thinks it's going to read about 18,000 records out of 67,000 or about 25%. In that case the sequential scan is almost certainly better. In fact it's going to read about 6,000 or just under 10%, in which case the sequential scan is probably still better but it's not so clear. I suspect the only reason you're seeing such a big difference when I would expect it to be about even is because nearly all the data is cached. In that case the non-sequential access pattern of the nested loop has little effect. You might get away with lowering random_page_cost but since it thinks it's going to read 25% of the table I suspect you'll have to get very close to 1 before it switches over, if it does even then. Be careful about tuning settings like this based on a single query, especially to unrealistically low values. You might also want to try raising the statistics target on pdb_entry. See if that makes the estimate go down from 6 to closer to 2. -- greg From pgsql-performance-owner@postgresql.org Wed Feb 9 21:00:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C58428B9FB6 for ; Wed, 9 Feb 2005 21:00:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41200-08 for ; Wed, 9 Feb 2005 21:00:02 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 475E88B9F04 for ; Wed, 9 Feb 2005 21:00:03 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1CyywB-0003tN-00; Wed, 09 Feb 2005 15:59:51 -0500 To: Chris Kratz Cc: pgsql-performance@postgresql.org Subject: Re: Performance Tuning References: <200502091501.31447.chris.kratz@vistashare.com> In-Reply-To: <200502091501.31447.chris.kratz@vistashare.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 09 Feb 2005 15:59:50 -0500 Message-ID: <87wtthcuux.fsf@stark.xeocode.com> Lines: 27 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/152 X-Sequence-Number: 10481 Chris Kratz writes: > We continue to tune our individual queries where we can, but it seems we still > are waiting on the db a lot in our app. When we run most queries, top shows > the postmaster running at 90%+ constantly during the duration of the request. > The disks get touched occasionally, but not often. Our database on disk is > around 2.6G and most of the working set remains cached in memory, hence the > few disk accesses. All this seems to point to the need for faster > processors. I would suggest looking at the top few queries that are taking the most cumulative time on the processor. It sounds like the queries are doing a ton of logical i/o on data that's cached in RAM. A few indexes might cut down on the memory bandwidth needed to churn through all that data. > Items changed in the postgresql.conf: > ... > random_page_cost = 1 # units are one sequential page fetch cost This makes it nigh impossible for the server from ever making a sequential scan when an index would suffice. What query made you do this? What plan did it fix? -- greg From pgsql-performance-owner@postgresql.org Wed Feb 9 21:25:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 271328B9FB1 for ; Wed, 9 Feb 2005 21:25:45 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43147-08 for ; Wed, 9 Feb 2005 21:25:35 +0000 (GMT) Received: from greywolf.vistashare.net (www.vistashare.net [65.207.67.162]) by svr1.postgresql.org (Postfix) with ESMTP id 091028B9EF0 for ; Wed, 9 Feb 2005 21:25:36 +0000 (GMT) Received: from [10.100.2.210] (phoenix.vistashare.net [10.100.2.210]) by greywolf.vistashare.net (Postfix) with ESMTP id 09D50146B5A; Wed, 9 Feb 2005 16:25:36 -0500 (EST) From: Chris Kratz Organization: VistaShare To: John Arbash Meinel Subject: Re: Performance Tuning Date: Wed, 9 Feb 2005 16:25:34 -0500 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <200502091501.31447.chris.kratz@vistashare.com> <420A74BE.8010009@arbash-meinel.com> In-Reply-To: <420A74BE.8010009@arbash-meinel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502091625.34787.chris.kratz@vistashare.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/153 X-Sequence-Number: 10482 On Wednesday 09 February 2005 03:38 pm, John Arbash Meinel wrote: >... > I'm very surprised you are doing RAID 0. You realize that if 1 drive > goes out, your entire array is toast, right? I would recommend doing > either RAID 10 (0+1), or even Raid 5 if you don't do a lot of writes. Yeah, we know. This is a development server and we drop and reload databases regularly (sometimes several times a day). In this case we don't really care about the integrity of the data since it's for our developers to test code against. Also, the system is on a mirrored set of drives. On our live servers we have hardware raid 1 at this point for the data drives. When I/O becomes a bottleneck, we are planning on moving to Raid 10 for the data and Raid 1 for the transaction log with as many drives as I can twist arms for. Up to this point it has been easier just to stuff the servers full of memory and let the OS cache the db in memory. We know that at some point this will no longer work, but for now it is. As a side note, I learned something very interesting for our developers here. We had been doing a drop database and then a reload off a db dump from our live server for test data. This takes 8-15 minutes depending on the server (the one above takes about 8 minutes). I learned through testing that I can use create database template some_other_database and make a duplicate in about 2.5 minutes. which is a huge gain for us. We can load a pristine copy, make a duplicate, do our testing on the duplicate, drop the duplicate and create a new duplicate in less then five mintes. Cool. > Probably most important, though is to look at the individual queries and > see what they are doing. > > >Postgresql 7.4.5 installed via RPM running on Linux kernel 2.6.8.1 > > > >Items changed in the postgresql.conf: > > > >tcpip_socket = true > >max_connections = 32 > >port = 5432 > >shared_buffers = 12288 # min 16, at least max_connections*2, 8KB each > >sort_mem=16384 > >vacuum_mem = 32768 # min 1024, size in KB > >max_fsm_pages = 60000 # min max_fsm_relations*16, 6 bytes each > >max_fsm_relations = 1000 # min 100, ~50 bytes each > >effective_cache_size = 115200 # typically 8KB each > >random_page_cost = 1 # units are one sequential page fetch cost > > Most of these seem okay to me, but random page cost is *way* too low. > This should never be tuned below 2. I think this says "an index scan of > *all* rows is as cheap as a sequential scan of all rows." and that > should never be true. You caught me. I actually tweaked that today after finding a page that suggested doing that if the data was mostly in memory. I have been running it at 2, and since we didn't notice any improvement, it will be going back to 2. > What could actually be happening is that you are getting index scans > when a sequential scan would be faster. > > I don't know what you would see, but what does "explain analyze select > count(*) from blah;" say. If it is an index scan, you have your machine > mistuned. select count(*) always grabs every row, and this is always > cheaper with a sequential scan. > > John > =:-> With a random_page_cost set to 1, on a larger table a select count(*) nets this... QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- Aggregate (cost=9848.12..9848.12 rows=1 width=0) (actual time=4916.869..4916.872 rows=1 loops=1) -> Seq Scan on answer (cost=0.00..8561.29 rows=514729 width=0) (actual time=0.011..2624.202 rows=514729 loops=1) Total runtime: 4916.942 ms (3 rows) Now here is a very curious thing. If I turn on timing and run the count without explain analyze, I get... count -------- 514729 (1 row) Time: 441.539 ms How odd. Running the explain adds 4.5s to it. Running the explain again goes back to almost 5s. Now I wonder why that would be different. Changing random cpu cost back to 2 nets little difference (4991.940ms for explain and 496ms) But we will leave it at that for now. -- Chris Kratz Systems Analyst/Programmer VistaShare LLC www.vistashare.com From pgsql-performance-owner@postgresql.org Wed Feb 9 21:46:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 582E58B9E42; Wed, 9 Feb 2005 21:46:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44916-04; Wed, 9 Feb 2005 21:46:28 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id A23A58BA029; Wed, 9 Feb 2005 21:46:28 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [64.81.245.111] (account josh@agliodbs.com HELO temoku.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7008536; Wed, 09 Feb 2005 13:48:14 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: sfpug@postgresql.org, pgsql-performance@postgresql.org Subject: annotated PostgreSQL.conf now up Date: Wed, 9 Feb 2005 13:50:24 -0800 User-Agent: KMail/1.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502091350.24885.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.051 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/154 X-Sequence-Number: 10483 Folks, A lot of people have been pestering me for this stuff, so I've finally finished it and put it up. http://www.powerpostgresql.com/ Hopefully this should help people as much as the last one did. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Feb 9 22:09:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 94C288B9CF0 for ; Wed, 9 Feb 2005 22:08:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45954-06 for ; Wed, 9 Feb 2005 22:08:41 +0000 (GMT) Received: from mail.jobflash.com (oncallweb2.jobflash.com [64.62.211.41]) by svr1.postgresql.org (Postfix) with ESMTP id CC3A68B9E0F for ; Wed, 9 Feb 2005 22:08:41 +0000 (GMT) Received: from [192.168.200.152] (unknown [192.168.200.152]) by mail.jobflash.com (Postfix) with ESMTP id B975A420C1; Wed, 9 Feb 2005 14:08:39 -0800 (PST) Message-ID: <420A89CA.2080303@jobflash.com> Date: Wed, 09 Feb 2005 14:08:10 -0800 From: Tom Arthurs User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: paul@oxton.com Cc: Tom Arthurs , Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Solaris 9 tuning References: <3834.81.134.31.64.1107815117.squirrel@www.gradwell.com> <200502071822.42805.josh@agliodbs.com> <28097.80.5.160.4.1107975762.squirrel@www.gradwell.com> <420A6332.70207@jobflash.com> <4234.81.138.75.25.1107982183.squirrel@www.gradwell.com> In-Reply-To: <4234.81.138.75.25.1107982183.squirrel@www.gradwell.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/156 X-Sequence-Number: 10485 Yes, I agree it's unnecessary -- but you'll never have to worry about the postmaster not starting due to lack of allocatable memory -- when I was testing setups, I got sick of rebooting everytime I had to make a change to /etc/system, that I threw up my hands and said, "let it take all it wants". :) "single user read only" -- the key is how many connections -- what's your application? Is this being driven by a front end application? In my case, we run a website with an apache fronted, a tomcat server as middleware, and 4 applications. We may, at times, have only 1 user on, but the java code could be doing a half dozen queries in different threads for that one user. run /usr/ucb/ps -auxww | grep (-- we use postgres so "grep post" works for us) while under load and see how many backends are running. if it's more than 4 or 5, then you are using the cpu's. On the topic of shared memory, watch for the ouput of top or prstat -a -- these programs count the shared memory block towards each process and therefor lie about amount of memory used. Looking at vmstat, etc show that the percentage of utilization reported by top or prstat is way off, and if you care to examine the memory for each proces, you'll see that the shared memory block address is, well, shared by each process (by definition, eh?) but it can be reported as if it were a different block for each process. Not sure the e3500 is the best box for a data warehouse application Paul Johnson wrote: > Hi Tom, I've made changes to postgresql.conf as recommended on Josh's site > and this seems to be working well so far. > > Given your comments on shared memory, it would appear that the following > entry in /etc/system is unnecessary: > > set shmsys:shminfo_shmmax=0xFFFFFFFF > > Ironically, we both have this identical setting! > > Given that most of our queries are single-user read-only, how do we take > advantage of the 6 CPUs? I'm guessing we can't!?!?! > > Also, does this type of workload benefit from moving the txlog? > > I'll check our settings against yours given the Solaris 9/E3500 setup that > we both run. > > Many thanks, > > Paul. > > >>Hi, Paul >> >>Josh helped my company with this issue -- PG doesn't use shared memory >>like Oracle, it depends more on the OS buffers. Making shared mem >>too large a fraction is disasterous and seriously impact performance. >>(though I find myself having to justify this to Oracle trained >>DBA's) :) >> >>What I found was the biggest performance improvement on the write side was >>to turn of file system journaling, and on the read side was >>to feed postgres as many CPU's as you can. What we found for a high use >>db (for example backending a web site) is that 8-400 g cpu's >>outperforms 2 or 4 fast cpus. The fast cpu's spend all of their time >>context switching as more connections are made. >> >>Also make sure your txlog is on another spindle -- it might even be worth >>taking one out of the stripe to do this. >> >>I am running solaris 9 on an e3500 also (though my disc setup is >>different) >> >>Here's what I have things set to -- it's probably a pretty good starting >>point for you: >> >># - Memory - >> >>shared_buffers = 65536 # min 16, at least max_connections*2, 8KB >>each >>sort_mem = 12000 # min 64, size in KB >>vacuum_mem = 64000 # min 1024, size in KB >> >># - Free Space Map - >> >>max_fsm_pages = 100000 # min max_fsm_relations*16, 6 bytes each >>#max_fsm_relations = 10000 # min 100, ~50 bytes each >> >># - Kernel Resource Usage - >> >>#max_files_per_process = 1000 # min 25 >>#preload_libraries = '' >> >>----------------------------------------------------------------------------------- >> >>and the tail end of /etc/system: >> >>* shared memory config for postgres >>set shmsys:shminfo_shmmax=0xFFFFFFFF >>set shmsys:shminfo_shmmin=1 >>set shmsys:shminfo_shmmni=256 >>set shmsys:shminfo_shmseg=256 >>set semsys:seminfo_semmap=256 >>set semsys:seminfo_semmni=512 >>set semsys:seminfo_semmsl=1000 >>set semsys:seminfo_semmns=512 >>* end of shared memory setting >>* Set the hme card to force 100 full duplex and not to autonegotiate >>* since hme does not play well with cisco >>* >>set hme:hme_adv_autoneg_cap=0 >>set hme:hme_adv_100fdx_cap=1 >>set hme:hme_adv_100hdx_cap=0 >>set hme:hme_adv_10fdx_cap=0 >>set hme:hme_adv_10hdx_cap=0 >>set hme:hme_adv_100T4_cap=0 >> >> >>Paul Johnson wrote: >> >> >>>Hi Josh, there are 8 internal disks - all are 18GB@10,000 RPM, fibre >>>connected. >>> >>>The O/S is on 2 mirrored disks, the Postgres cluster is on the /data1 >>>filesystem that is striped across the other 6 disks. >>> >>>The shared_buffers value is a semi-educated guess based on having made >>>4GB >>>shared memory available via /etc/system, and having read all we could >>>find >>>on various web sites. >>> >>>Should I knock it down to 400MB as you suggest? >>> >>>I'll check out that URL. >>> >>>Cheers, >>> >>>Paul. >>> >>> >>> >>>>Paul, >>>> >>>> >>>>>I would like to know what /etc/system and postgresql_conf values are >>> >>>recommended to deliver as much system resource as possible to Postgres. >>>We >>> >>> >>>>>use this Sun box solely for single user Postgres data warehousing >>> >>>workloads. >>> >>> >>>>What's your disk system? >>>> >>>> >>>>>shared_buffers = 500000 >>>> >>>>This is highly unlikely to be optimal. That's 3GB. On test linux >>> >>>systems >>> >>> >>>>up to 8GB, we've not seen useful values of shared buffers anywhere above >>> >>>400mb. How did you arrive at that figure? >>> >>> >>>>>sort_mem = 2097152 >>>>>vacuum_mem = 1000000 >>>> >>>>These could be fine on a single-user system. sort_mem is per *sort* >>> >>>though, >>> >>> >>>>not per query, so you'd need to watch out for complex queries spillling >>> >>>into >>> >>> >>>>swap; perhaps set it a 0.5GB or 1GB? >>>>Otherwise, start with the config guide at >>> >>>www.powerpostgresql.com/PerfList >>> >>> >>>>-- >>>>Josh Berkus >>>>Aglio Database Solutions >>>>San Francisco >>> >>> >>> >>> >>> >>> >>>---------------------------(end of broadcast)--------------------------- >>>TIP 6: Have you searched our list archives? >>> >>> http://archives.postgresql.org >>> >>> >>> >> > > > > From pgsql-performance-owner@postgresql.org Wed Feb 9 22:08:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 868DA8B9B86 for ; Wed, 9 Feb 2005 22:08:57 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45948-08 for ; Wed, 9 Feb 2005 22:08:48 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id D57078B9E0C for ; Wed, 9 Feb 2005 22:08:49 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: Performance Tuning Date: Wed, 9 Feb 2005 17:08:48 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A7615@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Performance Tuning Thread-Index: AcUO40giI6SBBN/mRxeujFAswqYPigACuHNw From: "Merlin Moncure" To: "Chris Kratz" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/155 X-Sequence-Number: 10484 > Hello All, >=20 > In contrast to what we hear from most others on this list, we find our > database servers are mostly CPU bound. We are wondering if this is > because > we have postgres configured incorrectly in some way, or if we really need > more powerfull processor(s) to gain more performance from postgres. Yes, many apps are not I/O bound (mine isn't). Here are factors that are likely to make your app CPU bound: 1. Your cache hit ratio is very high 2. You have a lot of concurrency. 3. Your queries are complex, for example, doing sorting or statistics analysis 4. Your queries are simple, but the server has to process a lot of them (transaction overhead becomes significant) sequentially. 5. You have context switching problems, etc. On the query side, you can tune things down considerably...try and keep sorting down to a minimum (order on keys, avoid distinct where possible, use 'union all', not 'union'). Basically, reduce individual query time. Other stuff: For complex queries, use views to cut out plan generation. For simple but frequently run queries (select a,b,c from t where k), use parameterized prepared statements for a 50% cpu savings, this may not be an option in some client interfaces. On the hardware side, you will get improvements by moving to Opteron, etc. Merlin From pgsql-performance-owner@postgresql.org Wed Feb 9 22:15:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7B9F88B9E8B for ; Wed, 9 Feb 2005 22:15:34 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46332-09 for ; Wed, 9 Feb 2005 22:15:26 +0000 (GMT) Received: from greywolf.vistashare.net (www.vistashare.net [65.207.67.162]) by svr1.postgresql.org (Postfix) with ESMTP id D310A8B9E0C for ; Wed, 9 Feb 2005 22:15:27 +0000 (GMT) Received: from [10.100.2.210] (phoenix.vistashare.net [10.100.2.210]) by greywolf.vistashare.net (Postfix) with ESMTP id 22F8B17651; Wed, 9 Feb 2005 17:15:27 -0500 (EST) From: Chris Kratz Organization: VistaShare To: Rod Taylor Subject: Re: Performance Tuning Date: Wed, 9 Feb 2005 17:15:26 -0500 User-Agent: KMail/1.7.1 References: <200502091501.31447.chris.kratz@vistashare.com> <1107980873.7553.41.camel@home> In-Reply-To: <1107980873.7553.41.camel@home> Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502091715.26974.chris.kratz@vistashare.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/157 X-Sequence-Number: 10486 On Wednesday 09 February 2005 03:27 pm, you wrote: ---snip--- > > We continue to tune our individual queries where we can, but it seems we > > still are waiting on the db a lot in our app. When we run most queries, > > top shows the postmaster running at 90%+ constantly during the duration > > of the request. > > Is this for the duration of a single request or 90% constantly? No, this is during the processing of a request. The rest of the time, it sits idle. We thought we would post our config and see if there was something obvious we were missing. I expect the only real answer is to continue to optimise the sql our app generates since compexity seems to be the issue. > If it's a single request, odds are you're going through much more > information than you need to. Lots of aggregate work (max / min) perhaps > or count(*)'s where an approximation would do? Yes, many of our queries heavily use common aggregates and grouping. And the explains bears out that we spend most of our time in sorts related to the grouping, aggregating, etc. The problem we often need to get multiple records per person, but then summarize that data per person. Our users want Accurate, Fast and Complex. It's hard to convince them they can only have 2 of the 3. :-) > > Our question is simply this, is it better to invest in a faster processor > > at this point, or are there configuration changes to make it faster? > > I've done > > If it's for a single request, you cannot get single processors which are > much faster than what you describe as having. > > Want to send us a few EXPLAIN ANALYZE's of your longer running queries? Many (most) of our queries are dynamic based on what the user needs. Searches, statistics gathering, etc are all common tasks our users do. Here is an explain from a common search giving a list of people. This runs in about 4.2s (4.5s with web page generation) which is actually pretty amazing when you think about what it does. It's just that we are always looking for speed in the web environment since concurrent usage can be high at times making the server feel less responsive. I'm looking at possibly moving this into lazy materialized views at some point since I can't seem to make the sql go much faster. Sort (cost=8165.28..8198.09 rows=13125 width=324) (actual time=4116.714..4167.915 rows=13124 loops=1) Sort Key: system_name_id, fullname_lfm_sort -> GroupAggregate (cost=6840.96..7267.53 rows=13125 width=324) (actual time=2547.928..4043.255 rows=13124 loops=1) -> Sort (cost=6840.96..6873.78 rows=13125 width=324) (actual time=2547.876..2603.938 rows=14115 loops=1) Sort Key: system_name_id, fullname_last_first_mdl, phone, daytime_phone, email_address, fullname_lfm_sort, firstname, is_business, ssn, inactive -> Subquery Scan foo (cost=5779.15..5943.21 rows=13125 width=324) (actual time=2229.877..2459.003 rows=14115 loops=1) -> Sort (cost=5779.15..5811.96 rows=13125 width=194) (actual time=2229.856..2288.350 rows=14115 loops=1) Sort Key: dem.nameid, dem.name_float_lfm_sort -> Hash Left Join (cost=2354.58..4881.40 rows=13125 width=194) (actual time=1280.523..2139.423 rows=14115 loops=1) Hash Cond: ("outer".relatednameid = "inner".nameid) -> Hash Left Join (cost=66.03..1889.92 rows=13125 width=178) (actual time=576.228..1245.760 rows=14115 loops=1) Hash Cond: ("outer".nameid = "inner".nameid) -> Merge Left Join (cost=0.00..1758.20 rows=13125 width=174) (actual time=543.056..1015.657 rows=13124 loops=1) Merge Cond: ("outer".inactive = "inner".validanswerid) -> Index Scan using namemaster_inactive_idx on namemaster dem (cost=0.00..3714.19 rows=13125 width=163) (actual time=0.594..188.219 rows=13124 loops=1) Filter: (programid = 55) -> Index Scan using validanswerid_pk on validanswer ina (cost=0.00..1103.61 rows=46367 width=19) (actual time=0.009..360.218 rows=26005 loops=1) -> Hash (cost=65.96..65.96 rows=31 width=8) (actual time=33.053..33.053 rows=0 loops=1) -> Nested Loop (cost=0.00..65.96 rows=31 width=8) (actual time=0.078..25.047 rows=1874 loops=1) -> Index Scan using relationship_programid on relationship s (cost=0.00..3.83 rows=1 width=4) (actual time=0.041..0.047 rows=1 loops=1) Index Cond: (programid = 55) Filter: (inter_agency_id = 15530) -> Index Scan using "relationshipdetail_relatio-4" on relationshipdetail r (cost=0.00..61.17 rows=77 width=12) (actual time=0.017..9.888 rows=1874 loops=1) Index Cond: (r.relationshipid = "outer".relationshipid) -> Hash (cost=2142.84..2142.84 rows=58284 width=24) (actual time=704.197..704.197 rows=0 loops=1) -> Seq Scan on namemaster rln155301 (cost=0.00..2142.84 rows=58284 width=24) (actual time=0.015..402.784 rows=58284 loops=1) Total runtime: 4228.945 ms From pgsql-performance-owner@postgresql.org Wed Feb 9 22:18:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 51A608B9CCC for ; Wed, 9 Feb 2005 22:18:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46848-07 for ; Wed, 9 Feb 2005 22:18:02 +0000 (GMT) Received: from greywolf.vistashare.net (www.vistashare.net [65.207.67.162]) by svr1.postgresql.org (Postfix) with ESMTP id 30EBC8B9FD6 for ; Wed, 9 Feb 2005 22:18:03 +0000 (GMT) Received: from [10.100.2.210] (phoenix.vistashare.net [10.100.2.210]) by greywolf.vistashare.net (Postfix) with ESMTP id 08B5A1EE5E; Wed, 9 Feb 2005 17:18:00 -0500 (EST) From: Chris Kratz Organization: VistaShare To: Greg Stark Subject: Re: Performance Tuning Date: Wed, 9 Feb 2005 17:17:59 -0500 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <200502091501.31447.chris.kratz@vistashare.com> <87wtthcuux.fsf@stark.xeocode.com> In-Reply-To: <87wtthcuux.fsf@stark.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502091718.00014.chris.kratz@vistashare.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/158 X-Sequence-Number: 10487 On Wednesday 09 February 2005 03:59 pm, Greg Stark wrote: > Chris Kratz writes: > > We continue to tune our individual queries where we can, but it seems we > > still are waiting on the db a lot in our app. When we run most queries, > > top shows the postmaster running at 90%+ constantly during the duration > > of the request. The disks get touched occasionally, but not often. Our > > database on disk is around 2.6G and most of the working set remains > > cached in memory, hence the few disk accesses. All this seems to point > > to the need for faster processors. > > I would suggest looking at the top few queries that are taking the most > cumulative time on the processor. It sounds like the queries are doing a > ton of logical i/o on data that's cached in RAM. A few indexes might cut > down on the memory bandwidth needed to churn through all that data. Hmmm, yes we continue to use indexes judiciously. I actually think we've overdone it in some cases since inserts are starting to slow in some critical areas. > > Items changed in the postgresql.conf: > > ... > > random_page_cost = 1 # units are one sequential page fetch cost > > This makes it nigh impossible for the server from ever making a sequential > scan when an index would suffice. What query made you do this? What plan > did it fix? Yes, it got set back to 2. I was testing various settings suggested by a posting in the archives and that one didn't get reset. From pgsql-performance-owner@postgresql.org Wed Feb 9 22:30:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 046CD8B9B26 for ; Wed, 9 Feb 2005 22:30:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48254-03 for ; Wed, 9 Feb 2005 22:30:41 +0000 (GMT) Received: from greywolf.vistashare.net (www.vistashare.net [65.207.67.162]) by svr1.postgresql.org (Postfix) with ESMTP id 970168BA0F9 for ; Wed, 9 Feb 2005 22:30:42 +0000 (GMT) Received: from [10.100.2.210] (phoenix.vistashare.net [10.100.2.210]) by greywolf.vistashare.net (Postfix) with ESMTP id 6DD33132C4; Wed, 9 Feb 2005 17:30:42 -0500 (EST) From: Chris Kratz Organization: VistaShare To: "Merlin Moncure" Subject: Re: Performance Tuning Date: Wed, 9 Feb 2005 17:30:41 -0500 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3412A7615@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A7615@Herge.rcsinc.local> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502091730.41997.chris.kratz@vistashare.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/159 X-Sequence-Number: 10488 On Wednesday 09 February 2005 05:08 pm, Merlin Moncure wrote: > > Hello All, > > > > In contrast to what we hear from most others on this list, we find our > > database servers are mostly CPU bound. We are wondering if this is > > because > > we have postgres configured incorrectly in some way, or if we really > > need > > > more powerfull processor(s) to gain more performance from postgres. > > Yes, many apps are not I/O bound (mine isn't). Here are factors that > are likely to make your app CPU bound: > > 1. Your cache hit ratio is very high > 2. You have a lot of concurrency. > 3. Your queries are complex, for example, doing sorting or statistics > analysis For now, it's number 3. Relatively low usage, but very complex sql. > 4. Your queries are simple, but the server has to process a lot of them > (transaction overhead becomes significant) sequentially. > 5. You have context switching problems, etc. > > On the query side, you can tune things down considerably...try and keep > sorting down to a minimum (order on keys, avoid distinct where possible, > use 'union all', not 'union'). Basically, reduce individual query time. > > Other stuff: > For complex queries, use views to cut out plan generation. > For simple but frequently run queries (select a,b,c from t where k), use > parameterized prepared statements for a 50% cpu savings, this may not be > an option in some client interfaces. Prepared statements are not something we've tried yet. Perhaps we should look into that in cases where it makes sense. > > On the hardware side, you will get improvements by moving to Opteron, > etc. > > Merlin Well, that's what we were looking for. --- It sounds like our configuration as it stands is probably about as good as we are going to get with the hardware we have at this point. We are cpu bound reflecting the fact that we tend to have complex statements doing aggregates, sorts and group bys. The solutions appear to primarily be: 1. Going to faster hardware of which probably Opterons would be about the only choice. And even that probably won't be a huge difference. 2. Moving to more materialized views and prepared statements where we can. 3. Continue to tweak the sql behind our app. From sfpug-owner@postgresql.org Wed Feb 9 23:18:48 2005 X-Original-To: sfpug-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 628108BA043 for ; Wed, 9 Feb 2005 23:18:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50790-09 for ; Wed, 9 Feb 2005 23:18:30 +0000 (GMT) Received: from greatmail2.nmsrv.com (69-28-204-70.nmsrv.com [69.28.204.70]) by svr1.postgresql.org (Postfix) with ESMTP id 8AD1F8BA056 for ; Wed, 9 Feb 2005 23:18:31 +0000 (GMT) Received: (qmail 31220 invoked from network); 9 Feb 2005 23:18:31 -0000 X-AntiVirus: Clean Received: from unknown (HELO IBMFF9B15A080F) (66.125.168.94) by greatmail2.nmsrv.com with SMTP; 9 Feb 2005 23:18:31 -0000 From: "Jon Asher" To: Subject: Re: annotated PostgreSQL.conf now up Date: Wed, 9 Feb 2005 15:18:28 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcUO8NumPT2P7xMzTmORB1/fThy+HwADK7Ug X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 In-Reply-To: <200502091350.24885.josh@agliodbs.com> Message-Id: <20050209231831.8AD1F8BA056@svr1.postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.434 tagged_above=0 required=5 tests=AWL, MSGID_FROM_MTA_ID X-Spam-Level: * X-Archive-Number: 200502/22 X-Sequence-Number: 1037 Josh, It would be great if you could email this list when you add new articles or content to the site- and of course let us know when it's for sale..... -Jon -----Original Message----- From: sfpug-owner@postgresql.org [mailto:sfpug-owner@postgresql.org] On Behalf Of Josh Berkus Sent: Wednesday, February 09, 2005 1:50 PM To: sfpug@postgresql.org; pgsql-performance@postgresql.org Subject: [sfpug] annotated PostgreSQL.conf now up Folks, A lot of people have been pestering me for this stuff, so I've finally finished it and put it up. http://www.powerpostgresql.com/ Hopefully this should help people as much as the last one did. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Feb 9 23:59:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7E01F8BA053 for ; Wed, 9 Feb 2005 23:55:46 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53422-02 for ; Wed, 9 Feb 2005 23:55:29 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id BE6C48B9E84 for ; Wed, 9 Feb 2005 23:55:30 +0000 (GMT) Received: (qmail 13740 invoked from network); 10 Feb 2005 00:55:57 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 10 Feb 2005 00:55:57 +0100 To: "Chris Kratz" , "John Arbash Meinel" Cc: pgsql-performance@postgresql.org Subject: Re: Performance Tuning References: <200502091501.31447.chris.kratz@vistashare.com> <420A74BE.8010009@arbash-meinel.com> <200502091625.34787.chris.kratz@vistashare.com> Message-ID: Date: Thu, 10 Feb 2005 00:58:48 +0100 From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <200502091625.34787.chris.kratz@vistashare.com> User-Agent: Opera M2/7.54u1 (Linux, build 892) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/160 X-Sequence-Number: 10489 > As a side note, I learned something very interesting for our developers > here. > We had been doing a drop database and then a reload off a db dump from > our > live server for test data. This takes 8-15 minutes depending on the > server > (the one above takes about 8 minutes). I learned through testing that I > can > use create database template some_other_database and make a duplicate in > about 2.5 minutes. which is a huge gain for us. We can load a pristine > copy, > make a duplicate, do our testing on the duplicate, drop the duplicate and > create a new duplicate in less then five mintes. I think thats because postgres just makes a file copy from the template. Thus you could make it 2x faster if you put the template in another tablespace on another drive. From pgsql-performance-owner@postgresql.org Thu Feb 10 00:56:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4BA2F8B9F8B for ; Thu, 10 Feb 2005 00:55:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56531-10 for ; Thu, 10 Feb 2005 00:55:05 +0000 (GMT) Received: from morework.geizhals.at (home.geizhals.at [213.229.14.34]) by svr1.postgresql.org (Postfix) with ESMTP id 04D0D8B9FB3 for ; Thu, 10 Feb 2005 00:55:07 +0000 (GMT) Received: from localhost (morework [127.0.0.1]) by morework.geizhals.at (Postfix) with ESMTP id 213B4DEE91; Thu, 10 Feb 2005 01:55:03 +0100 (CET) Received: from [10.0.0.33] (mjy.ghoffice [10.0.0.33]) by morework.geizhals.at (Postfix) with ESMTP; Thu, 10 Feb 2005 01:55:03 +0100 (CET) Message-ID: <420AB0E9.8070808@geizhals.at> Date: Thu, 10 Feb 2005 01:55:05 +0100 From: "Marinos J. Yannikos" User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Oleg Bartunov , pgsql-performance@postgresql.org Subject: Re: GiST indexes and concurrency (tsearch2) References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> <4204C3B4.1050209@geizhals.at> <24848.1107630092@sss.pgh.pa.us> In-Reply-To: <24848.1107630092@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 at geizhals.at X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/161 X-Sequence-Number: 10490 Tom Lane wrote: > I'm not completely convinced that you're seeing the same thing, > but if you're seeing a whole lot of semops then it could well be. I'm seeing ~280 semops/second with spinlocks enabled and ~80k semops/second (> 4 mil. for 100 queries) with --disable-spinlocks, which increases total run time by ~20% only. In both cases, cpu usage stays around 25%, which is a bit odd. > [...]You said > you're testing a quad-processor machine, so it could be that you're > seeing the same lock contention issues that we've been trying to figure > out for the past year ... Are those issues specific to a particular platform (only x86/Linux?) or is it a problem with SMP systems in general? I guess I'll be following the current discussion on -hackers closely... Regards, Marinos From pgsql-performance-owner@postgresql.org Thu Feb 10 01:14:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 04A268B9F7A for ; Thu, 10 Feb 2005 01:13:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58306-03 for ; Thu, 10 Feb 2005 01:13:39 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id DC3FA8B9F8B for ; Thu, 10 Feb 2005 01:13:41 +0000 (GMT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id 8C41F18CD0A; Wed, 9 Feb 2005 20:13:55 -0500 (EST) Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id 31617-01-4; Wed, 9 Feb 2005 20:13:54 -0500 (EST) Received: from fjgateway (unknown [61.88.101.19]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mailbox.samurai.com (Postfix) with ESMTP id 88B3A18CD30; Wed, 9 Feb 2005 20:13:52 -0500 (EST) Subject: Re: GiST indexes and concurrency (tsearch2) From: Neil Conway To: Tom Lane Cc: Marinos Yannikos , Oleg Bartunov , pgsql-performance@postgresql.org In-Reply-To: <28977.1107632554@sss.pgh.pa.us> References: <4201AEB1.4000504@geizhals.at> <4202053B.10207@geizhals.at> <4204C3B4.1050209@geizhals.at> <28977.1107632554@sss.pgh.pa.us> Content-Type: text/plain Date: Thu, 10 Feb 2005 12:13:03 +1100 Message-Id: <1107997983.1286.132.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/162 X-Sequence-Number: 10491 On Sat, 2005-02-05 at 14:42 -0500, Tom Lane wrote: > Marinos Yannikos writes: > > Some more things I tried: > > You might try the attached patch (which I just applied to HEAD). > It cuts down the number of acquisitions of the BufMgrLock by merging > adjacent bufmgr calls during a GIST index search. I'm not sure it will help much either, but there is more low-hanging fruit in this area: GiST currently does a ReadBuffer() for each tuple produced by the index scan, which is grossly inefficient. I recently applied a patch to change rtree to keep a pin on the scan's current buffer in between invocations of the index scan API (which is how btree and hash already work), and it improved performance by about 10% (according to contrib/rtree_gist's benchmark). I've made similar changes for GiST, but unfortunately it is part of a larger GiST improvement patch that I haven't had a chance to commit to 8.1 yet: http://archives.postgresql.org/pgsql-patches/2004-11/msg00144.php I'll try and get this cleaned up for application to HEAD next week. -Neil From pgsql-performance-owner@postgresql.org Thu Feb 10 01:27:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 62AA98B9F68 for ; Thu, 10 Feb 2005 01:27:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58803-04 for ; Thu, 10 Feb 2005 01:27:18 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.197]) by svr1.postgresql.org (Postfix) with ESMTP id E4AD68BA076 for ; Thu, 10 Feb 2005 01:27:20 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id j1so15498rnf for ; Wed, 09 Feb 2005 17:27:18 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=LGisWLXArhba0Xl+YSHIodzohCYLn/kG2yY5kyMq7oPNvbMyxEs1Hf4oZ2gpFt7ncKr42abbBvadWwkxIgPT4zWjfLun07NAucT6/HvPIC+IRsTCFfp6JRB/gTUxmxWlbfIsLfctL9wWJaOZsryENMyw1HdQxNEpnWVdSkFLF4I= Received: by 10.38.65.51 with SMTP id n51mr47742rna; Wed, 09 Feb 2005 17:27:18 -0800 (PST) Received: by 10.38.126.43 with HTTP; Wed, 9 Feb 2005 17:27:16 -0800 (PST) Message-ID: Date: Thu, 10 Feb 2005 01:27:16 +0000 From: Mike Rylander Reply-To: Mike Rylander To: Chris Kratz Subject: Re: Performance Tuning Cc: Merlin Moncure , pgsql-performance@postgresql.org In-Reply-To: <200502091730.41997.chris.kratz@vistashare.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A7615@Herge.rcsinc.local> <200502091730.41997.chris.kratz@vistashare.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.055 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/163 X-Sequence-Number: 10492 On Wed, 9 Feb 2005 17:30:41 -0500, Chris Kratz wrote: > The solutions appear to primarily be: > 1. Going to faster hardware of which probably Opterons would be about the only > choice. And even that probably won't be a huge difference. I'd beg to differ on that last part. The difference between a 3.6GHz Xeon and a 2.8GHz Opteron is ~150% speed increase on the Opteron on my CPU bound app. This is because the memory bandwidth on the Opteron is ENORMOUS compared to on the Xeon. Add to that the fact that you actually get to use more than about 2G of RAM directly and you've got the perfect platform for a high speed database on a budget. > 2. Moving to more materialized views and prepared statements where we can. Definitely worth investigating. I wish I could, but I can't get my customers to even consider slightly out of date stats.... :( > 3. Continue to tweak the sql behind our app. Short of an Opteron based system, this is by far your best bet. -- Mike Rylander mrylander@gmail.com GPLS -- PINES Development Database Developer http://open-ils.org From pgsql-performance-owner@postgresql.org Thu Feb 10 01:48:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A8FCD8B9FBD for ; Thu, 10 Feb 2005 01:48:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59546-10 for ; Thu, 10 Feb 2005 01:47:52 +0000 (GMT) Received: from millenium.mst.co.jp (millenium.mst.co.jp [210.251.240.193]) by svr1.postgresql.org (Postfix) with ESMTP id B78CF8B9FD7 for ; Thu, 10 Feb 2005 01:47:53 +0000 (GMT) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id j1A1lEQ30622; Thu, 10 Feb 2005 10:47:16 +0900 Message-ID: <00ab01c50f12$e2413780$7201a8c0@mst1x5r347kymb> From: "Iain" To: "Alex" , "John A Meinel" Cc: References: <420A1D9B.1040801@meerkatsoft.com> <420A22E7.5010501@arbash-meinel.com> <420A2580.3040404@meerkatsoft.com> Subject: Re: How can I make use of both CPUs in a dual processor Date: Thu, 10 Feb 2005 10:50:16 +0900 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/164 X-Sequence-Number: 10493 You can wait for processes to finish as follows: #launch 3 processes sh -c './build_indexes1.sh' & PID1=$! sh -c './build_indexes2.sh' & PID2=$! sh -c './build_indexes3.sh' & PID3=$! # then wait $PID1 wait $PID2 wait $PID3 #continue My feeling is that doing so should generally reduce the overall processing time, but if there are contention problems then it could conceivably get much worse. regards Iain ----- Original Message ----- From: "Alex" To: "John A Meinel" Cc: Sent: Thursday, February 10, 2005 12:00 AM Subject: Re: [PERFORM] How can I make use of both CPUs in a dual processor > Thanks John. > > Well as I mentioned. I have a Dual AMD Opteron 64 2.4ghz, 15k rpm SCSI > Disks, 4GB of memory. > Disks are pretty fast and memory should be more than enough. Currently we > dont have many concurrent connections. > > I run PG 8.0.1 on Fedora Core 3 > > When I now run the batch job, one CPU runs in the 80-90% the other in > 5-10% max. > > > > > > > John A Meinel wrote: > >> Alex wrote: >> >>> Hi, >>> we just got a new dual processor machine and I wonder if there is a way >>> to utilize both processors. >>> >>> Our DB server is basically fully dedicated to postgres. (its a dual amd >>> with 4gb mem.) >>> >>> I have a batch job that periodically loads about 8 million records into >>> a table. >>> for this I drop the indices, truncate the table, use the copy to insert >>> the data, recreate the indices (4 indices), vacuum the table. >>> >>> That is all done through a perl batch job. >>> >>> While I am doing this, I noticed that only one CPU is really used. >>> >>> So here are my questions: >>> >>> Is there a way to utilize both CPUs >>> >> For postgres, you get a max of 1 CPU per connection, so to use both, you >> need 2 CPU's. >> >>> Is it possible to split up the import file and run 2 copy processes >>> >>> Is it possible to create 2 indices at the same time >>> >> You'd want to be a little careful. Postgres uses work_mem for vacuum and >> index creation, so if you have 2 processes doing it, just make sure you >> aren't running out of RAM and going to swap. >> >>> Would I actually gain anything from that, or is the bottleneck somewhere >>> else ? >>> >> More likely, the bottleneck would be disk I/O. Simply because it is >> almost always disk I/O. However, without knowing your configuration, how >> much CPU is used during the operation, etc, it's hard to say. >> >>> (perl is a given here for the batch job) >>> >>> If anyone has some experience or ideas... any hints or help on this >>> would be appreciated. >>> >>> Thanks >>> Alex >>> >> Sorry I wasn't a lot of help. You should probably post your postgres >> version, and more information about how much CPU load there is while your >> load is running. >> >> John >> =:-> >> > > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend From pgsql-performance-owner@postgresql.org Thu Feb 10 03:50:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3289A8B9C8D for ; Thu, 10 Feb 2005 03:50:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67974-06 for ; Thu, 10 Feb 2005 03:50:04 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8DCD78B9E68 for ; Thu, 10 Feb 2005 03:50:06 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id E297531E31; Thu, 10 Feb 2005 04:50:06 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Performance Tuning Date: Wed, 09 Feb 2005 22:09:29 -0500 Organization: cbbrowne Computing Inc Lines: 52 Message-ID: References: <200502091501.31447.chris.kratz@vistashare.com> <420A74BE.8010009@arbash-meinel.com> <200502091625.34787.chris.kratz@vistashare.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:yEf519gP5JFEXiiQwn3df/HKHLw= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.085 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/166 X-Sequence-Number: 10495 The world rejoiced as lists@boutiquenumerique.com (PFC) wrote: >> As a side note, I learned something very interesting for our >> developers here. >> We had been doing a drop database and then a reload off a db dump >> from our >> live server for test data. This takes 8-15 minutes depending on the >> server >> (the one above takes about 8 minutes). I learned through testing >> that I can >> use create database template some_other_database and make a duplicate in >> about 2.5 minutes. which is a huge gain for us. We can load a >> pristine copy, >> make a duplicate, do our testing on the duplicate, drop the duplicate and >> create a new duplicate in less then five mintes. > > I think thats because postgres just makes a file copy from the > template. Thus you could make it 2x faster if you put the template > in another tablespace on another drive. I had some small amusement today trying this feature out in one of our environments today... We needed to make a copy of one of the databases we're replicating for the sysadmins to use for some testing. I figured using the "template" capability was: a) Usefully educational to one of the other DBAs, and b) Probably a quick way to copy the data over. We shortly discovered that we had to shut off the Slony-I daemon in order to get exclusive access to the database; no _big_ deal. At that point, he hit ENTER, and rather quickly saw... CREATE DATABASE. We then discovered that the sysadmins wanted the test DB to be on one of the other servers. Oops. Oh, well, we'll have to do this on the other server; no big deal. Entertainment ensued... "My, that's taking a while..." At about the point that we started thinking there might be a problem... CREATE DATABASE The entertainment was that the first box is one of those spiffy new 4-way Opteron boxes, whilst the "slow" one was a 4-way Xeon... Boy, those Opterons are faster... -- output = reverse("moc.liamg" "@" "enworbbc") http://cbbrowne.com/info/rdbms.html "No matter how far you have gone on the wrong road, turn back." -- Turkish proverb From pgsql-performance-owner@postgresql.org Thu Feb 10 03:35:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B7E088B9EE1 for ; Thu, 10 Feb 2005 03:35:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67287-01 for ; Thu, 10 Feb 2005 03:35:17 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id EB3DB8B9E68 for ; Thu, 10 Feb 2005 03:35:19 +0000 (GMT) Received: (qmail 1887 invoked from network); 10 Feb 2005 04:35:48 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 10 Feb 2005 04:35:48 +0100 Date: Thu, 10 Feb 2005 04:38:39 +0100 To: "Mike Rylander" , "Chris Kratz" Subject: Re: Performance Tuning Cc: "Merlin Moncure" , pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3412A7615@Herge.rcsinc.local> <200502091730.41997.chris.kratz@vistashare.com> From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: User-Agent: Opera M2/7.54u1 (Linux, build 892) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/165 X-Sequence-Number: 10494 >> 2. Moving to more materialized views and prepared statements where we >> can. > > Definitely worth investigating. I wish I could, but I can't get my > customers to even consider slightly out of date stats.... :( Put a button 'Stats updated every hour', which gives the results in 0.1 seconds, and a button 'stats in real time' which crunches 10 seconds before displaying the page... if 90% of the people click on the first one you save a lot of CPU. Seems like people who hit Refresh every 10 seconds to see an earnings graph creep up by half a pixel every time... but it seems it's moving ! More seriously, you can update your stats in near real time with a materialized view, there are two ways : - ON INSERT / ON UPDATE triggers which update the stats in real time based on each modification - Have statistics computed for everything until some point in time (like an hour ago) and only compute and add stats on the records added or modified since (but it does not work very well for deleted records...) From pgsql-performance-owner@postgresql.org Thu Feb 10 05:49:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 90E908B9C0E for ; Thu, 10 Feb 2005 05:49:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93789-04 for ; Thu, 10 Feb 2005 05:49:13 +0000 (GMT) Received: from web50005.mail.yahoo.com (web50005.mail.yahoo.com [206.190.38.20]) by svr1.postgresql.org (Postfix) with SMTP id 79DEC8B9EC4 for ; Thu, 10 Feb 2005 05:49:11 +0000 (GMT) Received: (qmail 76923 invoked by uid 60001); 10 Feb 2005 05:49:10 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=Rjwv9WJIcRAkklhV9AFhAQonpmtxgcKXKtZY105Ccz3D4ftNe0nNmrsFK5HRBqr3tf9OkaODuIv39YxmnP/JXIFrttqKmMdNwQWqsRj2h4HWXqwAAQcAujsx+WUvEzVLxQKZh4frGnO7jb8wwQvFkqbrnTirApTdmjcduuFjOlw= ; Message-ID: <20050210054910.76921.qmail@web50005.mail.yahoo.com> Received: from [157.100.236.60] by web50005.mail.yahoo.com via HTTP; Wed, 09 Feb 2005 23:49:10 CST Date: Wed, 9 Feb 2005 23:49:10 -0600 (CST) From: Jaime Casanova Subject: Benchmark To: performance pgsql MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.427 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/169 X-Sequence-Number: 10498 Hi guys, i'm planning try to do a comparative between some DBMS and postgresql (informix, oracle, m$ sql server, firebird and even mysql) i'm coordinating with people in the irc spanish postgresql channel. 1) maybe can anyone give me suggestions on this? 2) point me to a good benchmark test or script that can be used? 3) any comments? regards, Jaime Casanova _________________________________________________________ Do You Yahoo!? Informaci�n de Estados Unidos y Am�rica Latina, en Yahoo! Noticias. Vis�tanos en http://noticias.espanol.yahoo.com From pgsql-performance-owner@postgresql.org Thu Feb 10 13:18:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 084508B9F81 for ; Thu, 10 Feb 2005 13:18:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58139-06 for ; Thu, 10 Feb 2005 13:18:36 +0000 (GMT) Received: from m-monitor.net (unknown [207.44.134.28]) by svr1.postgresql.org (Postfix) with ESMTP id 190DF8B9CE2 for ; Thu, 10 Feb 2005 13:18:38 +0000 (GMT) Received: (qmail 5080 invoked from network); 10 Feb 2005 13:18:38 -0000 Received: from 203-173-49-188.dyn.iinet.net.au (HELO ?127.0.0.1?) (203.173.49.188) by ev1s-207-44-134-28.ev1servers.net with SMTP; 10 Feb 2005 13:18:37 -0000 Message-ID: <420B5F22.2070407@meerkatsoft.com> Date: Fri, 11 Feb 2005 00:18:26 +1100 From: Alex User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John A Meinel Cc: pgsql-performance@postgresql.org Subject: Re: How can I make use of both CPUs in a dual processor References: <420A1D9B.1040801@meerkatsoft.com> <420A22E7.5010501@arbash-meinel.com> <420A2580.3040404@meerkatsoft.com> <420A2933.6060100@arbash-meinel.com> In-Reply-To: <420A2933.6060100@arbash-meinel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/170 X-Sequence-Number: 10499 Thanks for all the suggestions. It seems that creating indices, or even import data using a copy is easy to implement. I also have some jobs that create reports and want to try if I gain anything if i work reports in parallel. will give it a try in the next week and let you know the resuls. Alex John A Meinel wrote: > Alex wrote: > >> Thanks John. >> >> Well as I mentioned. I have a Dual AMD Opteron 64 2.4ghz, 15k rpm >> SCSI Disks, 4GB of memory. >> Disks are pretty fast and memory should be more than enough. >> Currently we dont have many concurrent connections. >> > Well, you didn't mention Opteron before (it makes a difference against > Xeons). > How many disks and in what configuration? > Do you have pg_xlog on a separate set of disks? > Are your drives in RAID 10 (0+1) or RAID 5? > > If you have enough disks the recommended configuration is at least a > RAID1 for the OS, RAID 10 for pg_xlog (4drives), and RAID 10 (the rest > of the drives) for the actual data. > > If your dataset is read heavy, or you have more than 6 disks, you can > get away with RAID 5 for the actual data. But since you are talking > about loading 8million rows at once, it certainly sounds like you are > write heavy. > > If you only have a few disks, it's still probably better to put > pg_xlog on it's own RAID1 (2-drive) mirror. pg_xlog is pretty much > append only, so if you dedicate a disk set to it, you eliminate a lot > of seek times. > >> I run PG 8.0.1 on Fedora Core 3 >> >> When I now run the batch job, one CPU runs in the 80-90% the other in >> 5-10% max. > > > > Anyway, it doesn't completely sound like you are CPU limited, but you > might be able to get a little bit more if you spawn another process. > Have you tried dropping the index, doing the copy, and then recreating > the 4-indexes in separate processes? > > The simple test for this is to open 3-4 psql connections, have one of > them drop the indexes and do the copy, in the other connections you > can already have typed "CREATE INDEX ..." so when the copy is done and > committed to the database, you just go to the other terminals and hit > enter. > > Unfortunately you'll have to use wall clock time to see if this is > faster. > > Though I think you could do the same thing with a bash script. The > authentication should be in "trust" mode so that you don't take the > time to type your password. > > #!/bin/bash > psql -h -c "DROP INDEX ...; COPY FROM ..." > > psql -h -c "CREATE INDEX ..." & > psql -h -c "CREATE INDEX ..." & > psql -h -c "CREATE INDEX ..." & > psql -h -c "CREATE INDEX ..." > > > Now, I don't really know how to wait for all child processes in a bash > script (I could give you the python for it, but you're a perl guy). > But by not spawning the last INDEX, I'm hoping it takes longer than > the rest. Try to put the most difficult index there. > > Then you could just run > > time loadscript.sh > > I'm sure you could do the equivalent in perl. Just open multiple > connections to the DB, and have them ready. > > I'm guessing since you are on a dual processor machine, you won't get > much better performance above 2 connections. > > You can also try doing 2 COPYs at the same time, but it seems like you > would have issues. Do you have any serial columns that you expect to > be in a certain order, or is all the information in the copy? > > If the latter, try it, let us know what you get. I can't tell you the > perl for this, since I'm not a perl guy. > > John > =:-> > From pgsql-performance-owner@postgresql.org Thu Feb 10 13:19:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8483E8BA05C for ; Thu, 10 Feb 2005 13:19:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57873-08 for ; Thu, 10 Feb 2005 13:18:49 +0000 (GMT) Received: from dhcp-7-248.ma.lycos.com (waltham-nat.ma.lycos.com [209.202.205.1]) by svr1.postgresql.org (Postfix) with SMTP id C065D8BA04C for ; Thu, 10 Feb 2005 13:18:50 +0000 (GMT) Received: (qmail 3596 invoked from network); 10 Feb 2005 12:27:09 -0000 Received: from dhcp-10-124-7-131.wal.lycos.com (HELO ?10.124.7.131?) (10.124.7.131) by dhcp-10-124-7-248.wal.lycos.com with SMTP; 10 Feb 2005 12:27:09 -0000 In-Reply-To: <20050210054910.76921.qmail@web50005.mail.yahoo.com> References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: performance pgsql From: Jeff Subject: Re: Benchmark Date: Thu, 10 Feb 2005 08:21:09 -0500 To: Jaime Casanova X-Mailer: Apple Mail (2.619) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.065 tagged_above=0 required=5 tests=AWL, HELO_DYNAMIC_DHCP X-Spam-Level: X-Archive-Number: 200502/171 X-Sequence-Number: 10500 On Feb 10, 2005, at 12:49 AM, Jaime Casanova wrote: > Hi guys, > > i'm planning try to do a comparative between some DBMS > and postgresql (informix, oracle, m$ sql server, > firebird and even mysql) i'm coordinating with people > in the irc spanish postgresql channel. > > 2) point me to a good benchmark test or script that > can be used? The TPC tests are fairly widely accepted. The thing with a benchmark is they are unlikely to simulate your real traffic. But it is always fun to look at numbers > 3) any comments? > If you plan on making your results public be very careful with the license agreements on the other db's. I know Oracle forbids the release of benchmark numbers without their approval. -- Jeff Trout http://www.jefftrout.com/ http://www.stuarthamm.net/ From pgsql-performance-owner@postgresql.org Thu Feb 10 18:34:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A6DDC8B9EBA for ; Thu, 10 Feb 2005 18:34:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88036-03 for ; Thu, 10 Feb 2005 18:34:42 +0000 (GMT) Received: from greywolf.vistashare.net (www.vistashare.net [65.207.67.162]) by svr1.postgresql.org (Postfix) with ESMTP id C0FFE8B9E31 for ; Thu, 10 Feb 2005 18:34:41 +0000 (GMT) Received: from [10.100.2.210] (phoenix.vistashare.net [10.100.2.210]) by greywolf.vistashare.net (Postfix) with ESMTP id AC32F141A9B for ; Thu, 10 Feb 2005 13:34:40 -0500 (EST) From: Chris Kratz Organization: VistaShare To: pgsql-performance@postgresql.org Subject: Large time difference between explain analyze and normal run Date: Thu, 10 Feb 2005 13:34:40 -0500 User-Agent: KMail/1.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502101334.40341.chris.kratz@vistashare.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/172 X-Sequence-Number: 10501 Does anyone have any idea why there be over a 4s difference between running the statement directly and using explain analyze? Multiple runs give the same result and I've tested on several servers. db=# \timing Timing is on. db=# select count(*) from answer; count -------- 530576 (1 row) Time: 358.805 ms db=# explain analyze select count(*) from answer; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- Aggregate (cost=9848.12..9848.12 rows=1 width=0) (actual time=4841.231..4841.235 rows=1 loops=1) -> Seq Scan on answer (cost=0.00..8561.29 rows=514729 width=0) (actual time=0.011..2347.762 rows=530576 loops=1) Total runtime: 4841.412 ms (3 rows) Time: 4855.712 ms --- Postgresql 7.4.5 running on Linux 2.6.8.1 From pgsql-performance-owner@postgresql.org Thu Feb 10 18:58:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A15478B9E31 for ; Thu, 10 Feb 2005 18:58:48 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90030-04 for ; Thu, 10 Feb 2005 18:58:40 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E2A258B9D56 for ; Thu, 10 Feb 2005 18:58:38 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1AIwb1M028554; Thu, 10 Feb 2005 13:58:37 -0500 (EST) To: Chris Kratz Cc: pgsql-performance@postgresql.org Subject: Re: Large time difference between explain analyze and normal run In-reply-to: <200502101334.40341.chris.kratz@vistashare.com> References: <200502101334.40341.chris.kratz@vistashare.com> Comments: In-reply-to Chris Kratz message dated "Thu, 10 Feb 2005 13:34:40 -0500" Date: Thu, 10 Feb 2005 13:58:37 -0500 Message-ID: <28553.1108061917@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/173 X-Sequence-Number: 10502 Chris Kratz writes: > Does anyone have any idea why there be over a 4s difference between running > the statement directly and using explain analyze? > Aggregate (cost=9848.12..9848.12 rows=1 width=0) (actual > time=4841.231..4841.235 rows=1 loops=1) > -> Seq Scan on answer (cost=0.00..8561.29 rows=514729 width=0) (actual > time=0.011..2347.762 rows=530576 loops=1) > Total runtime: 4841.412 ms EXPLAIN ANALYZE's principal overhead is two gettimeofday() kernel calls per plan node execution, so 1061154 such calls here. I infer that gettimeofday takes about 4 microseconds on your hardware ... which seems a bit slow for modern machines. What sort of box is it? regards, tom lane From pgsql-performance-owner@postgresql.org Thu Feb 10 19:06:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D2DE18B9E8D for ; Thu, 10 Feb 2005 19:06:11 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90485-06 for ; Thu, 10 Feb 2005 19:05:47 +0000 (GMT) Received: from greywolf.vistashare.net (www.vistashare.net [65.207.67.162]) by svr1.postgresql.org (Postfix) with ESMTP id 007CE8B9D56 for ; Thu, 10 Feb 2005 19:05:47 +0000 (GMT) Received: from [10.100.2.210] (phoenix.vistashare.net [10.100.2.210]) by greywolf.vistashare.net (Postfix) with ESMTP id 209DF249B3 for ; Thu, 10 Feb 2005 14:05:47 -0500 (EST) From: Chris Kratz Organization: VistaShare To: pgsql-performance@postgresql.org Subject: Re: Large time difference between explain analyze and normal run Date: Thu, 10 Feb 2005 14:05:46 -0500 User-Agent: KMail/1.7.1 References: <200502101334.40341.chris.kratz@vistashare.com> <28553.1108061917@sss.pgh.pa.us> In-Reply-To: <28553.1108061917@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502101405.46581.chris.kratz@vistashare.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/174 X-Sequence-Number: 10503 On Thursday 10 February 2005 01:58 pm, Tom Lane wrote: > Chris Kratz writes: > > Does anyone have any idea why there be over a 4s difference between > > running the statement directly and using explain analyze? > > > > Aggregate (cost=9848.12..9848.12 rows=1 width=0) (actual > > time=4841.231..4841.235 rows=1 loops=1) > > -> Seq Scan on answer (cost=0.00..8561.29 rows=514729 width=0) > > (actual time=0.011..2347.762 rows=530576 loops=1) > > Total runtime: 4841.412 ms > > EXPLAIN ANALYZE's principal overhead is two gettimeofday() kernel calls > per plan node execution, so 1061154 such calls here. I infer that > gettimeofday takes about 4 microseconds on your hardware ... which seems > a bit slow for modern machines. What sort of box is it? > > regards, tom lane OK, that makes sense. Athlon XP 3000+ 1.5G Mem Is there a way to test the gettimeofday() directly? From pgsql-performance-owner@postgresql.org Thu Feb 10 20:10:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5320C8B9FB0 for ; Thu, 10 Feb 2005 20:10:16 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95049-10 for ; Thu, 10 Feb 2005 20:09:45 +0000 (GMT) Received: from mail2.dbitech.ca (radius.wavefire.com [64.141.13.252]) by svr1.postgresql.org (Postfix) with SMTP id 18AFB8BA027 for ; Thu, 10 Feb 2005 20:09:45 +0000 (GMT) Received: (qmail 24504 invoked from network); 10 Feb 2005 21:31:37 -0000 Received: from dbitech.wavefire.com (HELO ?64.141.15.253?) (darcy@64.141.15.253) by radius.wavefire.com with SMTP; 10 Feb 2005 21:31:37 -0000 From: Darcy Buskermolen Organization: Wavefire Technologies Corp. To: Tom Lane Subject: Re: Large time difference between explain analyze and normal run Date: Thu, 10 Feb 2005 12:09:42 -0800 User-Agent: KMail/1.6.2 Cc: Chris Kratz , pgsql-performance@postgresql.org References: <200502101334.40341.chris.kratz@vistashare.com> <28553.1108061917@sss.pgh.pa.us> In-Reply-To: <28553.1108061917@sss.pgh.pa.us> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200502101209.42079.darcy@wavefire.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/175 X-Sequence-Number: 10504 On February 10, 2005 10:58 am, Tom Lane wrote: > Chris Kratz writes: > > Does anyone have any idea why there be over a 4s difference between > > running the statement directly and using explain analyze? > > > > Aggregate (cost=9848.12..9848.12 rows=1 width=0) (actual > > time=4841.231..4841.235 rows=1 loops=1) > > -> Seq Scan on answer (cost=0.00..8561.29 rows=514729 width=0) > > (actual time=0.011..2347.762 rows=530576 loops=1) > > Total runtime: 4841.412 ms > > EXPLAIN ANALYZE's principal overhead is two gettimeofday() kernel calls > per plan node execution, so 1061154 such calls here. I infer that > gettimeofday takes about 4 microseconds on your hardware ... which seems > a bit slow for modern machines. What sort of box is it? dvl reported the same thing on #postgresql some months back, and neilc was/is/did looking into it. I belive he came up with a way to move the function call outside of the loop with no ill effects to the rest of the expected behavior. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Darcy Buskermolen Wavefire Technologies Corp. ph: 250.717.0200 fx: 250.763.1759 http://www.wavefire.com From pgsql-performance-owner@postgresql.org Thu Feb 10 20:25:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A85D88BA0E5 for ; Thu, 10 Feb 2005 20:25:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96303-10 for ; Thu, 10 Feb 2005 20:25:09 +0000 (GMT) Received: from greywolf.vistashare.net (www.vistashare.net [65.207.67.162]) by svr1.postgresql.org (Postfix) with ESMTP id A16DA8B9FD6 for ; Thu, 10 Feb 2005 20:25:09 +0000 (GMT) Received: from [10.100.2.210] (phoenix.vistashare.net [10.100.2.210]) by greywolf.vistashare.net (Postfix) with ESMTP id 682D914BC49; Thu, 10 Feb 2005 15:25:09 -0500 (EST) From: Chris Kratz Organization: VistaShare To: Darcy Buskermolen Subject: Re: Large time difference between explain analyze and normal run Date: Thu, 10 Feb 2005 15:25:09 -0500 User-Agent: KMail/1.7.1 Cc: Tom Lane , pgsql-performance@postgresql.org References: <200502101334.40341.chris.kratz@vistashare.com> <28553.1108061917@sss.pgh.pa.us> <200502101209.42079.darcy@wavefire.com> In-Reply-To: <200502101209.42079.darcy@wavefire.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502101525.09165.chris.kratz@vistashare.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/176 X-Sequence-Number: 10505 On Thursday 10 February 2005 03:09 pm, Darcy Buskermolen wrote: > On February 10, 2005 10:58 am, Tom Lane wrote: > > Chris Kratz writes: > > > Does anyone have any idea why there be over a 4s difference between > > > running the statement directly and using explain analyze? > > > > > > Aggregate (cost=9848.12..9848.12 rows=1 width=0) (actual > > > time=4841.231..4841.235 rows=1 loops=1) > > > -> Seq Scan on answer (cost=0.00..8561.29 rows=514729 width=0) > > > (actual time=0.011..2347.762 rows=530576 loops=1) > > > Total runtime: 4841.412 ms > > > > EXPLAIN ANALYZE's principal overhead is two gettimeofday() kernel calls > > per plan node execution, so 1061154 such calls here. I infer that > > gettimeofday takes about 4 microseconds on your hardware ... which seems > > a bit slow for modern machines. What sort of box is it? > > dvl reported the same thing on #postgresql some months back, and neilc > was/is/did looking into it. I belive he came up with a way to move the > function call outside of the loop with no ill effects to the rest of the > expected behavior. That's interesting to know. It's not a big deal, we were just curious as to why the difference. Tom's explanation makes good sense. We run into the same situation with using a profiler on an application, ie measuring incurs overhead. -Chris From pgsql-performance-owner@postgresql.org Fri Feb 11 05:22:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A340F8B9DFE for ; Fri, 11 Feb 2005 05:22:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40462-07 for ; Fri, 11 Feb 2005 05:22:06 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) by svr1.postgresql.org (Postfix) with ESMTP id 31FF78B9CE1 for ; Fri, 11 Feb 2005 05:22:06 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 36so326167wri for ; Thu, 10 Feb 2005 21:22:05 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=Y5VWsL3jOQ0R1RF0iX1n59Tf9YiL8ghjQm3Bd3+SXRRFFggPv3y9rFiV3E6VVYLsD50lib5l7FVC26kz8S0nOD5s5bfFpDmdXjibmLcQWKhKPwO5cyl6zJFbqNwr9GGknMwdG1rJHat3p4eCmbsg3Uyk6qqgE0YdlqwYtks6do0= Received: by 10.54.20.28 with SMTP id 28mr142057wrt; Thu, 10 Feb 2005 21:22:05 -0800 (PST) Received: by 10.54.59.22 with HTTP; Thu, 10 Feb 2005 21:22:05 -0800 (PST) Message-ID: <330532b60502102122638d887@mail.gmail.com> Date: Fri, 11 Feb 2005 00:22:05 -0500 From: Mitch Pirtle Reply-To: Mitch Pirtle To: performance pgsql Subject: Re: Benchmark In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.066 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/177 X-Sequence-Number: 10506 On Thu, 10 Feb 2005 08:21:09 -0500, Jeff wrote: > > If you plan on making your results public be very careful with the > license agreements on the other db's. I know Oracle forbids the > release of benchmark numbers without their approval. ...as all of the other commercial databases do. This may be off-topic, but has anyone actually suffered any consequences of a published benchmark without permission? For example, I am a developer of Mambo, a PHP-based CMS application, and am porting the mysql functions to ADOdb so I can use grown-up databases ;-) What is keeping me from running a copy of Mambo on a donated server for testing and performance measures (including the commercial databases) and then publishing the results based on Mambo's performance on each? It would be really useful to know if anyone has ever been punished for doing this, as IANAL but that restriction is going to be very, VERY difficult to back up in court without precedence. Is this just a deterrent, or is it real? -- Mitch From pgsql-performance-owner@postgresql.org Fri Feb 11 06:38:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 439898BA16A for ; Fri, 11 Feb 2005 06:38:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45947-01 for ; Fri, 11 Feb 2005 06:38:18 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id ACC3A8B9FB5 for ; Fri, 11 Feb 2005 06:38:17 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1B6cD8v007415; Fri, 11 Feb 2005 01:38:13 -0500 (EST) To: Mitch Pirtle Cc: performance pgsql Subject: Re: Benchmark In-reply-to: <330532b60502102122638d887@mail.gmail.com> References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> Comments: In-reply-to Mitch Pirtle message dated "Fri, 11 Feb 2005 00:22:05 -0500" Date: Fri, 11 Feb 2005 01:38:13 -0500 Message-ID: <7414.1108103893@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/178 X-Sequence-Number: 10507 Mitch Pirtle writes: > It would be really useful to know if anyone has ever been punished for > doing this, as IANAL but that restriction is going to be very, VERY > difficult to back up in court without precedence. Is this just a > deterrent, or is it real? If Oracle doesn't eat your rear for lunch, it would only be because you hadn't annoyed them sufficiently for them to bother. Under the terms of the license agreement that you presumably clicked through, you gave up your rights to publish anything they don't like. Do a little Google research. For instance http://www.infoworld.com/articles/op/xml/01/04/16/010416opfoster.html The impression I get is that if you are willing to spend lots of $$ you could *maybe* win the case, if you can still find a judge who thinks that the public good outweighs private contract law (good luck, with the Republicans in office). Do you have a larger budget for legal issues than Oracle does? If so, step right up. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Feb 11 07:04:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0508F8BA16C for ; Fri, 11 Feb 2005 07:04:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49074-02 for ; Fri, 11 Feb 2005 07:04:03 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by svr1.postgresql.org (Postfix) with ESMTP id 4D06F8BA04C for ; Fri, 11 Feb 2005 07:04:03 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 36so330849wri for ; Thu, 10 Feb 2005 23:04:03 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=jOwgTtEmZMWLbi1HhauhpfEBC3cJ/4SkSitvnelIkEtyNEsT8LWK3DeY4Y3G8SAWnCNBGuWblOkCW/49oQxI2VwBsJJFu2Snru+rrrZHyX17WzSMH1f0MQVRoyWCgvLP4PPPWGhr2pqXOQkeAREVLk3EuNmm2UrNB2Nd9A7eSIU= Received: by 10.54.20.76 with SMTP id 76mr261907wrt; Thu, 10 Feb 2005 23:04:03 -0800 (PST) Received: by 10.54.59.22 with HTTP; Thu, 10 Feb 2005 23:04:03 -0800 (PST) Message-ID: <330532b605021023043b34e03@mail.gmail.com> Date: Fri, 11 Feb 2005 02:04:03 -0500 From: Mitch Pirtle Reply-To: Mitch Pirtle To: performance pgsql Subject: Re: Benchmark In-Reply-To: <7414.1108103893@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> <7414.1108103893@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.065 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/179 X-Sequence-Number: 10508 On Fri, 11 Feb 2005 01:38:13 -0500, Tom Lane wrote: > > If Oracle doesn't eat your rear for lunch, That would be more like an appetizer at a california cuisine place. > it would only be because you > hadn't annoyed them sufficiently for them to bother. Under the terms of > the license agreement that you presumably clicked through, you gave up > your rights to publish anything they don't like. Do a little Google > research. For instance > http://www.infoworld.com/articles/op/xml/01/04/16/010416opfoster.html I did do the research, but couldn't find one instance where someone was actually taken to task over it. So far it appears to be bluster. Horrifying to some, but still bluster. > The impression I get is that if you are willing to spend lots of $$ > you could *maybe* win the case, if you can still find a judge who thinks > that the public good outweighs private contract law (good luck, with the > Republicans in office). Do you have a larger budget for legal issues > than Oracle does? If so, step right up. The reason I asked is because this has a lot more to do with than just money. This is restriction of speech as well, and publishing benchmarks (simply as statistical data) cannot in any way be construed as defamation or libel. Just because it is in the click-wrap contract doesn't mean you waive certain rights, and this has been proven (and now has precedence). Again, I would love to know of any instances where someone published (forbidden) benchmarks and was actually pursued in a court of law. Well, and the result, too ;-) I ask not to cause trouble, but to learn if this is just a deterrent that has never been tested ("small pebble") or a well-defined threat that will be enforced ("plasma cannon"). -- Mitch, thinking this is off topic but still fascinating From pgsql-performance-owner@postgresql.org Fri Feb 11 07:22:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7E0968BA16D for ; Fri, 11 Feb 2005 07:22:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50403-09 for ; Fri, 11 Feb 2005 07:22:39 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.198]) by svr1.postgresql.org (Postfix) with ESMTP id 6CA938BA169 for ; Fri, 11 Feb 2005 07:22:39 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id j1so240006rnf for ; Thu, 10 Feb 2005 23:22:39 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=ZmEi+5JfSZE7ECsiGDiSIyE4AU8MTYVeCBzxNM0iu4H0p1aDJBjYeEDWmrNhfeLsqMTi/MJBI8c3FdjQdpjEURv090TivVqcLxIfeiEtTTNwi0wD+wRQYmY/saoB10bXBqZ10xnyorLIXHClJUQumUw4AKc7a9zhYpbjPWQGHQI= Received: by 10.38.164.76 with SMTP id m76mr97520rne; Thu, 10 Feb 2005 23:22:39 -0800 (PST) Received: by 10.38.97.31 with HTTP; Thu, 10 Feb 2005 23:22:39 -0800 (PST) Message-ID: Date: Fri, 11 Feb 2005 02:22:39 -0500 From: Jaime Casanova Reply-To: Jaime Casanova To: performance pgsql Subject: Re: Benchmark In-Reply-To: <7414.1108103893@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> <7414.1108103893@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.187 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/180 X-Sequence-Number: 10509 On Fri, 11 Feb 2005 01:38:13 -0500, Tom Lane wrote: > Mitch Pirtle writes: > > It would be really useful to know if anyone has ever been punished for > > doing this, as IANAL but that restriction is going to be very, VERY > > difficult to back up in court without precedence. Is this just a > > deterrent, or is it real? > > If Oracle doesn't eat your rear for lunch, it would only be because you > hadn't annoyed them sufficiently for them to bother. Under the terms of > the license agreement that you presumably clicked through, you gave up > your rights to publish anything they don't like. Do a little Google > research. For instance > http://www.infoworld.com/articles/op/xml/01/04/16/010416opfoster.html > What about the free speech rigths, in USA they are in the constitution and cannot be denied or revoked, IANAL. And like stated by Mitch just numbers are not lies that can be pursued in a court of law. Think anout it, In USA you can speak and publish about the President but cannot say anything about M$ or Oracles' DBMS? regards, Jaime Casanova From pgsql-performance-owner@postgresql.org Fri Feb 11 09:19:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4E5838BA16C for ; Fri, 11 Feb 2005 09:19:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64916-10 for ; Fri, 11 Feb 2005 09:18:49 +0000 (GMT) Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id B1A668BA19D for ; Fri, 11 Feb 2005 09:18:46 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: How to interpret this explain analyse? Date: Fri, 11 Feb 2005 10:18:45 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: How to interpret this explain analyse? Thread-Index: AcUQGq+Jq8t2O8pMR+mT2Yai3FNlEw== From: "Joost Kraaijeveld" To: "Pgsql-Performance (E-mail)" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.057 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, WEIRD_QUOTING X-Spam-Level: * X-Archive-Number: 200502/181 X-Sequence-Number: 10510 Hi all, A question on how to read and interpret the explain analyse statement = (and what to do) I have a query "SELECT A.ordernummer, B.klantnummer FROM orders A LEFT = OUTER JOIN klt_alg B ON A.Klantnummer=3DB.Klantnummer ORDER BY = A.klantnummer;" Both tables have an btree index on klantnummer (int4, the column the = join is on). I have vacuumed and analyzed both tables. The explain = analyse is: QUERY PLAN Sort (cost=3D220539.32..223291.41 rows=3D1100836 width=3D12) (actual = time=3D51834.128..56065.126 rows=3D1104380 loops=3D1) Sort Key: a.klantnummer -> Hash Left Join (cost=3D41557.43..110069.51 rows=3D1100836 = width=3D12) (actual time=3D21263.858..42845.158 rows=3D1104380 = loops=3D1) Hash Cond: (""outer"".klantnummer =3D ""inner"".klantnummer) -> Seq Scan on orders a (cost=3D0.00..46495.36 rows=3D1100836 = width=3D8) (actual time=3D5.986..7378.488 rows=3D1104380 loops=3D1) -> Hash (cost=3D40635.14..40635.14 rows=3D368914 width=3D4) = (actual time=3D21256.683..21256.683 rows=3D0 loops=3D1) -> Seq Scan on klt_alg b (cost=3D0.00..40635.14 = rows=3D368914 width=3D4) (actual time=3D8.880..18910.120 rows=3D368914 = loops=3D1) Total runtime: 61478.077 ms Questions: -> Hash Left Join (cost=3D41557.43..110069.51 rows=3D1100836 = width=3D12) (actual time=3D21263.858..42845.158 rows=3D1104380 = loops=3D1) 0. What exactly are the numbers in "cost=3D41557.43..110069.51" ( I = assume for the other questions that 41557.43 is the estimated MS the = query will take, what are the others)? 1. I assume that (cost=3D41557.43..110069.51 rows=3D1100836 width=3D12) = is the estimated cost and (actual time=3D21263.858..42845.158 = rows=3D1104380 loops=3D1) the actual cost. Is the difference acceptable? 2. If not, what can I do about it? Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl=20 From pgsql-performance-owner@postgresql.org Fri Feb 11 10:20:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E1D558B9F0B for ; Fri, 11 Feb 2005 10:20:21 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73450-08 for ; Fri, 11 Feb 2005 10:20:05 +0000 (GMT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id C08DA8B9F0C for ; Fri, 11 Feb 2005 10:20:07 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-33.mail.demon.net with esmtp (Exim 4.42) id 1CzXu9-000Pyv-B8; Fri, 11 Feb 2005 10:20:06 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 3D87516DBF; Fri, 11 Feb 2005 10:20:04 +0000 (GMT) Message-ID: <420C86D2.6050907@archonet.com> Date: Fri, 11 Feb 2005 10:20:02 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joost Kraaijeveld Cc: "Pgsql-Performance (E-mail)" Subject: Re: How to interpret this explain analyse? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.066 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/182 X-Sequence-Number: 10511 Joost Kraaijeveld wrote: > Hi all, > > A question on how to read and interpret the explain analyse statement > (and what to do) > > I have a query "SELECT A.ordernummer, B.klantnummer FROM orders A > LEFT OUTER JOIN klt_alg B ON A.Klantnummer=B.Klantnummer ORDER BY > A.klantnummer;" > > Both tables have an btree index on klantnummer (int4, the column the > join is on). I have vacuumed and analyzed both tables. The explain > analyse is: Indexes not necessarily useful here since you're fetching all rows in A and presumably much of B Sort Hash Left Join Seq Scan on orders a Hash Seq Scan on klt_alg b I've trimmed the above from your explain output. It's sequentially scanning "b" and using a hash to join to "a" before sorting the results. > Questions: -> Hash Left Join (cost=41557.43..110069.51 rows=1100836 > width=12) (actual time=21263.858..42845.158 rows=1104380 loops=1) > > 0. What exactly are the numbers in "cost=41557.43..110069.51" ( I > assume for the other questions that 41557.43 is the estimated MS the > query will take, what are the others)? The cost numbers represent "effort" rather than time. They're only really useful in that you can compare one part of the query to another. There are two numbers because the first shows startup, the second final time. So - the "outer" parts of the query will have increasing startup values since the "inner" parts will have to do their work first. The "actual time" is measured in ms, but remember to multiply it by the "loops" value. Oh, and actually measuring the time slows the query down too. > 1. I assume that (cost=41557.43..110069.51 rows=1100836 width=12) is > the estimated cost and (actual time=21263.858..42845.158 rows=1104380 > loops=1) the actual cost. Is the difference acceptable? > > 2. If not, what can I do about it? The key thing to look for here is the number of rows. If PG expects say 100 rows but there are instead 10,000 then it may choose the wrong plan. In this case the estimate is 1,100,836 and the actual is 1,104,380 - very close. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Feb 11 12:54:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 159ED8B9BF5 for ; Fri, 11 Feb 2005 12:54:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89483-06 for ; Fri, 11 Feb 2005 12:53:44 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 4ACFB8BA1A9 for ; Fri, 11 Feb 2005 12:53:46 +0000 (GMT) Received: (qmail 5374 invoked by uid 500); 11 Feb 2005 13:08:41 -0000 Date: Fri, 11 Feb 2005 07:08:41 -0600 From: Bruno Wolff III To: Jaime Casanova Cc: performance pgsql Subject: Re: Benchmark Message-ID: <20050211130841.GA5110@wolff.to> Mail-Followup-To: Jaime Casanova , performance pgsql References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> <7414.1108103893@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/183 X-Sequence-Number: 10512 On Fri, Feb 11, 2005 at 02:22:39 -0500, Jaime Casanova wrote: > What about the free speech rigths, in USA they are in the constitution > and cannot be denied or revoked, IANAL. You can voluntarily give up your rights to free speech in the US. > And like stated by Mitch just numbers are not lies that can be pursued > in a court of law. I think part of the reason they don't want people doing this, is because if you don't configure their database well, you can make it look bad when it shouldn't. > Think anout it, In USA you can speak and publish about the President > but cannot say anything about M$ or Oracles' DBMS? Not if you signed a contract that says you can't. If you didn't actually sign an agreement saying you wouldn't publish benchmarks, then you might have a case. You might argue that a click through eula isn't a valid contract or that you are a third party who isn't bound by whatever agreement the person who installed Oracle made. However it probably would cost you a bundle to have a chance at winning. From pgsql-performance-owner@postgresql.org Fri Feb 11 13:16:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 78C8D8BA0FF for ; Fri, 11 Feb 2005 13:16:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91630-01 for ; Fri, 11 Feb 2005 13:16:33 +0000 (GMT) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by svr1.postgresql.org (Postfix) with ESMTP id 002538B9EB0 for ; Fri, 11 Feb 2005 13:16:33 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-30.mail.demon.net with esmtp (Exim 4.42) id 1Czaeu-000GXL-39; Fri, 11 Feb 2005 13:16:33 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id F15C1166B5; Fri, 11 Feb 2005 13:16:31 +0000 (GMT) Message-ID: <420CB02D.2080608@archonet.com> Date: Fri, 11 Feb 2005 13:16:29 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bruno Wolff III Cc: Jaime Casanova , performance pgsql Subject: Re: Benchmark References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> <7414.1108103893@sss.pgh.pa.us> <20050211130841.GA5110@wolff.to> In-Reply-To: <20050211130841.GA5110@wolff.to> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.066 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/184 X-Sequence-Number: 10513 Bruno Wolff III wrote: > On Fri, Feb 11, 2005 at 02:22:39 -0500, > Jaime Casanova wrote: > >>Think anout it, In USA you can speak and publish about the President >>but cannot say anything about M$ or Oracles' DBMS? > > > Not if you signed a contract that says you can't. > > If you didn't actually sign an agreement saying you wouldn't publish > benchmarks, then you might have a case. You might argue that a click > through eula isn't a valid contract or that you are a third party > who isn't bound by whatever agreement the person who installed Oracle > made. However it probably would cost you a bundle to have a chance > at winning. IANAL etc, but the key fear is more likely that Oracle merely cancel your licence(s). And deny you any more. And prevent your software from running on top of Oracle. At which point, you have to sue Oracle and prove restraint of trade or unfair competition or similar. Don't forget that you have no right to purchase Oracle licences, they are free to sell to whoever they choose and under whatever conditions. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Feb 11 13:17:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B2D838BA11D for ; Fri, 11 Feb 2005 13:17:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91754-01 for ; Fri, 11 Feb 2005 13:17:42 +0000 (GMT) Received: from dhcp-7-248.ma.lycos.com (waltham-nat.ma.lycos.com [209.202.205.1]) by svr1.postgresql.org (Postfix) with SMTP id 85C678BA120 for ; Fri, 11 Feb 2005 13:17:44 +0000 (GMT) Received: (qmail 23490 invoked from network); 11 Feb 2005 12:26:18 -0000 Received: from dhcp-10-124-7-131.wal.lycos.com (HELO ?10.124.7.131?) (10.124.7.131) by dhcp-10-124-7-248.wal.lycos.com with SMTP; 11 Feb 2005 12:26:18 -0000 In-Reply-To: <330532b605021023043b34e03@mail.gmail.com> References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> <7414.1108103893@sss.pgh.pa.us> <330532b605021023043b34e03@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: performance pgsql From: Jeff Subject: Re: Benchmark Date: Fri, 11 Feb 2005 08:20:05 -0500 To: Mitch Pirtle X-Mailer: Apple Mail (2.619) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.065 tagged_above=0 required=5 tests=AWL, HELO_DYNAMIC_DHCP X-Spam-Level: X-Archive-Number: 200502/185 X-Sequence-Number: 10514 On Feb 11, 2005, at 2:04 AM, Mitch Pirtle wrote: > > I did do the research, but couldn't find one instance where someone > was actually taken to task over it. So far it appears to be bluster. > Horrifying to some, but still bluster. > They may not have done that yet, but they _COULD_. And if they decide to they have more money and power than you likely have and would drive you into financial ruin for the rest of your life (Even if you are correct). It is a big risk. I think that clause is in there so MS, etc. can't say "Use FooSQL, its 428% faster than that Oracle POS Just look!" After using oracle in the last few months.. I can see why they'd want to prevent those numbers.. Oracle really isn't that good. I had been under the impression that it was holy smokes amazingly fast. It just isn't. At least, in my experience it isn't. but that is another story. -- Jeff Trout http://www.jefftrout.com/ http://www.stuarthamm.net/ From pgsql-performance-owner@postgresql.org Fri Feb 11 15:04:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A64D78B9FB3 for ; Fri, 11 Feb 2005 15:04:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98798-07 for ; Fri, 11 Feb 2005 15:04:12 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 67B4D8B9CFB for ; Fri, 11 Feb 2005 15:04:15 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1CzcL3-0005Lx-00; Fri, 11 Feb 2005 10:04:09 -0500 To: Jeff Cc: Mitch Pirtle , performance pgsql Subject: Re: Benchmark References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> <7414.1108103893@sss.pgh.pa.us> <330532b605021023043b34e03@mail.gmail.com> In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 11 Feb 2005 10:04:08 -0500 Message-ID: <873bw387fb.fsf@stark.xeocode.com> Lines: 22 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/186 X-Sequence-Number: 10515 Jeff writes: > After using oracle in the last few months.. I can see why they'd want to > prevent those numbers.. Oracle really isn't that good. I had been under the > impression that it was holy smokes amazingly fast. It just isn't. At least, > in my experience it isn't. but that is another story. Oracle's claim to performance comes not from tight coding and low overhead. For that you use Mysql :) Oracle's claim to performance comes from how you can throw it at a machine with 4-16 processors and it really does get 4-16x as fast. Features like partitioned tables, parallel query, materialized views, etc make it possible to drive it further up the performance curve than Sybase/MSSQL or Postgres. In terms of performance, Oracle is to Postgres as Postgres is to Mysql: More complexity, more overhead, more layers of abstraction, but in the long run it pays off when you need it. (Only without the user-friendliness of either open-source softwares.) -- greg From pgsql-performance-owner@postgresql.org Fri Feb 11 16:18:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 54FD48BA111 for ; Fri, 11 Feb 2005 16:18:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05478-03 for ; Fri, 11 Feb 2005 16:18:39 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 11E4F8BA103 for ; Fri, 11 Feb 2005 16:18:38 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1BGIU2h011350; Fri, 11 Feb 2005 11:18:30 -0500 (EST) To: Richard Huxton Cc: Joost Kraaijeveld , "Pgsql-Performance (E-mail)" Subject: Re: How to interpret this explain analyse? In-reply-to: <420C86D2.6050907@archonet.com> References: <420C86D2.6050907@archonet.com> Comments: In-reply-to Richard Huxton message dated "Fri, 11 Feb 2005 10:20:02 +0000" Date: Fri, 11 Feb 2005 11:18:30 -0500 Message-ID: <11349.1108138710@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/187 X-Sequence-Number: 10516 Richard Huxton writes: > Joost Kraaijeveld wrote: >> 2. If not, what can I do about it? > The key thing to look for here is the number of rows. If PG expects say > 100 rows but there are instead 10,000 then it may choose the wrong plan. > In this case the estimate is 1,100,836 and the actual is 1,104,380 - > very close. On the surface this looks like a reasonable plan choice. If you like you can try the other two basic types of join plan by turning off enable_hashjoin, which will likely drive the planner to use a merge join, and then also turn off enable_mergejoin to get a nested loop (or if it thinks nested loop is second best, turn off enable_nestloop to see the behavior with a merge join). What's important in comparing different plan alternatives is the ratios of estimated costs to actual elapsed times. If the planner is doing its job well, those ratios should be similar across all the alternatives (which implies of course that the cheapest-estimate plan is also the cheapest in reality). If not, it may be appropriate to fool with the planner's cost estimate parameters to try to line up estimates and reality a bit better. See http://www.postgresql.org/docs/8.0/static/performance-tips.html for more detail. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Feb 11 18:09:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BC2D68BA117 for ; Fri, 11 Feb 2005 18:09:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14804-01 for ; Fri, 11 Feb 2005 18:09:15 +0000 (GMT) Received: from mail.academyoflearning.ca (unknown [69.93.244.106]) by svr1.postgresql.org (Postfix) with ESMTP id 884CE8B9CEF for ; Fri, 11 Feb 2005 18:09:14 +0000 (GMT) Received: from d207-81-249-35.bchsia.telus.net ([207.81.249.35] helo=ipso.snappymail.ca) by mail.academyoflearning.ca with esmtpa (Exim 4.44) id 1CzfE9-0002pd-3K; Fri, 11 Feb 2005 12:09:13 -0600 Subject: Re: Benchmark From: Mike Benoit To: Mitch Pirtle Cc: performance pgsql In-Reply-To: <330532b60502102122638d887@mail.gmail.com> References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-UvzxNPUh6+ZZGajr+bpP" Date: Fri, 11 Feb 2005 10:09:10 -0800 Message-Id: <1108145350.18341.11.camel@ipso.snappymail.ca> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3-2mdk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/188 X-Sequence-Number: 10517 --=-UvzxNPUh6+ZZGajr+bpP Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I have never used Oracle myself, nor have I read its license agreement, but what if you didn't name Oracle directly? ie: TPS Database ------------------------------- 112 MySQL 120 PgSQL 90 Sybase 95 "Other database that *may* start with a letter after N" 50 "Other database that *may* start with a letter after L" As far as I know there are only a couple databases that don't allow you to post benchmarks, but if they remain "unnamed" can legal action be taken?=20 Just like all those commercials on TV where they advertise: "Cleans 10x better then the other leading brand". On Fri, 2005-02-11 at 00:22 -0500, Mitch Pirtle wrote: > On Thu, 10 Feb 2005 08:21:09 -0500, Jeff wrote: > >=20 > > If you plan on making your results public be very careful with the > > license agreements on the other db's. I know Oracle forbids the > > release of benchmark numbers without their approval. >=20 > ...as all of the other commercial databases do. This may be off-topic, > but has anyone actually suffered any consequences of a published > benchmark without permission? >=20 > For example, I am a developer of Mambo, a PHP-based CMS application, > and am porting the mysql functions to ADOdb so I can use grown-up > databases ;-) >=20 > What is keeping me from running a copy of Mambo on a donated server > for testing and performance measures (including the commercial > databases) and then publishing the results based on Mambo's > performance on each? >=20 > It would be really useful to know if anyone has ever been punished for > doing this, as IANAL but that restriction is going to be very, VERY > difficult to back up in court without precedence. Is this just a > deterrent, or is it real? >=20 > -- Mitch >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org --=20 Mike Benoit --=-UvzxNPUh6+ZZGajr+bpP Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD4DBQBCDPTFMhKjsejwBhgRAmMXAJ90k0EOzEAKKkZas5WPo3+fXeCwSgCXWovS QsE1EZo83R7kLEjMgwAvlA== =LN6c -----END PGP SIGNATURE----- --=-UvzxNPUh6+ZZGajr+bpP-- From pgsql-performance-owner@postgresql.org Fri Feb 11 18:19:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 270C58B9BCC for ; Fri, 11 Feb 2005 18:19:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14855-07 for ; Fri, 11 Feb 2005 18:19:09 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 07C8B8BA18A for ; Fri, 11 Feb 2005 18:19:08 +0000 (GMT) Received: (qmail 30586 invoked from network); 11 Feb 2005 19:19:35 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 11 Feb 2005 19:19:35 +0100 Date: Fri, 11 Feb 2005 19:22:35 +0100 To: "Mitch Pirtle" , "performance pgsql" Subject: Re: Benchmark (slightly off topic but oh well) References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <330532b60502102122638d887@mail.gmail.com> User-Agent: Opera M2/7.54u1 (Linux, build 892) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/189 X-Sequence-Number: 10518 > For example, I am a developer of Mambo, a PHP-based CMS application, > and am porting the mysql functions to ADOdb so I can use grown-up > databases ;-) Just yesterday I "optimized" a query for a website running MySQL. It's the 'new products' type query : SELECT product_id, pd.product_name, p.price, COALESCE( s.specials_price, p.price ) as real_price FROM products p, products_descriptions pd LEFT join specials s ON (p.product_id = s.product_id) WHERE p.product_id = pd.product_id AND pd.language_id=(constant) AND p.product_visible=TRUE AND s.is_active = TRUE ORDER BY p.date_added DESC LIMIT 6 With ~100 products everything went smooth, about 0.5 ms. I decided to test with 20.000 because we have a client with a large catalog coming. Wow. It took half a second, to yield six products. Note that there are appropriate indexes all over the place (for getting the new products, I have an index on product_visible, date_added) I tested with Postgres : with 100 products it takes 0.4 ms, with 20.000 it takes 0.6 ms... Postgres needs a bit of query massaging (putting an extra ORDER BY product_visible to use the index). With MySQL no amount of query rewriting would do. I noted sometimes MySQL would never use a multicolumn index for an ORDER BY LIMIT unless one specifies a dummy condition on the missing parameter. So I had to split the query in two : fetch the six product_ids, store them in a PHP variable, implode(',',$ids), and SELECT ... WHERE product_id IN (x,y,z) UGLY ! And a lot slower. Note this is with MySQL 4.0.23 or something. Maybe 4.1 would be faster. Here's the URL to the site. There is a query log if you wanna look just for laughs. Note that all the products boxes are active which makes a very long page time... There are 42000 fictive products and about 60 real products. Don't use the search form unless you have a good book to read ! You can click on "Nouveaut�s" to see the old "new products" query in action, but please, only one people at a time. http://pinceau-d-or.com/gros/product_info.php?products_id=164 Ah, you can buy stuff with the test version if you like, just don't use the credit card because ... it works ;) This is the un-messed-up version (production) : http://pinceau-d-or.com/product_info.php?products_id=164 If some day I can recode this mess to use Postgres... this would be nice, so nice... the other day my database went apeshit and in the absence of foreign keys... and the absence of PHP checking anything... ! test=# CREATE TABLE suicide (id INT NOT NULL, moment TIMESTAMP NOT NULL); CREATE TABLE test=# INSERT INTO suicide (id,moment) VALUES (0,now()); INSERT 6145577 1 test=# INSERT INTO suicide (id,moment) VALUES (0,0); ERREUR: La colonne <> est de type timestamp without time zone mais l'expression est de type integer HINT: Vous devez reecrire l'expression ou lui appliquer une transformation de type. test=# INSERT INTO suicide (id,moment) VALUES (NULL,1); ERREUR: La colonne <> est de type timestamp without time zone mais l'expression est de type integer HINT: Vous devez reecrire l'expression ou lui appliquer une transformation de type. test=# INSERT INTO suicide (id,moment) VALUES (NULL,now()); ERREUR: Une valeur NULL dans la colonne <> viole la contrainte NOT NULL test=# SELECT * FROM suicide; id | moment ----+---------------------------- 0 | 2005-02-11 19:16:21.262359 mysql> CREATE TABLE suicide (id INT NOT NULL, moment DATETIME NOT NULL); Query OK, 0 rows affected (0.02 sec) mysql> INSERT INTO suicide (id,moment) VALUES (0,now()); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO suicide (id,moment) VALUES (0,0); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO suicide (id,moment) VALUES (NULL,1); ERROR 1048: Column 'id' cannot be null mysql> INSERT INTO suicide (moment) VALUES (now()); Query OK, 1 row affected (0.00 sec) hey, did I specify a default value ? mysql> SELECT * FROM suicide; +----+---------------------+ | id | moment | +----+---------------------+ | 0 | 2005-02-11 19:17:49 | | 0 | 0000-00-00 00:00:00 | | 0 | 2005-02-11 19:18:45 | +----+---------------------+ 3 rows in set (0.00 sec) From pgsql-performance-owner@postgresql.org Fri Feb 11 18:29:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BB4C28BA184 for ; Fri, 11 Feb 2005 18:29:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16018-04 for ; Fri, 11 Feb 2005 18:29:12 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id B89848BA138 for ; Fri, 11 Feb 2005 18:29:12 +0000 (GMT) Received: (qmail 31049 invoked from network); 11 Feb 2005 19:29:41 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 11 Feb 2005 19:29:41 +0100 To: "performance pgsql" Subject: Re: Benchmark References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> <7414.1108103893@sss.pgh.pa.us> <330532b605021023043b34e03@mail.gmail.com> <873bw387fb.fsf@stark.xeocode.com> Message-ID: Date: Fri, 11 Feb 2005 19:32:40 +0100 From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <873bw387fb.fsf@stark.xeocode.com> User-Agent: Opera M2/7.54u1 (Linux, build 892) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/190 X-Sequence-Number: 10519 > In terms of performance, Oracle is to Postgres as Postgres is to Mysql: > More > complexity, more overhead, more layers of abstraction, but in the long > run it > pays off when you need it. (Only without the user-friendliness of either > open-source softwares.) > I don't find postgres complex... I find it nice, well-behaved, very easy to use, very powerful, user-friendly... there are a lot of features but somehow it's well integrated and makes a coherent set. It also has some very useful secret passages (like the whole GiST family) which can save you from some things at which SQL really sucks. It certainly is complex on the inside but I think the devs have done a very good job at hiding that. It's also polite : it will say 'I have a function with the name you said but the parameter types don't match' ; mysql will just say 'syntax error, RTFM', or insert its favorite value of 0. From pgsql-performance-owner@postgresql.org Fri Feb 11 18:41:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B9BD88B9BCC for ; Fri, 11 Feb 2005 18:41:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17197-02 for ; Fri, 11 Feb 2005 18:41:20 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1D38B8B9BF5 for ; Fri, 11 Feb 2005 18:41:20 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1BIfIEo012479; Fri, 11 Feb 2005 13:41:18 -0500 (EST) To: Mike Benoit Cc: Mitch Pirtle , performance pgsql Subject: Re: Benchmark In-reply-to: <1108145350.18341.11.camel@ipso.snappymail.ca> References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> <1108145350.18341.11.camel@ipso.snappymail.ca> Comments: In-reply-to Mike Benoit message dated "Fri, 11 Feb 2005 10:09:10 -0800" Date: Fri, 11 Feb 2005 13:41:17 -0500 Message-ID: <12478.1108147277@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/191 X-Sequence-Number: 10520 Mike Benoit writes: > I have never used Oracle myself, nor have I read its license agreement, > but what if you didn't name Oracle directly? ie: > TPS Database > ------------------------------- > 112 MySQL > 120 PgSQL > 90 Sybase > 95 "Other database that *may* start with a letter after N" > 50 "Other database that *may* start with a letter after L" Great Bridge did essentially that years ago, but I think we only got away with it because we didn't say which DBs "Commercial Database A" and "Commercial Database B" actually were. Even off the record, we were only allowed to tell people that the commercial DBs were Oracle and SQL Server ... but not which was which. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Feb 11 19:25:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2E1CD8B9E60 for ; Fri, 11 Feb 2005 19:25:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21283-03 for ; Fri, 11 Feb 2005 19:25:13 +0000 (GMT) Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 0E1718BA156 for ; Fri, 11 Feb 2005 19:25:12 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Re: How to interpret this explain analyse? Date: Fri, 11 Feb 2005 20:25:11 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] How to interpret this explain analyse? Thread-Index: AcUQVgEPweEGo2P5TkGBiswOtRxcugAE+itA From: "Joost Kraaijeveld" To: "Tom Lane" , "Richard Huxton" Cc: "Pgsql-Performance (E-mail)" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.119 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/192 X-Sequence-Number: 10521 Hi Tom, Tom Lane schreef: > On the surface this looks like a reasonable plan choice. If you like > you can try the other two basic types of join plan by turning off > enable_hashjoin, which will likely drive the planner to use a merge > join, and then also turn off enable_mergejoin to get a nested loop > (or if it thinks nested loop is second best, turn off enable_nestloop > to see the behavior with a merge join). The problem is that the query logically requests all records ( as in = "select * from a join") from the database but actually displays (in = practise) in 97% of the time the first 1000 records and at most the = first 50.000 records 99.99999999999999% of the time by scrolling (using = "page down) in the gui and an occasional "jump to record xxxx" through = something called a locator) (both percentages tested!). If I do the same query with a "limit 60.000" or if I do a "set = enable_seqscan =3D off" the query returns in 0.3 secs. Otherwise it = lasts for 20 secs (which is too much for the user to wait for, given the = circumstances). I cannot change the query (it is geneated by a tool called Clarion) but = it something like (from the psqlodbc_xxx.log): "... declare SQL_CUR01 cursor for=20 SELECT A.ordernummer, B.klantnummer FROM "orders" A LEFT OUTER JOIN = "klt_alg" B ON A.Klantnummer=3DB.Klantnummer ORDER BY A.klantnummer; fetch 100 in SQL_CUR01; ..." PostgreSQL does the planning (and than executes accordingly) to the = query and not the "fetch 100". Changing the query with a "limit = whatever" prohibits scrolling after the size of the resultset. If = Postgres should delay the planning of the actual query untill the fetch = it could choose the quick solution. Another solution would be to = "advise" PostgreSQL which index etc (whatever etc means ;-)) to use ( = as in the mailing from Silke Trissl in the performance list on = 09-02-05). > What's important in comparing different plan alternatives is the = ratios > of estimated costs to actual elapsed times. If the planner is doing = its > job well, those ratios should be similar across all the alternatives > (which implies of course that the cheapest-estimate plan is also the > cheapest in reality). If not, it may be appropriate to fool with the > planner's cost estimate parameters to try to line up estimates and > reality a bit better.=20 I I really do a "select *" and display the result, the planner is right = (tested with "set enable_seqscan =3D off" and "set enable_seqscan =3D = on). Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Fri Feb 11 19:41:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BD6838BA0F2 for ; Fri, 11 Feb 2005 19:41:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22470-03 for ; Fri, 11 Feb 2005 19:40:38 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4D7318BA0A2 for ; Fri, 11 Feb 2005 19:40:38 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1BJePFh013009; Fri, 11 Feb 2005 14:40:25 -0500 (EST) To: "Joost Kraaijeveld" Cc: "Richard Huxton" , "Pgsql-Performance (E-mail)" Subject: Re: How to interpret this explain analyse? In-reply-to: References: Comments: In-reply-to "Joost Kraaijeveld" message dated "Fri, 11 Feb 2005 20:25:11 +0100" Date: Fri, 11 Feb 2005 14:40:25 -0500 Message-ID: <13008.1108150825@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/193 X-Sequence-Number: 10522 "Joost Kraaijeveld" writes: > I cannot change the query (it is geneated by a tool called Clarion) but it something like (from the psqlodbc_xxx.log): > "... > declare SQL_CUR01 cursor for > SELECT A.ordernummer, B.klantnummer FROM "orders" A LEFT OUTER JOIN "klt_alg" B ON A.Klantnummer=B.Klantnummer ORDER BY A.klantnummer; > fetch 100 in SQL_CUR01; > ..." Well, the planner does put some emphasis on startup time when dealing with a DECLARE CURSOR plan; the problem you face is just that that correction isn't large enough. (From memory, I think it optimizes on the assumption that 10% of the estimated rows will actually be fetched; you evidently want a setting of 1% or even less.) We once talked about setting up a GUC variable to control the percentage of a cursor that is estimated to be fetched: http://archives.postgresql.org/pgsql-hackers/2000-10/msg01108.php It never got done but that seems like the most reasonable solution to me. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Feb 11 20:42:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 99FF58BA17F for ; Fri, 11 Feb 2005 20:42:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28166-01 for ; Fri, 11 Feb 2005 20:42:45 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 14DB78BA10C for ; Fri, 11 Feb 2005 20:42:46 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: Benchmark Date: Fri, 11 Feb 2005 15:41:58 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A761C@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Benchmark Thread-Index: AcUQZWcKqvDes+X1TBmR8GoSBNAFeAAFAjAQ From: "Merlin Moncure" To: "Mike Benoit" Cc: "performance pgsql" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.055 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/194 X-Sequence-Number: 10523 > I have never used Oracle myself, nor have I read its license agreement, > but what if you didn't name Oracle directly? ie: >=20 > TPS Database > ------------------------------- > 112 MySQL > 120 PgSQL > 90 Sybase > 95 "Other database that *may* start with a letter after N" > 50 "Other database that *may* start with a letter after L" >=20 > As far as I know there are only a couple databases that don't allow you > to post benchmarks, but if they remain "unnamed" can legal action be > taken? >=20 > Just like all those commercials on TV where they advertise: "Cleans 10x > better then the other leading brand". Instead of measuring transactions/second, let's put everything in terms of transactions/dollar. This will make it quite easy to determine which database is which from the results. Since postgresql is free and would invalidate our test on mathematical terms, we will sub in the $19.99 price of a T-Shirt (http://www.sourcewear.com/) for the price of the database. TP$ Database ------------------------------- 25 A .5 B .01 C .001 D .00001 E Merlin From pgsql-performance-owner@postgresql.org Fri Feb 11 23:12:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9B4228BA086 for ; Fri, 11 Feb 2005 23:12:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40825-09 for ; Fri, 11 Feb 2005 23:12:27 +0000 (GMT) Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr1.postgresql.org (Postfix) with ESMTP id 9442F8B9E3C for ; Fri, 11 Feb 2005 23:12:27 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 Subject: Re: How to interpret this explain analyse? Date: Sat, 12 Feb 2005 00:12:26 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] How to interpret this explain analyse? Thread-Index: AcUQcdzEaoxnvzWbRFeGTn3AavUdOgAHLT9w From: "Joost Kraaijeveld" To: "Tom Lane" Cc: "Richard Huxton" , "Pgsql-Performance (E-mail)" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.116 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/195 X-Sequence-Number: 10524 Hi Tom, Tom Lane schreef: > Well, the planner does put some emphasis on startup time when dealing > with a DECLARE CURSOR plan; the problem you face is just that that > correction isn't large enough. (From memory, I think it optimizes on > the assumption that 10% of the estimated rows will actually > be fetched; you evidently want a setting of 1% or even less.) I wish I had your mnemory ;-) . The tables contain 1.100.000 records by = the way (that is not nearly 10 %, my math is not that good)) > We once talked about setting up a GUC variable to control the > percentage of a cursor that is estimated to be fetched: > http://archives.postgresql.org/pgsql-hackers/2000-10/msg01108.php > It never got done but that seems like the most reasonable solution to > me.=20 If the proposal means that the cursor is not limited to ths limit in the = query but is limited to the fetch than I support the proposal. A bit = late I presume. Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl From pgsql-performance-owner@postgresql.org Sun Feb 13 01:34:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 77F348B9E17 for ; Sun, 13 Feb 2005 01:34:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51644-01 for ; Sun, 13 Feb 2005 01:34:47 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 85A3B8B9D97 for ; Sun, 13 Feb 2005 01:34:45 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 3BCF730E4C; Sun, 13 Feb 2005 02:34:46 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Benchmark Date: Sat, 12 Feb 2005 20:34:24 -0500 Organization: cbbrowne Computing Inc Lines: 36 Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3412A761C@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:z4PUJ4EhKcClcsUtA4Mt6SwYC28= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.093 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/196 X-Sequence-Number: 10525 Oops! merlin.moncure@rcsonline.com ("Merlin Moncure") was seen spray-painting on a wall: > Instead of measuring transactions/second, let's put everything in terms > of transactions/dollar. This will make it quite easy to determine which > database is which from the results. Since postgresql is free and would > invalidate our test on mathematical terms, we will sub in the $19.99 > price of a T-Shirt (http://www.sourcewear.com/) for the price of the > database. > > TP$ Database > ------------------------------- > 25 A > .5 B > .01 C > .001 D > .00001 E Ah, but that's a completely wrong evaluation. The fact that PostgreSQL is available without licensing charges does _not_ make a transactions/dollar ratio break down. After all, the cost of a computer system to run the transactions is likely to be comprised of some combination of software licenses and hardware costs. Even if the software is free, the hardware isn't. If you're doing a high end evaluation, you probably have a million dollars worth of computer hardware. If you're running PostgreSQL, that may mean you can afford to throw some extra RAM on the box, but you still need the million dollar server in order to get hefty TPS counts... -- (reverse (concatenate 'string "moc.liamg" "@" "enworbbc")) http://cbbrowne.com/info/linuxdistributions.html "Let's face it -- ASCII text is a far richer medium than most of us deserve." -- Scott McNealy From pgsql-performance-owner@postgresql.org Sun Feb 13 09:13:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E17238B9FB7 for ; Sun, 13 Feb 2005 09:13:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40820-05 for ; Sun, 13 Feb 2005 09:13:01 +0000 (GMT) Received: from ylpvm43.prodigy.net (ylpvm43-ext.prodigy.net [207.115.57.74]) by svr1.postgresql.org (Postfix) with ESMTP id 2347C8B9E08 for ; Sun, 13 Feb 2005 09:13:00 +0000 (GMT) Received: from one (adsl-68-127-212-197.dsl.pltn13.pacbell.net [68.127.212.197]) by ylpvm43.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id j1D9D82Y016798; Sun, 13 Feb 2005 04:13:08 -0500 Received: from [192.168.5.105] (unknown [192.168.5.105]) by one (Postfix) with ESMTP id 6551AF1B21; Sun, 13 Feb 2005 10:12:52 +0100 (CET) Message-ID: <420F1C00.7030808@cheapcomplexdevices.com> Date: Sun, 13 Feb 2005 01:21:04 -0800 From: Ron Mayer User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ron Mayer , pgsql-performance@postgresql.org Subject: Re: Benchmark References: <20050210054910.76921.qmail@web50005.mail.yahoo.com> <330532b60502102122638d887@mail.gmail.com> <1108145350.18341.11.camel@ipso.snappymail.ca> <12478.1108147277@sss.pgh.pa.us> In-Reply-To: <12478.1108147277@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/197 X-Sequence-Number: 10526 Tom Lane wrote: > Great Bridge did essentially that years ago, but I think we only got > away with it because we didn't say which DBs "Commercial Database A" > and "Commercial Database B" actually were. Even off the record, we > were only allowed to tell people that the commercial DBs were Oracle > and SQL Server ... but not which was which. IMHO clues like: "What versions of the databases did you use? - PostgreSQL - 7.0 release version - Proprietary 1 - 8.1.5 - Proprietary 2 - 7.0 - MySQL - 3.22.32 - Interbase - 6.0 " and "PostgreSQL" and "Proprietary 1" was running "red hat linux 6.1" and "Proprietary 2" was running Windows NT server 4 - service pack 4" in articles like this one: http://www.xperts.com/news/press1.htm helped some people narrow it down a bit. :) From pgsql-performance-owner@postgresql.org Sun Feb 13 16:35:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 704EC8B9F55 for ; Sun, 13 Feb 2005 16:35:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90276-04 for ; Sun, 13 Feb 2005 16:35:05 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id E2CB88B9B2B for ; Sun, 13 Feb 2005 16:35:04 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1D0Mhy-00082K-00; Sun, 13 Feb 2005 11:34:54 -0500 To: Christopher Browne Cc: pgsql-performance@postgresql.org Subject: Re: Benchmark References: <6EE64EF3AB31D5448D0007DD34EEB3412A761C@Herge.rcsinc.local> In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 13 Feb 2005 11:34:54 -0500 Message-ID: <87mzu85sgh.fsf@stark.xeocode.com> Lines: 10 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/198 X-Sequence-Number: 10527 Christopher Browne writes: > After all, the cost of a computer system to run the transactions is > likely to be comprised of some combination of software licenses and > hardware costs. Even if the software is free, the hardware isn't. And labour costs. -- greg From pgsql-performance-owner@postgresql.org Sun Feb 13 19:25:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 299938B9DFB for ; Sun, 13 Feb 2005 19:25:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16401-05 for ; Sun, 13 Feb 2005 19:25:44 +0000 (GMT) Received: from external.wtcm.be (mail.wtcm.be [212.224.138.150]) by svr1.postgresql.org (Postfix) with ESMTP id A9DA58B9B2C for ; Sun, 13 Feb 2005 19:25:42 +0000 (GMT) Received: from server04.site04.wtcm.be (server04.site04.wtcm.be [192.168.64.1]) by external.wtcm.be (Postfix) with ESMTP id ABD21D408E; Sun, 13 Feb 2005 20:21:42 +0100 (CET) Received: from lt00027.wtcm.be by server04.site04.wtcm.be (8.8.8/1.1.22.3/18Aug99-1117AM) id UAA0000001464; Sun, 13 Feb 2005 20:25:39 +0100 (MET) Message-Id: <5.2.1.1.0.20050213202121.029592b8@server04.site04.wtcm.be> X-Sender: mey@server04.site04.wtcm.be (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.2.1 Date: Sun, 13 Feb 2005 20:24:22 +0100 To: Greg Stark , Christopher Browne From: Patrick Meylemans Subject: Re: Benchmark Cc: pgsql-performance@postgresql.org In-Reply-To: <87mzu85sgh.fsf@stark.xeocode.com> References: <6EE64EF3AB31D5448D0007DD34EEB3412A761C@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====================_750979==.ALT" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.107 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, HTML_30_40, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200502/199 X-Sequence-Number: 10528 --=====================_750979==.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed Dear, We are using PostgreSQL for 4 Years now, one can say it is a blessing to maintain. Our previous database was number one (;-), it was much harder to maintain so labor is a pro for PostgreSQL ... Kind Regards Patrick Meylemans IT Manager WTCM-CRIF Celestijnenlaan 300C 3001 Helerlee At 11:34 13/02/2005 -0500, Greg Stark wrote: >Christopher Browne writes: > > > After all, the cost of a computer system to run the transactions is > > likely to be comprised of some combination of software licenses and > > hardware costs. Even if the software is free, the hardware isn't. > >And labour costs. > >-- >greg > > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > > http://archives.postgresql.org --=====================_750979==.ALT Content-Type: text/html; charset="us-ascii" Dear,

We are using PostgreSQL for 4 Years now, one can say it is a blessing to maintain. Our previous database was number one (;-), it was much harder to maintain so labor is a pro for PostgreSQL ...

Kind Regards

Patrick Meylemans

IT Manager
WTCM-CRIF
Celestijnenlaan 300C
3001 Helerlee


At 11:34 13/02/2005 -0500, Greg Stark wrote:
Christopher Browne <cbbrowne@acm.org> writes:

> After all, the cost of a computer system to run the transactions is
> likely to be comprised of some combination of software licenses and
> hardware costs.  Even if the software is free, the hardware isn't.

And labour costs.

--
greg


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org
--=====================_750979==.ALT-- From pgsql-performance-owner@postgresql.org Sun Feb 13 21:27:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 04F768B9EF1 for ; Sun, 13 Feb 2005 21:27:48 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30018-06 for ; Sun, 13 Feb 2005 21:27:46 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.201]) by svr1.postgresql.org (Postfix) with ESMTP id DF9FD8B9EB1 for ; Sun, 13 Feb 2005 21:27:45 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id j1so541621rnf for ; Sun, 13 Feb 2005 13:27:45 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=OvZtyfHtOqe2cIKSSByvb1UADzPDrlOo88V+AWGgFBggwfhmhgvyPycAFTi9SjEf5xOfpadRLLIEd7fz8zvIeNLpA1gqtG8O8RfLMVHSYPspCSpc4wDzKsvNnfcwMGyoyyzwudPMZR98qpukYH1mMiX1zLSKKV713hj+668rnj8= Received: by 10.39.3.49 with SMTP id f49mr231370rni; Sun, 13 Feb 2005 13:27:45 -0800 (PST) Received: by 10.38.97.31 with HTTP; Sun, 13 Feb 2005 13:27:45 -0800 (PST) Message-ID: Date: Sun, 13 Feb 2005 16:27:45 -0500 From: Jaime Casanova Reply-To: Jaime Casanova To: performance pgsql Subject: estimated rows vs. actual rows Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.137 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/200 X-Sequence-Number: 10529 Hi, in the #postgresql-es channel someone shows me this: pgsql-7.4.5 + postgis=20 --- begin context --- CREATE TABLE calles ( gid int4 NOT NULL DEFAULT nextval('public.callesstgo_gid_seq'::text), nombre varchar, inicio int4, termino int4, comuna varchar, ciudad varchar, region numeric, pais varchar, the_geom geometry, id_comuna numeric, CONSTRAINT callesstgo_pkey PRIMARY KEY (gid), CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =3D 'MULTILINESTRING'::text OR the_geom IS NULL), CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) =3D -1) )=20 WITH OIDS; =A0 CREATE INDEX idx_region_comunas ON calles USING btree (id_comuna, region); select count(*) from calles; 143902 --- end context --- =A0 Ok . here is the problem (BTW, the database has been analyzed just before this query was execured) explain analyze select * from calles where id_comuna =3D 92 and region=3D13;=20 QUERY PLAN Seq Scan on calles (cost=3D0.00..7876.53 rows=3D2610 width=3D279) (actual time=3D182.590..454.195 rows=3D4612 loops=3D1) Filter: ((id_comuna =3D 92::numeric) AND (region =3D 13::numeric)) Total runtime: 456.876 ms Why is this query using a seq scan rather than a index scan? i notice the diff between the estimated rows and actual rows (almost 2000). Can this affect the query plan? i think this is a problem of statistics, am i right? if so, what can be done? regards, Jaime Casanova From pgsql-performance-owner@postgresql.org Sun Feb 13 21:42:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7894C8BA059 for ; Sun, 13 Feb 2005 21:42:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32061-08 for ; Sun, 13 Feb 2005 21:42:25 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 5417E8BA058 for ; Sun, 13 Feb 2005 21:42:24 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7023154; Sun, 13 Feb 2005 13:44:09 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: Jaime Casanova Subject: Re: estimated rows vs. actual rows Date: Sun, 13 Feb 2005 13:41:09 -0800 User-Agent: KMail/1.6.2 Cc: performance pgsql References: In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200502131341.09811.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/201 X-Sequence-Number: 10530 Jaime, > Why is this query using a seq scan rather than a index scan? Because it thinks a seq scan will be faster. > i notice > the diff between the estimated rows and actual rows (almost 2000). Yes, ANALYZE, and possibly increasing the column stats, should help that. > Can this affect the query plan? i think this is a problem of > statistics, am i right? if so, what can be done? Well, if the estimate was accurate, PG would be even *more* likely to use a seq scan (more rows). I think maybe you should establish whether a seq scan actually *is* faster? Perhaps do SET enable_seqscan = false and then re-run the query a few times? -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Feb 14 03:19:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6D26D8BA0A2 for ; Mon, 14 Feb 2005 03:18:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77597-07 for ; Mon, 14 Feb 2005 03:18:53 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.201]) by svr1.postgresql.org (Postfix) with ESMTP id 5EF778BA0A0 for ; Mon, 14 Feb 2005 03:18:52 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id j1so569539rnf for ; Sun, 13 Feb 2005 19:18:53 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=tjs/Sfval/HpEKHOuILDLrzTcEIJjqEelsKhy0ECW86EWyp5OXJoilLdqrjr/qolrSZw4LQuqbUfZm3LCixL0VUKUY2UtxPqutYWQBg8uxhZzwMC3y9Sqihd7KZidtbXot+K6lFdeOeJ/c3xsZrWYP5zNtHb97MuThOtA1sRrbg= Received: by 10.38.97.1 with SMTP id u1mr191330rnb; Sun, 13 Feb 2005 19:18:52 -0800 (PST) Received: by 10.38.97.31 with HTTP; Sun, 13 Feb 2005 19:18:52 -0800 (PST) Message-ID: Date: Sun, 13 Feb 2005 22:18:52 -0500 From: Jaime Casanova Reply-To: Jaime Casanova To: Josh Berkus Subject: Re: estimated rows vs. actual rows Cc: performance pgsql In-Reply-To: <200502131341.09811.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <200502131341.09811.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.122 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/202 X-Sequence-Number: 10531 On Sun, 13 Feb 2005 13:41:09 -0800, Josh Berkus wrote: > Jaime, > > > Why is this query using a seq scan rather than a index scan? > > Because it thinks a seq scan will be faster. > I will suggest him to probe with seq scans disabled. But, IMHO, if the table has 143902 and it thinks will retrieve 2610 (almost 1.81% of the total). it won't be faster with an index? i know, i will suggest him to probe to be sure. just an opinion. regards, Jaime Casanova From pgsql-performance-owner@postgresql.org Mon Feb 14 03:38:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9EAC48B9D1A for ; Mon, 14 Feb 2005 03:38:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80807-04 for ; Mon, 14 Feb 2005 03:38:04 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8BA858B9D11 for ; Mon, 14 Feb 2005 03:38:03 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1E3c16D019675; Sun, 13 Feb 2005 22:38:01 -0500 (EST) To: Jaime Casanova Cc: Josh Berkus , performance pgsql Subject: Re: estimated rows vs. actual rows In-reply-to: References: <200502131341.09811.josh@agliodbs.com> Comments: In-reply-to Jaime Casanova message dated "Sun, 13 Feb 2005 22:18:52 -0500" Date: Sun, 13 Feb 2005 22:38:01 -0500 Message-ID: <19674.1108352281@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/203 X-Sequence-Number: 10532 Jaime Casanova writes: > But, IMHO, if the table has 143902 and it thinks will retrieve 2610 > (almost 1.81% of the total). it won't be faster with an index? That's almost one row in fifty. We don't know how wide the table is, but it's certainly possible that there are order-of-a-hundred rows on each page; in which case the indexscan is likely to hit every page. Twice. Not in sequence. Only if the selected rows are pretty well clustered in a small part of the table is this going to be a win over a seqscan. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Feb 14 03:41:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A31348BA0CA for ; Mon, 14 Feb 2005 03:41:48 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80244-08 for ; Mon, 14 Feb 2005 03:41:45 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 53A078BA0A0 for ; Mon, 14 Feb 2005 03:41:43 +0000 (GMT) Received: (qmail 17754 invoked from network); 14 Feb 2005 03:41:40 -0000 Received: from 218-101-14-48.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.48) by 0 with SMTP; 14 Feb 2005 03:41:41 -0000 Message-ID: <42101EF6.8010403@coretech.co.nz> Date: Mon, 14 Feb 2005 16:45:58 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jaime Casanova Cc: performance pgsql Subject: Re: estimated rows vs. actual rows References: <200502131341.09811.josh@agliodbs.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/204 X-Sequence-Number: 10533 Jaime Casanova wrote: > > But, IMHO, if the table has 143902 and it thinks will retrieve 2610 > (almost 1.81% of the total). it won't be faster with an index? > Depends on how those 2610 rows are distributed amongst the 143902. The worst case scenario is each one of them in its own page. In that case you have to read 2610 *pages*, which is probably a significant percentage of the table. You can find out this information from the pg_stats view (particularly the correlation column). Mark From pgsql-performance-owner@postgresql.org Mon Feb 14 08:01:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3C9AB8BA097 for ; Mon, 14 Feb 2005 08:01:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47644-02 for ; Mon, 14 Feb 2005 08:01:29 +0000 (GMT) Received: from ew.mimos.my (ew.mimos.my [192.228.129.34]) by svr1.postgresql.org (Postfix) with ESMTP id E355F8BA043 for ; Mon, 14 Feb 2005 08:01:27 +0000 (GMT) Received: from mimos.my (mcg189.nat.mimos.my [10.1.18.189]) by ew.mimos.my (8.12.9p2/8.12.9) with ESMTP id j1E81Pdp057886 for ; Mon, 14 Feb 2005 16:01:25 +0800 (MYT) (envelope-from hasnulfadhly.h@mimos.my) Message-ID: <42105AD0.2010803@mimos.my> Date: Mon, 14 Feb 2005 16:01:20 +0800 From: Hasnul Fadhly bin Hasan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Autocommit Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.059 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/205 X-Sequence-Number: 10534 Hi, I am just wondering, by default, autocommit is enabled for every client connection. The documentations states that we have to use BEGIN and END or COMMIT so to increase performance by not using autocommit. My question is, when we use the BEGIN and END statements, is autocommit unset/disabled automatically or we have to disable/unset it manually? Hasnul From pgsql-performance-owner@postgresql.org Mon Feb 14 08:47:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 53FE18BA030 for ; Mon, 14 Feb 2005 08:47:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52182-09 for ; Mon, 14 Feb 2005 08:47:19 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 04D258BA01F for ; Mon, 14 Feb 2005 08:47:18 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id j1E8l4CZ026274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Feb 2005 01:47:06 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id j1E8l4Hp004147; Mon, 14 Feb 2005 01:47:04 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j1E8l44B004146; Mon, 14 Feb 2005 01:47:04 -0700 (MST) (envelope-from mfuhr) Date: Mon, 14 Feb 2005 01:47:03 -0700 From: Michael Fuhr To: Hasnul Fadhly bin Hasan Cc: pgsql-performance@postgresql.org Subject: Re: Autocommit Message-ID: <20050214084703.GA4038@winnie.fuhr.org> References: <42105AD0.2010803@mimos.my> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42105AD0.2010803@mimos.my> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/206 X-Sequence-Number: 10535 On Mon, Feb 14, 2005 at 04:01:20PM +0800, Hasnul Fadhly bin Hasan wrote: > > I am just wondering, by default, autocommit is enabled for every client > connection. The documentations states that we have to use BEGIN > and END or COMMIT so to increase performance by not using autocommit. > My question is, when we use the BEGIN and END statements, is autocommit > unset/disabled automatically or we have to disable/unset it manually? What version of PostgreSQL is your server running and what client software are you using? PostgreSQL 7.3 had a server-side autocommit setting, but it caused problems with some clients so 7.4 got rid of it and left autocommit up to the client. How to enable or disable client-side autocommit depends on the client software, but if you're able to execute a BEGIN (or START TRANSACTION) statement then you should be inside a transaction until you execute COMMIT (or END) or ROLLBACK. That is, unless your client intercepts these statements and does whatever it wants.... -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Mon Feb 14 08:59:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1E1F38BA0C5 for ; Mon, 14 Feb 2005 08:59:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54517-03 for ; Mon, 14 Feb 2005 08:58:43 +0000 (GMT) Received: from ew.mimos.my (ew.mimos.my [192.228.129.34]) by svr1.postgresql.org (Postfix) with ESMTP id 1F0D88BA030 for ; Mon, 14 Feb 2005 08:58:42 +0000 (GMT) Received: from mimos.my (mcg189.nat.mimos.my [10.1.18.189]) by ew.mimos.my (8.12.9p2/8.12.9) with ESMTP id j1E8wadp087413; Mon, 14 Feb 2005 16:58:36 +0800 (MYT) (envelope-from hasnulfadhly.h@mimos.my) Message-ID: <42106837.3020103@mimos.my> Date: Mon, 14 Feb 2005 16:58:31 +0800 From: Hasnul Fadhly bin Hasan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Fuhr Cc: pgsql-performance@postgresql.org Subject: Re: Autocommit References: <42105AD0.2010803@mimos.my> <20050214084703.GA4038@winnie.fuhr.org> In-Reply-To: <20050214084703.GA4038@winnie.fuhr.org> Content-Type: multipart/alternative; boundary="------------060209090609060406000901" X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.333 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_20_30, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200502/207 X-Sequence-Number: 10536 This is a multi-part message in MIME format. --------------060209090609060406000901 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi Micheal, Thanks for the reply. I am using postgres 7.4.5 client. There's one that is using 7.4.1 client. I'm not sure if there would be any difference. When i use psql and check the status of autocommit, it is set to enable. I'm not sure if libpq and psql uses the same defaults. Thanks, Hasnul Michael Fuhr wrote: >On Mon, Feb 14, 2005 at 04:01:20PM +0800, Hasnul Fadhly bin Hasan wrote: > > >>I am just wondering, by default, autocommit is enabled for every client >>connection. The documentations states that we have to use BEGIN >>and END or COMMIT so to increase performance by not using autocommit. >>My question is, when we use the BEGIN and END statements, is autocommit >>unset/disabled automatically or we have to disable/unset it manually? >> >> > >What version of PostgreSQL is your server running and what client >software are you using? PostgreSQL 7.3 had a server-side autocommit >setting, but it caused problems with some clients so 7.4 got rid >of it and left autocommit up to the client. How to enable or disable >client-side autocommit depends on the client software, but if you're >able to execute a BEGIN (or START TRANSACTION) statement then you >should be inside a transaction until you execute COMMIT (or END) >or ROLLBACK. That is, unless your client intercepts these statements >and does whatever it wants.... > > > --------------060209090609060406000901 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi Micheal,

Thanks for the reply.  I am using postgres 7.4.5 client.  There's one that is using 7.4.1 client.  I'm not sure if there would be any difference.
When i use psql and check the status of autocommit, it is set to enable.  I'm not sure if libpq and psql uses the same defaults.

Thanks,

Hasnul



Michael Fuhr wrote:
On Mon, Feb 14, 2005 at 04:01:20PM +0800, Hasnul Fadhly bin Hasan wrote:
  
I am just wondering, by default, autocommit is enabled for every client 
connection.  The documentations states that we have to use BEGIN
and  END or COMMIT so to increase performance by not using autocommit. 
My question is, when we use the BEGIN and END statements, is autocommit 
unset/disabled automatically or we have to disable/unset it manually?
    

What version of PostgreSQL is your server running and what client
software are you using?  PostgreSQL 7.3 had a server-side autocommit
setting, but it caused problems with some clients so 7.4 got rid
of it and left autocommit up to the client.  How to enable or disable
client-side autocommit depends on the client software, but if you're
able to execute a BEGIN (or START TRANSACTION) statement then you
should be inside a transaction until you execute COMMIT (or END)
or ROLLBACK.  That is, unless your client intercepts these statements
and does whatever it wants....

  
--------------060209090609060406000901-- From pgsql-performance-owner@postgresql.org Mon Feb 14 09:34:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3B4E18BA0EA for ; Mon, 14 Feb 2005 09:34:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58554-08 for ; Mon, 14 Feb 2005 09:34:13 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id E94918B9F06 for ; Mon, 14 Feb 2005 09:34:12 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id j1E9Y4k7026318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Feb 2005 02:34:06 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id j1E9Y4NH004693; Mon, 14 Feb 2005 02:34:04 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j1E9Y3Lx004692; Mon, 14 Feb 2005 02:34:04 -0700 (MST) (envelope-from mfuhr) Date: Mon, 14 Feb 2005 02:34:03 -0700 From: Michael Fuhr To: Hasnul Fadhly bin Hasan Cc: pgsql-performance@postgresql.org Subject: Re: Autocommit Message-ID: <20050214093403.GA4629@winnie.fuhr.org> References: <42105AD0.2010803@mimos.my> <20050214084703.GA4038@winnie.fuhr.org> <42106837.3020103@mimos.my> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42106837.3020103@mimos.my> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/208 X-Sequence-Number: 10537 On Mon, Feb 14, 2005 at 04:58:31PM +0800, Hasnul Fadhly bin Hasan wrote: > Thanks for the reply. I am using postgres 7.4.5 client. There's one > that is using 7.4.1 client. I'm not sure if there would be any difference. > When i use psql and check the status of autocommit, it is set to > enable. I'm not sure if libpq and psql uses the same defaults. As far as I can tell, libpq doesn't have an autocommit setting -- it just sends statements on behalf of the application. Clients that allow the user to disable autocommit presumably do so by implicitly sending BEGIN statements to start new transactions. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Mon Feb 14 10:47:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 473F78BA021 for ; Mon, 14 Feb 2005 10:47:04 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69077-01 for ; Mon, 14 Feb 2005 10:46:58 +0000 (GMT) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by svr1.postgresql.org (Postfix) with ESMTP id E84D38B9D1F for ; Mon, 14 Feb 2005 10:46:57 +0000 (GMT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1D0diH-0000Ta-GT for pgsql-performance@postgresql.org; Mon, 14 Feb 2005 11:44:21 +0100 Received: from srv.protecting.net ([212.126.218.242]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 14 Feb 2005 11:44:21 +0100 Received: from hf0722x by srv.protecting.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 14 Feb 2005 11:44:21 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Harald Fuchs Subject: Re: Benchmark Date: 14 Feb 2005 11:46:18 +0100 Organization: Linux Private Site Lines: 11 Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3412A761C@Herge.rcsinc.local> <87mzu85sgh.fsf@stark.xeocode.com> Reply-To: hf1122x@protecting.net Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: srv.protecting.net User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 X-Gmane-MailScanner: Found to be clean X-Gmane-MailScanner: Found to be clean X-MailScanner-From: gcdpp-pgsql-performance@m.gmane.org X-MailScanner-To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/209 X-Sequence-Number: 10538 In article <87mzu85sgh.fsf@stark.xeocode.com>, Greg Stark writes: > Christopher Browne writes: >> After all, the cost of a computer system to run the transactions is >> likely to be comprised of some combination of software licenses and >> hardware costs. Even if the software is free, the hardware isn't. > And labour costs. Except that working with PostgreSQL is fun, not labour :-) From pgsql-performance-owner@postgresql.org Mon Feb 14 12:48:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0A0308BA0E0 for ; Mon, 14 Feb 2005 12:48:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87980-03 for ; Mon, 14 Feb 2005 12:47:57 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 08A9F8B9EAD for ; Mon, 14 Feb 2005 12:47:56 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 2229631E04; Mon, 14 Feb 2005 13:47:57 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: estimated rows vs. actual rows Date: Mon, 14 Feb 2005 07:41:13 -0500 Organization: cbbrowne Computing Inc Lines: 30 Message-ID: References: <200502131341.09811.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:B7qCLE39aCv5fUg07Bz+WBHwohk= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.091 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/210 X-Sequence-Number: 10539 After takin a swig o' Arrakan spice grog, systemguards@gmail.com (Jaime Casanova) belched out: > On Sun, 13 Feb 2005 13:41:09 -0800, Josh Berkus wrote: >> Jaime, >> >> > Why is this query using a seq scan rather than a index scan? >> >> Because it thinks a seq scan will be faster. >> > I will suggest him to probe with seq scans disabled. > > But, IMHO, if the table has 143902 and it thinks will retrieve 2610 > (almost 1.81% of the total). it won't be faster with an index? If the 2610 rows are scattered widely enough, it may be cheaper to do a seq scan. After all, with a seq scan, you read each block of the table's pages exactly once. With an index scan, you read index pages _and_ table pages, and may do and redo some of the pages. It sounds as though it's worth forcing the matter and trying it both ways and comparing them. Don't be surprised if the seq scan is in fact faster... -- select 'cbbrowne' || '@' || 'gmail.com'; http://cbbrowne.com/info/emacs.html When aiming for the common denominator, be prepared for the occasional division by zero. From pgsql-performance-owner@postgresql.org Mon Feb 14 19:57:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 53AAE8B9F7D for ; Mon, 14 Feb 2005 19:57:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58698-03 for ; Mon, 14 Feb 2005 19:57:52 +0000 (GMT) Received: from pinus.cc.fer.hr (pinus.cc.fer.hr [161.53.73.18]) by svr1.postgresql.org (Postfix) with ESMTP id 90D958B9F7B for ; Mon, 14 Feb 2005 19:57:46 +0000 (GMT) Received: from [161.53.72.113] (lara.cc.fer.hr [161.53.72.113]) by pinus.cc.fer.hr (8.12.2/8.12.2) with ESMTP id j1EJvfJu024179 for ; Mon, 14 Feb 2005 20:57:41 +0100 (MET) Message-ID: <421102A7.4090006@fer.hr> Date: Mon, 14 Feb 2005 20:57:27 +0100 From: Ivan Voras User-Agent: Mozilla Thunderbird 1.0 (X11/20041213) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: String matching Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/211 X-Sequence-Number: 10540 Is there a way to use indexes for queries like: select field from table where field like 'abc%' (i.e. filter for string fields that begin with something) ? From pgsql-performance-owner@postgresql.org Mon Feb 14 20:05:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 04BA98B9F91 for ; Mon, 14 Feb 2005 20:05:02 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59182-08 for ; Mon, 14 Feb 2005 20:04:56 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 008E08B9FFC for ; Mon, 14 Feb 2005 20:04:55 +0000 (GMT) Received: (qmail 22506 invoked from network); 14 Feb 2005 21:05:27 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 14 Feb 2005 21:05:27 +0100 To: "Ivan Voras" , pgsql-performance@postgresql.org Subject: Re: String matching References: <421102A7.4090006@fer.hr> Message-ID: Date: Mon, 14 Feb 2005 21:08:39 +0100 From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <421102A7.4090006@fer.hr> User-Agent: Opera M2/7.54u1 (Linux, build 892) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/212 X-Sequence-Number: 10541 normally you shouldn't have to do anything, it should just work : > select field from table where field like 'abc%' CREATE INDEX ... ON table( field ); that's all If it does not use the index, I saw on the mailing list that the locale could be an issue. From pgsql-performance-owner@postgresql.org Mon Feb 14 20:32:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DF8B58B9FF6 for ; Mon, 14 Feb 2005 20:32:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64524-02 for ; Mon, 14 Feb 2005 20:32:05 +0000 (GMT) Received: from pinus.cc.fer.hr (pinus.cc.fer.hr [161.53.73.18]) by svr1.postgresql.org (Postfix) with ESMTP id DADBD8B9F88 for ; Mon, 14 Feb 2005 20:32:03 +0000 (GMT) Received: from [161.53.72.113] (lara.cc.fer.hr [161.53.72.113]) by pinus.cc.fer.hr (8.12.2/8.12.2) with ESMTP id j1EKW0Ju018255; Mon, 14 Feb 2005 21:32:00 +0100 (MET) Message-ID: <42110AB2.1010903@fer.hr> Date: Mon, 14 Feb 2005 21:31:46 +0100 From: Ivan Voras User-Agent: Mozilla Thunderbird 1.0 (X11/20041213) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PFC Cc: pgsql-performance@postgresql.org Subject: Re: String matching References: <421102A7.4090006@fer.hr> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/213 X-Sequence-Number: 10542 PFC wrote: > > normally you shouldn't have to do anything, it should just work : > >> select field from table where field like 'abc%' > If it does not use the index, I saw on the mailing list that the > locale could be an issue. Oh yes, I forgot about that :( I do have LC_COLLATE (on latin2)... It's a shame PostgreSQL doesn't allow collation rules on specific fields - this field I'm using here will always be 7bit ASCII :( From pgsql-performance-owner@postgresql.org Mon Feb 14 20:42:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DF3028BA096 for ; Mon, 14 Feb 2005 20:42:18 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64192-09 for ; Mon, 14 Feb 2005 20:42:18 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id CFE378BA095 for ; Mon, 14 Feb 2005 20:42:17 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id ACC74351C2; Mon, 14 Feb 2005 12:42:14 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id A5E0D3514B; Mon, 14 Feb 2005 12:42:14 -0800 (PST) Date: Mon, 14 Feb 2005 12:42:14 -0800 (PST) From: Stephan Szabo To: Ivan Voras Cc: PFC , pgsql-performance@postgresql.org Subject: Re: String matching In-Reply-To: <42110AB2.1010903@fer.hr> Message-ID: <20050214124119.C4920@megazone.bigpanda.com> References: <421102A7.4090006@fer.hr> <42110AB2.1010903@fer.hr> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/214 X-Sequence-Number: 10543 On Mon, 14 Feb 2005, Ivan Voras wrote: > PFC wrote: > > > > normally you shouldn't have to do anything, it should just work : > > > >> select field from table where field like 'abc%' > > > If it does not use the index, I saw on the mailing list that the > > locale could be an issue. > > Oh yes, I forgot about that :( I do have LC_COLLATE (on latin2)... > > It's a shame PostgreSQL doesn't allow collation rules on specific fields > - this field I'm using here will always be 7bit ASCII :( You can also create an index using a _pattern_ops operator class which should be usable even with other collations. From pgsql-performance-owner@postgresql.org Mon Feb 14 20:45:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 971BB8B9BC9 for ; Mon, 14 Feb 2005 20:45:34 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66433-01 for ; Mon, 14 Feb 2005 20:45:25 +0000 (GMT) Received: from pinus.cc.fer.hr (pinus.cc.fer.hr [161.53.73.18]) by svr1.postgresql.org (Postfix) with ESMTP id 009B48BA083 for ; Mon, 14 Feb 2005 20:45:24 +0000 (GMT) Received: from [161.53.72.113] (lara.cc.fer.hr [161.53.72.113]) by pinus.cc.fer.hr (8.12.2/8.12.2) with ESMTP id j1EKjEJu021186; Mon, 14 Feb 2005 21:45:14 +0100 (MET) Message-ID: <42110DCC.4040706@fer.hr> Date: Mon, 14 Feb 2005 21:45:00 +0100 From: Ivan Voras User-Agent: Mozilla Thunderbird 1.0 (X11/20041213) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stephan Szabo Cc: PFC , pgsql-performance@postgresql.org Subject: Re: String matching References: <421102A7.4090006@fer.hr> <42110AB2.1010903@fer.hr> <20050214124119.C4920@megazone.bigpanda.com> In-Reply-To: <20050214124119.C4920@megazone.bigpanda.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/215 X-Sequence-Number: 10544 Stephan Szabo wrote: > You can also create an index using a _pattern_ops operator > class which should be usable even with other collations. Could you give me an example for this, or point me to the relevant documentation? From pgsql-performance-owner@postgresql.org Mon Feb 14 22:13:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E20638B9CD1 for ; Mon, 14 Feb 2005 22:12:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79543-03 for ; Mon, 14 Feb 2005 22:12:50 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 28F908B9CCE for ; Mon, 14 Feb 2005 22:12:49 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 86ECE35592; Mon, 14 Feb 2005 14:12:49 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 75E8235540; Mon, 14 Feb 2005 14:12:49 -0800 (PST) Date: Mon, 14 Feb 2005 14:12:49 -0800 (PST) From: Stephan Szabo To: Ivan Voras Cc: PFC , pgsql-performance@postgresql.org Subject: Re: String matching In-Reply-To: <42110DCC.4040706@fer.hr> Message-ID: <20050214141029.W9640@megazone.bigpanda.com> References: <421102A7.4090006@fer.hr> <42110AB2.1010903@fer.hr> <20050214124119.C4920@megazone.bigpanda.com> <42110DCC.4040706@fer.hr> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/216 X-Sequence-Number: 10545 On Mon, 14 Feb 2005, Ivan Voras wrote: > Stephan Szabo wrote: > > > You can also create an index using a _pattern_ops operator > > class which should be usable even with other collations. > > Could you give me an example for this, or point me to the relevant > documentation? Basically, you could have something like: create table test_table(a text); create index test_index on test_table(a text_pattern_ops); ------------------------------------------------------------------ http://www.postgresql.org/docs/8.0/interactive/indexes-opclass.html From pgsql-performance-owner@postgresql.org Mon Feb 14 22:29:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5202F8B9CEF for ; Mon, 14 Feb 2005 22:29:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80999-10 for ; Mon, 14 Feb 2005 22:29:34 +0000 (GMT) Received: from pinus.cc.fer.hr (pinus.cc.fer.hr [161.53.73.18]) by svr1.postgresql.org (Postfix) with ESMTP id 2CE888B9CE0 for ; Mon, 14 Feb 2005 22:29:33 +0000 (GMT) Received: from [161.53.72.113] (lara.cc.fer.hr [161.53.72.113]) by pinus.cc.fer.hr (8.12.2/8.12.2) with ESMTP id j1EMTTJu029722; Mon, 14 Feb 2005 23:29:29 +0100 (MET) Message-ID: <4211263B.7080003@fer.hr> Date: Mon, 14 Feb 2005 23:29:15 +0100 From: Ivan Voras User-Agent: Mozilla Thunderbird 1.0 (X11/20041213) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stephan Szabo Cc: PFC , pgsql-performance@postgresql.org Subject: Re: String matching References: <421102A7.4090006@fer.hr> <42110AB2.1010903@fer.hr> <20050214124119.C4920@megazone.bigpanda.com> <42110DCC.4040706@fer.hr> <20050214141029.W9640@megazone.bigpanda.com> In-Reply-To: <20050214141029.W9640@megazone.bigpanda.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/217 X-Sequence-Number: 10546 Stephan Szabo wrote: > On Mon, 14 Feb 2005, Ivan Voras wrote: >>Could you give me an example for this, or point me to the relevant >>documentation? > > http://www.postgresql.org/docs/8.0/interactive/indexes-opclass.html Thanks! I didn't know this and I certainly didn't think it would be that easy :) From pgsql-performance-owner@postgresql.org Mon Feb 14 22:32:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 65D018B9CEE for ; Mon, 14 Feb 2005 22:31:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80150-10 for ; Mon, 14 Feb 2005 22:31:46 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 62EBB8B9CE4 for ; Mon, 14 Feb 2005 22:31:45 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 24EF03567C; Mon, 14 Feb 2005 14:31:46 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 23A8E34D5B; Mon, 14 Feb 2005 14:31:46 -0800 (PST) Date: Mon, 14 Feb 2005 14:31:46 -0800 (PST) From: Stephan Szabo To: Ivan Voras Cc: PFC , pgsql-performance@postgresql.org Subject: Re: String matching In-Reply-To: <4211263B.7080003@fer.hr> Message-ID: <20050214143050.R11070@megazone.bigpanda.com> References: <421102A7.4090006@fer.hr> <42110AB2.1010903@fer.hr> <20050214124119.C4920@megazone.bigpanda.com> <42110DCC.4040706@fer.hr> <20050214141029.W9640@megazone.bigpanda.com> <4211263B.7080003@fer.hr> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/218 X-Sequence-Number: 10547 On Mon, 14 Feb 2005, Ivan Voras wrote: > Stephan Szabo wrote: > > On Mon, 14 Feb 2005, Ivan Voras wrote: > > >>Could you give me an example for this, or point me to the relevant > >>documentation? > > > > > http://www.postgresql.org/docs/8.0/interactive/indexes-opclass.html > > Thanks! I didn't know this and I certainly didn't think it would be that > easy :) Well, it's not perfect. It requires a separate index from one for normal comparisons, so it's trading modification speed for LIKE lookup speed. From pgsql-performance-owner@postgresql.org Mon Feb 14 23:35:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A5C238B9D5D for ; Mon, 14 Feb 2005 23:34:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88835-03 for ; Mon, 14 Feb 2005 23:34:34 +0000 (GMT) Received: from mx1.mailsecurity.net.au (mx1.mailsecurity.net.au [66.135.32.89]) by svr1.postgresql.org (Postfix) with ESMTP id 1D8728B9F21 for ; Mon, 14 Feb 2005 23:34:33 +0000 (GMT) Received: from [211.28.202.200] (211.28.202.200.optusnet.com.au [211.28.202.200] (may be forged)) (authenticated) by mx1.mailsecurity.net.au (8.11.6/2.52a) with ESMTP id j1ENYPo20145 for ; Tue, 15 Feb 2005 10:34:25 +1100 Mime-Version: 1.0 (Apple Message framework v619) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; format=flowed To: " " From: Mark Aufflick Subject: seq scan cache vs. index cache smackdown Date: Tue, 15 Feb 2005 10:34:35 +1100 X-Mailer: Apple Mail (2.619) X-MS-Info: Message scanned by Mail Security - www.mailsecurity.net.au X-MS: Message OK X-MS-From: mark@pumptheory.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/219 X-Sequence-Number: 10548 Hi All, I have boiled my situation down to the following simple case: (postgres version 7.3) * Query 1 is doing a sequential scan over a table (courtesy of field ILIKE 'foo%') and index joins to a few others * Query 2 is doing a functional index scan over the same table (lower(field) LIKE 'foo%') and index joins to a few others * neither query has an order by clause * for the purpose of testing, both queries are designed to return the same result set Obviously Q2 is faster than Q1, but if I ever run them both at the same time (lets say I run two of Q1 and one of Q2 at the same time) then Q2 consistently returns WORSE times than Q1 (explain analyze confirms that it is using the index). My assumption is that the sequential scan is blowing the index from any cache it might live in, and simultaneously stealing all the disk IO that is needed to access the index on disk (the table has 200,000 rows). If I simplify the case to not do the index joins (ie. operate on the one table only) the situation is not as dramatic, but similar. My thoughts are: 1) kill the sequential scan - but unfortunately I don't have direct control over that code 2) change the way the server allocates/prioritizes different caches - i don't know enough about how postgres caches work to do this (if it's possible) 3) try it on postgres 7.4 - possible, but migrating the system to 7.4 in production will be hard because the above code that I am not responsible for has a lot of (slightly wacky) implicit date casts 4) ask the fine people on the mailing list for other suggestions! -- Mark Aufflick e mark@pumptheory.com w www.pumptheory.com (work) w mark.aufflick.com (personal) p +61 438 700 647 f +61 2 9436 4737 ======================================================================== iBurst Wireless Broadband from $34.95/month www.platformnetworks.net Forward undetected SPAM to: spam@mailsecurity.net.au ======================================================================== From pgsql-performance-owner@postgresql.org Tue Feb 15 00:11:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0FAC18B9E50 for ; Tue, 15 Feb 2005 00:10:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92321-07 for ; Tue, 15 Feb 2005 00:10:23 +0000 (GMT) Received: from sccrmhc11.comcast.net (sccrmhc14.comcast.net [204.127.202.59]) by svr1.postgresql.org (Postfix) with ESMTP id DB3BF8B9D5F for ; Tue, 15 Feb 2005 00:10:21 +0000 (GMT) Received: from sysexperts.com (c-24-6-183-218.client.comcast.net[24.6.183.218]) by comcast.net (sccrmhc14) with ESMTP id <2005021500101701400odk2te>; Tue, 15 Feb 2005 00:10:18 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Mon, 14 Feb 2005 16:10:12 -0800 id 00112181.42113DE4.0000578A Date: Mon, 14 Feb 2005 16:10:12 -0800 From: Kevin Brown To: "Pgsql-Performance (E-mail)" Subject: Re: How to interpret this explain analyse? Message-ID: <20050215001011.GA31014@filer> Mail-Followup-To: Kevin Brown , "Pgsql-Performance (E-mail)" References: <13008.1108150825@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <13008.1108150825@sss.pgh.pa.us> Organization: Frobozzco International User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/220 X-Sequence-Number: 10549 Tom Lane wrote: > "Joost Kraaijeveld" writes: > > I cannot change the query (it is geneated by a tool called Clarion) but it something like (from the psqlodbc_xxx.log): > > "... > > declare SQL_CUR01 cursor for > > SELECT A.ordernummer, B.klantnummer FROM "orders" A LEFT OUTER JOIN "klt_alg" B ON A.Klantnummer=B.Klantnummer ORDER BY A.klantnummer; > > fetch 100 in SQL_CUR01; > > ..." > > Well, the planner does put some emphasis on startup time when dealing > with a DECLARE CURSOR plan; the problem you face is just that that > correction isn't large enough. (From memory, I think it optimizes on > the assumption that 10% of the estimated rows will actually be fetched; > you evidently want a setting of 1% or even less.) Ouch. Is this really a reasonable assumption? I figured the primary use of a cursor was to fetch small amounts of data at a time from a large table, so 10% seems extremely high as an average fetch size. Or is the optimization based on the number of rows that will be fetched by the cursor during the cursor's lifetime (as opposed to in a single fetch)? Also, one has to ask what the consequences are of assuming a value too low versus too high. Which ends up being worse? > We once talked about setting up a GUC variable to control the percentage > of a cursor that is estimated to be fetched: > http://archives.postgresql.org/pgsql-hackers/2000-10/msg01108.php > It never got done but that seems like the most reasonable solution to > me. Or keep some statistics on cursor usage, and adjust the value dynamically based on actual cursor queries (this might be easier said than done, of course). -- Kevin Brown kevin@sysexperts.com From pgsql-performance-owner@postgresql.org Tue Feb 15 01:30:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E96E98B9C9D for ; Tue, 15 Feb 2005 01:29:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06704-10 for ; Tue, 15 Feb 2005 01:29:46 +0000 (GMT) Received: from mail.census.gov.ph (mail.census.gov.ph [203.172.28.120]) by svr1.postgresql.org (Postfix) with ESMTP id AD6178B9CAF for ; Tue, 15 Feb 2005 01:29:04 +0000 (GMT) Received: from notnot ([192.168.1.70]) by mail.census.gov.ph (8.12.8/8.12.8) with ESMTP id j1F1QolW028793 for ; Tue, 15 Feb 2005 09:26:56 +0800 Message-Id: <200502150126.j1F1QolW028793@mail.census.gov.ph> From: "Michael Ryan S. Puncia" To: Subject: VACCUM FULL ANALYZE PROBLEM Date: Tue, 15 Feb 2005 09:34:39 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C51341.953074F0" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcUS/oObFWTM93GJQTq6dFXC0Y03SQ== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-MailScanner: Found to be clean by NSO mail server. X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.366 tagged_above=0 required=5 tests=HTML_MESSAGE, SUBJ_ALL_CAPS X-Spam-Level: X-Archive-Number: 200502/221 X-Sequence-Number: 10550 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C51341.953074F0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I have 3 tables in the database with 80G of data, one of them is almost 40G and the remaining 2 tables has 20G each. We use this database mainly for query and updating is done only quarterly and the database perform well. My problem is after updating and then run VACCUM FULL ANALYZE vacuuming the tables takes days to complete. I hope someone can help me solve my problem. Thanks ------=_NextPart_000_0000_01C51341.953074F0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

 

I have 3 tables in the database with 80G of data, one = of them is almost 40G and the remaining 2 tables has 20G = each.

We use this database mainly for query and updating is done only = quarterly and the database perform well. My problem

is after updating and then run VACCUM FULL ANALYZE =  vacuuming the tables takes days to complete. I hope someone

can help me solve my problem.

 

Thanks

 

 

------=_NextPart_000_0000_01C51341.953074F0-- From pgsql-performance-owner@postgresql.org Tue Feb 15 01:53:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 94F5A8BA0BC for ; Tue, 15 Feb 2005 01:52:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10322-07 for ; Tue, 15 Feb 2005 01:52:25 +0000 (GMT) Received: from millenium.mst.co.jp (millenium.mst.co.jp [210.251.240.193]) by svr1.postgresql.org (Postfix) with ESMTP id 3EF138B9CE0 for ; Tue, 15 Feb 2005 01:52:23 +0000 (GMT) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id j1F1mIQ19032; Tue, 15 Feb 2005 10:48:18 +0900 Message-ID: <007f01c51300$f44334a0$7201a8c0@mst1x5r347kymb> From: "Iain" To: "Michael Ryan S. Puncia" , References: <200502150126.j1F1QolW028793@mail.census.gov.ph> Subject: Re: VACCUM FULL ANALYZE PROBLEM Date: Tue, 15 Feb 2005 10:52:01 +0900 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0079_01C5134C.611A8F60" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200502/222 X-Sequence-Number: 10551 This is a multi-part message in MIME format. ------=_NextPart_000_0079_01C5134C.611A8F60 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Hi, just make sure that your freespace map is big enough and then do a vacuum analyse without the full option. I can imagine that database performance might not be as good as it would be after a vacuum full, though I expect that it wouldn't make much difference. regards Iain ----- Original Message ----- From: Michael Ryan S. Puncia To: pgsql-performance@postgresql.org Sent: Tuesday, February 15, 2005 10:34 AM Subject: [PERFORM] VACCUM FULL ANALYZE PROBLEM Hi, I have 3 tables in the database with 80G of data, one of them is almost 40G and the remaining 2 tables has 20G each. We use this database mainly for query and updating is done only quarterly and the database perform well. My problem is after updating and then run VACCUM FULL ANALYZE vacuuming the tables takes days to complete. I hope someone can help me solve my problem. Thanks ------=_NextPart_000_0079_01C5134C.611A8F60 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
just make sure that your = freespace map is=20 big enough and then do a vacuum analyse without the full option. =
 
I can imagine that database = performance=20 might not be as good as it would be after a vacuum full, though I expect = that it=20 wouldn't make much difference.
 
regards
Iain
----- Original Message ----- =
From:=20 Michael=20 Ryan S. Puncia
To: pgsql-performance@postgr= esql.org=20
Sent: Tuesday, February = 15, 2005=20 10:34 AM
Subject: [PERFORM] = VACCUM FULL=20 ANALYZE PROBLEM

Hi,

 

I have 3 tables in the = database=20 with 80G of data, one of them is almost 40G and the remaining 2 tables = has 20G=20 each.

We use this database mainly for query and = updating is=20 done only quarterly and the database perform well. My=20 problem

is after updating and then run VACCUM FULL = ANALYZE=20  vacuuming the tables takes days to complete. I hope=20 someone

can help me solve my=20 problem.

 

Thanks

 

 

------=_NextPart_000_0079_01C5134C.611A8F60-- From pgsql-performance-owner@postgresql.org Tue Feb 15 02:07:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EFA5E8B9B8A for ; Tue, 15 Feb 2005 02:07:02 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11538-09 for ; Tue, 15 Feb 2005 02:06:58 +0000 (GMT) Received: from mail.census.gov.ph (mail.census.gov.ph [203.172.28.120]) by svr1.postgresql.org (Postfix) with ESMTP id 374CC8B9D56 for ; Tue, 15 Feb 2005 02:05:06 +0000 (GMT) Received: from notnot ([192.168.1.70]) by mail.census.gov.ph (8.12.8/8.12.8) with ESMTP id j1F22flW029903; Tue, 15 Feb 2005 10:02:42 +0800 Message-Id: <200502150202.j1F22flW029903@mail.census.gov.ph> From: "Michael Ryan S. Puncia" To: "'Iain'" , Subject: Re: VACCUM FULL ANALYZE PROBLEM Date: Tue, 15 Feb 2005 10:10:30 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C51346.94B49BF0" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcUTAMGqF4dGsuPoSPSZQffPSZp92AAAja9w In-Reply-To: <007f01c51300$f44334a0$7201a8c0@mst1x5r347kymb> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-MailScanner: Found to be clean by NSO mail server. X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.366 tagged_above=0 required=5 tests=HTML_MESSAGE, SUBJ_ALL_CAPS X-Spam-Level: X-Archive-Number: 200502/223 X-Sequence-Number: 10552 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C51346.94B49BF0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit But I need to do full vacuum because I deleted some of the fields that are not use anymore and I also add another fields. Is there another way to speed up full vacuum? _____ From: Iain [mailto:iain@mst.co.jp] Sent: Tuesday, February 15, 2005 9:52 AM To: Michael Ryan S. Puncia; pgsql-performance@postgresql.org Subject: Re: [PERFORM] VACCUM FULL ANALYZE PROBLEM Hi, just make sure that your freespace map is big enough and then do a vacuum analyse without the full option. I can imagine that database performance might not be as good as it would be after a vacuum full, though I expect that it wouldn't make much difference. regards Iain ----- Original Message ----- From: Michael Ryan S. Puncia To: pgsql-performance@postgresql.org Sent: Tuesday, February 15, 2005 10:34 AM Subject: [PERFORM] VACCUM FULL ANALYZE PROBLEM Hi, I have 3 tables in the database with 80G of data, one of them is almost 40G and the remaining 2 tables has 20G each. We use this database mainly for query and updating is done only quarterly and the database perform well. My problem is after updating and then run VACCUM FULL ANALYZE vacuuming the tables takes days to complete. I hope someone can help me solve my problem. Thanks __________ NOD32 1.998 (20050212) Information __________ This message was checked by NOD32 Antivirus System. http://www.nod32.com ------=_NextPart_000_0000_01C51346.94B49BF0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

 

But I need to do full vacuum = because I deleted some of the fields that are not use anymore and I also add = another fields. Is there

another  way  to speed up = full vacuum?

 

 


From: Iain [mailto:iain@mst.co.jp]
Sent: Tuesday, February = 15, 2005 9:52 AM
To: Michael Ryan S. = Puncia; pgsql-performance@postgresql.org
Subject: Re: [PERFORM] = VACCUM FULL ANALYZE PROBLEM

 

Hi,

 

just make sure that your freespace = map is big enough and then do a vacuum analyse without the full option. =

 

I can imagine that database = performance might not be as good as it would be after a vacuum full, though I expect = that it wouldn't make much difference.

 

regards

Iain

----- Original Message ----- =

Sent: Tuesday, February 15, 2005 10:34 AM

Subject: [PERFORM] VACCUM FULL ANALYZE PROBLEM

 

Hi,

 

I have 3 tables in the database with 80G of data, one = of them is almost 40G and the remaining 2 tables has 20G = each.

We use this database mainly for query and updating is done only quarterly and the database perform well. My = problem

is after updating and then run VACCUM FULL ANALYZE =  vacuuming the tables takes days to complete. I hope = someone

can help me solve my problem.

 

Thanks

 

 



__________ NOD32 1.998 (20050212) Information __________

This message was checked by NOD32 Antivirus System.
http://www.nod32.com
<= /font>

------=_NextPart_000_0000_01C51346.94B49BF0-- From pgsql-performance-owner@postgresql.org Tue Feb 15 02:23:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CA1938BA0FC for ; Tue, 15 Feb 2005 02:22:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13909-09 for ; Tue, 15 Feb 2005 02:22:22 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id D2BF78B9EB1 for ; Tue, 15 Feb 2005 02:22:20 +0000 (GMT) Received: from dyn-69-234.tor.dsl.tht.net (dyn-69-234.tor.dsl.tht.net [134.22.69.234]) by tht.net (Postfix) with ESMTP id A19E876A19; Mon, 14 Feb 2005 21:22:17 -0500 (EST) Subject: Re: VACCUM FULL ANALYZE PROBLEM From: Rod Taylor To: "Michael Ryan S. Puncia" Cc: Postgresql Performance In-Reply-To: <200502150126.j1F1QolW028793@mail.census.gov.ph> References: <200502150126.j1F1QolW028793@mail.census.gov.ph> Content-Type: text/plain Date: Mon, 14 Feb 2005 21:21:56 -0500 Message-Id: <1108434116.67118.92.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.019 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/224 X-Sequence-Number: 10553 On Tue, 2005-02-15 at 09:34 +0800, Michael Ryan S. Puncia wrote: > Hi, > > > > I have 3 tables in the database with 80G of data, one of them is > almost 40G and the remaining 2 tables has 20G each. > > We use this database mainly for query and updating is done only > quarterly and the database perform well. My problem > > is after updating and then run VACCUM FULL ANALYZE vacuuming the > tables takes days to complete. I hope someone I suspect the VACUUM FULL is the painful part. Try running CLUSTER on the table or changing a column type (in 8.0) instead. -- From pgsql-performance-owner@postgresql.org Tue Feb 15 02:30:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 480BB8B9B6C for ; Tue, 15 Feb 2005 02:29:39 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16024-02 for ; Tue, 15 Feb 2005 02:29:12 +0000 (GMT) Received: from millenium.mst.co.jp (millenium.mst.co.jp [210.251.240.193]) by svr1.postgresql.org (Postfix) with ESMTP id 449B28B9B8A for ; Tue, 15 Feb 2005 02:29:10 +0000 (GMT) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id j1F2RVQ19171; Tue, 15 Feb 2005 11:27:31 +0900 Message-ID: <009201c51306$6e9ece80$7201a8c0@mst1x5r347kymb> From: "Iain" To: "Michael Ryan S. Puncia" , References: <200502150202.j1F22flW029903@mail.census.gov.ph> Subject: Re: VACCUM FULL ANALYZE PROBLEM Date: Tue, 15 Feb 2005 11:31:14 +0900 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_008C_01C51351.DB73B840" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200502/225 X-Sequence-Number: 10554 This is a multi-part message in MIME format. ------=_NextPart_000_008C_01C51351.DB73B840 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit >> But I need to do full vacuum because I deleted some of the fields that >> are not use anymore and I also add another fields. Is there >> another way to speed up full vacuum? Hmmm... a full vacuum may help to re-organize the structure of modified tables, but whether this is significant or not is another matter. I don't know enough of the internals to comment on that maybe someone else who knows more can. The obvious thing is the vacuum memory setting (in postgresql.conf). Presumably, you could set this quite high at least just for the duration of the vacuum anyway. Would the total time be reduced by dropping the indexes, then vacuuming and rebuilding the indexes? I havn't tried anything like this so I can't say. You should probably say what version of the db you are using and describe your system a little. Regards Iain ----- Original Message ----- From: Michael Ryan S. Puncia To: 'Iain' ; pgsql-performance@postgresql.org Sent: Tuesday, February 15, 2005 11:10 AM Subject: RE: [PERFORM] VACCUM FULL ANALYZE PROBLEM But I need to do full vacuum because I deleted some of the fields that are not use anymore and I also add another fields. Is there another way to speed up full vacuum? ------------------------------------------------------------------------------ From: Iain [mailto:iain@mst.co.jp] Sent: Tuesday, February 15, 2005 9:52 AM To: Michael Ryan S. Puncia; pgsql-performance@postgresql.org Subject: Re: [PERFORM] VACCUM FULL ANALYZE PROBLEM Hi, just make sure that your freespace map is big enough and then do a vacuum analyse without the full option. I can imagine that database performance might not be as good as it would be after a vacuum full, though I expect that it wouldn't make much difference. regards Iain ----- Original Message ----- From: Michael Ryan S. Puncia To: pgsql-performance@postgresql.org Sent: Tuesday, February 15, 2005 10:34 AM Subject: [PERFORM] VACCUM FULL ANALYZE PROBLEM Hi, I have 3 tables in the database with 80G of data, one of them is almost 40G and the remaining 2 tables has 20G each. We use this database mainly for query and updating is done only quarterly and the database perform well. My problem is after updating and then run VACCUM FULL ANALYZE vacuuming the tables takes days to complete. I hope someone can help me solve my problem. Thanks __________ NOD32 1.998 (20050212) Information __________ This message was checked by NOD32 Antivirus System. http://www.nod32.com ------=_NextPart_000_008C_01C51351.DB73B840 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable

>> But = I need to=20 do full vacuum because I deleted some of the fields that are not use = anymore and=20 I also add another fields. Is there

>> = another=20  way  to speed up full vacuum?

 

Hmmm... a = full vacuum=20 may help to re-organize the structure of modified tables, but whether = this is=20 significant or not is another matter. I don't know enough of the = internals to=20 comment on that maybe someone else who knows more = can.

 

The obvious = thing is=20 the vacuum memory setting (in postgresql.conf). Presumably, you could = set this=20 quite high at least just for the duration of the vacuum=20 anyway.

 

Would the = total time be=20 reduced by dropping the indexes, then vacuuming and rebuilding the = indexes? I=20 havn't tried anything like this so I can't say.

 

You should = probably say=20 what version of the db you are using and describe your system a=20 little.

 

Regards

Iain

-----=20 Original Message -----

From:=20 Michael=20 Ryan S. Puncia
To: 'Iain' ; pgsql-performance@postgr= esql.org=20
Sent: Tuesday, February = 15, 2005=20 11:10 AM
Subject: RE: [PERFORM] = VACCUM FULL=20 ANALYZE PROBLEM

 

But I need = to do full=20 vacuum because I deleted some of the fields that are not use anymore = and I=20 also add another fields. Is there

another =  way=20  to speed up full vacuum?

 

 


From: Iain=20 [mailto:iain@mst.co.jp]
Sent:
Tuesday, February 15, = 2005 9:52=20 AM
To: Michael Ryan = S.=20 Puncia; pgsql-performance@postgr= esql.org
Subject: Re: [PERFORM] VACCUM = FULL=20 ANALYZE PROBLEM

 

Hi,

 

just make sure = that your=20 freespace map is big enough and then do a vacuum analyse without the = full=20 option.

 

I can imagine = that=20 database performance might not be as good as it would be after a = vacuum full,=20 though I expect that it wouldn't make much=20 difference.

 

regards

Iain=20

----- = Original Message=20 -----

From: Michael Ryan=20 S. Puncia

To: pgsql-performance@postgr= esql.org=20

Sent: Tuesday, = February 15,=20 2005 10:34 AM

Subject: [PERFORM] = VACCUM FULL=20 ANALYZE PROBLEM

 

Hi,

 

I have 3 tables in the = database=20 with 80G of data, one of them is almost 40G and the remaining 2 = tables has=20 20G each.

We use this database mainly for query and = updating=20 is done only quarterly and the database perform well. My=20 problem

is after updating and then run VACCUM FULL = ANALYZE=20  vacuuming the tables takes days to complete. I hope=20 someone

can help me solve my=20 problem.

 

Thanks

 

 



__________ NOD32 1.998 (20050212) = Information=20 __________

This message was checked by NOD32 Antivirus = System.
http://www.nod32.com<= /FONT>

------=_NextPart_000_008C_01C51351.DB73B840-- From pgsql-performance-owner@postgresql.org Tue Feb 15 03:52:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D8E1B8BA294 for ; Tue, 15 Feb 2005 03:52:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30999-04 for ; Tue, 15 Feb 2005 03:52:10 +0000 (GMT) Received: from millenium.mst.co.jp (millenium.mst.co.jp [210.251.240.193]) by svr1.postgresql.org (Postfix) with ESMTP id C49FD8BA20D for ; Tue, 15 Feb 2005 03:52:06 +0000 (GMT) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id j1F3ppQ19499; Tue, 15 Feb 2005 12:51:51 +0900 Message-ID: <00a001c51312$35fb5510$7201a8c0@mst1x5r347kymb> From: "Iain" To: , "Mark Aufflick" References: Subject: Re: seq scan cache vs. index cache smackdown Date: Tue, 15 Feb 2005 12:55:33 +0900 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/226 X-Sequence-Number: 10555 Hi, I think there was some discussion about seq scans messing up the cache, and talk about doing something about it but I don't think it has been addressed yet. Maybe worth a troll through the archives. It is certainly true that in many situations, a seq scan is preferable to using an index. I have been testing a situation here on two versions of the same database, one of the databases is much bigger than the other (artificially bloated for testing purposes). Some of the query plans change to use seq scans on the big database, where they used indexes on the little database - but either way, in *single user* testing the performance is fine. My concern is that this kind of testing has very little relevance to the real world of multiuser processing where contention for the cache becomes an issue. It may be that, at least in the current situation, postgres is giving too much weight to seq scans based on single user, straight line performance comparisons. If your assumption is correct, then addressing that might help, though it's bound to have it's compromises too... regards Iain ----- Original Message ----- From: "Mark Aufflick" To: Sent: Tuesday, February 15, 2005 8:34 AM Subject: [PERFORM] seq scan cache vs. index cache smackdown > Hi All, > > I have boiled my situation down to the following simple case: (postgres > version 7.3) > > * Query 1 is doing a sequential scan over a table (courtesy of field ILIKE > 'foo%') and index joins to a few others > * Query 2 is doing a functional index scan over the same table > (lower(field) LIKE 'foo%') and index joins to a few others > * neither query has an order by clause > * for the purpose of testing, both queries are designed to return the same > result set > > Obviously Q2 is faster than Q1, but if I ever run them both at the same > time (lets say I run two of Q1 and one of Q2 at the same time) then Q2 > consistently returns WORSE times than Q1 (explain analyze confirms that it > is using the index). > > My assumption is that the sequential scan is blowing the index from any > cache it might live in, and simultaneously stealing all the disk IO that > is needed to access the index on disk (the table has 200,000 rows). > > If I simplify the case to not do the index joins (ie. operate on the one > table only) the situation is not as dramatic, but similar. > > My thoughts are: > > 1) kill the sequential scan - but unfortunately I don't have direct > control over that code > 2) change the way the server allocates/prioritizes different caches - i > don't know enough about how postgres caches work to do this (if it's > possible) > 3) try it on postgres 7.4 - possible, but migrating the system to 7.4 in > production will be hard because the above code that I am not responsible > for has a lot of (slightly wacky) implicit date casts > 4) ask the fine people on the mailing list for other suggestions! > -- > Mark Aufflick > e mark@pumptheory.com > w www.pumptheory.com (work) > w mark.aufflick.com (personal) > p +61 438 700 647 > f +61 2 9436 4737 > > > ======================================================================== > iBurst Wireless Broadband from $34.95/month www.platformnetworks.net > Forward undetected SPAM to: spam@mailsecurity.net.au > ======================================================================== > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings From pgsql-performance-owner@postgresql.org Tue Feb 15 04:21:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0738E8BA27B for ; Tue, 15 Feb 2005 04:21:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35112-10 for ; Tue, 15 Feb 2005 04:21:07 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id A4B3E8BA24E for ; Tue, 15 Feb 2005 04:21:05 +0000 (GMT) Received: from dyn-69-234.tor.dsl.tht.net (dyn-69-234.tor.dsl.tht.net [134.22.69.234]) by tht.net (Postfix) with ESMTP id 026DF76A36; Mon, 14 Feb 2005 23:21:08 -0500 (EST) Subject: Re: seq scan cache vs. index cache smackdown From: Rod Taylor To: Iain Cc: Postgresql Performance , Mark Aufflick In-Reply-To: <00a001c51312$35fb5510$7201a8c0@mst1x5r347kymb> References: <00a001c51312$35fb5510$7201a8c0@mst1x5r347kymb> Content-Type: text/plain Date: Mon, 14 Feb 2005 23:20:51 -0500 Message-Id: <1108441251.67118.111.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.018 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/227 X-Sequence-Number: 10556 > My concern is that this kind of testing has very little relevance to the > real world of multiuser processing where contention for the cache becomes an > issue. It may be that, at least in the current situation, postgres is > giving too much weight to seq scans based on single user, straight line To be fair, a large index scan can easily throw the buffers out of whack as well. An index scan on 0.1% of a table with 1 billion tuples will have a similar impact to buffers as a sequential scan of a table with 1 million tuples. Any solution fixing buffers should probably not take into consideration the method being performed (do you really want to skip caching a sequential scan of a 2 tuple table because it didn't use an index) but the volume of data involved as compared to the size of the cache. I've often wondered if a single 1GB toasted tuple could wipe out the buffers. I would suppose that toast doesn't bypass them. -- Rod Taylor From pgsql-performance-owner@postgresql.org Tue Feb 15 05:50:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E735E8BA304 for ; Tue, 15 Feb 2005 05:50:46 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61767-05 for ; Tue, 15 Feb 2005 05:50:33 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7A33B8BA31C for ; Tue, 15 Feb 2005 05:50:10 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id BF3CD31E3D; Tue, 15 Feb 2005 06:50:09 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: seq scan cache vs. index cache smackdown Date: Mon, 14 Feb 2005 23:54:46 -0500 Organization: cbbrowne Computing Inc Lines: 57 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:mzUVVPC1lfxpYqCsTEuCiSqli9U= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.331 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200502/229 X-Sequence-Number: 10558 The world rejoiced as mark@pumptheory.com (Mark Aufflick) wrote: > Hi All, > > I have boiled my situation down to the following simple case: > (postgres version 7.3) > > * Query 1 is doing a sequential scan over a table (courtesy of field > ILIKE 'foo%') and index joins to a few others > * Query 2 is doing a functional index scan over the same table > (lower(field) LIKE 'foo%') and index joins to a few others > * neither query has an order by clause > * for the purpose of testing, both queries are designed to return the > same result set > > Obviously Q2 is faster than Q1, but if I ever run them both at the > same time (lets say I run two of Q1 and one of Q2 at the same time) > then Q2 consistently returns WORSE times than Q1 (explain analyze > confirms that it is using the index). > > My assumption is that the sequential scan is blowing the index from > any cache it might live in, and simultaneously stealing all the disk > IO that is needed to access the index on disk (the table has 200,000 > rows). There's something to be said for that... > If I simplify the case to not do the index joins (ie. operate on the > one table only) the situation is not as dramatic, but similar. > > My thoughts are: > > 1) kill the sequential scan - but unfortunately I don't have direct > control over that code This is a good choice, if plausible... > 2) change the way the server allocates/prioritizes different caches - > i don't know enough about how postgres caches work to do this (if it's > possible) That's what the 8.0 cache changes did... Patent claim issues are leading to some changes to the prioritization, which is liable to change 8.0.something and 8.1. > 3) try it on postgres 7.4 - possible, but migrating the system to 7.4 > in production will be hard because the above code that I am not > responsible for has a lot of (slightly wacky) implicit date casts Moving to 7.4 wouldn't materially change the situation; you'd have to go all the way to version 8. -- (format nil "~S@~S" "cbbrowne" "gmail.com") http://linuxdatabases.info/~cbbrowne/postgresql.html Rules of the Evil Overlord #32. "I will not fly into a rage and kill a messenger who brings me bad news just to illustrate how evil I really am. Good messengers are hard to come by." From pgsql-performance-owner@postgresql.org Tue Feb 15 05:32:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 39F588BA29D for ; Tue, 15 Feb 2005 05:32:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58969-03 for ; Tue, 15 Feb 2005 05:32:24 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A278D8BA287 for ; Tue, 15 Feb 2005 05:32:22 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1F5UULR008500; Tue, 15 Feb 2005 00:30:31 -0500 (EST) To: "Iain" Cc: "Michael Ryan S. Puncia" , pgsql-performance@postgresql.org Subject: Re: VACCUM FULL ANALYZE PROBLEM In-reply-to: <009201c51306$6e9ece80$7201a8c0@mst1x5r347kymb> References: <200502150202.j1F22flW029903@mail.census.gov.ph> <009201c51306$6e9ece80$7201a8c0@mst1x5r347kymb> Comments: In-reply-to "Iain" message dated "Tue, 15 Feb 2005 11:31:14 +0900" Date: Tue, 15 Feb 2005 00:30:30 -0500 Message-ID: <8499.1108445430@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/228 X-Sequence-Number: 10557 "Iain" writes: >> another way to speed up full vacuum? > Hmmm... a full vacuum may help to re-organize the structure of modified > tables, but whether this is significant or not is another matter. Actually, VACUUM FULL is designed to work nicely for the situation where a table has say 10% wasted space and you want the wasted space all compressed out. When there is a lot of wasted space, so that nearly all the rows have to be moved to complete the compaction operation, VACUUM FULL is not a very good choice. And it simply moves rows around, it doesn't modify the rows internally; so it does nothing at all to reclaim space that would have been freed up by DROP COLUMN operations. CLUSTER is actually a better bet if you want to repack a table that's suffered a lot of updates or deletions. In PG 8.0 you might also consider one of the rewriting variants of ALTER TABLE. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Feb 15 05:55:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5723C8BA2E6 for ; Tue, 15 Feb 2005 05:55:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62506-03 for ; Tue, 15 Feb 2005 05:55:50 +0000 (GMT) Received: from millenium.mst.co.jp (millenium.mst.co.jp [210.251.240.193]) by svr1.postgresql.org (Postfix) with ESMTP id F2AF08BA29B for ; Tue, 15 Feb 2005 05:55:48 +0000 (GMT) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id j1F5sZQ20036; Tue, 15 Feb 2005 14:54:35 +0900 Message-ID: <001701c51323$5b1c1f80$7201a8c0@mst1x5r347kymb> From: "Iain" To: "Tom Lane" Cc: "Michael Ryan S. Puncia" , References: <200502150202.j1F22flW029903@mail.census.gov.ph> <009201c51306$6e9ece80$7201a8c0@mst1x5r347kymb> <8499.1108445430@sss.pgh.pa.us> Subject: Re: VACCUM FULL ANALYZE PROBLEM Date: Tue, 15 Feb 2005 14:58:16 +0900 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-2022-jp"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/230 X-Sequence-Number: 10559 OK, that's interesting. So the original assumption that vacuum full was needed was completely wrong anyway. If table re-organisation isn't required a plain vacuum would be fastest. I will take a guess that the next best alternative is to do the "create table newtable as select ... order by ..." thing and then create the indexes and stuff. This would reorganize the table completely. After that you have the cluster command, and coming in last place is vacuum full. Sound about right? Michael, you said that a vacuum that runs for 3 days is too long, but hasn't given any specific requirements or limitations. Hopefully you can find something suitable in the alternatives listed above. regards Iain ----- Original Message ----- From: "Tom Lane" To: "Iain" Cc: "Michael Ryan S. Puncia" ; Sent: Tuesday, February 15, 2005 2:30 PM Subject: Re: [PERFORM] VACCUM FULL ANALYZE PROBLEM > "Iain" writes: >>> another way to speed up full vacuum? > >> Hmmm... a full vacuum may help to re-organize the structure of modified >> tables, but whether this is significant or not is another matter. > > Actually, VACUUM FULL is designed to work nicely for the situation where > a table has say 10% wasted space and you want the wasted space all > compressed out. When there is a lot of wasted space, so that nearly all > the rows have to be moved to complete the compaction operation, VACUUM > FULL is not a very good choice. And it simply moves rows around, it > doesn't modify the rows internally; so it does nothing at all to reclaim > space that would have been freed up by DROP COLUMN operations. > > CLUSTER is actually a better bet if you want to repack a table that's > suffered a lot of updates or deletions. In PG 8.0 you might also > consider one of the rewriting variants of ALTER TABLE. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Tue Feb 15 06:52:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 518D78B9F5C for ; Tue, 15 Feb 2005 06:52:02 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74042-05 for ; Tue, 15 Feb 2005 06:51:53 +0000 (GMT) Received: from millenium.mst.co.jp (millenium.mst.co.jp [210.251.240.193]) by svr1.postgresql.org (Postfix) with ESMTP id B3D158B9E37 for ; Tue, 15 Feb 2005 06:51:51 +0000 (GMT) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id j1F6pLQ20262; Tue, 15 Feb 2005 15:51:21 +0900 Message-ID: <001e01c5132b$48efbe40$7201a8c0@mst1x5r347kymb> From: "Iain" To: "Rod Taylor" Cc: "Postgresql Performance" , "Mark Aufflick" References: <00a001c51312$35fb5510$7201a8c0@mst1x5r347kymb> <1108441251.67118.111.camel@home> Subject: Re: seq scan cache vs. index cache smackdown Date: Tue, 15 Feb 2005 15:55:02 +0900 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-2022-jp"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/231 X-Sequence-Number: 10560 Hi Rod, > Any solution fixing buffers should probably not take into consideration > the method being performed (do you really want to skip caching a > sequential scan of a 2 tuple table because it didn't use an index) but > the volume of data involved as compared to the size of the cache. Yes, in fact indexes aren't so different to tables really in that regard. It sounds like version 8 may help out anyway. regards Iain From pgsql-performance-owner@postgresql.org Tue Feb 15 07:07:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0A2AC8B9F5C for ; Tue, 15 Feb 2005 07:07:45 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82012-02 for ; Tue, 15 Feb 2005 07:07:27 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id D78B08BA1AC for ; Tue, 15 Feb 2005 07:07:26 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1D0wnc-0000YX-00; Tue, 15 Feb 2005 02:07:08 -0500 To: Mark Aufflick Cc: " " Subject: Re: seq scan cache vs. index cache smackdown References: In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 15 Feb 2005 02:07:07 -0500 Message-ID: <87d5v247z8.fsf@stark.xeocode.com> Lines: 44 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/232 X-Sequence-Number: 10561 Mark Aufflick writes: > Obviously Q2 is faster than Q1, That's not really obvious at all. If there are lots of records being returned the index might not be faster than a sequential scan. > My assumption is that the sequential scan is blowing the index from any cache > it might live in, and simultaneously stealing all the disk IO that is needed to > access the index on disk (the table has 200,000 rows). It kind of sounds to me like you've lowered random_page_cost to reflect the fact that your indexes are nearly always completely cached. But when they're not this unrealistic random_page_cost causes indexes to be used when they're no longer faster. Perhaps you should post an "EXPLAIN ANALYZE" of your Q1 and Q2 (the latter preferable with and without enable_indexscan, but since it's a join you may not be able to get precisely the comparable plan without just that one index scan.) > 2) change the way the server allocates/prioritizes different caches - i don't > know enough about how postgres caches work to do this (if it's possible) Postgres keeps one set of shared buffers, not separate pools . Normally you only allocate a small amount of your memory for Postgres and let the OS handle disk caching. What is your shared_buffers set to and how much memory do you have? > 3) try it on postgres 7.4 - possible, but migrating the system to 7.4 in > production will be hard because the above code that I am not responsible for > has a lot of (slightly wacky) implicit date casts I can't think of any 7.4 changes that would affect this directly, but there were certainly plenty of changes that had broad effects. you never know. 8.0, on the other hand, has a new algorithm that specifically tries to protect against the shared buffers being blown out by a sequential scan. But that will only help if it's the shared buffers being thrashed that's hurting you, not the entire OS file system cache. -- greg From pgsql-performance-owner@postgresql.org Tue Feb 15 07:40:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A7CDC8BA156 for ; Tue, 15 Feb 2005 07:40:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93659-10 for ; Tue, 15 Feb 2005 07:40:18 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 209ED8BA151 for ; Tue, 15 Feb 2005 07:40:17 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1D0wxx-0000aU-00; Tue, 15 Feb 2005 02:17:50 -0500 To: Kevin Brown Cc: "Pgsql-Performance (E-mail)" Subject: Re: How to interpret this explain analyse? References: <13008.1108150825@sss.pgh.pa.us> <20050215001011.GA31014@filer> In-Reply-To: <20050215001011.GA31014@filer> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 15 Feb 2005 02:17:49 -0500 Message-ID: <877jla47he.fsf@stark.xeocode.com> Lines: 25 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/234 X-Sequence-Number: 10563 Kevin Brown writes: > Ouch. Is this really a reasonable assumption? I figured the primary > use of a cursor was to fetch small amounts of data at a time from a > large table, so 10% seems extremely high as an average fetch size. Or > is the optimization based on the number of rows that will be fetched > by the cursor during the cursor's lifetime (as opposed to in a single > fetch)? > > Also, one has to ask what the consequences are of assuming a value too > low versus too high. Which ends up being worse? This is one of the things the planner really cannot know. Ultimately it's the kind of thing for which hints really are necessary. Oracle distinguishes between the "minimize total time" versus "minimize startup time" with /*+ ALL_ROWS */ and /*+ FIRST_ROWS */ hints, for example. I would also find it reasonable to have hints to specify a selectivity for expressions the optimizer has no hope of possibly being able to estimate. Things like "WHERE myfunction(col1,col2,?) /*+ 10% */" -- greg From pgsql-performance-owner@postgresql.org Tue Feb 15 07:36:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C955D8BA123 for ; Tue, 15 Feb 2005 07:36:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94442-02 for ; Tue, 15 Feb 2005 07:36:11 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 267668B9F30 for ; Tue, 15 Feb 2005 07:36:10 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1F7a2aA009327; Tue, 15 Feb 2005 02:36:03 -0500 (EST) To: Greg Stark Cc: Mark Aufflick , pgsql-performance@postgresql.org Subject: Re: seq scan cache vs. index cache smackdown In-reply-to: <87d5v247z8.fsf@stark.xeocode.com> References: <87d5v247z8.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark message dated "15 Feb 2005 02:07:07 -0500" Date: Tue, 15 Feb 2005 02:36:02 -0500 Message-ID: <9326.1108452962@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/233 X-Sequence-Number: 10562 Greg Stark writes: > 8.0, on the other hand, has a new algorithm that specifically tries to > protect against the shared buffers being blown out by a sequential > scan. But that will only help if it's the shared buffers being > thrashed that's hurting you, not the entire OS file system cache. Something we ought to think about sometime: what are the performance implications of the real-world situation that we have another level of caching sitting underneath us? AFAIK all the theoretical studies we've looked at consider only a single level of caching. But for example, if our buffer management algorithm recognizes an index page as being heavily hit and therefore keeps it in cache for a long time, then when it does fall out of cache you can be sure it's going to need to be read from disk when it's next used, because the OS-level buffer cache has not seen a call for that page in a long time. Contrariwise a page that we think is only on the fringe of usefulness is going to stay in the OS cache because we repeatedly drop it and then have to ask for it again. I have no idea how to model this situation, but it seems like it needs some careful thought. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Feb 15 08:11:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B074D8BA16F for ; Tue, 15 Feb 2005 08:11:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99361-07 for ; Tue, 15 Feb 2005 08:10:53 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 99D508BA151 for ; Tue, 15 Feb 2005 08:10:51 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1D0xn5-0000rN-00; Tue, 15 Feb 2005 03:10:39 -0500 To: Tom Lane Cc: Greg Stark , Mark Aufflick , pgsql-performance@postgresql.org Subject: Re: seq scan cache vs. index cache smackdown References: <87d5v247z8.fsf@stark.xeocode.com> <9326.1108452962@sss.pgh.pa.us> In-Reply-To: <9326.1108452962@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 15 Feb 2005 03:10:39 -0500 Message-ID: <87vf8u2qgw.fsf@stark.xeocode.com> Lines: 41 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/235 X-Sequence-Number: 10564 Tom Lane writes: > Greg Stark writes: > > 8.0, on the other hand, has a new algorithm that specifically tries to > > protect against the shared buffers being blown out by a sequential > > scan. But that will only help if it's the shared buffers being > > thrashed that's hurting you, not the entire OS file system cache. > > Something we ought to think about sometime: what are the performance > implications of the real-world situation that we have another level of > caching sitting underneath us? It seems inevitable that Postgres will eventually eliminate that redundant layer of buffering. Since mmap is not workable, that means using O_DIRECT to read table and index data. Every other database eventually goes this direction, and for good reason. Having two layers of caching and buffering is inherently inefficient. It also makes it impossible for Postgres to offer any application-specific hints to the caching replacement algorithms. In that world you would configure Postgres much like you configure Oracle, with shared_buffers taking up as much of your memory as you can afford. And the OS file system cache is kept entirely out of the loop. > AFAIK all the theoretical studies we've looked at consider only a single > level of caching. But for example, if our buffer management algorithm > recognizes an index page as being heavily hit and therefore keeps it in > cache for a long time, then when it does fall out of cache you can be sure > it's going to need to be read from disk when it's next used, because the > OS-level buffer cache has not seen a call for that page in a long time. > Contrariwise a page that we think is only on the fringe of usefulness is > going to stay in the OS cache because we repeatedly drop it and then have to > ask for it again. Hum. Is it clear that that's bad? By the same logic it's the ones on the fringe that you're likely to have to read again anyways. The ones that are being heavily used are likely not to have to be read again anyways. -- greg From pgsql-performance-owner@postgresql.org Tue Feb 15 08:47:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF0D38BA16F for ; Tue, 15 Feb 2005 08:47:41 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04154-09 for ; Tue, 15 Feb 2005 08:47:38 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 2CB998BA15B for ; Tue, 15 Feb 2005 08:47:36 +0000 (GMT) Received: (qmail 2553 invoked from network); 15 Feb 2005 09:48:07 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 15 Feb 2005 09:48:07 +0100 To: pgsql-performance@postgresql.org Subject: Re: VACCUM FULL ANALYZE PROBLEM References: <200502150202.j1F22flW029903@mail.census.gov.ph> <009201c51306$6e9ece80$7201a8c0@mst1x5r347kymb> <8499.1108445430@sss.pgh.pa.us> Message-ID: Date: Tue, 15 Feb 2005 09:51:22 +0100 From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <8499.1108445430@sss.pgh.pa.us> User-Agent: Opera M2/7.54u1 (Linux, build 892) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/236 X-Sequence-Number: 10565 I don't know if this would work, but if you just want to restructure your rows, your could do this: UPDATE table SET id = id WHERE id BETWEEN 0 AND 20000; VACUUM table; UPDATE table SET id = id WHERE id BETWEEN 20001 AND 40000; VACUUM table; wash, rinse, repeat. The idea is that an update rewrites the rows (in your new format) and that VACUUM (not FULL) is quite fast when you just modified a part of the table, and non-locking. Would this work ? > "Iain" writes: >>> another way to speed up full vacuum? > >> Hmmm... a full vacuum may help to re-organize the structure of modified >> tables, but whether this is significant or not is another matter. > > Actually, VACUUM FULL is designed to work nicely for the situation where > a table has say 10% wasted space and you want the wasted space all > compressed out. When there is a lot of wasted space, so that nearly all > the rows have to be moved to complete the compaction operation, VACUUM > FULL is not a very good choice. And it simply moves rows around, it > doesn't modify the rows internally; so it does nothing at all to reclaim > space that would have been freed up by DROP COLUMN operations. > > CLUSTER is actually a better bet if you want to repack a table that's > suffered a lot of updates or deletions. In PG 8.0 you might also > consider one of the rewriting variants of ALTER TABLE. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Tue Feb 15 14:48:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3282A8BA27C for ; Tue, 15 Feb 2005 14:48:04 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57980-05 for ; Tue, 15 Feb 2005 14:48:01 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 7783D8BA150 for ; Tue, 15 Feb 2005 14:47:59 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: seq scan cache vs. index cache smackdown Date: Tue, 15 Feb 2005 09:46:33 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A761E@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] seq scan cache vs. index cache smackdown Thread-Index: AcUTNmwYT6o8vlhmRwexoU2Zd5VB1wALC85A From: "Merlin Moncure" To: "Greg Stark" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.055 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/237 X-Sequence-Number: 10566 > It seems inevitable that Postgres will eventually eliminate that redundant > layer of buffering. Since mmap is not workable, that means using O_DIRECT > to > read table and index data. What about going the other way and simply letting the o/s do all the caching? How bad (or good) would the performance really be? =20 Merlin From pgsql-performance-owner@postgresql.org Tue Feb 15 15:12:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 845088BA15B for ; Tue, 15 Feb 2005 15:12:04 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61927-04 for ; Tue, 15 Feb 2005 15:12:00 +0000 (GMT) Received: from presinet-main.presinet.com (mail.presinet.com [209.53.156.1]) by svr1.postgresql.org (Postfix) with ESMTP id A31868BA124 for ; Tue, 15 Feb 2005 15:11:58 +0000 (GMT) Received: from [10.10.1.151] (BRICK [10.10.1.151]) by presinet-main.presinet.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2658.3) id 1VVBZZVX; Tue, 15 Feb 2005 07:10:18 -0800 Message-ID: <4212113D.40808@PresiNET.com> Date: Tue, 15 Feb 2005 07:11:57 -0800 From: Bricklen Anderson User-Agent: Debian Thunderbird 1.0 (X11/20050116) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Greg Stark Cc: "Pgsql-Performance (E-mail)" Subject: Re: How to interpret this explain analyse? References: <13008.1108150825@sss.pgh.pa.us> <20050215001011.GA31014@filer> <877jla47he.fsf@stark.xeocode.com> In-Reply-To: <877jla47he.fsf@stark.xeocode.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/238 X-Sequence-Number: 10567 Greg Stark wrote: > Kevin Brown writes: > > >>Ouch. Is this really a reasonable assumption? I figured the primary >>use of a cursor was to fetch small amounts of data at a time from a >>large table, so 10% seems extremely high as an average fetch size. Or >>is the optimization based on the number of rows that will be fetched >>by the cursor during the cursor's lifetime (as opposed to in a single >>fetch)? >> >>Also, one has to ask what the consequences are of assuming a value too >>low versus too high. Which ends up being worse? > > > This is one of the things the planner really cannot know. Ultimately it's the > kind of thing for which hints really are necessary. Oracle distinguishes > between the "minimize total time" versus "minimize startup time" with > /*+ ALL_ROWS */ and /*+ FIRST_ROWS */ hints, for example. > > I would also find it reasonable to have hints to specify a selectivity for > expressions the optimizer has no hope of possibly being able to estimate. > Things like "WHERE myfunction(col1,col2,?) /*+ 10% */" > > Not to mention that hints would be helpful if you want to specify a particular index for a specific query (case in point, testing plans and response of various indices without having to drop and create other ones). This is a bit of functionality that I'd like to see. From pgsql-performance-owner@postgresql.org Tue Feb 15 17:23:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 211C68BA1DD for ; Tue, 15 Feb 2005 17:23:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84949-03 for ; Tue, 15 Feb 2005 17:23:33 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id A4E9D8BA0F3 for ; Tue, 15 Feb 2005 17:23:32 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7031340; Tue, 15 Feb 2005 09:25:17 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: Greg Stark Subject: Re: seq scan cache vs. index cache smackdown Date: Tue, 15 Feb 2005 09:22:59 -0800 User-Agent: KMail/1.6.2 Cc: Tom Lane , Mark Aufflick , pgsql-performance@postgresql.org References: <9326.1108452962@sss.pgh.pa.us> <87vf8u2qgw.fsf@stark.xeocode.com> In-Reply-To: <87vf8u2qgw.fsf@stark.xeocode.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200502150922.59176.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/239 X-Sequence-Number: 10568 Tom, Greg, Merlin, > But for example, > if our buffer management algorithm recognizes an index page as being > heavily hit and therefore keeps it in cache for a long time, then when > it does fall out of cache you can be sure it's going to need to be read > from disk when it's next used, because the OS-level buffer cache has not > seen a call for that page in a long time. Contrariwise a page that we > think is only on the fringe of usefulness is going to stay in the OS > cache because we repeatedly drop it and then have to ask for it again. Now you can see why other DBMSs don't use the OS disk cache. There's other= =20 issues as well; for example, as long as we use the OS disk cache, we can't= =20 eliminate checkpoint spikes, at least on Linux. No matter what we do with= =20 the bgwriter, fsyncing the OS disk cache causes heavy system activity. > It seems inevitable that Postgres will eventually eliminate that redundant > layer of buffering. Since mmap is not workable, that means using O_DIRECT > to read table and index data. Why is mmap not workable? It would require far-reaching changes to our c= ode=20 =2D- certainly -- but I don't think it can be eliminated from consideration. > What about going the other way and simply letting the o/s do all the > caching? =A0How bad (or good) would the performance really be? =A0 Pretty bad. You can simulate this easily by turning your shared_buffers w= ay=20 down ... =2D-=20 Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Feb 15 17:55:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5302A8BA20C for ; Tue, 15 Feb 2005 17:55:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89447-03 for ; Tue, 15 Feb 2005 17:55:33 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id F2AC18BA071 for ; Tue, 15 Feb 2005 17:55:30 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1FHtJKO014043; Tue, 15 Feb 2005 12:55:20 -0500 (EST) To: Josh Berkus Cc: Greg Stark , Mark Aufflick , pgsql-performance@postgresql.org Subject: Re: seq scan cache vs. index cache smackdown In-reply-to: <200502150922.59176.josh@agliodbs.com> References: <9326.1108452962@sss.pgh.pa.us> <87vf8u2qgw.fsf@stark.xeocode.com> <200502150922.59176.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Tue, 15 Feb 2005 09:22:59 -0800" Date: Tue, 15 Feb 2005 12:55:19 -0500 Message-ID: <14042.1108490119@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/240 X-Sequence-Number: 10569 Josh Berkus writes: > Why is mmap not workable? We can't control write order. There are other equally bad problems, but that one alone eliminates it from consideration. See past discussions. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Feb 15 18:04:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 007D78B9E19 for ; Tue, 15 Feb 2005 18:03:59 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89546-09 for ; Tue, 15 Feb 2005 18:03:56 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 95A778BA20C for ; Tue, 15 Feb 2005 18:03:54 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: seq scan cache vs. index cache smackdown Date: Tue, 15 Feb 2005 13:03:53 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A7621@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] seq scan cache vs. index cache smackdown Thread-Index: AcUTg5l/mCelLZkaQOaNrOUcL7eTyQAAVxEQ From: "Merlin Moncure" To: "Josh Berkus" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.055 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/241 X-Sequence-Number: 10570 Josh Berkus wrote: > Now you can see why other DBMSs don't use the OS disk cache. There's > other > issues as well; for example, as long as we use the OS disk cache, we can't > eliminate checkpoint spikes, at least on Linux. No matter what we do with > the bgwriter, fsyncing the OS disk cache causes heavy system activity. MS SQL server uses the O/S disk cache...the database is very tightly integrated with the O/S. Write performance is one of the few things SQL server can do better than most other databases despite running on a mid-grade kernel and a low-grade filesystem...what does that say? ReadFileScatter() and ReadFileGather() were added to the win32 API specifically for SQL server...this is somewhat analogous to transaction based writing such as in Reisfer4. I'm not arguing ms sql server is better in any way, IIRC they are still using table locks (!). =20 > > It seems inevitable that Postgres will eventually eliminate that > redundant > > layer of buffering. Since mmap is not workable, that means using > O_DIRECT > > to read table and index data. IMO, The O_DIRECT argument makes assumptions about storage and o/s technology that are moving targets. Not sure about mmap(). Merlin From pgsql-performance-owner@postgresql.org Tue Feb 15 18:40:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CDB208B9D70 for ; Tue, 15 Feb 2005 18:40:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96813-05 for ; Tue, 15 Feb 2005 18:39:57 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 9AB848B9D1F for ; Tue, 15 Feb 2005 18:39:56 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1D17bu-0003SV-00; Tue, 15 Feb 2005 13:39:46 -0500 To: Josh Berkus Cc: Greg Stark , Tom Lane , Mark Aufflick , pgsql-performance@postgresql.org Subject: Re: seq scan cache vs. index cache smackdown References: <9326.1108452962@sss.pgh.pa.us> <87vf8u2qgw.fsf@stark.xeocode.com> <200502150922.59176.josh@agliodbs.com> In-Reply-To: <200502150922.59176.josh@agliodbs.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 15 Feb 2005 13:39:46 -0500 Message-ID: <87k6p93bwt.fsf@stark.xeocode.com> Lines: 24 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/242 X-Sequence-Number: 10571 Josh Berkus writes: > Why is mmap not workable? It would require far-reaching changes to our code > -- certainly -- but I don't think it can be eliminated from consideration. Fundamentally because there is no facility for being notified by the OS before a page is written to disk. And there's no way to prevent a page from being written to disk (mlock just prevents it from being flushed from memory, not from being synced to disk). So there's no way to guarantee the WAL will be written before the buffer is synced to disk. Maybe it could be done by writing and syncing the WAL independently before the shared buffer is written to at all, but that would be a completely different model. And it would locking the shared buffer until the sync is done, and require a private copy of the shared buffer necessitating more copies than the double buffering in the first place. -- greg From pgsql-performance-owner@postgresql.org Tue Feb 15 18:41:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 88ED08B9EFA for ; Tue, 15 Feb 2005 18:41:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97002-04 for ; Tue, 15 Feb 2005 18:41:28 +0000 (GMT) Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 1CC248B9D1F for ; Tue, 15 Feb 2005 18:41:27 +0000 (GMT) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id A1CBB8F285; Tue, 15 Feb 2005 19:41:26 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: seq scan cache vs. index cache smackdown Date: Tue, 15 Feb 2005 19:41:26 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE4768A7@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] seq scan cache vs. index cache smackdown Thread-Index: AcUTg5l/mCelLZkaQOaNrOUcL7eTyQAAVxEQAAH/mKA= From: "Magnus Hagander" To: "Merlin Moncure" , "Josh Berkus" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.063 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/243 X-Sequence-Number: 10572 >Josh Berkus wrote: >> Now you can see why other DBMSs don't use the OS disk cache. There's >> other >> issues as well; for example, as long as we use the OS disk cache, we >can't >> eliminate checkpoint spikes, at least on Linux. No matter what we do >with >> the bgwriter, fsyncing the OS disk cache causes heavy system=20 >activity. > >MS SQL server uses the O/S disk cache... No, it doesn't. They open all files with FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING. It scales the size of it dynamically with the system, but it uses it's own buffer cache. > the database is very tightly >integrated with the O/S. =20 That it is. >Write performance is one of the few things SQL >server can do better than most other databases despite running on a >mid-grade kernel and a low-grade filesystem...what does that say? >ReadFileScatter() and ReadFileGather() were added to the win32 API >specifically for SQL server...this is somewhat analogous to transaction >based writing such as in Reisfer4.=20 (Those are ReadFileScatter and WriteFileGather) I don't think that's correct either. Scatter/Gather I/O is used to SQL Server can issue reads for several blocks from disks into it's own buffer cache with a single syscall even if these buffers are not sequential. It did make significant performance improvements when they added it, though. (For those not knowing - it's ReadFile/WriteFile where you pass an array of "this many bytes to this address" as parameters) > I'm not arguing ms sql server is >better in any way, IIRC they are still using table locks (!). =20 Not at all. They use row level locks, escalated to page level, then escalated to table level. Has been since 7.0. In <=3D 6.5 they had page level and table level locks. I think possibly back in 4.2 (this is 16-bit days on OS/2) they had only table level locks, but that's a long time ago. They don't do MVCC, though. (I'm not saying it's better either. At some things it is, at many it is not) //Magnus From pgsql-performance-owner@postgresql.org Tue Feb 15 20:16:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 06AA28BA349 for ; Tue, 15 Feb 2005 20:16:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11011-07 for ; Tue, 15 Feb 2005 20:16:24 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 17CD58BA179 for ; Tue, 15 Feb 2005 20:16:24 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.1/8.13.1) with ESMTP id j1FKGJR9039680 for ; Tue, 15 Feb 2005 20:16:21 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id j1FJoBmn034132 for pgsql-performance@postgresql.org; Tue, 15 Feb 2005 19:50:11 GMT (envelope-from news) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: seq scan cache vs. index cache smackdown Date: Tue, 15 Feb 2005 14:04:49 -0500 Organization: cbbrowne Computing Inc Lines: 22 Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3412A761E@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:P8ZOfb1UHdusu/2WiuQ1+RJA/yU= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200502/244 X-Sequence-Number: 10573 In the last exciting episode, merlin.moncure@rcsonline.com ("Merlin Moncure") wrote: >> It seems inevitable that Postgres will eventually eliminate that >> redundant layer of buffering. Since mmap is not workable, that >> means using O_DIRECT to read table and index data. > > What about going the other way and simply letting the o/s do all the > caching? How bad (or good) would the performance really be? I'm going to see about taking this story to OLS (Ottawa Linux Symposium) in July and will see what hearing I can get. There are historically some commonalities in the way this situation is regarded, in that there was _long_ opposition to the notion of having unbuffered disk devices. If there's more "story" that definitely needs to be taken, let me know... -- output = reverse("moc.enworbbc" "@" "enworbbc") http://linuxdatabases.info/info/slony.html Rules of the Evil Overlord #90. "I will not design my Main Control Room so that every workstation is facing away from the door." From pgsql-performance-owner@postgresql.org Wed Feb 16 19:02:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 77DDA8BA1D9 for ; Tue, 15 Feb 2005 20:16:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10193-10 for ; Tue, 15 Feb 2005 20:16:24 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 917598BA310 for ; Tue, 15 Feb 2005 20:16:24 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.1/8.13.1) with ESMTP id j1FKGJRF039680 for ; Tue, 15 Feb 2005 20:16:21 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id j1FJFwW5027386 for pgsql-performance@postgresql.org; Tue, 15 Feb 2005 19:15:58 GMT (envelope-from news) From: "lcham02" X-Newsgroups: pgsql.performance Subject: disagreeing query planners Date: 15 Feb 2005 11:15:55 -0800 Organization: http://groups.google.com Lines: 33 Message-ID: <1108494955.402264.279020@l41g2000cwc.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Complaints-To: groups-abuse@google.com User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: l41g2000cwc.googlegroups.com; posting-host=65.77.250.21; posting-account=I-Krjg0AAACq3z4k5QcewfiQmSmcyykp To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200502/247 X-Sequence-Number: 10576 With three databases running the same query, I am receiving greatly differing results from 2 of the query planners. -db2 and db3 are slonied copies of db1. The servers have identical postgresql.conf files but the server hardware differs. -all appropriate columns are indexed -vacuum analyze is run nightly on all dbs Here is a simplified version of the query: ------------------------------------------------------------------------ EXPLAIN ANALYZE SELECT COUNT(DISTINCT(m_object_paper.id)) FROM m_object_paper, m_assignment, m_class, r_comment_rubric_user_object WHERE m_object_paper.assignment=m_assignment.id AND m_assignment.class=m_class.id AND m_class.account = 36123 AND m_object_paper.id = r_comment_rubric_user_object.objectid; ------------------------------------------------------------------------ db1 displays a concise query plan of nested loops and index scans executing in 85 ms. However, db2's query plan consists of sequential scans and takes 3500 ms to complete. The strange part is this. Last week, db1 and db3 were in agreement and executing the more efficient plan. Now, db3 is in agreement with db2 with the less efficient, slower plan. Are we missing something, what could cause this disagreement? Thanks From pgsql-performance-owner@postgresql.org Tue Feb 15 21:51:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DA1628B9ED8 for ; Tue, 15 Feb 2005 21:51:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28450-03 for ; Tue, 15 Feb 2005 21:51:44 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id CACAC8B9E19 for ; Tue, 15 Feb 2005 21:51:42 +0000 (GMT) Received: (qmail 10233 invoked from network); 15 Feb 2005 22:52:14 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 15 Feb 2005 22:52:14 +0100 Date: Tue, 15 Feb 2005 22:55:32 +0100 To: "Magnus Hagander" , "Merlin Moncure" , "Josh Berkus" Subject: Re: seq scan cache vs. index cache smackdown Cc: pgsql-performance@postgresql.org References: <6BCB9D8A16AC4241919521715F4D8BCE4768A7@algol.sollentuna.se> From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE4768A7@algol.sollentuna.se> User-Agent: Opera M2/7.54u1 (Linux, build 892) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/245 X-Sequence-Number: 10574 In the 'wishful hand waving' department : read index -> determine (tuple id,page) to hit in table -> for each of these, tell the OS 'I'm gonna need these' via a NON BLOCKING call. Non blocking because you feed the information to the OS as you read the index, streaming it. Meanwhile, the OS accumulates the requests in an internal FIFO, reorganizes them according to the order best suited to good disk head movements, then reads them in clusters, and calls a callback inside the application when it has data available. Or the application polls it once in a while to get a bucketload of pages. The 'I'm gonna need these()' syscall would also sometimes return 'hey, I'm full, read the pages I have here waiting for you before asking for new ones'. A flag would tell the OS if the application wanted the results in any order, or with order preserved. Without order preservation, if the application has requested twice the same page with different tuple id's, the OS would call the callback only once, giving it a list of the tuple id's associated with that page. It involves a tradeoff between memory and performance : as the size of the FIFO increases, likelihood of good contiguous disk reading increases. However, the memory structure would only contain page numbers and tuple id's, so it could be pretty small. Returning the results in-order would also need more memory. It could be made very generic if instead of 'tuple id' you read 'opaque application data', and instead of 'page' you read '(offset, length)'. This structure actually exists already in the Linux Kernel, it's called the Elevator or something, but it works for scheduling reads between threads. You can also read 'internal not yet developed postgres cache manager' instead of OS if you don't feel like talking kernel developers into implementing this thing. > (Those are ReadFileScatter and WriteFileGather) > From pgsql-performance-owner@postgresql.org Wed Feb 16 04:20:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DFFD28BA3DA for ; Wed, 16 Feb 2005 04:20:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17325-10 for ; Wed, 16 Feb 2005 04:20:34 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 06CEA8BA3E5 for ; Wed, 16 Feb 2005 04:19:57 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1D1Ger-0006OR-00; Tue, 15 Feb 2005 23:19:25 -0500 To: PFC Cc: "Magnus Hagander" , "Merlin Moncure" , "Josh Berkus" , pgsql-performance@postgresql.org Subject: Re: seq scan cache vs. index cache smackdown References: <6BCB9D8A16AC4241919521715F4D8BCE4768A7@algol.sollentuna.se> In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 15 Feb 2005 23:19:25 -0500 Message-ID: <873bvx2l2q.fsf@stark.xeocode.com> Lines: 14 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/246 X-Sequence-Number: 10575 PFC writes: > You can also read 'internal not yet developed postgres cache manager' > instead of OS if you don't feel like talking kernel developers into > implementing this thing. It exists already, it's called aio. But there are a *lot* of details you skipped over. And as always, the devil is in the details. -- greg From pgsql-performance-owner@postgresql.org Wed Feb 16 21:10:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C61C08B9B8F for ; Wed, 16 Feb 2005 21:09:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52454-07 for ; Wed, 16 Feb 2005 21:09:33 +0000 (GMT) Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) by svr1.postgresql.org (Postfix) with ESMTP id E50D88B9B48 for ; Wed, 16 Feb 2005 21:09:33 +0000 (GMT) Received: from sysexperts.com (c-24-6-183-218.client.comcast.net[24.6.183.218]) by comcast.net (sccrmhc12) with ESMTP id <2005021621093001200f9s2de>; Wed, 16 Feb 2005 21:09:30 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Wed, 16 Feb 2005 13:09:28 -0800 id 0010A967.4213B688.00006744 Date: Wed, 16 Feb 2005 13:09:28 -0800 From: Kevin Brown To: "Pgsql-Performance (E-mail)" Subject: Re: How to interpret this explain analyse? Message-ID: <20050216210928.GB31014@filer> Mail-Followup-To: Kevin Brown , "Pgsql-Performance (E-mail)" References: <13008.1108150825@sss.pgh.pa.us> <20050215001011.GA31014@filer> <877jla47he.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: <877jla47he.fsf@stark.xeocode.com> Organization: Frobozzco International User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/248 X-Sequence-Number: 10577 Greg Stark wrote: > > Kevin Brown writes: > > Also, one has to ask what the consequences are of assuming a value too > > low versus too high. Which ends up being worse? > > This is one of the things the planner really cannot know. Ultimately it's the > kind of thing for which hints really are necessary. Oracle distinguishes > between the "minimize total time" versus "minimize startup time" with > /*+ ALL_ROWS */ and /*+ FIRST_ROWS */ hints, for example. Well, the planner *can* know the actual value to use in this case, or at least a close approximation, but the system would have to gather some information about cursors during fetches. At the very least, it will know how many rows were actually fetched by the cursor in question, and it will also hopefully know how many rows were returned by the query being executed. Store the ratio of the two in a list, then store the list itself into a table (or something) at backend exit time. -- Kevin Brown kevin@sysexperts.com From pgsql-performance-owner@postgresql.org Thu Feb 17 03:14:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DD1AB8BA083 for ; Thu, 17 Feb 2005 03:14:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98092-06 for ; Thu, 17 Feb 2005 03:14:03 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0A7A08BA0BE for ; Thu, 17 Feb 2005 03:14:06 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id DC4F731E18; Thu, 17 Feb 2005 04:14:06 +0100 (MET) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: seq scan cache vs. index cache smackdown Date: Wed, 16 Feb 2005 19:22:19 -0800 Organization: Hub.Org Networking Services Lines: 39 Message-ID: <42140DEB.2030207@cheapcomplexdevices.com> References: <9326.1108452962@sss.pgh.pa.us> <87vf8u2qgw.fsf@stark.xeocode.com> <200502150922.59176.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Josh Berkus User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <200502150922.59176.josh@agliodbs.com> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/249 X-Sequence-Number: 10578 Josh Berkus wrote: > > Now you can see why other DBMSs don't use the OS disk cache. ... > ...as long as we use the OS disk cache, we can't > eliminate checkpoint spikes, at least on Linux. Wouldn't the VM settings like the ones under /proc/sys/vm and/or the commit=XXX mount option if using ext3 be a good place to control this? It seems if you wanted, by setting /proc/sys/vm/dirty_background_ratio and /proc/sys/vm/dirty_expire_centisecs very low you'd be constantly flushing dirty pages. Has anyone experimented with these kinds of values: /proc/sys/vm/dirty_ratio /* the generator of dirty data writes back at this ratio */ /proc/sys/vm/dirty_background_ratio /* start background writeback */ /proc/sys/vm/dirty_writeback_centisecs /* the interval between [some style of] writebacks */ /proc/sys/vm/dirty_expire_centisecs /* the number of centiseconds that data is allowed to remain dirty I tried these to workaround the opposite kind of problem.... on a laptop running linux under vmware I wanted to avoid having it do writes quickly to make each individual transaction go faster; at the expense of a big spike in IO that the sales guy would trigger explicitly before talking a while. Setting each of those very high and using a commit=600 mount option made the whole demo run with very little IO except for the explicit sync; but I never took the time to understand which setting mattered to me or why. >>It seems inevitable that Postgres will eventually eliminate that redundant >>layer of buffering. Since mmap is not workable, that means using O_DIRECT >>to read table and index data. From pgsql-performance-owner@postgresql.org Thu Feb 17 13:29:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4F2A18BA1C8 for ; Thu, 17 Feb 2005 13:29:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97562-08 for ; Thu, 17 Feb 2005 13:29:20 +0000 (GMT) Received: from gatekeeper.gmanetwork.com (mailhost.gmanetwork.com [61.9.4.50]) by svr1.postgresql.org (Postfix) with ESMTP id 480EC8BA108 for ; Thu, 17 Feb 2005 13:29:18 +0000 (GMT) Received: from gmanmi.tv (mailhost.gmanmi.tv [192.168.6.3]) by gatekeeper.gmanetwork.com (8.12.8/8.12.8) with ESMTP id j1HDT2hJ006211 for ; Thu, 17 Feb 2005 21:29:02 +0800 Received: (qmail 20060 invoked by uid 107); 17 Feb 2005 13:29:02 -0000 Received: from mail.gmanmi.tv (HELO jerome.gmanmi.tv) (192.168.6.3) by mail.gmanmi.tv with SMTP; 17 Feb 2005 13:29:02 -0000 From: JM Reply-To: jerome@gmanmi.tv To: "Pgsql-Performance (E-mail)" Subject: PG proper configuation for a php forum Date: Thu, 17 Feb 2005 21:29:01 +0800 User-Agent: KMail/1.5.4 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502172129.01749.jerome@gmanmi.tv> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/250 X-Sequence-Number: 10579 Hi, I was wondering if there would be a proper configuration for a PG database used for a forum.. hmm phpBB to be exact.. It seems that postgres on phpBB is kinda slow.. TIA, From pgsql-performance-owner@postgresql.org Thu Feb 17 22:24:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 069518BA100 for ; Thu, 17 Feb 2005 22:24:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64888-06 for ; Thu, 17 Feb 2005 22:24:27 +0000 (GMT) Received: from web41408.mail.yahoo.com (web41408.mail.yahoo.com [66.218.93.74]) by svr1.postgresql.org (Postfix) with SMTP id 37D118B9CFF for ; Thu, 17 Feb 2005 22:24:28 +0000 (GMT) Received: (qmail 84113 invoked by uid 60001); 17 Feb 2005 22:24:28 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=ttaIiRBvX4GuM9SMeRfipCwrnMj/Z6LmeM5cr2j29aw8HL88vKXQTO5kMdQZMHT6X2pQomg7qdVlhJkik6db0wm6zTCMpbdZOIAdG904dxES+ED+L8gtSpFf+pltwURC2v41Ytg3zMgfE7bbc7oItBGC9nltC/tHVnyne+/PbwQ= ; Message-ID: <20050217222428.84111.qmail@web41408.mail.yahoo.com> Received: from [64.42.192.130] by web41408.mail.yahoo.com via HTTP; Thu, 17 Feb 2005 14:24:27 PST Date: Thu, 17 Feb 2005 14:24:27 -0800 (PST) From: werner fraga Subject: VACUUM ANALYZE slows down query To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/251 X-Sequence-Number: 10580 Certain queries on my database get slower after running a VACUUM ANALYZE. Why would this happen, and how can I fix it? I am running PostgreSQL 7.4.2 (I also seen this problem on v. 7.3 and 8.0) Here is a sample query that exhibits this behaviour (here the query goes from 1 second before VACUUM ANALYZE to 2 seconds after; there are other queries that go from 20 seconds before to 800 seconds after): ================================================== select ToolRepairRequest.RequestID, (Select count(ToolHistory.HistoryID) from ToolHistory where ToolRepairRequest.RepairID=ToolHistory.RepairID) as CountOfTH from ((ToolRepairRequest LEFT JOIN (ToolRepair LEFT JOIN ToolHistory on (ToolRepair.RepairID = ToolHistory.RepairID)) on (ToolRepairRequest.RepairID = ToolRepair.RepairID)) LEFT JOIN ServiceOrder ON (ToolRepairRequest.ServiceOrderID = ServiceOrder.ServiceOrderID)) LEFT JOIN Tool ON (ToolRepairRequest.ToolID = Tool.ID) where (ToolRepairRequest.StationID = 1303) ================================================== Here are the EXPLAIN ANALYZE results: Before VACUUM ANALYZE: ================================================== QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop Left Join (cost=3974.74..48055.42 rows=79 width=8) (actual time=359.751..1136.165 rows=1518 loops=1) -> Nested Loop Left Join (cost=3974.74..6175.84 rows=78 width=12) (actual time=359.537..1023.404 rows=1518 loops=1) -> Merge Right Join (cost=3974.74..5705.83 rows=78 width=16) (actual time=359.516..991.826 rows=1518 loops=1) Merge Cond: ("outer".repairid = "inner".repairid) -> Merge Left Join (cost=3289.68..4949.83 rows=27907 width=4) (actual time=302.058..840.706 rows=28000 loops=1) Merge Cond: ("outer".repairid = "inner".repairid) -> Index Scan using toolrepair_pkey on toolrepair (cost=0.00..1175.34 rows=26485 width=4) (actual time=0.063..130.516 rows=26485 loops=1) -> Sort (cost=3289.68..3359.44 rows=27906 width=4) (actual time=301.965..402.228 rows=27906 loops=1) Sort Key: toolhistory.repairid -> Seq Scan on toolhistory (cost=0.00..1229.06 rows=27906 width=4) (actual time=0.009..116.441 rows=27906 loops=1) -> Sort (cost=685.06..685.24 rows=74 width=16) (actual time=26.490..36.454 rows=1518 loops=1) Sort Key: toolrepairrequest.repairid -> Seq Scan on toolrepairrequest (cost=0.00..682.76 rows=74 width=16) (actual time=0.039..20.506 rows=1462 loops=1) Filter: (stationid = 1303) -> Index Scan using serviceorder_pkey on serviceorder (cost=0.00..6.01 rows=1 width=4) (actual time=0.008..0.009 rows=0 loops=1518) Index Cond: ("outer".serviceorderid = serviceorder.serviceorderid) -> Index Scan using tool_pkey on tool (cost=0.00..6.01 rows=1 width=4) (actual time=0.013..0.018 rows=1 loops=1518) Index Cond: ("outer".toolid = tool.id) SubPlan -> Aggregate (cost=524.17..524.17 rows=1 width=4) (actual time=0.032..0.035 rows=1 loops=1518) -> Index Scan using th_repair_key on toolhistory (cost=0.00..523.82 rows=140 width=4) (actual time=0.013..0.018 rows=1 loops=1518) Index Cond: ($0 = repairid) Total runtime: 1147.350 ms (23 rows) ================================================== and after VACUUM ANALYZE: ================================================== QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Left Join (cost=18310.59..29162.44 rows=1533 width=8) (actual time=1886.942..2183.774 rows=1518 loops=1) Merge Cond: ("outer".toolid = "inner".id) -> Sort (cost=15110.46..15114.29 rows=1532 width=12) (actual time=1534.319..1539.461 rows=1518 loops=1) Sort Key: toolrepairrequest.toolid -> Nested Loop Left Join (cost=4050.79..15029.41 rows=1532 width=12) (actual time=410.948..1527.360 rows=1518 loops=1) -> Merge Right Join (cost=4050.79..5800.48 rows=1532 width=16) (actual time=410.926..1488.229 rows=1518 loops=1) Merge Cond: ("outer".repairid = "inner".repairid) -> Merge Left Join (cost=3289.68..4946.79 rows=27907 width=4) (actual time=355.606..1321.320 rows=28000 loops=1) Merge Cond: ("outer".repairid = "inner".repairid) -> Index Scan using toolrepair_pkey on toolrepair (cost=0.00..1172.67 rows=26485 width=4) (actual time=0.108..235.096 rows=26485 loops=1) -> Sort (cost=3289.68..3359.44 rows=27906 width=4) (actual time=355.460..519.987 rows=27906 loops=1) Sort Key: toolhistory.repairid -> Seq Scan on toolhistory (cost=0.00..1229.06 rows=27906 width=4) (actual time=0.016..129.811 rows=27906 loops=1) -> Sort (cost=761.11..764.83 rows=1487 width=16) (actual time=30.447..35.695 rows=1518 loops=1) Sort Key: toolrepairrequest.repairid -> Seq Scan on toolrepairrequest (cost=0.00..682.76 rows=1487 width=16) (actual time=0.039..23.852 rows=1462 loops=1) Filter: (stationid = 1303) -> Index Scan using serviceorder_pkey on serviceorder (cost=0.00..6.01 rows=1 width=4) (actual time=0.009..0.010 rows=0 loops=1518) Index Cond: ("outer".serviceorderid = serviceorder.serviceorderid) -> Sort (cost=3200.13..3267.24 rows=26844 width=4) (actual time=352.324..453.352 rows=24746 loops=1) Sort Key: tool.id -> Seq Scan on tool (cost=0.00..1225.44 rows=26844 width=4) (actual time=0.024..126.826 rows=26844 loops=1) SubPlan -> Aggregate (cost=6.98..6.98 rows=1 width=4) (actual time=0.038..0.042 rows=1 loops=1518) -> Index Scan using th_repair_key on toolhistory (cost=0.00..6.97 rows=2 width=4) (actual time=0.016..0.021 rows=1 loops=1518) Index Cond: ($0 = repairid) Total runtime: 2191.401 ms (27 rows) ================================================== Thanks for any assistance. Walt __________________________________ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com From pgsql-performance-owner@postgresql.org Thu Feb 17 22:38:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B034B8BA2CC for ; Thu, 17 Feb 2005 22:38:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68511-03 for ; Thu, 17 Feb 2005 22:38:32 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 1E2AF8BA2C5 for ; Thu, 17 Feb 2005 22:38:30 +0000 (GMT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.2/8.12.9) with ESMTP id j1HMcT09010114; (envelope-from ) Thu, 17 Feb 2005 16:38:29 -0600 (CST) Received: from [192.168.1.100] (12-217-241-0.client.mchsi.com [12.217.241.0]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j1HMcSW4020807 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Thu, 17 Feb 2005 16:38:29 -0600 (CST) Message-ID: <42151CED.7050309@arbash-meinel.com> Date: Thu, 17 Feb 2005 16:38:37 -0600 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: werner fraga Cc: pgsql-performance@postgresql.org Subject: Re: VACUUM ANALYZE slows down query References: <20050217222428.84111.qmail@web41408.mail.yahoo.com> In-Reply-To: <20050217222428.84111.qmail@web41408.mail.yahoo.com> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig073C75771F7B62E0836CCEC1" X-Virus-Scanned: ClamAV 0.80/682/Mon Jan 24 12:53:43 2005 clamav-milter version 0.80j on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV 0.80/706/Sun Feb 13 18:14:02 2005, clamav-milter version 0.75 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/252 X-Sequence-Number: 10581 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig073C75771F7B62E0836CCEC1 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit werner fraga wrote: >Certain queries on my database get slower after >running a VACUUM ANALYZE. Why would this happen, and >how can I fix it? > >I am running PostgreSQL 7.4.2 (I also seen this >problem on v. 7.3 and 8.0) > >Here is a sample query that exhibits this behaviour >(here the query goes from 1 second before VACUUM >ANALYZE to 2 seconds after; there are other queries >that go from 20 seconds before to 800 seconds after): > > > First, try to attach your explain analyze as a textfile attachment, rather than inline to prevent wrapping and make it easier to read. Second, the problem is that it *is* getting a more accurate estimate of the number of rows that are going to be returned, compare: Plan 1: >----------------------------------------------------------------------------------------------------------------------------------------------------------------- > Nested Loop Left Join (cost=3974.74..48055.42 >rows=79 width=8) (actual time=359.751..1136.165 >rows=1518 loops=1) > > The planner was expecting 79 rows, but was actually getting 1518. Plan 2: >----------------------------------------------------------------------------------------------------------------------------------------------------------------------- > Merge Left Join (cost=18310.59..29162.44 rows=1533 >width=8) (actual time=1886.942..2183.774 rows=1518 >loops=1) > > It is predicting 1533 rows, and found 1518, a pretty good guess. So the big issue is why does the planner think that a nested loop is going to be more expensive than a merge join. That I don't really know. I'm guessing some parameters like random_page_cost could be tweaked, but I don't really know the criteria postgres uses for merge joins vs nested loop joins. >Thanks for any assistance. > >Walt > > Hopefully someone can help a little better. In the mean time, you might want to resend with an attachment. I know I had trouble reading your explain analyze. John =:-> --------------enig073C75771F7B62E0836CCEC1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCFRztJdeBCYSNAAMRAuH2AKCBNz/SpGT2oq2gk3tnz4OW0mEm9gCgtHlM SBbeTT88SuzqfkZU/meGp6Q= =6kb7 -----END PGP SIGNATURE----- --------------enig073C75771F7B62E0836CCEC1-- From pgsql-performance-owner@postgresql.org Thu Feb 17 23:28:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8DC718BA315 for ; Thu, 17 Feb 2005 23:28:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80593-03 for ; Thu, 17 Feb 2005 23:28:07 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0341B8BA30E for ; Thu, 17 Feb 2005 23:28:08 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1HNS5X0011927; Thu, 17 Feb 2005 18:28:06 -0500 (EST) To: werner fraga Cc: John Arbash Meinel , pgsql-performance@postgresql.org Subject: Re: VACUUM ANALYZE slows down query In-reply-to: <42151CED.7050309@arbash-meinel.com> References: <20050217222428.84111.qmail@web41408.mail.yahoo.com> <42151CED.7050309@arbash-meinel.com> Comments: In-reply-to John Arbash Meinel message dated "Thu, 17 Feb 2005 16:38:37 -0600" Date: Thu, 17 Feb 2005 18:28:05 -0500 Message-ID: <11926.1108682885@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/253 X-Sequence-Number: 10582 John Arbash Meinel writes: > So the big issue is why does the planner think that a nested loop is > going to be more expensive than a merge join. That I don't really know. Well, with the increased (and much more accurate) rowcount estimate, the estimated cost of the nestloop naturally went up a lot: it's proportional to the number of rows involved. It appears that the estimated cost of the mergejoin actually went *down* quite a bit (else it'd have been selected the first time too). That seems odd to me. AFAIR the only reason that would happen is that given stats about the distributions of the two join keys, the planner can recognize that one side of the merge may not need to be run to completion --- for example if one column ranges from 1..100 and the other only from 1..40, you never need to look at the values 41..100 in the first table. You can see in the explain output that this is indeed happening to some extent: -> Sort (cost=3200.13..3267.24 rows=26844 width=4) (actual time=352.324..453.352 rows=24746 loops=1) Sort Key: tool.id -> Seq Scan on tool (cost=0.00..1225.44 rows=26844 width=4) (actual time=0.024..126.826 rows=26844 loops=1) Only 24746 of the 26844 tool rows ever got read from the sort node (and even that is probably overstating matters; if there are duplicate toolid values in the lefthand input, as seems likely, then the same rows will be pulled from the sort node multiple times). However, when both sides of the merge are being explicitly sorted, as is happening here, then not running one side to completion does not save you much at all (since you had to do the sort anyway). The early-out trick only really wins when you can quit early on a more incremental subplan, such as an indexscan. So I'm pretty surprised that the planner made this pair of choices. The estimated cost of the mergejoin shouldn't have changed much with the addition of statistics, and so ISTM it should have been picked the first time too. Walt, is there anything proprietary about the contents of these tables? If you'd be willing to send me a dump off-list, I'd like to dig through what the planner is doing here. There may be a bug somewhere in the cost estimation code. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Feb 18 10:15:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0290F8BA248 for ; Fri, 18 Feb 2005 10:15:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50716-08 for ; Fri, 18 Feb 2005 10:15:21 +0000 (GMT) Received: from gatekeeper.gmanetwork.com (mailhost.gmanetwork.com [61.9.4.50]) by svr1.postgresql.org (Postfix) with ESMTP id CC0718BA279 for ; Fri, 18 Feb 2005 10:15:20 +0000 (GMT) Received: from gmanmi.tv (mailhost.gmanmi.tv [192.168.6.3]) by gatekeeper.gmanetwork.com (8.12.8/8.12.8) with ESMTP id j1IAFIhJ010349 for ; Fri, 18 Feb 2005 18:15:18 +0800 Received: (qmail 10932 invoked by uid 107); 18 Feb 2005 10:15:18 -0000 Received: from mail.gmanmi.tv (HELO jerome.gmanmi.tv) (192.168.6.3) by mail.gmanmi.tv with SMTP; 18 Feb 2005 10:15:18 -0000 From: JM Reply-To: jerome@gmanmi.tv To: "Pgsql-Performance (E-mail)" Subject: Effects of IDLE processes Date: Fri, 18 Feb 2005 18:15:16 +0800 User-Agent: KMail/1.5.4 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502181815.17000.jerome@gmanmi.tv> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/254 X-Sequence-Number: 10583 Hi ALL, I was wondering if there is a DB performance reduction if there are a lot of IDLE processes. 30786 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 32504 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 32596 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 1722 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 1724 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 3881 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 6332 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 6678 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 6700 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 6768 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 8544 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 8873 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 8986 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 9000 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 9010 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 9013 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 9016 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 9019 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle 9020 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle TIA, From pgsql-performance-owner@postgresql.org Fri Feb 18 14:09:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 30B278BA47C for ; Fri, 18 Feb 2005 14:08:59 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16590-03 for ; Fri, 18 Feb 2005 14:08:52 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id BBA448BA476 for ; Fri, 18 Feb 2005 14:08:54 +0000 (GMT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1D28oO-0000Ru-VC for pgsql-performance@postgresql.org; Fri, 18 Feb 2005 15:08:54 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1D28oM-0004Ta-00 for ; Fri, 18 Feb 2005 15:08:50 +0100 Date: Fri, 18 Feb 2005 15:08:50 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Degradation of postgres 7.4.5 on FreeBSD/CygWin Message-ID: <20050218140850.GA16919@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Operating-System: Linux 2.6.11-rc3 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/256 X-Sequence-Number: 10585 On Fri, Feb 18, 2005 at 11:54:34AM -0300, Rodrigo Moreno wrote: > 00 23 * * 1-5 /usr/local/pgsql/bin/psql supre -c "vacuum analyze;" >>>/dev/null 2>&1 Isn't vacuum once a day a bit too little with heavy activity? You should probably consider autovacuum. > 00 23 * * 6 /usr/local/pgsql/bin/psql supre -c "reindex database supre;" >>>/dev/null 2>&1 REINDEX DATABASE does (AFAIK) only index the indexes on the system tables in the database. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Fri Feb 18 14:16:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 60FC98B9B6C for ; Fri, 18 Feb 2005 14:16:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19143-06 for ; Fri, 18 Feb 2005 14:16:44 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id DAD668B9F5F for ; Fri, 18 Feb 2005 14:16:47 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1IEGe13017619; Fri, 18 Feb 2005 09:16:41 -0500 (EST) To: jerome@gmanmi.tv Cc: "Pgsql-Performance (E-mail)" Subject: Re: Effects of IDLE processes In-reply-to: <200502181815.17000.jerome@gmanmi.tv> References: <200502181815.17000.jerome@gmanmi.tv> Comments: In-reply-to JM message dated "Fri, 18 Feb 2005 18:15:16 +0800" Date: Fri, 18 Feb 2005 09:16:40 -0500 Message-ID: <17618.1108736200@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/257 X-Sequence-Number: 10586 JM writes: > I was wondering if there is a DB performance reduction if there are a lot of > IDLE processes. There will be some overhead, but I dunno if anyone's ever tried to measure it. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Feb 18 14:32:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2E9718BA469 for ; Fri, 18 Feb 2005 14:32:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23319-09 for ; Fri, 18 Feb 2005 14:32:23 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 700C68BA2DC for ; Fri, 18 Feb 2005 14:32:25 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1IEWQJT017771; Fri, 18 Feb 2005 09:32:26 -0500 (EST) To: "Rodrigo Moreno" Cc: pgsql-performance@postgresql.org Subject: Re: Degradation of postgres 7.4.5 on FreeBSD/CygWin In-reply-to: References: Comments: In-reply-to "Rodrigo Moreno" message dated "Fri, 18 Feb 2005 11:54:34 -0300" Date: Fri, 18 Feb 2005 09:32:25 -0500 Message-ID: <17770.1108737145@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/258 X-Sequence-Number: 10587 "Rodrigo Moreno" writes: > After 2 months, postgres start get down the performance, and simple queries > that should run in 100ms now tooks about 15 secs. > Another behaviour, the data is growing to much, with no reason, just like > the comparision. Are you vacuuming on a regular basis? Do you have the FSM settings high enough to cover the database? regards, tom lane From pgsql-performance-owner@postgresql.org Fri Feb 18 14:40:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F349F8B9B6C for ; Fri, 18 Feb 2005 14:40:39 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27261-05 for ; Fri, 18 Feb 2005 14:40:32 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 16CDD8BA485 for ; Fri, 18 Feb 2005 14:40:30 +0000 (GMT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1D29Iz-0000ne-8O for pgsql-performance@postgresql.org; Fri, 18 Feb 2005 15:40:30 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1D29Ir-0005WY-00 for ; Fri, 18 Feb 2005 15:40:21 +0100 Date: Fri, 18 Feb 2005 15:40:21 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Degradation of postgres 7.4.5 on FreeBSD/CygWin Message-ID: <20050218144021.GA21158@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <17770.1108737145@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <17770.1108737145@sss.pgh.pa.us> X-Operating-System: Linux 2.6.11-rc3 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/259 X-Sequence-Number: 10588 On Fri, Feb 18, 2005 at 09:32:25AM -0500, Tom Lane wrote: > Are you vacuuming on a regular basis? Do you have the FSM settings high > enough to cover the database? He posted his cron settings ;-) /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Fri Feb 18 14:53:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A10828BA489 for ; Fri, 18 Feb 2005 14:53:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30234-04 for ; Fri, 18 Feb 2005 14:53:18 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id 57B0B8BA483 for ; Fri, 18 Feb 2005 14:53:17 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j1IEnuT8030519; Fri, 18 Feb 2005 14:49:57 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.306 [265.8.9]); Fri, 18 Feb 2005 14:51:42 +0000 Message-ID: <421600FE.8090407@familyhealth.com.au> Date: Fri, 18 Feb 2005 14:51:42 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rodrigo Moreno Cc: pgsql-performance@postgresql.org Subject: Re: RES: Degradation of postgres 7.4.5 on FreeBSD/CygWin References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/261 X-Sequence-Number: 10590 > this is only max 15 concurrent conections. And is not a heavy performance > database, so i think this is not necessary vacumm more than once a day. > > In another customer, has only 5 users and the database have 300mb, small > database, and has the same behaviour (haven't modified postgresql). > My first instalation was not changed anything in postgresql.conf, but in > this new server (FreeBSD) i have changed some parameters. > > as showed in my crontab list, i think this is enough: > 00 13 * * 1-5 /bin/sh /home/postgres/backup.sh >/dev/null 2>&1 > 00 19 * * 1-5 /bin/sh /home/postgres/backup.sh >/dev/null 2>&1 > 00 23 * * 1-5 /usr/local/pgsql/bin/psql supre -c "vacuum analyze;" We just told you - it's nowhere near enough. Vacuum once an hour. Size of the database is not that relevant, its size of changes that is. Chris From pgsql-performance-owner@postgresql.org Fri Feb 18 14:54:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF1798BA469 for ; Fri, 18 Feb 2005 14:54:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31136-03 for ; Fri, 18 Feb 2005 14:54:20 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id B14418BA475 for ; Fri, 18 Feb 2005 14:54:23 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j1IEp2Nh030573; Fri, 18 Feb 2005 14:51:02 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.306 [265.8.9]); Fri, 18 Feb 2005 14:52:49 +0000 Message-ID: <42160140.20407@familyhealth.com.au> Date: Fri, 18 Feb 2005 14:52:48 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rodrigo Moreno Cc: pgsql-performance@postgresql.org Subject: Re: RES: Degradation of postgres 7.4.5 on FreeBSD/CygWin References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/262 X-Sequence-Number: 10591 > 00 23 * * 1-5 /usr/local/pgsql/bin/psql supre -c "vacuum analyze;" Also, this is bad - you are not vacuuming all your databases, which will cause you data loss one day with transaction wraparound. Use the vacuumdb utility that comes with PostgreSQL instead. Chris From pgsql-performance-owner@postgresql.org Fri Feb 18 13:56:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 00E748B9BCE for ; Fri, 18 Feb 2005 13:56:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14807-02 for ; Fri, 18 Feb 2005 13:56:24 +0000 (GMT) Received: from itapoa.terra.com.br (itapoa.terra.com.br [200.154.55.227]) by svr1.postgresql.org (Postfix) with ESMTP id 2099A8B9B6C for ; Fri, 18 Feb 2005 13:56:26 +0000 (GMT) Received: from bugala.terra.com.br (bugala.terra.com.br [200.154.55.135]) by itapoa.terra.com.br (Postfix) with ESMTP id 9AAC430D39B for ; Fri, 18 Feb 2005 11:56:26 -0200 (BRST) X-Terra-Karma: -2% X-Terra-Hash: d87ce205a65a904f6e3faee17ea78e7d Received: from rmsmnote (unknown [200.168.177.32]) (authenticated user rodrigo.miguel) by bugala.terra.com.br (Postfix) with ESMTP id 12D293C079 for ; Fri, 18 Feb 2005 11:56:26 -0200 (BRST) From: "Rodrigo Moreno" To: Subject: Degradation of postgres 7.4.5 on FreeBSD/CygWin Date: Fri, 18 Feb 2005 11:54:34 -0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.032 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200502/255 X-Sequence-Number: 10584 Hi All I'm really desparate about this. The problem has occurried in both of my customers first with cygwin and now with FreeBSD 5.3. After 2 months, postgres start get down the performance, and simple queries that should run in 100ms now tooks about 15 secs. Another behaviour, the data is growing to much, with no reason, just like the comparision. So, to solve problem, for the 5th time, a made a backup, dropped the entire database, recreate e reimported. One friend of mine tell me about same problem in linux and he go back to 7.3.x, and with me 5 times. The old data have this sizes: $ du -ks * | sort -nr 1379872 base 131202 pg_xlog 390 global 336 serverlog 74 pg_clog 8 postgresql.conf 4 pg_hba.conf 2 postmaster.opts 2 pg_ident.conf 2 PG_VERSION The Reimported database has this sizes: $ du -ks * | sort -nr 916496 base 131202 pg_xlog 134 global 14 serverlog 10 pg_clog 8 postgresql.conf 4 pg_hba.conf 2 postmaster.pid 2 postmaster.opts 2 pg_ident.conf 2 PG_VERSION This Procedure took 100 ms, but before re-import it took about 15secs, in a process that have a 1000 itens its took about 4 hours to finish, and after re-import 5 minutes. The bottleneck is this recursion procedure, that is a part os others procedure, but it have a simple query. CREATE OR REPLACE FUNCTION Produt_Repos(numeric, double precision, integer, integer) RETURNS double precision AS ' DECLARE xcodpro ALIAS FOR $1; xPesfor ALIAS FOR $2; xAno ALIAS FOR $3; xMes ALIAS FOR $4; oMatpro RECORD; xPreRep DOUBLE PRECISION; nPreRep DOUBLE PRECISION; xQtdKgs DOUBLE PRECISION; xPreCus DOUBLE PRECISION; BEGIN xPreRep := 0; IF xPesFor <> 0 THEN FOR oMatpro IN SELECT a.qtdpro, a.codmat, b.pesfor FROM matpro a, produt b WHERE a.codpro = xCodpro AND b.codpro = a.codmat LOOP xQtdKgs := oMatpro.QtdPro / xPesFor; nPreRep := Produt_Repos( oMatpro.codmat, coalesce(oMatpro.pesfor, 0.0), xAno, xMes); xPrerep := xPrerep + (nPreRep * xQtdKgs); IF nPreRep = 0 THEN SELECT coalesce(PreCus, 0.0) INTO xPreCus FROM produt_fecha WHERE codpro = oMatPro.codmat and ano = xAno and mes = xMes LIMIT 1; xPreRep := xPrerep + ( xPrecus * xQtdKgs ); END IF; END LOOP; END IF; RETURN xPreRep; END; ' LANGUAGE 'plpgsql'; This are my configs: msginfo: msgmax: 16384 (max characters in a message) msgmni: 40 (# of message queues) msgmnb: 2048 (max characters in a message queue) msgtql: 40 (max # of messages in system) msgssz: 8 (size of a message segment) msgseg: 2048 (# of message segments in system) shminfo: shmmax: 163840000 (max shared memory segment size) shmmin: 1 (min shared memory segment size) shmmni: 4000 (max number of shared memory identifiers) shmseg: 128 (max shared memory segments per process) shmall: 40000 (max amount of shared memory in pages) seminfo: semmap: 30 (# of entries in semaphore map) semmni: 40961 (# of semaphore identifiers) semmns: 16380 (# of semaphores in system) semmnu: 30 (# of undo structures in system) semmsl: 16380 (max # of semaphores per id) semopm: 100 (max # of operations per semop call) semume: 10 (max # of undo entries per process) semusz: 92 (size in bytes of undo structure) semvmx: 32767 (semaphore maximum value) semaem: 16384 (adjust on exit max value) max_connections = 30 shared_buffers = 8192 # min 16, at least max_connections*2, 8KB each sort_mem = 32768 # min 64, size in KB vacuum_mem = 32768 # min 1024, size in KB max_fsm_pages = 40000 # min max_fsm_relations*16, 6 bytes each max_fsm_relations = 2000 # min 100, ~50 bytes each These are my crontab activities: $ crontab -l 00 13 * * 1-5 /bin/sh /home/postgres/backup.sh >/dev/null 2>&1 00 19 * * 1-5 /bin/sh /home/postgres/backup.sh >/dev/null 2>&1 00 23 * * 1-5 /usr/local/pgsql/bin/psql supre -c "vacuum analyze;" >>/dev/null 2>&1 00 23 * * 6 /usr/local/pgsql/bin/psql supre -c "reindex database supre;" >>/dev/null 2>&1 00 23 * * 7 /usr/local/pgsql/bin/psql supre -c "vacuum full analyze;" >>/dev/null 2>&1 So guys, i'm really desparate about this issue, and i think i'm doing everthing right. Please help me. If i tell to my customer that he is having the same problem that in cygwin version, after spending money to change from windows to freebsd,upgrading server, etc, problably he will kill me. :) Best Regards Rodrigo Moreno From pgsql-performance-owner@postgresql.org Fri Feb 18 14:59:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 23E3E8BA485 for ; Fri, 18 Feb 2005 14:59:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33448-02 for ; Fri, 18 Feb 2005 14:59:48 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 052988BA483 for ; Fri, 18 Feb 2005 14:59:51 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1IExqv2018066; Fri, 18 Feb 2005 09:59:52 -0500 (EST) To: "Rodrigo Moreno" Cc: pgsql-performance@postgresql.org Subject: Re: RES: Degradation of postgres 7.4.5 on FreeBSD/CygWin In-reply-to: References: Comments: In-reply-to "Rodrigo Moreno" message dated "Fri, 18 Feb 2005 12:43:58 -0300" Date: Fri, 18 Feb 2005 09:59:52 -0500 Message-ID: <18065.1108738792@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/263 X-Sequence-Number: 10592 "Rodrigo Moreno" writes: > max_fsm_pages = 40000 > max_fsm_relations = 2000 > But why after 2 months the database has 1.3gb and after reimport on 900mb ? 40k pages = 320M bytes = 1/3rd of your database. Perhaps you need a larger setting for max_fsm_pages. However, 30% bloat of the database doesn't particularly bother me, especially when you are using infrequent vacuums. Bear in mind that, for example, the steady-state fill factor of a b-tree index is usually estimated at less than 70%. A certain amount of wasted space is not only intended, but essential for reasonable performance. What you need is to take a more detailed look at the behavior of that function that's getting so slow. Are the query plans changing? Is the loop iterating over many more rows than before? You haven't told us anything that would account for 100x slowdown. regards, tom lane From pgsql-hackers-owner@postgresql.org Fri Feb 18 15:11:25 2005 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AAE3F8B9EAE; Fri, 18 Feb 2005 15:11:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36173-05; Fri, 18 Feb 2005 15:11:15 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 7329F8B9B6C; Fri, 18 Feb 2005 15:11:18 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: win32 performance - fsync question Date: Fri, 18 Feb 2005 10:11:18 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A762D@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [HACKERS] win32 performance - fsync question Thread-Index: AcUVKHxbIUTAk8QQQUeweR4+s8XOkwAAE1kwAADD0eAAJ7b7oA== From: "Merlin Moncure" To: "Magnus Hagander" Cc: , , , "Tom Lane" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/595 X-Sequence-Number: 64423 Magnus prepared a trivial patch which added the O_SYNC flag for windows and mapped it to FILE_FLAG_WRITE_THROUGH in win32_open.c. We pg_benched it and here are the results of our test on my WinXP workstation on a 10k raptor: Settings were pgbench -t 100 -c 10. fsync =3D off:=20 ~ 280 tps fsync on, WAL=3Dfsync: ~ 35 tps=20 fsync on, WAL=3Dopen_sync write cache policy on: ~ 240 tps fsync on, WAL=3Dopen_sync write cache policy off: ~ 80 tps 80 tps, btw, is about the results I'd expect from linux on this hardware. Also, the open_sync method plays much nicer with RAID devices, but it would need some more rigorous testing before I'd personally certify it as safe. As an aside, it doesn't look like the open_sync can be trusted with write caching policy on the disk (the default), and that's worth noting. =20 Merlin From pgsql-performance-owner@postgresql.org Fri Feb 18 14:45:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5620D8B9EE3 for ; Fri, 18 Feb 2005 14:45:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27852-06 for ; Fri, 18 Feb 2005 14:45:47 +0000 (GMT) Received: from itapoa.terra.com.br (itapoa.terra.com.br [200.154.55.227]) by svr1.postgresql.org (Postfix) with ESMTP id 511588B9B6C for ; Fri, 18 Feb 2005 14:45:50 +0000 (GMT) Received: from buvuma.terra.com.br (buvuma.terra.com.br [200.154.55.139]) by itapoa.terra.com.br (Postfix) with ESMTP id F2E0A30C0D4 for ; Fri, 18 Feb 2005 12:45:50 -0200 (BRST) X-Terra-Karma: -2% X-Terra-Hash: fc4addf59d928d70279e15a31fb94bf2 Received-SPF: pass (buvuma.terra.com.br: domain of terra.com.br designates 200.154.55.139 as permitted sender) client-ip=200.154.55.139; envelope-from=rodrigo.miguel@terra.com.br; helo=rmsmnote; Received: from rmsmnote (unknown [200.168.177.32]) (authenticated user rodrigo.miguel) by buvuma.terra.com.br (Postfix) with ESMTP id A9F703C034 for ; Fri, 18 Feb 2005 12:45:50 -0200 (BRST) From: "Rodrigo Moreno" To: Subject: RES: Degradation of postgres 7.4.5 on FreeBSD/CygWin Date: Fri, 18 Feb 2005 12:43:58 -0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal In-Reply-To: <17770.1108737145@sss.pgh.pa.us> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.032 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200502/260 X-Sequence-Number: 10589 Hi, this is only max 15 concurrent conections. And is not a heavy performance database, so i think this is not necessary vacumm more than once a day. In another customer, has only 5 users and the database have 300mb, small database, and has the same behaviour (haven't modified postgresql). My first instalation was not changed anything in postgresql.conf, but in this new server (FreeBSD) i have changed some parameters. as showed in my crontab list, i think this is enough: 00 13 * * 1-5 /bin/sh /home/postgres/backup.sh >/dev/null 2>&1 00 19 * * 1-5 /bin/sh /home/postgres/backup.sh >/dev/null 2>&1 00 23 * * 1-5 /usr/local/pgsql/bin/psql supre -c "vacuum analyze;" >>/dev/null 2>&1 00 23 * * 6 /usr/local/pgsql/bin/psql supre -c "reindex database supre;" >>/dev/null 2>&1 00 23 * * 7 /usr/local/pgsql/bin/psql supre -c "vacuum full analyze;" >>/dev/null 2>&1 These my changed configs in postgresql.conf: max_connections = 30 shared_buffers = 8192 sort_mem = 32768 vacuum_mem = 32768 max_fsm_pages = 40000 max_fsm_relations = 2000 But why after 2 months the database has 1.3gb and after reimport on 900mb ? Both customer are smaller databases, but one of them, has 8 years os data, it's the reason of size 900mb, these are too smaller database. Regards Rodrigo Moreno From pgsql-performance-owner@postgresql.org Fri Feb 18 15:12:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A261E8BA47D for ; Fri, 18 Feb 2005 15:11:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34114-10 for ; Fri, 18 Feb 2005 15:11:50 +0000 (GMT) Received: from loncoche.terra.com.br (loncoche.terra.com.br [200.154.55.229]) by svr1.postgresql.org (Postfix) with ESMTP id 3C34A8BA478 for ; Fri, 18 Feb 2005 15:11:53 +0000 (GMT) Received: from talara.terra.com.br (talara.terra.com.br [200.154.55.136]) by loncoche.terra.com.br (Postfix) with ESMTP id 860A1E78812; Fri, 18 Feb 2005 13:11:53 -0200 (BRST) X-Terra-Karma: -2% X-Terra-Hash: 069df1b3d0d0c71cb69b8896c75a111c Received: from rmsmnote (unknown [200.168.177.32]) (authenticated user rodrigo.miguel) by talara.terra.com.br (Postfix) with ESMTP id 2A5F53C067; Fri, 18 Feb 2005 13:11:53 -0200 (BRST) From: "Rodrigo Moreno" To: "Tom Lane" Cc: Subject: RES: RES: Degradation of postgres 7.4.5 on FreeBSD/CygWin Date: Fri, 18 Feb 2005 13:10:01 -0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal In-Reply-To: <18065.1108738792@sss.pgh.pa.us> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.032 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200502/265 X-Sequence-Number: 10594 Thanks to all, at this moment, can't stop the database and put back the old database, but at night i will take more analyzes on old database and reimported and i put here the results. Thanks a lot Rodrigo -----Mensagem original----- De: Tom Lane [mailto:tgl@sss.pgh.pa.us] Enviada em: sexta-feira, 18 de fevereiro de 2005 12:00 Para: Rodrigo Moreno Cc: pgsql-performance@postgresql.org Assunto: Re: RES: [PERFORM] Degradation of postgres 7.4.5 on FreeBSD/CygWin "Rodrigo Moreno" writes: > max_fsm_pages = 40000 > max_fsm_relations = 2000 > But why after 2 months the database has 1.3gb and after reimport on 900mb ? 40k pages = 320M bytes = 1/3rd of your database. Perhaps you need a larger setting for max_fsm_pages. However, 30% bloat of the database doesn't particularly bother me, especially when you are using infrequent vacuums. Bear in mind that, for example, the steady-state fill factor of a b-tree index is usually estimated at less than 70%. A certain amount of wasted space is not only intended, but essential for reasonable performance. What you need is to take a more detailed look at the behavior of that function that's getting so slow. Are the query plans changing? Is the loop iterating over many more rows than before? You haven't told us anything that would account for 100x slowdown. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Feb 18 23:25:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 346D08BA30E for ; Fri, 18 Feb 2005 23:25:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53616-03 for ; Fri, 18 Feb 2005 23:25:24 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 71D9B8B9EBD for ; Fri, 18 Feb 2005 23:25:23 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0F9B131E33; Sat, 19 Feb 2005 00:25:19 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Sat, 19 Feb 2005 00:20:08 +0100 Organization: Hub.Org Networking Services Lines: 30 Message-ID: References: <20050120144416.GO10437@ns.snowman.net> <200501200929.37228.darcy@wavefire.com> <20050121.104007.74755729.t-ishii@sra.co.jp> <200501201949.24292.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <200501201949.24292.josh@agliodbs.com> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/266 X-Sequence-Number: 10595 Josh Berkus wrote: > Tatsuo, > > >>Yes. However it would be pretty easy to modify pgpool so that it could >>cope with Slony-I. I.e. >> >>1) pgpool does the load balance and sends query to Slony-I's slave and >> master if the query is SELECT. >> >>2) pgpool sends query only to the master if the query is other than >> SELECT. Don't you think that this is unsafe ? SELECT foo(id), id FROM bar; where foo have side effect. Is pgpool able to detect it and perform this select on the master ? Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Fri Feb 18 23:27:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A21BD8BA316 for ; Fri, 18 Feb 2005 23:27:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35377-09 for ; Fri, 18 Feb 2005 23:27:35 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id B712E8BA0FA for ; Fri, 18 Feb 2005 23:27:37 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9C1FF31E33; Sat, 19 Feb 2005 00:27:37 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Sat, 19 Feb 2005 00:27:07 +0100 Organization: Hub.Org Networking Services Lines: 27 Message-ID: References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <41EFC26A.4070605@familyhealth.com.au> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> <20050120150847.GQ10437@ns.snowman.net> <20050121013204.GL67721@decibel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <20050121013204.GL67721@decibel.org> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/267 X-Sequence-Number: 10596 Jim C. Nasby wrote: > On Thu, Jan 20, 2005 at 10:08:47AM -0500, Stephen Frost wrote: > >>* Christopher Kings-Lynne (chriskl@familyhealth.com.au) wrote: >> >>>PostgreSQL has replication, but not partitioning (which is what you want). >> >>It doesn't have multi-server partitioning.. It's got partitioning >>within a single server (doesn't it? I thought it did, I know it was >>discussed w/ the guy from Cox Communications and I thought he was using >>it :). > > > No, PostgreSQL doesn't support any kind of partitioning, unless you > write it yourself. I think there's some work being done in this area, > though. Seen my last attempts to perform an horizontal partition I have to say that postgres do not support it even if you try to write it yourself (see my post "horizontal partion" ). Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Sat Feb 19 04:11:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 81B958B9F68 for ; Sat, 19 Feb 2005 04:11:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27487-02 for ; Sat, 19 Feb 2005 04:11:12 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id ACFAE8B9F5C for ; Sat, 19 Feb 2005 04:11:10 +0000 (GMT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j1J4B8T15005; Fri, 18 Feb 2005 23:11:08 -0500 (EST) From: Bruce Momjian Message-Id: <200502190411.j1J4B8T15005@candle.pha.pa.us> Subject: Re: seq scan cache vs. index cache smackdown In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE4768A7@algol.sollentuna.se> To: Magnus Hagander Date: Fri, 18 Feb 2005 23:11:08 -0500 (EST) Cc: Merlin Moncure , Josh Berkus , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/268 X-Sequence-Number: 10597 Magnus Hagander wrote: > I don't think that's correct either. Scatter/Gather I/O is used to SQL > Server can issue reads for several blocks from disks into it's own > buffer cache with a single syscall even if these buffers are not > sequential. It did make significant performance improvements when they > added it, though. > > (For those not knowing - it's ReadFile/WriteFile where you pass an array > of "this many bytes to this address" as parameters) Isn't that like the BSD writev()/readv() that Linux supports also? Is that something we should be using on Unix if it is supported by the OS? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Wed Feb 23 06:39:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6281F8B9D6B for ; Sat, 19 Feb 2005 11:06:02 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15214-03 for ; Sat, 19 Feb 2005 11:05:58 +0000 (GMT) Received: from mx2.lycos-europe.com (mx2.lycos-europe.com [213.193.26.151]) by svr1.postgresql.org (Postfix) with ESMTP id 1AE4A8B9D68 for ; Sat, 19 Feb 2005 11:05:58 +0000 (GMT) Received: from so1dc1012.Office.local (unverified) by mx2.lycos-europe.com (Lycos-Europe) with ESMTP id for ; Sat, 19 Feb 2005 12:02:22 +0100 Received: from so1evn001.Office.local ([10.37.4.11]) by so1dc1012.Office.local with Microsoft SMTPSVC(6.0.3790.0); Sat, 19 Feb 2005 12:05:57 +0100 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C51672.F9E1EA00" Subject: Help me please ! Date: Sat, 19 Feb 2005 15:05:52 +0400 Message-ID: <8267A5C8B2C7AD4DBE9C29304C6104DE251408@so1evn001.Office.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Help me please ! Thread-Index: AcUWcvm9bz1hzOJ1SjmYK32ilmuu5w== From: "Asatryan, Anahit" To: X-OriginalArrivalTime: 19 Feb 2005 11:05:57.0083 (UTC) FILETIME=[FCA742B0:01C51672] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.338 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200502/312 X-Sequence-Number: 10641 This is a multi-part message in MIME format. ------_=_NextPart_001_01C51672.F9E1EA00 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I am running postgreSQL 8.0.1 under the Windows 2000. I want to use COPY FROM STDIN function from Java application, but it doesn't work, it throws: "org.postgresql.util.PSQLException: Unknown Response Type G" error. Please help me! Note: COPY FROM filename works properly. =20 =20 ------_=_NextPart_001_01C51672.F9E1EA00 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I am running postgreSQL 8.0.1 under the Windows 2000. = I want to use COPY FROM STDIN function from Java application, but it = doesn’t work, it throws:

“org.postgresql.util.PSQLException: Unknown = Response Type G”  error.

Please help me!

Note: COPY FROM filename works = properly.

 

 

------_=_NextPart_001_01C51672.F9E1EA00-- From pgsql-performance-owner@postgresql.org Sun Feb 20 12:25:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DB4588BAF6D for ; Sun, 20 Feb 2005 12:25:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50755-09 for ; Sun, 20 Feb 2005 12:25:18 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id C4E708BAF6F for ; Sun, 20 Feb 2005 12:25:20 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 53C3A31DBF; Sun, 20 Feb 2005 13:25:20 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: bad performances using hashjoin Date: Sun, 20 Feb 2005 13:20:38 +0100 Organization: Hub.Org Networking Services Lines: 115 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/270 X-Sequence-Number: 10599 Hi all, I'm stuck in a select that use the hash join where should not: 6 seconds vs 0.3 ms !! If you need other info in order to improve the planner, let me know. Regards Gaetano Mendola empdb=# explain analyze SELECT id_sat_request empdb-# FROM sat_request sr, empdb-# v_sc_packages vs empdb-# WHERE ----- JOIN ---- empdb-# sr.id_package = vs.id_package AND empdb-# --------------- empdb-# id_user = 29416 AND empdb-# id_url = 329268 AND empdb-# vs.estimated_start > now() AND empdb-# id_sat_request_status = sp_lookup_id('sat_request_status', 'Scheduled'); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=272.95..276.61 rows=1 width=4) (actual time=6323.107..6323.107 rows=0 loops=1) Hash Cond: ("outer".id_package = "inner".id_package) -> Subquery Scan vs (cost=269.91..272.10 rows=292 width=4) (actual time=6316.534..6317.398 rows=407 loops=1) -> Sort (cost=269.91..270.64 rows=292 width=263) (actual time=6316.526..6316.789 rows=407 loops=1) Sort Key: vs.estimated_start -> Hash Join (cost=227.58..257.95 rows=292 width=263) (actual time=6302.480..6313.982 rows=407 loops=1) Hash Cond: ("outer".id_package = "inner".id_package) -> Subquery Scan vpk (cost=141.82..150.04 rows=1097 width=218) (actual time=6106.020..6113.038 rows=1104 loops=1) -> Sort (cost=141.82..144.56 rows=1097 width=162) (actual time=6106.006..6106.745 rows=1104 loops=1) Sort Key: p.id_publisher, p.name -> Hash Left Join (cost=15.54..86.42 rows=1097 width=162) (actual time=2.978..6087.608 rows=1104 loops=1) Hash Cond: ("outer".id_package = "inner".id_package) -> Seq Scan on packages p (cost=0.00..53.48 rows=1097 width=146) (actual time=0.011..7.978 rows=1104 loops=1) -> Hash (cost=13.69..13.69 rows=738 width=20) (actual time=2.061..2.061 rows=0 loops=1) -> Seq Scan on package_security ps (cost=0.00..13.69 rows=738 width=20) (actual time=0.027..1.289 rows=747 loops=1) -> Hash (cost=85.63..85.63 rows=54 width=49) (actual time=196.022..196.022 rows=0 loops=1) -> Merge Join (cost=82.83..85.63 rows=54 width=49) (actual time=192.898..195.565 rows=407 loops=1) Merge Cond: ("outer".id_program = "inner".id_program) -> Subquery Scan vs (cost=72.27..73.97 rows=226 width=16) (actual time=6.867..7.872 rows=407 loops=1) -> Sort (cost=72.27..72.84 rows=226 width=20) (actual time=6.851..7.114 rows=407 loops=1) Sort Key: sequences.id_program, sequences.internal_position -> Seq Scan on sequences (cost=0.00..63.44 rows=226 width=20) (actual time=0.295..3.370 rows=407 loops=1) Filter: ((estimated_start IS NOT NULL) AND (date_trunc('seconds'::text, estimated_start) > now())) -> Sort (cost=10.56..10.68 rows=47 width=37) (actual time=186.013..186.296 rows=439 loops=1) Sort Key: vpr.id_program -> Subquery Scan vpr (cost=8.90..9.25 rows=47 width=37) (actual time=185.812..185.928 rows=48 loops=1) -> Sort (cost=8.90..9.02 rows=47 width=61) (actual time=185.806..185.839 rows=48 loops=1) Sort Key: programs.id_publisher, programs.id_program -> Seq Scan on programs (cost=0.00..7.60 rows=47 width=61) (actual time=9.592..185.634 rows=48 loops=1) Filter: (id_program <> 0) -> Hash (cost=3.04..3.04 rows=1 width=8) (actual time=4.862..4.862 rows=0 loops=1) -> Index Scan using idx_id_url_sat_request on sat_request sr (cost=0.00..3.04 rows=1 width=8) (actual time=4.851..4.851 rows=0 loops=1) Index Cond: (id_url = 329268) Filter: ((id_user = 29416) AND (id_sat_request_status = 1)) Total runtime: 6324.435 ms (35 rows) empdb=# set enable_hashjoin = false; SET empdb=# explain analyze SELECT id_sat_request empdb-# FROM sat_request sr, empdb-# v_sc_packages vs empdb-# WHERE ----- JOIN ---- empdb-# sr.id_package = vs.id_package AND empdb-# --------------- empdb-# id_user = 29416 AND empdb-# id_url = 329268 AND empdb-# vs.estimated_start > now() AND empdb-# id_sat_request_status = sp_lookup_id('sat_request_status', 'Scheduled'); QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=393.41..400.83 rows=1 width=4) (actual time=0.080..0.080 rows=0 loops=1) Join Filter: ("outer".id_package = "inner".id_package) -> Index Scan using idx_id_url_sat_request on sat_request sr (cost=0.00..3.04 rows=1 width=8) (actual time=0.078..0.078 rows=0 loops=1) Index Cond: (id_url = 329268) Filter: ((id_user = 29416) AND (id_sat_request_status = 1)) -> Subquery Scan vs (cost=393.41..395.60 rows=292 width=4) (never executed) -> Sort (cost=393.41..394.14 rows=292 width=263) (never executed) Sort Key: vs.estimated_start -> Merge Join (cost=372.76..381.46 rows=292 width=263) (never executed) Merge Cond: ("outer".id_package = "inner".id_package) -> Sort (cost=87.19..87.32 rows=54 width=49) (never executed) Sort Key: vs.id_package -> Merge Join (cost=82.83..85.63 rows=54 width=49) (never executed) Merge Cond: ("outer".id_program = "inner".id_program) -> Subquery Scan vs (cost=72.27..73.97 rows=226 width=16) (never executed) -> Sort (cost=72.27..72.84 rows=226 width=20) (never executed) Sort Key: sequences.id_program, sequences.internal_position -> Seq Scan on sequences (cost=0.00..63.44 rows=226 width=20) (never executed) Filter: ((estimated_start IS NOT NULL) AND (date_trunc('seconds'::text, estimated_start) > now())) -> Sort (cost=10.56..10.68 rows=47 width=37) (never executed) Sort Key: vpr.id_program -> Subquery Scan vpr (cost=8.90..9.25 rows=47 width=37) (never executed) -> Sort (cost=8.90..9.02 rows=47 width=61) (never executed) Sort Key: programs.id_publisher, programs.id_program -> Seq Scan on programs (cost=0.00..7.60 rows=47 width=61) (never executed) Filter: (id_program <> 0) -> Sort (cost=285.57..288.31 rows=1097 width=218) (never executed) Sort Key: vpk.id_package -> Subquery Scan vpk (cost=221.95..230.17 rows=1097 width=218) (never executed) -> Sort (cost=221.95..224.69 rows=1097 width=162) (never executed) Sort Key: p.id_publisher, p.name -> Merge Right Join (cost=108.88..166.55 rows=1097 width=162) (never executed) Merge Cond: ("outer".id_package = "inner".id_package) -> Index Scan using package_security_id_package_key on package_security ps (cost=0.00..38.50 rows=738 width=20) (never executed) -> Sort (cost=108.88..111.62 rows=1097 width=146) (never executed) Sort Key: p.id_package -> Seq Scan on packages p (cost=0.00..53.48 rows=1097 width=146) (never executed) Total runtime: 0.302 ms (38 rows) From pgsql-performance-owner@postgresql.org Sun Feb 20 12:04:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 809B08BAF7E for ; Sun, 20 Feb 2005 12:04:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43846-10 for ; Sun, 20 Feb 2005 12:04:37 +0000 (GMT) Received: from loncoche.terra.com.br (loncoche.terra.com.br [200.154.55.229]) by svr1.postgresql.org (Postfix) with ESMTP id F322D8BA137 for ; Sun, 20 Feb 2005 12:04:39 +0000 (GMT) Received: from estero.terra.com.br (estero.terra.com.br [200.154.55.138]) by loncoche.terra.com.br (Postfix) with ESMTP id 44E4DE782DB for ; Sun, 20 Feb 2005 09:04:38 -0300 (BRT) X-Terra-Karma: -2% X-Terra-Hash: 22db4386953b00805cc146e92cb4a954 Received: from rmsmnote (unknown [200.168.176.201]) (authenticated user rodrigo.miguel) by estero.terra.com.br (Postfix) with ESMTP id 960283C02B for ; Sun, 20 Feb 2005 09:04:37 -0300 (BRT) From: "Rodrigo Moreno" To: Subject: RES: RES: Degradation of postgres 7.4.5 on FreeBSD/CygWin Date: Sun, 20 Feb 2005 10:02:44 -0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal In-Reply-To: <42160140.20407@familyhealth.com.au> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.032 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200502/269 X-Sequence-Number: 10598 Hi all, I Got more improvements using vacuumdb utility and the size of my database was decreasead from 1.3gb to 900mb. Only one thing is not right yeat. My procedure perform others 7 subprocedures and with reimported database, it's took about 5 minutes to complete. With old vacuumed database, the same process took 20minutes, it's much better than the 4 hours before, but there is little diference. Now, i have scheduled the vacuumdb --analyze once a day and vacuumdb --analyze --all --full once a week, i think this is enough. Now i'll check for reindexes tables and i'll perform analyze in each query in procedure. When i get more results, i post here. Thanks a Lot Rodrigo Moreno From pgsql-performance-owner@postgresql.org Sun Feb 20 15:46:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BB6458B9B8A for ; Sun, 20 Feb 2005 15:46:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98317-03 for ; Sun, 20 Feb 2005 15:46:42 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id B58B78B9B6C for ; Sun, 20 Feb 2005 15:46:44 +0000 (GMT) Received: (qmail 27270 invoked from network); 20 Feb 2005 15:49:31 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 20 Feb 2005 15:49:31 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 12416-52 for ; Sun, 20 Feb 2005 22:49:30 +0700 (ICT) Received: (qmail 27264 invoked from network); 20 Feb 2005 15:49:30 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 20 Feb 2005 15:49:30 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Sun, 20 Feb 2005 22:49:30 +0700 Message-ID: <1108914570.4218b18a2cf0d@webmail.moph.go.th> Date: Sun, 20 Feb 2005 22:49:30 +0700 From: amrit@health2.moph.go.th To: PGsql-performance Subject: Problem with 7.4.5 and webmin 1.8 in grant function MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200502/271 X-Sequence-Number: 10600 I newly installed the postgresql 7.4.5 and FC 3 in my server and transfer the data from 7.3.2 with just a few problems. After I use the webmin 1.8 to config the grant previllage to the users ,I found that there is an error in the grant previlege . postgresql --> Grant Previlege --> error select relname, relacl from pg_class where (relkind = 'r' OR relkind = 'S') and relname !~ '^pg_' order by relname : Unknown DBI error What is the cause of this error and how could I handle this order? Please make any comment, Thanks. Amrit , Thailand From pgsql-performance-owner@postgresql.org Sun Feb 20 18:25:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EACEF8BA434 for ; Sun, 20 Feb 2005 18:25:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46693-09 for ; Sun, 20 Feb 2005 18:25:36 +0000 (GMT) Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 9BD848BA411 for ; Sun, 20 Feb 2005 18:25:35 +0000 (GMT) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 982AF8F283; Sun, 20 Feb 2005 19:25:33 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: seq scan cache vs. index cache smackdown Date: Sun, 20 Feb 2005 19:25:33 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE47690D@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] seq scan cache vs. index cache smackdown Thread-Index: AcUWOQvHwixQdJ0AQ4e5pWGLowt6ZABP+DUA From: "Magnus Hagander" To: "Bruce Momjian" Cc: "Merlin Moncure" , "Josh Berkus" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.068 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/272 X-Sequence-Number: 10601 >> I don't think that's correct either. Scatter/Gather I/O is=20 >used to SQL >> Server can issue reads for several blocks from disks into it's own >> buffer cache with a single syscall even if these buffers are not >> sequential. It did make significant performance improvements=20 >when they >> added it, though. >>=20 >> (For those not knowing - it's ReadFile/WriteFile where you=20 >pass an array >> of "this many bytes to this address" as parameters) > >Isn't that like the BSD writev()/readv() that Linux supports also? Is >that something we should be using on Unix if it is supported by the OS? Yes, they certainly seem very similar. The win32 functions are explicitly designed for async I/O (they were after all created specifically for SQL Server), so they put harder requirements on the parameters. Specifically, it writes complete system pages only, and each pointer has to point to only one page. In a file opened without buffering it will also write all buffers out and then wait for I/O completion from the device instead of one for each. Not sure what the writev/readv ones do (not clear from my linux man page). Now wether this is something we could make use of - I'll leave that up to those who know the buffer manager a lot better than I do. //Magnus From pgsql-performance-owner@postgresql.org Sun Feb 20 18:46:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A390B8BAFB4 for ; Sun, 20 Feb 2005 18:46:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51519-06 for ; Sun, 20 Feb 2005 18:46:14 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 26CF48BAF82 for ; Sun, 20 Feb 2005 18:46:14 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1KIkBZr015414; Sun, 20 Feb 2005 13:46:11 -0500 (EST) To: Gaetano Mendola Cc: pgsql-performance@postgresql.org Subject: Re: bad performances using hashjoin In-reply-to: References: Comments: In-reply-to Gaetano Mendola message dated "Sun, 20 Feb 2005 13:20:38 +0100" Date: Sun, 20 Feb 2005 13:46:10 -0500 Message-ID: <15413.1108925170@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/273 X-Sequence-Number: 10602 Gaetano Mendola writes: > If you need other info in order to improve the planner, ... like, say, the PG version you are using, or the definitions of the views involved? It's difficult to say much of anything about this. However: the reason the second plan wins is because there are zero rows fetched from sat_request, and so the bulk of the plan is never executed at all. I doubt the second plan would win if there were any matching sat_request rows. If this is the case you actually need to optimize, probably the thing to do is to get rid of the ORDER BY clauses you evidently have in your views, so that there's some chance of building a fast-start plan. BTW, I believe in 8.0 the first plan would be about as fast as the second, because we added some code to hash join to fall out without scanning the left input if the right input is empty. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Feb 20 22:58:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6A2138BA279 for ; Sun, 20 Feb 2005 22:58:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44243-05 for ; Sun, 20 Feb 2005 22:58:44 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 0D3058B9D1B for ; Sun, 20 Feb 2005 22:58:44 +0000 (GMT) Received: (qmail 20023 invoked from network); 20 Feb 2005 22:58:44 -0000 Received: from 218-101-45-105.paradise.net.nz (HELO ?192.168.1.11?) (218.101.45.105) by 0 with SMTP; 20 Feb 2005 22:58:44 -0000 Message-ID: <42191623.7060401@coretech.co.nz> Date: Mon, 21 Feb 2005 11:58:43 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function References: <1108914570.4218b18a2cf0d@webmail.moph.go.th> In-Reply-To: <1108914570.4218b18a2cf0d@webmail.moph.go.th> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/274 X-Sequence-Number: 10603 amrit@health2.moph.go.th wrote: > I newly installed the postgresql 7.4.5 and FC 3 in my server and transfer the > data from 7.3.2 with just a few problems. After I use the webmin 1.8 to config > the grant previllage to the users ,I found that there is an error in the grant > previlege . > postgresql --> Grant Previlege --> error > > select relname, relacl from pg_class where (relkind = 'r' OR relkind = 'S') and > relname !~ '^pg_' order by relname : Unknown DBI error > > What is the cause of this error and how could I handle this order? > Please make any comment, Thanks. > I would suspect a DBI/DBD installation issue, either perl DBI cannot find DBD-Pg (not installed ?) or DBD-Pg cannot find your Pg 7.4.5. I note that FC3 comes with Pg 7.4.6 - did you installed 7.4.5 from source? If so this could be why the perl database modules cannot find it (you may need to rebuild DBD-Pg, telling it where your Pg install is). regards Mark From pgsql-performance-owner@postgresql.org Mon Feb 21 00:46:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7ED088BA04D for ; Mon, 21 Feb 2005 00:45:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95445-06 for ; Mon, 21 Feb 2005 00:45:37 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4415C8B9FE2 for ; Mon, 21 Feb 2005 00:45:38 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9F05931FE9; Mon, 21 Feb 2005 01:45:38 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: bad performances using hashjoin Date: Mon, 21 Feb 2005 01:45:03 +0100 Organization: Hub.Org Networking Services Lines: 214 Message-ID: <42192F0F.30404@bigfoot.com> References: <15413.1108925170@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Tom Lane User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <15413.1108925170@sss.pgh.pa.us> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/275 X-Sequence-Number: 10604 Tom Lane wrote: > Gaetano Mendola writes: > >>If you need other info in order to improve the planner, > > > ... like, say, the PG version you are using, or the definitions of the > views involved? It's difficult to say much of anything about this. That is true, sorry I forgot it :-( The engine is a 7.4.5 and these are the views definitions: sat_request is just a table CREATE OR REPLACE VIEW v_sc_packages AS SELECT * FROM v_programs vpr, v_packages vpk, v_sequences vs WHERE ------------ JOIN ------------- vpr.id_program = vs.id_program AND vpk.id_package = vs.id_package AND ------------------------------- vs.estimated_start IS NOT NULL ORDER BY vs.estimated_start; CREATE OR REPLACE VIEW v_programs AS SELECT * FROM programs WHERE id_program<>0 ORDER BY id_publisher, id_program ; CREATE OR REPLACE VIEW v_packages AS SELECT * FROM packages p LEFT OUTER JOIN package_security ps USING (id_package) ORDER BY p.id_publisher, p.name ; CREATE OR REPLACE VIEW v_sequences AS SELECT id_package AS id_package, id_program AS id_program, internal_position AS internal_position, estimated_start AS estimated_start FROM sequences ORDER BY id_program, internal_position ; > However: the reason the second plan wins is because there are zero rows > fetched from sat_request, and so the bulk of the plan is never executed > at all. I doubt the second plan would win if there were any matching > sat_request rows. If this is the case you actually need to optimize, > probably the thing to do is to get rid of the ORDER BY clauses you > evidently have in your views, so that there's some chance of building > a fast-start plan. Removed all order by from that views, this is the comparison between the two (orderdered and not ordered): empdb=# explain analyze SELECT id_sat_request empdb-# FROM sat_request sr, empdb-# v_sc_packages vs empdb-# WHERE ----- JOIN ---- empdb-# sr.id_package = vs.id_package AND empdb-# --------------- empdb-# id_user = 29416 AND empdb-# id_url = 424364 AND empdb-# vs.estimated_start > now() AND empdb-# id_sat_request_status = sp_lookup_id('sat_request_status', 'Scheduled'); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=280.98..284.74 rows=1 width=4) (actual time=895.344..895.344 rows=0 loops=1) Hash Cond: ("outer".id_package = "inner".id_package) -> Subquery Scan vs (cost=277.94..280.19 rows=301 width=4) (actual time=893.191..894.396 rows=569 loops=1) -> Sort (cost=277.94..278.69 rows=301 width=263) (actual time=893.184..893.546 rows=569 loops=1) Sort Key: vs.estimated_start -> Hash Join (cost=232.61..265.54 rows=301 width=263) (actual time=868.980..889.643 rows=569 loops=1) Hash Cond: ("outer".id_package = "inner".id_package) -> Subquery Scan vpk (cost=150.29..159.26 rows=1196 width=218) (actual time=822.281..834.063 rows=1203 loops=1) -> Sort (cost=150.29..153.28 rows=1196 width=159) (actual time=822.266..823.190 rows=1203 loops=1) Sort Key: p.id_publisher, p.name -> Hash Left Join (cost=16.14..89.16 rows=1196 width=159) (actual time=3.504..809.262 rows=1203 loops=1) Hash Cond: ("outer".id_package = "inner".id_package) -> Seq Scan on packages p (cost=0.00..53.98 rows=1196 width=143) (actual time=0.018..13.869 rows=1203 loops=1) -> Hash (cost=14.09..14.09 rows=818 width=20) (actual time=2.395..2.395 rows=0 loops=1) -> Seq Scan on package_security ps (cost=0.00..14.09 rows=818 width=20) (actual time=0.020..1.520 rows=845 loops=1) -> Hash (cost=82.19..82.19 rows=51 width=49) (actual time=46.402..46.402 rows=0 loops=1) -> Merge Join (cost=79.54..82.19 rows=51 width=49) (actual time=39.435..45.376 rows=569 loops=1) Merge Cond: ("outer".id_program = "inner".id_program) -> Subquery Scan vs (cost=70.98..72.59 rows=214 width=16) (actual time=16.834..19.102 rows=569 loops=1) -> Sort (cost=70.98..71.52 rows=214 width=20) (actual time=16.824..17.338 rows=569 loops=1) Sort Key: sequences.id_program, sequences.internal_position -> Seq Scan on sequences (cost=0.00..62.70 rows=214 width=20) (actual time=0.638..11.969 rows=569 loops=1) Filter: ((estimated_start IS NOT NULL) AND (date_trunc('seconds'::text, estimated_start) > now())) -> Sort (cost=8.56..8.68 rows=47 width=37) (actual time=22.580..23.123 rows=605 loops=1) Sort Key: vpr.id_program -> Subquery Scan vpr (cost=6.90..7.25 rows=47 width=37) (actual time=22.294..22.464 rows=48 loops=1) -> Sort (cost=6.90..7.02 rows=47 width=61) (actual time=22.287..22.332 rows=48 loops=1) Sort Key: programs.id_publisher, programs.id_program -> Seq Scan on programs (cost=0.00..5.60 rows=47 width=61) (actual time=4.356..22.068 rows=48 loops=1) Filter: (id_program <> 0) -> Hash (cost=3.04..3.04 rows=1 width=8) (actual time=0.033..0.033 rows=0 loops=1) -> Index Scan using idx_id_url_sat_request on sat_request sr (cost=0.00..3.04 rows=1 width=8) (actual time=0.031..0.031 rows=0 loops=1) Index Cond: (id_url = 424364) Filter: ((id_user = 29416) AND (id_sat_request_status = 1)) Total runtime: 897.044 ms (35 rows) empdb=# explain analyze SELECT id_sat_request empdb-# FROM sat_request sr, empdb-# v_sc_packages_new vs empdb-# WHERE ----- JOIN ---- empdb-# sr.id_package = vs.id_package AND empdb-# --------------- empdb-# id_user = 29416 AND empdb-# id_url = 424364 AND empdb-# vs.estimated_start > now() AND empdb-# id_sat_request_status = sp_lookup_id('sat_request_status', 'Scheduled'); QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=19.18..96.87 rows=1 width=4) (actual time=15.576..15.576 rows=0 loops=1) -> Nested Loop (cost=19.18..93.04 rows=1 width=8) (actual time=15.569..15.569 rows=0 loops=1) -> Hash Join (cost=19.18..89.21 rows=1 width=12) (actual time=15.566..15.566 rows=0 loops=1) Hash Cond: ("outer".id_package = "inner".id_package) -> Hash Left Join (cost=16.14..80.19 rows=1196 width=4) (actual time=7.291..13.620 rows=1203 loops=1) Hash Cond: ("outer".id_package = "inner".id_package) -> Seq Scan on packages p (cost=0.00..53.98 rows=1196 width=4) (actual time=0.028..2.694 rows=1203 loops=1) -> Hash (cost=14.09..14.09 rows=818 width=4) (actual time=6.707..6.707 rows=0 loops=1) -> Seq Scan on package_security ps (cost=0.00..14.09 rows=818 width=4) (actual time=0.026..4.620 rows=845 loops=1) -> Hash (cost=3.04..3.04 rows=1 width=8) (actual time=0.061..0.061 rows=0 loops=1) -> Index Scan using idx_id_url_sat_request on sat_request sr (cost=0.00..3.04 rows=1 width=8) (actual time=0.056..0.056 rows=0 loops=1) Index Cond: (id_url = 424364) Filter: ((id_user = 29416) AND (id_sat_request_status = 1)) -> Index Scan using idx_sequences_id_package on sequences (cost=0.00..3.82 rows=1 width=8) (never executed) Index Cond: ("outer".id_package = sequences.id_package) Filter: ((estimated_start IS NOT NULL) AND (date_trunc('seconds'::text, estimated_start) > now())) -> Index Scan using programs_pkey on programs (cost=0.00..3.83 rows=1 width=4) (never executed) Index Cond: (programs.id_program = "outer".id_program) Filter: (id_program <> 0) Total runtime: 16.279 ms (20 rows) The second one of course is faster, this is the second select with hashjoin disabled: empdb=# set enable_hashjoin = false; SET empdb=# explain analyze SELECT id_sat_request empdb-# FROM sat_request sr, empdb-# v_sc_packages_new vs empdb-# WHERE ----- JOIN ---- empdb-# sr.id_package = vs.id_package AND empdb-# --------------- empdb-# id_user = 29416 AND empdb-# id_url = 424364 AND empdb-# vs.estimated_start > now() AND empdb-# id_sat_request_status = sp_lookup_id('sat_request_status', 'Scheduled'); QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (cost=10.62..175.83 rows=1 width=4) (actual time=0.280..0.280 rows=0 loops=1) Merge Cond: ("outer".id_package = "inner".id_package) -> Merge Left Join (cost=0.00..162.21 rows=1196 width=4) (actual time=0.188..0.188 rows=1 loops=1) Merge Cond: ("outer".id_package = "inner".id_package) -> Index Scan using packages_pkey on packages p (cost=0.00..115.51 rows=1196 width=4) (actual time=0.085..0.085 rows=1 loops=1) -> Index Scan using package_security_id_package_key on package_security ps (cost=0.00..39.06 rows=818 width=4) (actual time=0.080..0.080 rows=1 loops=1) -> Sort (cost=10.62..10.62 rows=1 width=12) (actual time=0.087..0.087 rows=0 loops=1) Sort Key: sr.id_package -> Nested Loop (cost=0.00..10.61 rows=1 width=12) (actual time=0.069..0.069 rows=0 loops=1) -> Nested Loop (cost=0.00..6.77 rows=1 width=16) (actual time=0.067..0.067 rows=0 loops=1) -> Index Scan using idx_id_url_sat_request on sat_request sr (cost=0.00..3.04 rows=1 width=8) (actual time=0.065..0.065 rows=0 loops=1) Index Cond: (id_url = 424364) Filter: ((id_user = 29416) AND (id_sat_request_status = 1)) -> Index Scan using idx_sequences_id_package on sequences (cost=0.00..3.72 rows=1 width=8) (never executed) Index Cond: ("outer".id_package = sequences.id_package) Filter: ((estimated_start IS NOT NULL) AND (date_trunc('seconds'::text, estimated_start) > now())) -> Index Scan using programs_pkey on programs (cost=0.00..3.83 rows=1 width=4) (never executed) Index Cond: (programs.id_program = "outer".id_program) Filter: (id_program <> 0) Total runtime: 0.604 ms (20 rows) I see the problem is still here: Hash Left Join (cost=16.14..80.19 rows=1196 width=4) (actual time=7.291..13.620 rows=1203 loops=1) BTW, at this time the executions time seen are lower because right now is not a peak hour > BTW, I believe in 8.0 the first plan would be about as fast as the > second, because we added some code to hash join to fall out without > scanning the left input if the right input is empty. I'll take it a try if you are really interested in the results. Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Mon Feb 21 00:51:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 178AC8B9FE2 for ; Mon, 21 Feb 2005 00:51:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95971-08 for ; Mon, 21 Feb 2005 00:50:49 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9A72F8BA041 for ; Mon, 21 Feb 2005 00:50:51 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id D8E2C31FE9; Mon, 21 Feb 2005 01:50:51 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: Effects of IDLE processes Date: Mon, 21 Feb 2005 01:50:18 +0100 Organization: Hub.Org Networking Services Lines: 35 Message-ID: <4219304A.1070408@bigfoot.com> References: <200502181815.17000.jerome@gmanmi.tv> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: JM User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <200502181815.17000.jerome@gmanmi.tv> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/276 X-Sequence-Number: 10605 JM wrote: > Hi ALL, > > I was wondering if there is a DB performance reduction if there are a lot of > IDLE processes. > > 30786 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 32504 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 32596 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 1722 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 1724 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 3881 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 6332 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 6678 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 6700 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 6768 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 8544 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 8873 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 8986 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 9000 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 9010 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 9013 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 9016 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 9019 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > 9020 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle > In my experience not at all, you have to wonder if some of that are "idle in transaction" that are really a pain in the @#$ Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Mon Feb 21 01:30:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0A1318BA161 for ; Mon, 21 Feb 2005 01:29:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07177-01 for ; Mon, 21 Feb 2005 01:29:25 +0000 (GMT) Received: from mailhub2.une.edu.au (mailhub2.une.edu.au [129.180.1.142]) by svr1.postgresql.org (Postfix) with ESMTP id D33458BA041 for ; Mon, 21 Feb 2005 01:29:26 +0000 (GMT) Received: from icarus.une.edu.au (icarus.une.edu.au [129.180.47.120]) by mailhub2.une.edu.au (Postfix) with ESMTP id 138557EFF; Mon, 21 Feb 2005 12:29:25 +1100 (EST) Received: from kgb ([129.180.47.225]) by icarus.une.edu.au (8.12.8/8.12.8) with SMTP id j1L1TOnb028329; Mon, 21 Feb 2005 12:29:24 +1100 Date: Mon, 21 Feb 2005 12:30:21 +1100 From: Klint Gore To: Tom Lane Cc: pgsql-performance@postgresql.org, Gaetano Mendola Subject: Re: bad performances using hashjoin In-Reply-To: <15413.1108925170@sss.pgh.pa.us> References: <15413.1108925170@sss.pgh.pa.us> Message-Id: <421939AD2A4.CE73KG@129.180.47.120> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver 1.25.06 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/277 X-Sequence-Number: 10606 On Sun, 20 Feb 2005 13:46:10 -0500, Tom Lane wrote: > sat_request rows. If this is the case you actually need to optimize, > probably the thing to do is to get rid of the ORDER BY clauses you > evidently have in your views, so that there's some chance of building > a fast-start plan. Is having an order by in a view legal? In sybase ASA, mssql it throws a syntax error if there's an order by. If so, does it do 2 sorts when you sort by something else? i.e. if view is create view v1 as select * from table order by 1; and the statment select * from v1 order by 2; is run does it sort by 1 then resort by 2? klint. +---------------------------------------+-----------------+ : Klint Gore : "Non rhyming : : EMail : kg@kgb.une.edu.au : slang - the : : Snail : A.B.R.I. : possibilities : : Mail University of New England : are useless" : : Armidale NSW 2351 Australia : L.J.J. : : Fax : +61 2 6772 5376 : : +---------------------------------------+-----------------+ From pgsql-performance-owner@postgresql.org Mon Feb 21 01:33:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DB4E58BA134 for ; Mon, 21 Feb 2005 01:32:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06106-09 for ; Mon, 21 Feb 2005 01:32:01 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id EC9128BA048 for ; Mon, 21 Feb 2005 01:32:00 +0000 (GMT) Received: (qmail 32326 invoked from network); 21 Feb 2005 01:34:49 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 21 Feb 2005 01:34:49 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 25963-53 for ; Mon, 21 Feb 2005 08:34:45 +0700 (ICT) Received: (qmail 32195 invoked from network); 21 Feb 2005 01:34:45 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 21 Feb 2005 01:34:45 -0000 Received: from 203.185.128.19 ([203.185.128.19]) by webmail.moph.go.th (IMP) with HTTP for ; Mon, 21 Feb 2005 08:34:45 +0700 Message-ID: <1108949685.42193ab53e07c@webmail.moph.go.th> Date: Mon, 21 Feb 2005 08:34:45 +0700 From: amrit@health2.moph.go.th To: Mark Kirkwood , PGsql-performance Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function References: <1108914570.4218b18a2cf0d@webmail.moph.go.th> <42191623.7060401@coretech.co.nz> In-Reply-To: <42191623.7060401@coretech.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.185.128.19 X-Virus-Scanned: by amavisd-new at moph.go.th X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200502/278 X-Sequence-Number: 10607 > I would suspect a DBI/DBD installation issue, either perl DBI cannot > find DBD-Pg (not installed ?) or DBD-Pg cannot find your Pg 7.4.5. > > I note that FC3 comes with Pg 7.4.6 - did you installed 7.4.5 from > source? If so this could be why the perl database modules cannot find it > (you may need to rebuild DBD-Pg, telling it where your Pg install is). > > regards > > Mark > I installed FC3 from rpm kernel 2.6.9 which already included postgresql 7.4.5 . Suppose that there were some missing component , what should be the missing rpm component which I forgot to install ? Amrit , Thailand From pgsql-performance-owner@postgresql.org Mon Feb 21 02:03:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CC6538BA122 for ; Mon, 21 Feb 2005 02:01:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14389-01 for ; Mon, 21 Feb 2005 02:01:25 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 824EF8BA048 for ; Mon, 21 Feb 2005 02:01:27 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1L21HJm020288; Sun, 20 Feb 2005 21:01:17 -0500 (EST) To: Klint Gore Cc: pgsql-performance@postgresql.org, Gaetano Mendola Subject: Re: bad performances using hashjoin In-reply-to: <421939AD2A4.CE73KG@129.180.47.120> References: <15413.1108925170@sss.pgh.pa.us> <421939AD2A4.CE73KG@129.180.47.120> Comments: In-reply-to Klint Gore message dated "Mon, 21 Feb 2005 12:30:21 +1100" Date: Sun, 20 Feb 2005 21:01:17 -0500 Message-ID: <20287.1108951277@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/279 X-Sequence-Number: 10608 Klint Gore writes: > Is having an order by in a view legal? Not according to the SQL spec, but PG has allowed it for several releases. (The same goes for ORDER BY in a sub-select, which is actually pretty much the same thing ...) > If so, does it do 2 sorts when you sort by something else? Yup. It's something you'd only want for the topmost view in a stack, IMHO. A sort at a lower level is likely to be wasted effort. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Feb 21 03:04:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8D58A8BA26E for ; Mon, 21 Feb 2005 03:02:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90421-03 for ; Mon, 21 Feb 2005 03:02:03 +0000 (GMT) Received: from gizmo02ps.bigpond.com (gizmo02ps.bigpond.com [144.140.71.12]) by svr1.postgresql.org (Postfix) with SMTP id BD2D08BA041 for ; Mon, 21 Feb 2005 03:02:00 +0000 (GMT) Received: (qmail 20988 invoked from network); 21 Feb 2005 03:01:52 -0000 Received: from unknown (HELO psmam05.bigpond.com) (144.135.25.81) by gizmo02ps.bigpond.com with SMTP; 21 Feb 2005 03:01:52 -0000 Received: from cpe-203-45-202-230.qld.bigpond.net.au ([203.45.202.230]) by psmam05.bigpond.com(MAM REL_3_4_2a 107/1293331) with SMTP id 1293331; Mon, 21 Feb 2005 13:01:52 +1000 Message-ID: <42194F00.3030704@bigpond.net.au> Date: Mon, 21 Feb 2005 13:01:20 +1000 From: David Brown User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: bad performances using hashjoin References: <15413.1108925170@sss.pgh.pa.us> In-Reply-To: <15413.1108925170@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.796 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200502/280 X-Sequence-Number: 10609 Tom Lane wrote: >However: the reason the second plan wins is because there are zero rows >fetched from sat_request, and so the bulk of the plan is never executed >at all. I doubt the second plan would win if there were any matching >sat_request rows. > That's what I thought at first, but if you look more closely, that's having very little impact on either the cost or actual time: -> Index Scan using idx_id_url_sat_request on sat_request sr (cost=0.00..3.04 rows=1 width=8) (actual time=0.031..0.031 rows=0 loops=1) The real problem appears to be here: -> Hash Left Join (cost=16.14..89.16 rows=1196 width=159) (actual time=3.504..809.262 rows=1203 loops=1) As Gaetano points out in his follow-up post, the problem still exists after he removed the sorts: -> Hash Left Join (cost=16.14..80.19 rows=1196 width=4) (actual time=7.291..13.620 rows=1203 loops=1) The planner is not breaking up the outer join in his v_packages view: SELECT * FROM packages p LEFT OUTER JOIN package_security ps USING (id_package) It's not being selective at all with packages, despite id_package being the link to sat_request. If this is too complex for the planner, could he re-arrange his outer join so that's it's processed later? If he puts it in his actual query, for instance, will the planner flatten it out anyway? From pgsql-performance-owner@postgresql.org Mon Feb 21 03:54:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5F1B08BA35B for ; Mon, 21 Feb 2005 03:50:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31851-09 for ; Mon, 21 Feb 2005 03:50:01 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1C2B28BA333 for ; Mon, 21 Feb 2005 03:50:04 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id EEF3A31FEC; Mon, 21 Feb 2005 04:50:04 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Effects of IDLE processes Date: Sun, 20 Feb 2005 22:18:31 -0500 Organization: cbbrowne Computing Inc Lines: 44 Message-ID: References: <200502181815.17000.jerome@gmanmi.tv> <4219304A.1070408@bigfoot.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:A1Jz91vU0k2XLUeqZYF5WHrapxQ= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.345 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200502/281 X-Sequence-Number: 10610 After a long battle with technology, Gaetano Mendola , an earthling, wrote: > JM wrote: >> Hi ALL, >> >> I was wondering if there is a DB performance reduction if >> there are a lot of IDLE processes. >> >> 30786 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 32504 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 32596 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 1722 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 1724 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 3881 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 6332 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 6678 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 6700 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 6768 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 8544 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 8873 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 8986 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 9000 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 9010 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 9013 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 9016 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 9019 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> 9020 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >> > In my experience not at all, you have to wonder if some of that are > "idle in transaction" that are really a pain in the @#$ I'd be concerned about "idle" processes insofar as they are holding on to _some_ memory that isn't shared. "idle in transaction" is quite another matter; long-running transactions certainly do lead to evil. When running Slony-I, for instance, "idle in transaction" means that pg_listener entries are being held onto so they cannot be vacuumed out, and that's only one example of a possible evil... -- (reverse (concatenate 'string "moc.liamg" "@" "enworbbc")) http://linuxdatabases.info/info/languages.html You know how most packages say "Open here". What is the protocol if the package says, "Open somewhere else"? From pgsql-performance-owner@postgresql.org Mon Feb 21 03:55:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5C8C78BA11B for ; Mon, 21 Feb 2005 03:48:34 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64979-02 for ; Mon, 21 Feb 2005 03:48:27 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 34E938B9FDE for ; Mon, 21 Feb 2005 03:48:28 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1L3m6XJ020951; Sun, 20 Feb 2005 22:48:09 -0500 (EST) To: David Brown Cc: pgsql-performance@postgresql.org Subject: Re: bad performances using hashjoin In-reply-to: <42194F00.3030704@bigpond.net.au> References: <15413.1108925170@sss.pgh.pa.us> <42194F00.3030704@bigpond.net.au> Comments: In-reply-to David Brown message dated "Mon, 21 Feb 2005 13:01:20 +1000" Date: Sun, 20 Feb 2005 22:48:06 -0500 Message-ID: <20950.1108957686@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/282 X-Sequence-Number: 10611 David Brown writes: > The planner is not breaking up the outer join in his v_packages view: The planner doesn't make any attempt to rearrange join order of outer joins. There are some cases where such a rearrangement is OK, but there are other cases where it isn't, and we don't currently have the logic needed to tell which is which. In the particular case at hand here, 8.0's hack to suppress evaluating the outer side of a hash join after finding the inner side is empty would eliminate the complaint. In the original message, it did seem that the packages-to- package_security join is taking a lot longer than one would expect: -> Hash Left Join (cost=15.54..86.42 rows=1097 width=162) (actual time=2.978..6087.608 rows=1104 loops=1) Hash Cond: ("outer".id_package = "inner".id_package) -> Seq Scan on packages p (cost=0.00..53.48 rows=1097 width=146) (actual time=0.011..7.978 rows=1104 loops=1) -> Hash (cost=13.69..13.69 rows=738 width=20) (actual time=2.061..2.061 rows=0 loops=1) -> Seq Scan on package_security ps (cost=0.00..13.69 rows=738 width=20) (actual time=0.027..1.289 rows=747 loops=1) but this behavior isn't reproduced in the later message, so I wonder if it wasn't an artifact of something else taking a chunk of time. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Feb 21 11:18:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A24A58BB062 for ; Mon, 21 Feb 2005 11:18:18 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23235-03 for ; Mon, 21 Feb 2005 11:18:13 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id A32358BB05A for ; Mon, 21 Feb 2005 11:18:14 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id B4FFA31FE9; Mon, 21 Feb 2005 12:18:13 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: bad performances using hashjoin Date: Mon, 21 Feb 2005 12:17:39 +0100 Organization: Hub.Org Networking Services Lines: 12 Message-ID: <4219C353.7010306@bigfoot.com> References: <15413.1108925170@sss.pgh.pa.us> <42194F00.3030704@bigpond.net.au> <20950.1108957686@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Tom Lane User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <20950.1108957686@sss.pgh.pa.us> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/283 X-Sequence-Number: 10612 Tom Lane wrote: > but this behavior isn't reproduced in the later message, so I wonder if > it wasn't an artifact of something else taking a chunk of time. I think is due the fact that first queries were performed in peakhours. Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Mon Feb 21 11:25:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D1EC58BA91F for ; Mon, 21 Feb 2005 11:25:25 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23476-10 for ; Mon, 21 Feb 2005 11:25:19 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5A5038B9F77 for ; Mon, 21 Feb 2005 11:25:21 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 4BB2B31FE9; Mon, 21 Feb 2005 12:25:21 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: Effects of IDLE processes Date: Mon, 21 Feb 2005 12:23:15 +0100 Organization: Hub.Org Networking Services Lines: 51 Message-ID: <4219C4A3.20100@bigfoot.com> References: <200502181815.17000.jerome@gmanmi.tv> <4219304A.1070408@bigfoot.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Christopher Browne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/284 X-Sequence-Number: 10613 Christopher Browne wrote: > After a long battle with technology, Gaetano Mendola , an earthling, wrote: > >>JM wrote: >> >>>Hi ALL, >>> >>> I was wondering if there is a DB performance reduction if >>>there are a lot of IDLE processes. >>> >>>30786 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>>32504 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>>32596 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 1722 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 1724 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 3881 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 6332 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 6678 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 6700 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 6768 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 8544 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 8873 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 8986 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 9000 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 9010 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 9013 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 9016 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 9019 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> 9020 ? S 0:00 postgres: user1 gmadb 10.10.10.1 idle >>> > > >>In my experience not at all, you have to wonder if some of that are >>"idle in transaction" that are really a pain in the @#$ > > > I'd be concerned about "idle" processes insofar as they are holding on > to _some_ memory that isn't shared. For "not at all" I was refering the fact that the normal engine work and maintenances are not affected ( at least your iron shall be able to support all these connections and processes ). A long transaction for example can stop the entire engine if for example a "Vacuum full" remain stuck on some tables locked by that transaction Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Mon Feb 21 14:03:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EF3928BA51D for ; Mon, 21 Feb 2005 14:03:47 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75487-09 for ; Mon, 21 Feb 2005 14:03:39 +0000 (GMT) Received: from gizmo03ps.bigpond.com (gizmo03ps.bigpond.com [144.140.71.13]) by svr1.postgresql.org (Postfix) with SMTP id 4F72D8BA4BA for ; Mon, 21 Feb 2005 14:03:39 +0000 (GMT) Received: (qmail 20804 invoked from network); 21 Feb 2005 14:03:35 -0000 Received: from unknown (HELO psmam06.bigpond.com) (144.135.25.84) by gizmo03ps.bigpond.com with SMTP; 21 Feb 2005 14:03:35 -0000 Received: from cpe-203-45-206-87.qld.bigpond.net.au ([203.45.206.87]) by psmam06.bigpond.com(MAM REL_3_4_2a 116/2377272) with SMTP id 2377272; Tue, 22 Feb 2005 00:03:35 +1000 Message-ID: <4219EA17.8090906@bigpond.net.au> Date: Tue, 22 Feb 2005 00:03:03 +1000 From: David Brown User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gaetano Mendola Subject: Re: bad performances using hashjoin References: <15413.1108925170@sss.pgh.pa.us> <42194F00.3030704@bigpond.net.au> <20950.1108957686@sss.pgh.pa.us> <4219C353.7010306@bigfoot.com> In-Reply-To: <4219C353.7010306@bigfoot.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.778 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200502/286 X-Sequence-Number: 10615 Gaetano Mendola wrote: >I think is due the fact that first queries were performed in peakhours. > > A memory intensive operation takes 7.5 times longer during heavy loads. Doesn't this suggest that swapping of working memory is occurring? From pgsql-performance-owner@postgresql.org Mon Feb 21 14:03:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 66AAC8BA283 for ; Mon, 21 Feb 2005 14:03:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75373-10 for ; Mon, 21 Feb 2005 14:03:18 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 277608BB075 for ; Mon, 21 Feb 2005 14:03:20 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: seq scan cache vs. index cache smackdown Date: Mon, 21 Feb 2005 09:03:20 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A762F@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] seq scan cache vs. index cache smackdown Thread-Index: AcUWOQqTSBFonXyST4CKG4UuM8Pq0AB419/Q From: "Merlin Moncure" To: "Bruce Momjian" Cc: "Magnus Hagander" , , "Tom Lane" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/285 X-Sequence-Number: 10614 > Magnus Hagander wrote: > > I don't think that's correct either. Scatter/Gather I/O is used to SQL > > Server can issue reads for several blocks from disks into it's own > > buffer cache with a single syscall even if these buffers are not > > sequential. It did make significant performance improvements when they > > added it, though. > > > > (For those not knowing - it's ReadFile/WriteFile where you pass an array > > of "this many bytes to this address" as parameters) >=20 > Isn't that like the BSD writev()/readv() that Linux supports also? Is > that something we should be using on Unix if it is supported by the OS? readv and writev are in the single unix spec...and yes they are basically just like the win32 versions except that that are synchronous (and therefore better, IMO). On some systems they might just be implemented as a loop inside the library, or even as a macro. http://www.opengroup.org/onlinepubs/007908799/xsh/sysuio.h.html On operating systems that optimize vectored read operations, it's pretty reasonable to assume good or even great performance gains, in addition to (or instead of) recent changes to xlog.c to group writes together for a file...it just takes things one stop further. Is there a reason why readv/writev have not been considered in the past? Merlin From pgsql-performance-owner@postgresql.org Mon Feb 21 16:27:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 83C3A8BB024 for ; Mon, 21 Feb 2005 16:27:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24876-10 for ; Mon, 21 Feb 2005 16:27:31 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 17B2F8BAFCF for ; Mon, 21 Feb 2005 16:27:30 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1LGRTJo000449; Mon, 21 Feb 2005 11:27:29 -0500 (EST) To: "Merlin Moncure" Cc: "Bruce Momjian" , "Magnus Hagander" , pgsql-performance@postgresql.org Subject: Re: seq scan cache vs. index cache smackdown In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3412A762F@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3412A762F@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Mon, 21 Feb 2005 09:03:20 -0500" Date: Mon, 21 Feb 2005 11:27:29 -0500 Message-ID: <448.1109003249@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/287 X-Sequence-Number: 10616 "Merlin Moncure" writes: > Is there a reason why readv/writev have not been considered in the past? Lack of portability, and lack of obvious usefulness that would justify dealing with the lack of portability. I don't think there's any value in trying to write ordinary buffers this way; making the buffer manager able to write multiple buffers at once sounds like a great deal of complexity and deadlock risk in return for not much. It might be an alternative to the existing proposed patch for writing multiple WAL buffers at once, but frankly I consider that patch a waste of effort. In real scenarios you seldom get to write more than one WAL page without a forced sync occurring because someone committed. Even if *your* transaction is long, any other backend committing a small transaction still fsyncs. On top of that, the bgwriter will be flushing WAL in order to maintain the write-ahead rule any time it dumps a dirty buffer. I have a personal to-do item to make the bgwriter explicitly responsible for writing completed WAL pages as part of its duties, but I haven't done anything about it because I think that it will write lots of such pages without any explicit code, thanks to the bufmgr's LSN interlock. Even if it doesn't get it done that way, the simplest answer is to add a little bit of code to make sure bgwriter generally does the writes, and then we don't care. If you want to experiment with writev, feel free, but I'll want to see demonstrable performance benefits before any such code actually goes in. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Feb 21 17:11:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C6D408BB072 for ; Mon, 21 Feb 2005 17:11:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41767-06 for ; Mon, 21 Feb 2005 17:11:37 +0000 (GMT) Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net [199.185.220.223]) by svr1.postgresql.org (Postfix) with ESMTP id E9BD18BB071 for ; Mon, 21 Feb 2005 17:11:35 +0000 (GMT) Received: from localhost ([199.185.220.240]) by priv-edtnes51.telusplanet.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050221171134.IYBG22261.priv-edtnes51.telusplanet.net@localhost> for ; Mon, 21 Feb 2005 10:11:34 -0700 Received: from 209.17.183.249 ( [209.17.183.249]) as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; Mon, 21 Feb 2005 09:11:34 -0800 Message-ID: <1109005894.421a16469b1c5@webmail.telus.net> Date: Mon, 21 Feb 2005 09:11:34 -0800 From: Mischa To: pgsql-performance@postgresql.org Subject: Re: bad performances using hashjoin References: <15413.1108925170@sss.pgh.pa.us> <421939AD2A4.CE73KG@129.180.47.120> <20287.1108951277@sss.pgh.pa.us> In-Reply-To: <20287.1108951277@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1-cvs X-Originating-IP: 209.17.183.249 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200502/288 X-Sequence-Number: 10617 Quoting Tom Lane : > Klint Gore writes: > > Is having an order by in a view legal? > > Not according to the SQL spec, but PG has allowed it for several releases. > (The same goes for ORDER BY in a sub-select, which is actually pretty > much the same thing ...) Umm... if you implement LIMIT in a subselect, it becomes highly meaningful (nad useful. Is this a case of one nonstandard feature being the thin edge of the wedge for another? -- "Dreams come true, not free." From pgsql-performance-owner@postgresql.org Mon Feb 21 21:16:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 479798B9B4D for ; Mon, 21 Feb 2005 21:16:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01261-06 for ; Mon, 21 Feb 2005 21:16:15 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id CE34A8B9B2A for ; Mon, 21 Feb 2005 21:16:16 +0000 (GMT) Received: (qmail 3764 invoked from network); 21 Feb 2005 21:16:07 -0000 Received: from 218-101-14-65.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.65) by 0 with SMTP; 21 Feb 2005 21:16:07 -0000 Message-ID: <421A4F96.60803@coretech.co.nz> Date: Tue, 22 Feb 2005 10:16:06 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function References: <1108914570.4218b18a2cf0d@webmail.moph.go.th> <42191623.7060401@coretech.co.nz> <1108949685.42193ab53e07c@webmail.moph.go.th> In-Reply-To: <1108949685.42193ab53e07c@webmail.moph.go.th> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/289 X-Sequence-Number: 10618 amrit@health2.moph.go.th wrote: >>I would suspect a DBI/DBD installation issue, either perl DBI cannot >>find DBD-Pg (not installed ?) or DBD-Pg cannot find your Pg 7.4.5. >> >>I note that FC3 comes with Pg 7.4.6 - did you installed 7.4.5 from >>source? If so this could be why the perl database modules cannot find it >>(you may need to rebuild DBD-Pg, telling it where your Pg install is). > > I installed FC3 from rpm kernel 2.6.9 which already included postgresql 7.4.5 . > Suppose that there were some missing component , what should be the missing rpm > component which I forgot to install ? > Ok - I must be looking at the *updated* FC3 distribution... I may have 'jumped the gun' a little - the situation I describe above will prevent *any* access at all to Pg from webmin. If this is the case then check you have (perl) DBI and (perl) DBD-Pg components installed. If on the other hand you can do *some* Pg admin from webmin, and you are only having problems with the grants then there is something it does not like about the *particular* statement. The way to debug this is to do a tiny perl DBI program that tries to execute the statement : select relname, relacl from pg_class where (relkind = 'r' OR relkind = 'S') and relname !~ '^pg_' order by relname So - sorry to confuse, but let us know which situation you have there :-) best wishes Mark From pgsql-performance-owner@postgresql.org Mon Feb 21 21:51:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D62C78B9B3E for ; Mon, 21 Feb 2005 21:51:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13939-09 for ; Mon, 21 Feb 2005 21:51:18 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 3E21E8B9B64 for ; Mon, 21 Feb 2005 21:51:18 +0000 (GMT) Received: (qmail 5579 invoked from network); 21 Feb 2005 21:51:17 -0000 Received: from 218-101-14-65.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.65) by 0 with SMTP; 21 Feb 2005 21:51:17 -0000 Message-ID: <421A57D4.2070801@coretech.co.nz> Date: Tue, 22 Feb 2005 10:51:16 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mark Kirkwood Cc: amrit@health2.moph.go.th, PGsql-performance Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function References: <1108914570.4218b18a2cf0d@webmail.moph.go.th> <42191623.7060401@coretech.co.nz> <1108949685.42193ab53e07c@webmail.moph.go.th> <421A4F96.60803@coretech.co.nz> In-Reply-To: <421A4F96.60803@coretech.co.nz> Content-Type: multipart/mixed; boundary="------------090803040403050609020905" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/290 X-Sequence-Number: 10619 This is a multi-part message in MIME format. --------------090803040403050609020905 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Mark Kirkwood wrote: > If on the other hand you can do *some* Pg admin from webmin, and you are > only having problems with the grants then there is something it does not > like about the *particular* statement. The way to debug this is to do a > tiny perl DBI program that tries to execute the statement : > > select relname, relacl from pg_class where (relkind = 'r' OR relkind = > 'S') and relname !~ '^pg_' order by relname > I did a quick check of this case... seems to be no problem running this statement using perl 5.8.5, DBI-1.42 and DBD-Pg-1.22. You might like to try out the attached test program that does this (You may have to add a password in order to connect, depending on your security settings). Mark --------------090803040403050609020905 Content-Type: text/plain; name="relacl.pl" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="relacl.pl" #!/usr/bin/perl -w # # relacl.pl : testbed for # use DBI; use strict; my $db = "dbname=template1;port=5432"; my $user = "postgres"; my $pwd = ""; my $dsn = "DBI:Pg:$db"; my $con; my $sql = "select relname, relacl from pg_class where " . "(relkind = 'r' OR relkind = 'S') and relname !~ '^pg_' " . "order by relname"; my $sth; my @row; $con = DBI->connect($dsn,$user,$pwd) or die "Error in connect to $dsn: $!\n"; $sth = $con->prepare($sql) or die "Error in prepare : $!"; $sth->execute() or die "Error in execute : $!"; print "Relname\t\tRelacl\n"; while ( @row = $sth->fetchrow_array() ) { print $row[0] . "\t" . $row[1] . "\n"; } $sth->finish(); $con->disconnect(); --------------090803040403050609020905-- From pgsql-performance-owner@postgresql.org Tue Feb 22 01:05:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1A2F78B9BA0 for ; Tue, 22 Feb 2005 01:05:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70492-03 for ; Tue, 22 Feb 2005 01:05:10 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4CDE98B9B9A for ; Tue, 22 Feb 2005 01:05:12 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id EFB9230E67; Tue, 22 Feb 2005 02:05:12 +0100 (MET) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: seq scan cache vs. index cache smackdown Date: Mon, 21 Feb 2005 17:14:19 -0800 Organization: Hub.Org Networking Services Lines: 21 Message-ID: <421A876B.6010308@cheapcomplexdevices.com> References: <6EE64EF3AB31D5448D0007DD34EEB3412A762F@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Merlin Moncure User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A762F@Herge.rcsinc.local> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/291 X-Sequence-Number: 10620 Merlin Moncure wrote: > > readv and writev are in the single unix spec...and yes ... > > On some systems they might just be implemented as a loop inside the > library, or even as a macro. You sure? Requirements like this: http://www.opengroup.org/onlinepubs/007908799/xsh/write.html "Write requests of {PIPE_BUF} bytes or less will not be interleaved with data from other processes doing writes on the same pipe." make me think that it couldn't be just a macro; and if it were a loop in the library it seems it'd still have to make sure it's done with a single write system call. (yeah, I know that requirement is just for pipes; and I suppose they could write a loop for normal files and a different special case for pipes; but I'd be surprised). From pgsql-performance-owner@postgresql.org Tue Feb 22 04:59:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D64E28B9C84 for ; Tue, 22 Feb 2005 04:58:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07782-05 for ; Tue, 22 Feb 2005 04:58:15 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id B761B8B9E3C for ; Tue, 22 Feb 2005 04:58:13 +0000 (GMT) Received: (qmail 17377 invoked from network); 22 Feb 2005 05:00:59 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 22 Feb 2005 05:00:59 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 15528-40 for ; Tue, 22 Feb 2005 12:00:58 +0700 (ICT) Received: (qmail 17369 invoked from network); 22 Feb 2005 05:00:58 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 22 Feb 2005 05:00:58 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Tue, 22 Feb 2005 12:00:58 +0700 Message-ID: <1109048458.421abc8a280ed@webmail.moph.go.th> Date: Tue, 22 Feb 2005 12:00:58 +0700 From: amrit@health2.moph.go.th To: Mark Kirkwood Cc: PGsql-performance Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function References: <1108914570.4218b18a2cf0d@webmail.moph.go.th> <42191623.7060401@coretech.co.nz> <1108949685.42193ab53e07c@webmail.moph.go.th> <421A4F96.60803@coretech.co.nz> In-Reply-To: <421A4F96.60803@coretech.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=AWL, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200502/292 X-Sequence-Number: 10621 > Ok - I must be looking at the *updated* FC3 distribution... > > I may have 'jumped the gun' a little - the situation I describe above > will prevent *any* access at all to Pg from webmin. If this is the case > then check you have (perl) DBI and (perl) DBD-Pg components installed. > > If on the other hand you can do *some* Pg admin from webmin, and you are > only having problems with the grants then there is something it does not > like about the *particular* statement. The way to debug this is to do a > tiny perl DBI program that tries to execute the statement : > > select relname, relacl from pg_class where (relkind = 'r' OR relkind = > 'S') and relname !~ '^pg_' order by relname > > So - sorry to confuse, but let us know which situation you have there :-) > > best wishes > > Mark > I used you perl script and found the error => [root@samba tmp]# perl relacl.pl DBI connect('dbname=template1;port=5432','postgres',...) failed: FATAL: IDENT authentication failed for user "postgres" at relacl.pl line 21 Error in connect to DBI:Pg:dbname=template1;port=5432: And my pg_hba.conf is # IPv4-style local connections: host all all 127.0.0.1 255.255.255.255 trust host all all 192.168.0.0 255.255.0.0 trust trusted for every user. Would you give me an idea what's wrong? Thanks . Amrit,Thailand From pgsql-performance-owner@postgresql.org Tue Feb 22 05:45:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B08338B9E0E for ; Tue, 22 Feb 2005 05:45:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19352-03 for ; Tue, 22 Feb 2005 05:45:30 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id C1E5E8B9D23 for ; Tue, 22 Feb 2005 05:45:28 +0000 (GMT) Received: (qmail 26837 invoked from network); 22 Feb 2005 05:45:22 -0000 Received: from 218-101-14-65.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.65) by 0 with SMTP; 22 Feb 2005 05:45:22 -0000 Message-ID: <421AC6F3.5010102@coretech.co.nz> Date: Tue, 22 Feb 2005 18:45:23 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function References: <1108914570.4218b18a2cf0d@webmail.moph.go.th> <42191623.7060401@coretech.co.nz> <1108949685.42193ab53e07c@webmail.moph.go.th> <421A4F96.60803@coretech.co.nz> <1109048458.421abc8a280ed@webmail.moph.go.th> In-Reply-To: <1109048458.421abc8a280ed@webmail.moph.go.th> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/293 X-Sequence-Number: 10622 amrit@health2.moph.go.th wrote: > > I used you perl script and found the error => > [root@samba tmp]# perl relacl.pl > DBI connect('dbname=template1;port=5432','postgres',...) failed: FATAL: IDENT > authentication failed for user "postgres" at relacl.pl line 21 > Error in connect to DBI:Pg:dbname=template1;port=5432: > > Excellent - we know what is going on now! > And my pg_hba.conf is > > # IPv4-style local connections: > host all all 127.0.0.1 255.255.255.255 trust > host all all 192.168.0.0 255.255.0.0 trust > > trusted for every user. Ok, what I think has happened is that there is another Pg installation (or another initdb'ed cluster) on this machine that you are accidentally talking to. Try $ rpm -qa|grep -i postgres which will spot another software installation, you may just have to search for files called pg_hba.conf to find another initdb'ed cluster.... This other installation should have a pg_hba.conf that looks something like : local all all ident host all all 127.0.0.1 255.255.255.255 ident So a bit of detective work is in order :-) Mark From pgsql-performance-owner@postgresql.org Wed Feb 23 06:45:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 149408B9D5F for ; Tue, 22 Feb 2005 06:48:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34249-05 for ; Tue, 22 Feb 2005 06:48:03 +0000 (GMT) Received: from fomax.lunarpages.com (fomax.lunarpages.com [216.193.229.83]) by svr1.postgresql.org (Postfix) with ESMTP id 58EC18B9D21 for ; Tue, 22 Feb 2005 06:48:03 +0000 (GMT) Received: from wbar10.sea14.15.113.156.sea1.dsl-verizon.net ([4.15.113.156] helo=[192.168.2.13]) by fomax.lunarpages.com with esmtpa (Exim 4.44) id 1D3Tpx-0000Tz-Ax for pgsql-performance@postgresql.org; Mon, 21 Feb 2005 22:48:01 -0800 Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Reply-To: From: David Haas Subject: join vs. subquery Date: Mon, 21 Feb 2005 22:47:59 -0800 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.619.2) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - fomax.lunarpages.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - modelpredictivesystems.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.41 tagged_above=0 required=5 tests=REPLY_TO_EMPTY X-Spam-Level: * X-Archive-Number: 200502/313 X-Sequence-Number: 10642 Hi - This is based on a discussion I was having with neilc on IRC. He suggested I post it here. Sorry for the length - I'm including everything he requested. I'm comparing the speeds of the following two queries. I was curious why query 1 was faster than query 2: query 1: Select layer_number FROM batch_report_index WHERE device_id = (SELECT device_id FROM device_index WHERE device_name ='CP8M') AND technology_id = (SELECT technology_id FROM technology_index WHERE technology_name = 'G12'); query 2: Select b.layer_number FROM batch_report_index b, device_index d, technology_index t WHERE b.device_id = d.device_id AND b.technology_id = t.technology_id AND d.device_name = 'CP8M' AND t.technology_name = 'G12'; Here were my first runs: (query 1 explain analyze) Seq Scan on batch_report_index (cost=6.05..12370.66 rows=83 width=4) (actual time=19.274..1903.110 rows=61416 loops=1) Filter: ((device_id = $0) AND (technology_id = $1)) InitPlan -> Index Scan using device_index_device_name_key on device_index (cost=0.00..4.88 rows=1 width=4) (actual time=0.310..0.320 rows=1 loops=1) Index Cond: (device_name = 'CP8M'::text) -> Seq Scan on technology_index (cost=0.00..1.18 rows=1 width=4) (actual time=0.117..0.149 rows=1 loops=1) Filter: (technology_name = 'G12'::text) Total runtime: 1947.896 ms (8 rows) (query 2 explain analyze) Hash Join (cost=6.06..12380.70 rows=46 width=4) (actual time=35.509..2831.685 rows=61416 loops=1) Hash Cond: ("outer".technology_id = "inner".technology_id) -> Hash Join (cost=4.88..12375.87 rows=638 width=8) (actual time=34.584..2448.862 rows=61416 loops=1) Hash Cond: ("outer".device_id = "inner".device_id) -> Seq Scan on batch_report_index b (cost=0.00..10182.74 rows=436374 width=12) (actual time=0.100..1373.085 rows=436374 loops=1) -> Hash (cost=4.88..4.88 rows=1 width=4) (actual time=0.635..0.635 rows=0 loops=1) -> Index Scan using device_index_device_name_key on device_index d (cost=0.00..4.88 rows=1 width=4) (actual time=0.505..0.520 rows=1 loops=1) Index Cond: (device_name = 'CP8M'::text) -> Hash (cost=1.18..1.18 rows=1 width=4) (actual time=0.348..0.348 rows=0 loops=1) -> Seq Scan on technology_index t (cost=0.00..1.18 rows=1 width=4) (actual time=0.198..0.239 rows=1 loops=1) Filter: (technology_name = 'G12'::text) Total runtime: 2872.252 ms (12 rows) On neilc's suggestion, I did a vacuum analyze, then turned off hash joins. Here's query 2, no hash joins: (query 2 explain analyze) Nested Loop (cost=0.00..15651.44 rows=46 width=4) (actual time=22.079..2741.103 rows=61416 loops=1) Join Filter: ("inner".technology_id = "outer".technology_id) -> Seq Scan on technology_index t (cost=0.00..1.18 rows=1 width=4) (actual time=0.178..0.218 rows=1 loops=1) Filter: (technology_name = 'G12'::text) -> Nested Loop (cost=0.00..15642.29 rows=638 width=8) (actual time=21.792..2530.470 rows=61416 loops=1) Join Filter: ("inner".device_id = "outer".device_id) -> Index Scan using device_index_device_name_key on device_index d (cost=0.00..4.88 rows=1 width=4) (actual time=0.331..0.346 rows=1 loops=1) Index Cond: (device_name = 'CP8M'::text) -> Seq Scan on batch_report_index b (cost=0.00..10182.74 rows=436374 width=12) (actual time=0.070..1437.938 rows=436374 loops=1) Total runtime: 2782.628 ms (10 rows) He then suggested I turn hash_joins back on and put an index on the batch_report_table's device_id. Here's query 2 again: (query 2 explain analyze) Hash Join (cost=1.18..2389.06 rows=46 width=4) (actual time=1.562..2473.554 rows=61416 loops=1) Hash Cond: ("outer".technology_id = "inner".technology_id) -> Nested Loop (cost=0.00..2384.24 rows=638 width=8) (actual time=0.747..2140.160 rows=61416 loops=1) -> Index Scan using device_index_device_name_key on device_index d (cost=0.00..4.88 rows=1 width=4) (actual time=0.423..0.435 rows=1 loops=1) Index Cond: (device_name = 'CP8M'::text) -> Index Scan using b_r_device_index on batch_report_index b (cost=0.00..2365.82 rows=1083 width=12) (actual time=0.288..1868.118 rows=61416 loops=1) Index Cond: (b.device_id = "outer".device_id) -> Hash (cost=1.18..1.18 rows=1 width=4) (actual time=0.359..0.359 rows=0 loops=1) -> Seq Scan on technology_index t (cost=0.00..1.18 rows=1 width=4) (actual time=0.198..0.237 rows=1 loops=1) Filter: (technology_name = 'G12'::text) Total runtime: 2515.950 ms (11 rows) He then suggested I increase the statistics on batch_report_index & run the query again. I "set statistics" for both the device_id and technology_id column to 900, vacuum analyzed, and re-ran the query (it's still slower than query 1 run after the same contortions ): (query 2 explain analyze) Hash Join (cost=1.18..1608.49 rows=46 width=4) (actual time=1.437..1499.414 rows=61416 loops=1) Hash Cond: ("outer".technology_id = "inner".technology_id) -> Nested Loop (cost=0.00..1603.66 rows=638 width=8) (actual time=0.613..1185.826 rows=61416 loops=1) -> Index Scan using device_index_device_name_key on device_index d (cost=0.00..4.88 rows=1 width=4) (actual time=0.246..0.259 rows=1 loops=1) Index Cond: (device_name = 'CP8M'::text) -> Index Scan using b_r_device_index on batch_report_index b (cost=0.00..1589.93 rows=708 width=12) (actual time=0.324..928.888 rows=61416 loops=1) Index Cond: (b.device_id = "outer".device_id) -> Hash (cost=1.18..1.18 rows=1 width=4) (actual time=0.358..0.358 rows=0 loops=1) -> Seq Scan on technology_index t (cost=0.00..1.18 rows=1 width=4) (actual time=0.196..0.238 rows=1 loops=1) Filter: (technology_name = 'G12'::text) Total runtime: 1538.302 ms At this point, he said "send it to the -perform mailing list". So here I am. The relevant table schemas as of right now: reg=# \d batch_report_index Table "public.batch_report_index" Column | Type | Modifiers -----------------+------------------------ +--------------------------------------------------------------------- batch_report_id | integer | not null default nextval('"batch_report__batch_report__seq"'::text) lot | character varying(16) | tool_id | integer | not null technology_id | integer | not null device_id | integer | not null reticle_id | integer | not null layer_id | integer | not null layer_number | integer | not null image_id | integer | start_date | date | start_time | time without time zone | stop_date | date | stop_time | time without time zone | in_system | boolean | default false Indexes: "batch_report_index_pkey" primary key, btree (batch_report_id) "b_r_device_index" btree (device_id) "batch_report_stop_date_indexing" btree (stop_date) "batch_report_tool_id_index" btree (tool_id) reg=# \d technology_index Table "public.technology_index" Column | Type | Modifiers -----------------+--------- +--------------------------------------------------------------------- technology_id | integer | not null default nextval('"technology_in_technology_id_seq"'::text) technology_name | text | not null Indexes: "technology_index_pkey" primary key, btree (technology_id) "technology_in_technology_na_key" unique, btree (technology_name) reg=# \d device_index Table "public.device_index" Column | Type | Modifiers -------------+--------- +---------------------------------------------------------------- device_id | integer | not null default nextval('"device_index_device_id_seq"'::text) device_name | text | not null Indexes: "device_index_pkey" primary key, btree (device_id) "device_index_device_name_key" unique, btree (device_name) Thanks for the great work y'all do! From pgsql-performance-owner@postgresql.org Wed Feb 23 06:34:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6DD458B9D95 for ; Tue, 22 Feb 2005 07:05:21 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36346-09 for ; Tue, 22 Feb 2005 07:05:11 +0000 (GMT) Received: from fomax.lunarpages.com (fomax.lunarpages.com [216.193.229.83]) by svr1.postgresql.org (Postfix) with ESMTP id 4C7098B9DFA for ; Tue, 22 Feb 2005 07:05:12 +0000 (GMT) Received: from wbar10.sea14.15.113.156.sea1.dsl-verizon.net ([4.15.113.156] helo=[192.168.2.13]) by fomax.lunarpages.com with esmtpa (Exim 4.44) id 1D3U6Y-0003uu-Pv for pgsql-performance@postgresql.org; Mon, 21 Feb 2005 23:05:11 -0800 Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Reply-To: From: David Haas Subject: subquery vs join on 7.4.5 Date: Mon, 21 Feb 2005 23:05:08 -0800 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.619.2) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - fomax.lunarpages.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - modelpredictivesystems.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.41 tagged_above=0 required=5 tests=AWL, REPLY_TO_EMPTY X-Spam-Level: * X-Archive-Number: 200502/311 X-Sequence-Number: 10640 Hi - This is based on a discussion I was having with neilc on IRC. He suggested I post it here. Sorry for the length - I'm including everything he requested I'm comparing the speeds of the following two queries on 7.4.5. I was curious why query 1 was faster than query 2: query 1: Select layer_number FROM batch_report_index WHERE device_id = (SELECT device_id FROM device_index WHERE device_name ='CP8M') AND technology_id = (SELECT technology_id FROM technology_index WHERE technology_name = 'G12'); query 2: Select b.layer_number FROM batch_report_index b, device_index d, technology_index t WHERE b.device_id = d.device_id AND b.technology_id = t.technology_id AND d.device_name = 'CP8M' AND t.technology_name = 'G12'; Here were my first runs: (query 1 explain analyze) Seq Scan on batch_report_index (cost=6.05..12370.66 rows=83 width=4) (actual time=19.274..1903.110 rows=61416 loops=1) Filter: ((device_id = $0) AND (technology_id = $1)) InitPlan -> Index Scan using device_index_device_name_key on device_index (cost=0.00..4.88 rows=1 width=4) (actual time=0.310..0.320 rows=1 loops=1) Index Cond: (device_name = 'CP8M'::text) -> Seq Scan on technology_index (cost=0.00..1.18 rows=1 width=4) (actual time=0.117..0.149 rows=1 loops=1) Filter: (technology_name = 'G12'::text) Total runtime: 1947.896 ms (8 rows) (query 2 explain analyze) Hash Join (cost=6.06..12380.70 rows=46 width=4) (actual time=35.509..2831.685 rows=61416 loops=1) Hash Cond: ("outer".technology_id = "inner".technology_id) -> Hash Join (cost=4.88..12375.87 rows=638 width=8) (actual time=34.584..2448.862 rows=61416 loops=1) Hash Cond: ("outer".device_id = "inner".device_id) -> Seq Scan on batch_report_index b (cost=0.00..10182.74 rows=436374 width=12) (actual time=0.100..1373.085 rows=436374 loops=1) -> Hash (cost=4.88..4.88 rows=1 width=4) (actual time=0.635..0.635 rows=0 loops=1) -> Index Scan using device_index_device_name_key on device_index d (cost=0.00..4.88 rows=1 width=4) (actual time=0.505..0.520 rows=1 loops=1) Index Cond: (device_name = 'CP8M'::text) -> Hash (cost=1.18..1.18 rows=1 width=4) (actual time=0.348..0.348 rows=0 loops=1) -> Seq Scan on technology_index t (cost=0.00..1.18 rows=1 width=4) (actual time=0.198..0.239 rows=1 loops=1) Filter: (technology_name = 'G12'::text) Total runtime: 2872.252 ms (12 rows) On neilc's suggestion, I did a vacuum analyze, then turned off hash joins. Here's query 2, no hash joins: (query 2 explain analyze) Nested Loop (cost=0.00..15651.44 rows=46 width=4) (actual time=22.079..2741.103 rows=61416 loops=1) Join Filter: ("inner".technology_id = "outer".technology_id) -> Seq Scan on technology_index t (cost=0.00..1.18 rows=1 width=4) (actual time=0.178..0.218 rows=1 loops=1) Filter: (technology_name = 'G12'::text) -> Nested Loop (cost=0.00..15642.29 rows=638 width=8) (actual time=21.792..2530.470 rows=61416 loops=1) Join Filter: ("inner".device_id = "outer".device_id) -> Index Scan using device_index_device_name_key on device_index d (cost=0.00..4.88 rows=1 width=4) (actual time=0.331..0.346 rows=1 loops=1) Index Cond: (device_name = 'CP8M'::text) -> Seq Scan on batch_report_index b (cost=0.00..10182.74 rows=436374 width=12) (actual time=0.070..1437.938 rows=436374 loops=1) Total runtime: 2782.628 ms (10 rows) He then suggested I turn hash_joins back on and put an index on the batch_report_table's device_id. Here's query 2 again: (query 2 explain analyze) Hash Join (cost=1.18..2389.06 rows=46 width=4) (actual time=1.562..2473.554 rows=61416 loops=1) Hash Cond: ("outer".technology_id = "inner".technology_id) -> Nested Loop (cost=0.00..2384.24 rows=638 width=8) (actual time=0.747..2140.160 rows=61416 loops=1) -> Index Scan using device_index_device_name_key on device_index d (cost=0.00..4.88 rows=1 width=4) (actual time=0.423..0.435 rows=1 loops=1) Index Cond: (device_name = 'CP8M'::text) -> Index Scan using b_r_device_index on batch_report_index b (cost=0.00..2365.82 rows=1083 width=12) (actual time=0.288..1868.118 rows=61416 loops=1) Index Cond: (b.device_id = "outer".device_id) -> Hash (cost=1.18..1.18 rows=1 width=4) (actual time=0.359..0.359 rows=0 loops=1) -> Seq Scan on technology_index t (cost=0.00..1.18 rows=1 width=4) (actual time=0.198..0.237 rows=1 loops=1) Filter: (technology_name = 'G12'::text) Total runtime: 2515.950 ms (11 rows) He then suggested I increase the statistics on batch_report_index & run the query again. I "set statistics" for both the device_id and technology_id column to 900, vacuum analyzed, and re-ran the query (it's still slower than query 1 run after the same contortions ): (query 2 explain analyze) Hash Join (cost=1.18..1608.49 rows=46 width=4) (actual time=1.437..1499.414 rows=61416 loops=1) Hash Cond: ("outer".technology_id = "inner".technology_id) -> Nested Loop (cost=0.00..1603.66 rows=638 width=8) (actual time=0.613..1185.826 rows=61416 loops=1) -> Index Scan using device_index_device_name_key on device_index d (cost=0.00..4.88 rows=1 width=4) (actual time=0.246..0.259 rows=1 loops=1) Index Cond: (device_name = 'CP8M'::text) -> Index Scan using b_r_device_index on batch_report_index b (cost=0.00..1589.93 rows=708 width=12) (actual time=0.324..928.888 rows=61416 loops=1) Index Cond: (b.device_id = "outer".device_id) -> Hash (cost=1.18..1.18 rows=1 width=4) (actual time=0.358..0.358 rows=0 loops=1) -> Seq Scan on technology_index t (cost=0.00..1.18 rows=1 width=4) (actual time=0.196..0.238 rows=1 loops=1) Filter: (technology_name = 'G12'::text) Total runtime: 1538.302 ms At this point, he said "send it to the -perform mailing list". So here I am. The relevant table schemas as of right now: reg=# \d batch_report_index Table "public.batch_report_index" Column | Type | Modifiers -----------------+------------------------ +--------------------------------------------------------------------- batch_report_id | integer | not null default nextval('"batch_report__batch_report__seq"'::text) lot | character varying(16) | tool_id | integer | not null technology_id | integer | not null device_id | integer | not null reticle_id | integer | not null layer_id | integer | not null layer_number | integer | not null image_id | integer | start_date | date | start_time | time without time zone | stop_date | date | stop_time | time without time zone | in_system | boolean | default false Indexes: "batch_report_index_pkey" primary key, btree (batch_report_id) "b_r_device_index" btree (device_id) "batch_report_stop_date_indexing" btree (stop_date) "batch_report_tool_id_index" btree (tool_id) reg=# \d technology_index Table "public.technology_index" Column | Type | Modifiers -----------------+--------- +--------------------------------------------------------------------- technology_id | integer | not null default nextval('"technology_in_technology_id_seq"'::text) technology_name | text | not null Indexes: "technology_index_pkey" primary key, btree (technology_id) "technology_in_technology_na_key" unique, btree (technology_name) reg=# \d device_index Table "public.device_index" Column | Type | Modifiers -------------+--------- +---------------------------------------------------------------- device_id | integer | not null default nextval('"device_index_device_id_seq"'::text) device_name | text | not null Indexes: "device_index_pkey" primary key, btree (device_id) "device_index_device_name_key" unique, btree (device_name) Thanks for the great work y'all do! From pgsql-performance-owner@postgresql.org Wed Feb 23 06:28:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A65E48B9E74 for ; Tue, 22 Feb 2005 14:58:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87653-10 for ; Tue, 22 Feb 2005 14:58:24 +0000 (GMT) Received: from mailin4.audi.de (mailin4.audi.de [143.164.102.18]) by svr1.postgresql.org (Postfix) with ESMTP id 336018B9DCB for ; Tue, 22 Feb 2005 14:58:26 +0000 (GMT) Received: from mailin2.audi.de (inwlbesi2n10-proxy-ip1.web.audi.vwg [10.198.7.251]) by mailin4.audi.de (Postfix) with ESMTP id BB466E9570 for ; Tue, 22 Feb 2005 15:58:25 +0100 (CET) Message-ID: <977921B17B2F2048AA5AAE9B4CBB713E01423D1E@huaudigs0035.audi.de> From: "Vig, Sandor (G/FI-2)" To: "'pgsql-performance@postgresql.org'" Subject: PostgreSQL is extremely slow on Windows Date: Tue, 22 Feb 2005 15:58:23 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/310 X-Sequence-Number: 10639 Hi, I've downloaded the latest release (PostgreSQL 8.0) for windows. Installation was OK, but I have tried to restore a database. It had more than ~100.000 records. Usually I use PostgreSQL under Linux, and it used to be done under 10 minutes. Under W2k und XP it took 3 hours(!) Why is it so slow???? The commands I used: Under Linux: (duration: 1 minute) pg_dump -D databasename > databasename.db Under Windows: (duration: 3 - 3.5 hours(!)) psql databasename < databasename.db >nul It seemed to me, that only 20-30 transactions/sec were writen to the database. I need to write scripts for automatic (sheduled) database backup and recovery. Help anyone? Bye, Vig S=E1ndor The information transmitted is intended only for the person or entity = to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you = received this in error, please contact the sender and delete the material from = any computer. From pgsql-performance-owner@postgresql.org Tue Feb 22 15:01:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3B8F38B9E40 for ; Tue, 22 Feb 2005 15:01:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90991-09 for ; Tue, 22 Feb 2005 15:00:56 +0000 (GMT) Received: from mailin4.audi.de (mailin4.audi.de [143.164.102.18]) by svr1.postgresql.org (Postfix) with ESMTP id 365AD8B9CC0 for ; Tue, 22 Feb 2005 15:01:00 +0000 (GMT) Received: from mailin1.audi.de (inwlbesi2n10-proxy-ip2.web.audi.vwg [10.198.7.252]) by mailin4.audi.de (Postfix) with ESMTP id A21E6E975A for ; Tue, 22 Feb 2005 16:01:00 +0100 (CET) Message-ID: <977921B17B2F2048AA5AAE9B4CBB713E01423D1F@huaudigs0035.audi.de> From: "Vig, Sandor (G/FI-2)" To: "'pgsql-performance@postgresql.org'" Subject: PostgreSQL is extremely slow on Windows Date: Tue, 22 Feb 2005 16:00:59 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/294 X-Sequence-Number: 10623 Hi, I've downloaded the latest release (PostgreSQL 8.0) for windows. Installation was OK, but I have tried to restore a database. It had more than ~100.000 records. Usually I use PostgreSQL under Linux, and it used to be done under 10 minutes. Under W2k und XP it took 3 hours(!) Why is it so slow???? The commands I used: Under Linux: (duration: 1 minute) pg_dump -D databasename > databasename.db Under Windows: (duration: 3 - 3.5 hours(!)) psql databasename < databasename.db >nul It seemed to me, that only 20-30 transactions/sec were writen to the database. I need to write scripts for automatic (sheduled) database backup and recovery. Help anyone? Bye, Vig S=E1ndor The information transmitted is intended only for the person or entity = to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you = received this in error, please contact the sender and delete the material from = any computer. The information transmitted is intended only for the person or entity = to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you = received this in error, please contact the sender and delete the material from = any computer. From pgsql-performance-owner@postgresql.org Tue Feb 22 15:34:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 524418B9E08 for ; Tue, 22 Feb 2005 15:34:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03688-04 for ; Tue, 22 Feb 2005 15:34:32 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 2EED78B9E01 for ; Tue, 22 Feb 2005 15:34:33 +0000 (GMT) Received: (qmail 21804 invoked from network); 22 Feb 2005 15:37:20 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 22 Feb 2005 15:37:20 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 21152-18 for ; Tue, 22 Feb 2005 22:37:20 +0700 (ICT) Received: (qmail 21794 invoked from network); 22 Feb 2005 15:37:19 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 22 Feb 2005 15:37:19 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Tue, 22 Feb 2005 22:37:19 +0700 Message-ID: <1109086639.421b51af6edd4@webmail.moph.go.th> Date: Tue, 22 Feb 2005 22:37:19 +0700 From: amrit@health2.moph.go.th To: PGsql-performance Cc: Mark Kirkwood Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function References: <1108914570.4218b18a2cf0d@webmail.moph.go.th> <42191623.7060401@coretech.co.nz> <1108949685.42193ab53e07c@webmail.moph.go.th> <421A4F96.60803@coretech.co.nz> <1109048458.421abc8a280ed@webmail.moph.go.th> <421AC6F3.5010102@coretech.co.nz> In-Reply-To: <421AC6F3.5010102@coretech.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=AWL, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200502/295 X-Sequence-Number: 10624 > > I used you perl script and found the error => > > [root@samba tmp]# perl relacl.pl > > DBI connect('dbname=template1;port=5432','postgres',...) failed: FATAL: > IDENT > > authentication failed for user "postgres" at relacl.pl line 21 > > Error in connect to DBI:Pg:dbname=template1;port=5432: > > > > > Excellent - we know what is going on now! > > > > And my pg_hba.conf is > > > > # IPv4-style local connections: > > host all all 127.0.0.1 255.255.255.255 trust > > host all all 192.168.0.0 255.255.0.0 trust > > > > trusted for every user. > > Ok, what I think has happened is that there is another Pg installation > (or another initdb'ed cluster) on this machine that you are accidentally > talking to. Try > > $ rpm -qa|grep -i postgres > > which will spot another software installation, you may just have to > search for files called pg_hba.conf to find another initdb'ed cluster.... > > This other installation should have a pg_hba.conf that looks something > like : > > local all all ident > host all all 127.0.0.1 255.255.255.255 ident > > So a bit of detective work is in order :-) > > Mark After being a detector I found that [root@samba ~]# rpm -qa|grep -i postgres postgresql-7.4.5-3.1.tlc postgresql-python-7.4.5-3.1.tlc postgresql-jdbc-7.4.5-3.1.tlc postgresql-tcl-7.4.5-3.1.tlc postgresql-server-7.4.5-3.1.tlc postgresql-libs-7.4.5-3.1.tlc postgresql-docs-7.4.5-3.1.tlc postgresql-odbc-7.3-8.1.tlc postgresql-pl-7.4.5-3.1.tlc postgresql-test-7.4.5-3.1.tlc postgresql-contrib-7.4.5-3.1.tlc [root@samba ~]# no other pg installation except the pgsql for windows in samba folder which I think it isn't matter ,is it? No other pg being run. [root@samba ~]# ps ax|grep postmaster 2228 ? S 0:00 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data 3308 pts/0 S+ 0:00 grep postmaster [root@samba ~]# Is it possible that it is related to pg_ident.conf ? Any comment please. Amrit,Thailand From pgsql-performance-owner@postgresql.org Tue Feb 22 16:30:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A2C268B9B44 for ; Tue, 22 Feb 2005 16:30:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19561-10 for ; Tue, 22 Feb 2005 16:30:30 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id 2803F8B9E6E for ; Tue, 22 Feb 2005 16:30:29 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 36so777631wri for ; Tue, 22 Feb 2005 08:30:28 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=nMH2owZ+x4qEJsT7pwW6T7hDT9lbb4acs+7uNXzF78/3cj4uY7FUvDznulAeCmOPHrtqcKgyG3Qm7HYz9t//OXCqj1grmhcPlpdGJAudr1JEkrWBYTZJKJrg9G9zk1+FQreKMGGQI+PJ8mPxEZizJhFUVnTTRMfvIlLQXWg+p7A= Received: by 10.54.20.21 with SMTP id 21mr212343wrt; Tue, 22 Feb 2005 08:30:28 -0800 (PST) Received: by 10.54.59.22 with HTTP; Tue, 22 Feb 2005 08:30:28 -0800 (PST) Message-ID: <330532b6050222083077aa5c2a@mail.gmail.com> Date: Tue, 22 Feb 2005 11:30:28 -0500 From: Mitch Pirtle Reply-To: Mitch Pirtle To: "Vig, Sandor (G/FI-2)" Subject: Re: PostgreSQL is extremely slow on Windows Cc: "pgsql-performance@postgresql.org" In-Reply-To: <977921B17B2F2048AA5AAE9B4CBB713E01423D1F@huaudigs0035.audi.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <977921B17B2F2048AA5AAE9B4CBB713E01423D1F@huaudigs0035.audi.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.063 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/296 X-Sequence-Number: 10625 On Tue, 22 Feb 2005 16:00:59 +0100, Vig, Sandor (G/FI-2) wrote: > > > Hi, > > I've downloaded the latest release (PostgreSQL 8.0) for windows. > Installation was OK, but I have tried to restore a database. > It had more than ~100.000 records. Usually I use PostgreSQL > under Linux, and it used to be done under 10 minutes. > > Under W2k und XP it took 3 hours(!) Why is it so slow???? Can you tell us your postgresql.conf configuration settings? We cannot help without some information about your environment... -- Mitch From pgsql-performance-owner@postgresql.org Tue Feb 22 18:18:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 352978B9EB6 for ; Tue, 22 Feb 2005 18:15:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53816-10 for ; Tue, 22 Feb 2005 18:15:17 +0000 (GMT) Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id C9D0C8B9E6F for ; Tue, 22 Feb 2005 18:15:16 +0000 (GMT) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 2DD5E8F287; Tue, 22 Feb 2005 19:15:14 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: PostgreSQL is extremely slow on Windows Date: Tue, 22 Feb 2005 19:15:13 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE476962@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PostgreSQL is extremely slow on Windows Thread-Index: AcUY8VYHMqXPB4a6Qk2txWPrRM55xAAGL7PQ From: "Magnus Hagander" To: "Vig, Sandor (G/FI-2)" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.073 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/297 X-Sequence-Number: 10626 >I've downloaded the latest release (PostgreSQL 8.0) for windows. >Installation was OK, but I have tried to restore a database. >It had more than ~100.000 records. Usually I use PostgreSQL >under Linux, and it used to be done under 10 minutes. > >Under W2k und XP it took 3 hours(!) Why is it so slow???? > >The commands I used: > >Under Linux: (duration: 1 minute) > pg_dump -D databasename > databasename.db > >Under Windows: (duration: 3 - 3.5 hours(!)) > psql databasename < databasename.db >nul > >It seemed to me, that only 20-30 transactions/sec were >writen to the database. 20-30 transactionsi s about what you'll get on a single disk on Windows today. We have a patch in testing that will bring this up to about 80. You can *never* get above 80 without using write cache, regardless of your OS, if you have a single disk. You might want to look into wether write cacheing is enabled on your linux box, and disable it. (unless you are using RAID) A lot points towards write cache enabled on your system. If you need the performance that equals the one with write cache on, you can set fsync=3Doff. But then you will lose the guarantee that your machine will survive an unclean shutdown or crash. I would strongly advice against it on a production system - same goes for running with write cache! //Magnus From pgsql-performance-owner@postgresql.org Tue Feb 22 19:48:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 81DDE8B9CC9 for ; Tue, 22 Feb 2005 19:48:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84894-07 for ; Tue, 22 Feb 2005 19:48:06 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7833E8B9CA0 for ; Tue, 22 Feb 2005 19:48:07 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id E83C231FE4; Tue, 22 Feb 2005 20:48:05 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: is pg_autovacuum so effective ? Date: Tue, 22 Feb 2005 20:47:27 +0100 Organization: Hub.Org Networking Services Lines: 162 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/298 X-Sequence-Number: 10627 Hi all, I'm running since one week without use any vacuum full, I'm using ony pg_autovacuum. I expect that disk usage will reach a steady state but is not. PG engine: 7.4.5 Example: The message table is touched by pg_autvacuum at least 2 time a day: $ cat pg_autovacuum.log | grep VACUUM | grep messages [2005-02-15 16:41:00 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-16 03:31:47 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-16 12:44:18 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-16 23:26:09 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-17 09:25:41 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-17 19:57:11 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-18 05:38:46 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-18 14:28:55 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-19 02:22:20 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-19 13:43:02 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-20 02:05:40 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-20 14:06:33 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-20 23:54:32 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-21 08:57:20 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-21 19:24:53 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-22 05:25:03 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-22 15:20:39 CET] Performing: VACUUM ANALYZE "public"."messages" this is what gave me the vacuum full on that table: # vacuum full verbose messages; INFO: vacuuming "public.messages" INFO: "messages": found 77447 removable, 1606437 nonremovable row versions in 69504 pages DETAIL: 0 dead row versions cannot be removed yet. Nonremovable row versions range from 97 to 2033 bytes long. There were 633541 unused item pointers. Total free space (including removable row versions) is 52819600 bytes. 1690 pages are or will become empty, including 0 at the end of the table. 22217 pages containing 51144248 free bytes are potential move destinations. CPU 2.39s/0.55u sec elapsed 31.90 sec. INFO: index "idx_type_message" now contains 1606437 row versions in 7337 pages DETAIL: 77447 index row versions were removed. 446 index pages have been deleted, 446 are currently reusable. CPU 0.33s/0.75u sec elapsed 16.56 sec. INFO: index "messages_pkey" now contains 1606437 row versions in 5628 pages DETAIL: 77447 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.15s/0.80u sec elapsed 4.22 sec. INFO: index "idx_service_message" now contains 1606437 row versions in 6867 pages DETAIL: 77447 index row versions were removed. 499 index pages have been deleted, 499 are currently reusable. CPU 0.67s/0.99u sec elapsed 8.85 sec. INFO: index "idx_service_message_expired" now contains 135313 row versions in 3308 pages DETAIL: 77375 index row versions were removed. 512 index pages have been deleted, 512 are currently reusable. CPU 0.21s/0.32u sec elapsed 6.88 sec. INFO: index "idx_expired_messages" now contains 1606437 row versions in 7070 pages DETAIL: 77447 index row versions were removed. 448 index pages have been deleted, 448 are currently reusable. CPU 0.34s/1.10u sec elapsed 29.77 sec. INFO: index "idx_messages_target" now contains 1606437 row versions in 14480 pages DETAIL: 77447 index row versions were removed. 643 index pages have been deleted, 643 are currently reusable. CPU 0.84s/1.61u sec elapsed 25.72 sec. INFO: index "idx_messages_source" now contains 1606437 row versions in 10635 pages DETAIL: 77447 index row versions were removed. 190 index pages have been deleted, 190 are currently reusable. CPU 0.68s/1.04u sec elapsed 31.96 sec. INFO: "messages": moved 55221 row versions, truncated 69504 to 63307 pages DETAIL: CPU 5.46s/25.14u sec elapsed 280.20 sec. INFO: index "idx_type_message" now contains 1606437 row versions in 7337 pages DETAIL: 55221 index row versions were removed. 2304 index pages have been deleted, 2304 are currently reusable. CPU 0.42s/0.49u sec elapsed 53.35 sec. INFO: index "messages_pkey" now contains 1606437 row versions in 5628 pages DETAIL: 55221 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.31s/0.34u sec elapsed 13.27 sec. INFO: index "idx_service_message" now contains 1606437 row versions in 6867 pages DETAIL: 55221 index row versions were removed. 2024 index pages have been deleted, 2024 are currently reusable. CPU 0.51s/0.57u sec elapsed 16.60 sec. INFO: index "idx_service_message_expired" now contains 135313 row versions in 3308 pages DETAIL: 41411 index row versions were removed. 1918 index pages have been deleted, 1918 are currently reusable. CPU 0.30s/0.31u sec elapsed 36.01 sec. INFO: index "idx_expired_messages" now contains 1606437 row versions in 7064 pages DETAIL: 55221 index row versions were removed. 2166 index pages have been deleted, 2166 are currently reusable. CPU 0.94s/0.58u sec elapsed 34.97 sec. INFO: index "idx_messages_target" now contains 1606437 row versions in 14480 pages DETAIL: 55221 index row versions were removed. 3404 index pages have been deleted, 3404 are currently reusable. CPU 0.99s/1.03u sec elapsed 50.53 sec. INFO: index "idx_messages_source" now contains 1606437 row versions in 10635 pages DETAIL: 55221 index row versions were removed. 1809 index pages have been deleted, 1809 are currently reusable. CPU 0.84s/1.04u sec elapsed 35.44 sec. INFO: vacuuming "pg_toast.pg_toast_18376" INFO: "pg_toast_18376": found 0 removable, 1 nonremovable row versions in 1 pages DETAIL: 0 dead row versions cannot be removed yet. Nonremovable row versions range from 1976 to 1976 bytes long. There were 0 unused item pointers. Total free space (including removable row versions) is 6192 bytes. 0 pages are or will become empty, including 0 at the end of the table. 1 pages containing 6192 free bytes are potential move destinations. CPU 0.00s/0.00u sec elapsed 0.02 sec. INFO: index "pg_toast_18376_index" now contains 1 row versions in 2 pages DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.03 sec. INFO: "pg_toast_18376": moved 0 row versions, truncated 1 to 1 pages DETAIL: CPU 0.00s/0.00u sec elapsed 0.00 sec. VACUUM pg_class after the vacuum full for that table relfilenode | relname | relpages | reltuples -------------+----------+----------+------------- 18376 | messages | 63307 | 1.60644e+06 pg_class before the vacuum full for that table relfilenode | relname | relpages | reltuples -------------+----------+----------+------------- 18376 | messages | 69472 | 1.60644e+06 how was possible accumulate 6000 pages wasted on that table? Between these two calls: [2005-02-22 05:25:03 CET] Performing: VACUUM ANALYZE "public"."messages" [2005-02-22 15:20:39 CET] Performing: VACUUM ANALYZE "public"."messages" 1768 rows where inserted, and I had 21578 updated for that rows ( each row have a counter incremented for each update ) so that table is not so heavy updated I'm running autovacuum with these parameters: pg_autovacuum -d 3 -v 300 -V 0.1 -S 0.8 -a 200 -A 0.1 -D shall I run it in a more aggressive way ? May be I'm missing something. Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Tue Feb 22 20:07:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D2C748B9D47 for ; Tue, 22 Feb 2005 20:07:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92469-05 for ; Tue, 22 Feb 2005 20:07:22 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id E46F68B9D38 for ; Tue, 22 Feb 2005 20:07:22 +0000 (GMT) Received: (qmail 16787 invoked from network); 22 Feb 2005 20:07:10 -0000 Received: from 218-101-14-81.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.81) by 0 with SMTP; 22 Feb 2005 20:07:10 -0000 Message-ID: <421B90F4.9000707@coretech.co.nz> Date: Wed, 23 Feb 2005 09:07:16 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function References: <1108914570.4218b18a2cf0d@webmail.moph.go.th> <42191623.7060401@coretech.co.nz> <1108949685.42193ab53e07c@webmail.moph.go.th> <421A4F96.60803@coretech.co.nz> <1109048458.421abc8a280ed@webmail.moph.go.th> <421AC6F3.5010102@coretech.co.nz> <1109086639.421b51af6edd4@webmail.moph.go.th> In-Reply-To: <1109086639.421b51af6edd4@webmail.moph.go.th> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/299 X-Sequence-Number: 10628 amrit@health2.moph.go.th wrote: > After being a detector I found that > [root@samba ~]# rpm -qa|grep -i postgres > postgresql-7.4.5-3.1.tlc > postgresql-python-7.4.5-3.1.tlc > postgresql-jdbc-7.4.5-3.1.tlc > postgresql-tcl-7.4.5-3.1.tlc > postgresql-server-7.4.5-3.1.tlc > postgresql-libs-7.4.5-3.1.tlc > postgresql-docs-7.4.5-3.1.tlc > postgresql-odbc-7.3-8.1.tlc > postgresql-pl-7.4.5-3.1.tlc > postgresql-test-7.4.5-3.1.tlc > postgresql-contrib-7.4.5-3.1.tlc > [root@samba ~]# > > no other pg installation except the pgsql for windows in samba folder which I > think it isn't matter ,is it? > No other pg being run. > [root@samba ~]# ps ax|grep postmaster > 2228 ? S 0:00 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data > 3308 pts/0 S+ 0:00 grep postmaster > [root@samba ~]# > Well, sure looks like you only have one running. Your data directory is /var/lib/pgsql/data so lets see the files: /var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/data/pg_ident.conf /var/lib/pgsql/data/postmaster.opts Might also be useful to know any nondefault settings in postgresql.conf too. As I understand it, these vendor shipped rpms have ident *enabled*. I will download FC3 Pg and check this out... I'm a compile it from source guy :-) Mark From pgsql-performance-owner@postgresql.org Tue Feb 22 20:56:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1C7F78B9CF6 for ; Tue, 22 Feb 2005 20:56:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08912-06 for ; Tue, 22 Feb 2005 20:56:02 +0000 (GMT) Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by svr1.postgresql.org (Postfix) with ESMTP id D8F958B9CA2 for ; Tue, 22 Feb 2005 20:56:02 +0000 (GMT) Received: from ool-4350c7ad.dyn.optonline.net ([67.80.199.173] helo=[192.168.0.66]) by outbound.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.44) id 1D3h4c-000DeG-4P; Tue, 22 Feb 2005 15:56:02 -0500 Message-ID: <421B9CD9.6090703@zeut.net> Date: Tue, 22 Feb 2005 15:58:01 -0500 From: "Matthew T. O'Connor" Organization: Terrie O'Connor Realtors User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gaetano Mendola Cc: pgsql-performance@postgresql.org Subject: Re: is pg_autovacuum so effective ? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mail-Handler: MailHop Outbound by DynDNS.org X-Originating-IP: 67.80.199.173 X-Report-Abuse-To: abuse@dyndns.org (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: zeut X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/300 X-Sequence-Number: 10629 Gaetano Mendola wrote: >pg_class after the vacuum full for that table > > relfilenode | relname | relpages | reltuples >-------------+----------+----------+------------- > 18376 | messages | 63307 | 1.60644e+06 > > >pg_class before the vacuum full for that table > > relfilenode | relname | relpages | reltuples >-------------+----------+----------+------------- > 18376 | messages | 69472 | 1.60644e+06 > > > >how was possible accumulate 6000 pages wasted on that table? > >Between these two calls: >[2005-02-22 05:25:03 CET] Performing: VACUUM ANALYZE "public"."messages" >[2005-02-22 15:20:39 CET] Performing: VACUUM ANALYZE "public"."messages" > >1768 rows where inserted, and I had 21578 updated for that rows ( each >row have a counter incremented for each update ) so that table is not >so heavy updated > >I'm running autovacuum with these parameters: >pg_autovacuum -d 3 -v 300 -V 0.1 -S 0.8 -a 200 -A 0.1 -D > > >shall I run it in a more aggressive way ? May be I'm missing >something. > Well without thinking too much, I would first ask about your FSM settings? If they aren't big enought that will cause bloat. Try bumping your FSM settings and then see if you reach steady state. From pgsql-performance-owner@postgresql.org Tue Feb 22 21:28:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DA65E8B9D5F for ; Tue, 22 Feb 2005 21:28:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19643-01 for ; Tue, 22 Feb 2005 21:28:09 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4F9F78B9C8C for ; Tue, 22 Feb 2005 21:28:10 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1MLS36R012401; Tue, 22 Feb 2005 16:28:03 -0500 (EST) To: Gaetano Mendola Cc: pgsql-performance@postgresql.org Subject: Re: is pg_autovacuum so effective ? In-reply-to: References: Comments: In-reply-to Gaetano Mendola message dated "Tue, 22 Feb 2005 20:47:27 +0100" Date: Tue, 22 Feb 2005 16:28:03 -0500 Message-ID: <12400.1109107683@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/301 X-Sequence-Number: 10630 Gaetano Mendola writes: > I'm using ony pg_autovacuum. I expect that disk usage will reach > a steady state but is not. PG engine: 7.4.5 One data point doesn't prove that you're not at a steady state. > # vacuum full verbose messages; > INFO: vacuuming "public.messages" > INFO: "messages": found 77447 removable, 1606437 nonremovable row versions in 69504 pages > ... > INFO: "messages": moved 55221 row versions, truncated 69504 to 63307 pages 10% overhead sounds fairly reasonable to me. How does that compare to the amount of updating you do on the table --- ie, do you turn over 10% of the table in a day? regards, tom lane From pgsql-performance-owner@postgresql.org Wed Feb 23 06:23:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 509B48B9B49 for ; Tue, 22 Feb 2005 22:08:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30668-06 for ; Tue, 22 Feb 2005 22:08:12 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 923F48B9E5B for ; Tue, 22 Feb 2005 22:08:12 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 8162531FE4; Tue, 22 Feb 2005 23:08:12 +0100 (MET) From: "Luke Chambers" X-Newsgroups: pgsql.performance Subject: Inefficient Query Plans Date: 22 Feb 2005 14:08:05 -0800 Organization: http://groups.google.com Lines: 270 Message-ID: <1109110085.769681.93070@g14g2000cwa.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Complaints-To: groups-abuse@google.com User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: g14g2000cwa.googlegroups.com; posting-host=65.77.250.21; posting-account=I-Krjg0AAACq3z4k5QcewfiQmSmcyykp To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/309 X-Sequence-Number: 10638 The following query plans both result from the very same query run on different servers. They obviously differ drastically, but I don't why as one db is a slonied copy of the other with identical postgresql.conf files. Both databases are vacuum analyzed nightly. Here is the query: ------------------------------------------------------------------------ EXPLAIN ANALYZE SELECT COUNT(DISTINCT(t.id)) FROM ( SELECT m_object_paper.id FROM m_object_paper, m_assignment, m_class, r_comment_rubric_user_object WHERE m_object_paper.assignment=m_assignment.id AND m_assignment.class=m_class.id AND m_class.account IN (SELECT * FROM children_of(32660) as acts) AND m_object_paper.id = r_comment_rubric_user_object.objectid UNION SELECT m_object_paper.id FROM m_object_paper, m_assignment, m_class, r_quickmark_user_object WHERE m_object_paper.assignment=m_assignment.id AND m_assignment.class=m_class.id AND m_class.account IN (SELECT * FROM children_of(32660) acts) AND m_object_paper.id = r_quickmark_user_object.objectid)as t; ------------------------------------------------------------------------ ------------------- DB1 QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=314616.49..314616.49 rows=1 width=4) (actual time=853.483..853.484 rows=1 loops=1) -> Subquery Scan t (cost=314568.97..314609.70 rows=2715 width=4) (actual time=848.574..852.912 rows=354 loops=1) -> Unique (cost=314568.97..314582.55 rows=2715 width=4) (actual time=848.568..852.352 rows=354 loops=1) -> Sort (cost=314568.97..314575.76 rows=2715 width=4) (actual time=848.565..850.264 rows=2428 loops=1) Sort Key: id -> Append (cost=153181.39..314414.12 rows=2715 width=4) (actual time=224.984..844.714 rows=2428 loops=1) -> Subquery Scan "*SELECT* 1" (cost=153181.39..159900.66 rows=2250 width=4) (actual time=224.981..700.687 rows=2116 loops=1) -> Hash Join (cost=153181.39..159878.16 rows=2250 width=4) (actual time=224.975..696.639 rows=2116 loops=1) Hash Cond: ("outer".objectid = "inner".id) -> Seq Scan on r_comment_rubric_user_object (cost=0.00..5144.18 rows=306018 width=4) (actual time=0.021..405.881 rows=306392 loops=1) -> Hash (cost=153072.40..153072.40 rows=43595 width=4) (actual time=32.311..32.311 rows=0 loops=1) -> Nested Loop (cost=15.00..153072.40 rows=43595 width=4) (actual time=0.554..29.762 rows=2033 loops=1) -> Nested Loop (cost=15.00..16071.65 rows=3412 width=4) (actual time=0.512..3.657 rows=180 loops=1) -> Nested Loop (cost=15.00..3769.73 rows=1666 width=4) (actual time=0.452..0.943 rows=50 loops=1) -> HashAggregate (cost=15.00..15.00 rows=200 width=4) (actual time=0.388..0.394 rows=1 loops=1) -> Function Scan on children_of acts (cost=0.00..12.50 rows=1000 width=4) (actual time=0.376..0.377 rows=1 loops=1) -> Index Scan using m_class_account_idx on m_class (cost=0.00..18.67 rows=8 width=8) (actual time=0.057..0.416 rows=50 loops=1) Index Cond: (m_class.account = "outer".acts) -> Index Scan using m_assignment_class_idx on m_assignment (cost=0.00..7.25 rows=11 width=8) (actual time=0.023..0.043 rows=4 loops=50) Index Cond: (m_assignment."class" = "outer".id) -> Index Scan using m_object_paper_assignment_idx on m_object_paper (cost=0.00..39.24 rows=73 width=8) (actual time=0.026..0.118 rows=11 loops=180) Index Cond: (m_object_paper."assignment" = "outer".id) -> Subquery Scan "*SELECT* 2" (cost=153181.39..154513.46 rows=465 width=4) (actual time=54.883..140.747 rows=312 loops=1) -> Hash Join (cost=153181.39..154508.81 rows=465 width=4) (actual time=54.875..140.161 rows=312 loops=1) Hash Cond: ("outer".objectid = "inner".id) -> Seq Scan on r_quickmark_user_object (cost=0.00..1006.85 rows=63185 width=4) (actual time=0.007..70.446 rows=63268 loops=1) -> Hash (cost=153072.40..153072.40 rows=43595 width=4) (actual time=17.633..17.633 rows=0 loops=1) -> Nested Loop (cost=15.00..153072.40 rows=43595 width=4) (actual time=0.549..15.186 rows=2033 loops=1) -> Nested Loop (cost=15.00..16071.65 rows=3412 width=4) (actual time=0.515..2.406 rows=180 loops=1) -> Nested Loop (cost=15.00..3769.73 rows=1666 width=4) (actual time=0.482..0.792 rows=50 loops=1) -> HashAggregate (cost=15.00..15.00 rows=200 width=4) (actual time=0.443..0.449 rows=1 loops=1) -> Function Scan on children_of acts (cost=0.00..12.50 rows=1000 width=4) (actual time=0.428..0.429 rows=1 loops=1) -> Index Scan using m_class_account_idx on m_class (cost=0.00..18.67 rows=8 width=8) (actual time=0.029..0.219 rows=50 loops=1) Index Cond: (m_class.account = "outer".acts) -> Index Scan using m_assignment_class_idx on m_assignment (cost=0.00..7.25 rows=11 width=8) (actual time=0.013..0.023 rows=4 loops=50) Index Cond: (m_assignment."class" = "outer".id) -> Index Scan using m_object_paper_assignment_idx on m_object_paper (cost=0.00..39.24 rows=73 width=8) (actual time=0.011..0.048 rows=11 loops=180) Index Cond: (m_object_paper."assignment" = "outer".id) Total runtime: 854.101 ms ------------------- DB2 QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=431500.82..431500.82 rows=1 width=4) (actual time=161604.563..161604.568 rows=1 loops=1) -> Subquery Scan t (cost=431025.16..431432.86 rows=27180 width=4) (actual time=161571.533..161602.095 rows=354 loops=1) -> Unique (cost=431025.16..431161.06 rows=27180 width=4) (actual time=161571.515..161598.311 rows=354 loops=1) -> Sort (cost=431025.16..431093.11 rows=27180 width=4) (actual time=161571.502..161583.783 rows=2428 loops=1) Sort Key: id -> Append (cost=203789.85..429023.32 rows=27180 width=4) (actual time=79513.023..161555.122 rows=2428 loops=1) -> Subquery Scan "*SELECT* 1" (cost=203789.85..216527.64 rows=22528 width=4) (actual time=79513.012..82516.102 rows=2116 loops=1) -> Hash Join (cost=203789.85..216302.36 rows=22528 width=4) (actual time=79512.998..82493.092 rows=2116 loops=1) Hash Cond: ("outer".objectid = "inner".id) -> Seq Scan on r_comment_rubric_user_object (cost=0.00..5133.34 rows=306034 width=4) (actual time=0.045..1769.838 rows=306390 loops=1) -> Hash (cost=201205.35..201205.35 rows=436601 width=4) (actual time=78627.830..78627.830 rows=0 loops=1) -> Hash Join (cost=25006.81..201205.35 rows=436601 width=4) (actual time=9572.704..78612.859 rows=2033 loops=1) Hash Cond: ("outer"."assignment" = "inner".id) -> Seq Scan on m_object_paper (cost=0.00..142176.19 rows=5931219 width=8) (actual time=0.085..36433.616 rows=5934777 loops=1) -> Hash (cost=24921.40..24921.40 rows=34160 width=4) (actual time=8636.897..8636.897 rows=0 loops=1) -> Hash Join (cost=8773.25..24921.40 rows=34160 width=4) (actual time=3013.277..8635.612 rows=180 loops=1) Hash Cond: ("outer"."class" = "inner".id) -> Seq Scan on m_assignment (cost=0.00..13486.37 rows=464037 width=8) (actual time=0.037..2903.799 rows=464639 loops=1) -> Hash (cost=8731.55..8731.55 rows=16682 width=4) (actual time=2985.051..2985.051 rows=0 loops=1) -> Hash Join (cost=15.50..8731.55 rows=16682 width=4) (actual time=716.452..2984.651 rows=50 loops=1) Hash Cond: ("outer".account = "inner".acts) -> Seq Scan on m_class (cost=0.00..7416.15 rows=226615 width=8) (actual time=0.042..1586.784 rows=226796 loops=1) -> Hash (cost=15.00..15.00 rows=200 width=4) (actual time=0.548..0.548 rows=0 loops=1) -> HashAggregate (cost=15.00..15.00 rows=200 width=4) (actual time=0.519..0.527 rows=1 loops=1) -> Function Scan on children_of acts (cost=0.00..12.50 rows=1000 width=4) (actual time=0.485..0.491 rows=1 loops=1) -> Subquery Scan "*SELECT* 2" (cost=203789.85..212495.68 rows=4652 width=4) (actual time=78431.905..79014.599 rows=312 loops=1) -> Hash Join (cost=203789.85..212449.16 rows=4652 width=4) (actual time=78431.889..79011.085 rows=312 loops=1) Hash Cond: ("outer".objectid = "inner".id) -> Seq Scan on r_quickmark_user_object (cost=0.00..1006.95 rows=63195 width=4) (actual time=0.085..391.887 rows=63268 loops=1) -> Hash (cost=201205.35..201205.35 rows=436601 width=4) (actual time=78182.649..78182.649 rows=0 loops=1) -> Hash Join (cost=25006.81..201205.35 rows=436601 width=4) (actual time=9328.018..78167.922 rows=2033 loops=1) Hash Cond: ("outer"."assignment" = "inner".id) -> Seq Scan on m_object_paper (cost=0.00..142176.19 rows=5931219 width=8) (actual time=0.052..36243.971 rows=5934777 loops=1) -> Hash (cost=24921.40..24921.40 rows=34160 width=4) (actual time=8416.317..8416.317 rows=0 loops=1) -> Hash Join (cost=8773.25..24921.40 rows=34160 width=4) (actual time=2801.934..8415.065 rows=180 loops=1) Hash Cond: ("outer"."class" = "inner".id) -> Seq Scan on m_assignment (cost=0.00..13486.37 rows=464037 width=8) (actual time=0.121..2899.409 rows=464639 loops=1) -> Hash (cost=8731.55..8731.55 rows=16682 width=4) (actual time=2772.260..2772.260 rows=0 loops=1) -> Hash Join (cost=15.50..8731.55 rows=16682 width=4) (actual time=674.259..2771.886 rows=50 loops=1) Hash Cond: ("outer".account = "inner".acts) -> Seq Scan on m_class (cost=0.00..7416.15 rows=226615 width=8) (actual time=0.049..1430.376 rows=226796 loops=1) -> Hash (cost=15.00..15.00 rows=200 width=4) (actual time=0.647..0.647 rows=0 loops=1) -> HashAggregate (cost=15.00..15.00 rows=200 width=4) (actual time=0.604..0.613 rows=1 loops=1) -> Function Scan on children_of acts (cost=0.00..12.50 rows=1000 width=4) (actual time=0.568..0.574 rows=1 loops=1) Total runtime: 161605.867 -------------------------- -------------------------- Additionally, we have a db3 which was originally in agreement w/ db1 and executing the more efficient plan. However, now it is in agreement with db2 with the less efficient, slower plan. What could be causing this? Thanks for your help. From pgsql-performance-owner@postgresql.org Tue Feb 22 23:08:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 14EA28B9E7A for ; Tue, 22 Feb 2005 23:08:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48655-01 for ; Tue, 22 Feb 2005 23:08:22 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A87198B9E76 for ; Tue, 22 Feb 2005 23:08:23 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1MN8Lbw013065; Tue, 22 Feb 2005 18:08:22 -0500 (EST) To: werner fraga Cc: John Arbash Meinel , pgsql-performance@postgresql.org Subject: Re: VACUUM ANALYZE slows down query In-reply-to: <11926.1108682885@sss.pgh.pa.us> References: <20050217222428.84111.qmail@web41408.mail.yahoo.com> <42151CED.7050309@arbash-meinel.com> <11926.1108682885@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 17 Feb 2005 18:28:05 -0500" Date: Tue, 22 Feb 2005 18:08:21 -0500 Message-ID: <13064.1109113701@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/302 X-Sequence-Number: 10631 I wrote: > Well, with the increased (and much more accurate) rowcount estimate, > the estimated cost of the nestloop naturally went up a lot: it's > proportional to the number of rows involved. It appears that the > estimated cost of the mergejoin actually went *down* quite a bit > (else it'd have been selected the first time too). That seems odd to > me. Nah, I just can't count :-(. What I forgot about was the sub-select in the output list: >> select ToolRepairRequest.RequestID, (Select >> count(ToolHistory.HistoryID) from ToolHistory where >> ToolRepairRequest.RepairID=ToolHistory.RepairID) as >> CountOfTH which shows up in the (un-analyzed) EXPLAIN output here: SubPlan -> Aggregate (cost=524.17..524.17 rows=1 width=4) (actual time=0.032..0.035 rows=1 loops=1518) -> Index Scan using th_repair_key on toolhistory (cost=0.00..523.82 rows=140 width=4) (actual time=0.013..0.018 rows=1 loops=1518) Index Cond: ($0 = repairid) Now in this case the planner is estimating 79 rows out, so the estimated cost of the nestloop plan includes a charge of 79*524.17 for evaluating the subplan. If we discount that then the estimated cost of the nestloop plan is 3974.74..6645.99 (48055.42-79*524.17). In the ANALYZEd case the subplan is estimated to be a lot cheaper: SubPlan -> Aggregate (cost=6.98..6.98 rows=1 width=4) (actual time=0.038..0.042 rows=1 loops=1518) -> Index Scan using th_repair_key on toolhistory (cost=0.00..6.97 rows=2 width=4) (actual time=0.016..0.021 rows=1 loops=1518) Index Cond: ($0 = repairid) It's estimated to be needed 1533 times, but that still adds up to less of a charge than before. Discounting that, the mergejoin plan was estimated at 18310.59..18462.10 (29162.44 - 1533*6.98). So it's not true that the estimated cost of the join went down in the ANALYZEd case. Werner sent me a data dump off-list, and trawling through the planner I got these numbers for the estimated costs without the output subquery: without any statistics: mergejoin cost 9436.42 .. 9571.81 nestloop cost 3977.74 .. 6700.71 with statistics: mergejoin cost 18213.04 .. 18369.73 nestloop cost 4054.93 .. 24042.85 (these are a bit different from his results because of different ANALYZE samples etc, but close enough) So the planner isn't going crazy: in each case it chose what seemed the cheapest total-cost plan. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Feb 23 01:06:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 92EAF8B9CEF for ; Wed, 23 Feb 2005 01:03:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77079-10 for ; Wed, 23 Feb 2005 01:03:46 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id F34618B9BBF for ; Wed, 23 Feb 2005 01:03:48 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 14E8B31474; Wed, 23 Feb 2005 02:03:48 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: is pg_autovacuum so effective ? Date: Wed, 23 Feb 2005 02:03:10 +0100 Organization: Hub.Org Networking Services Lines: 38 Message-ID: <421BD64E.30803@bigfoot.com> References: <12400.1109107683@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Tom Lane User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <12400.1109107683@sss.pgh.pa.us> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/303 X-Sequence-Number: 10632 Tom Lane wrote: > Gaetano Mendola writes: > >>I'm using ony pg_autovacuum. I expect that disk usage will reach >>a steady state but is not. PG engine: 7.4.5 > > > One data point doesn't prove that you're not at a steady state. I do a graph about my disk usage and it's a ramp since one week, I'll continue to wait in order to see if it will decrease. I was expecting the steady state at something like 4 GB ( after a full vacuum and reindex ) + 10 % = 4.4 GB I'm at 4.6 GB and increasing. I'll see how it will continue. >># vacuum full verbose messages; >>INFO: vacuuming "public.messages" >>INFO: "messages": found 77447 removable, 1606437 nonremovable row versions in 69504 pages >>... >>INFO: "messages": moved 55221 row versions, truncated 69504 to 63307 pages > > > 10% overhead sounds fairly reasonable to me. How does that compare to > the amount of updating you do on the table --- ie, do you turn over 10% > of the table in a day? Less, that table have 1.6 milion rows, and I insert 2000 rows in a day with almost ~ 40000 update in one day. So it's something like: 2.5 % Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Wed Feb 23 01:06:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1AA938B9C8E for ; Wed, 23 Feb 2005 01:05:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76611-10 for ; Wed, 23 Feb 2005 01:05:38 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id BCE518B9D1F for ; Wed, 23 Feb 2005 01:05:40 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id C87D831DA7; Wed, 23 Feb 2005 02:05:40 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: is pg_autovacuum so effective ? Date: Wed, 23 Feb 2005 02:05:03 +0100 Organization: Hub.Org Networking Services Lines: 25 Message-ID: <421BD6BF.4060007@bigfoot.com> References: <421B9CD9.6090703@zeut.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: "Matthew T. O'Connor" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <421B9CD9.6090703@zeut.net> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/304 X-Sequence-Number: 10633 Matthew T. O'Connor wrote: > Well without thinking too much, I would first ask about your FSM > settings? If they aren't big enought that will cause bloat. Try > bumping your FSM settings and then see if you reach steady state. FSM settings are big enough: max_fsm_pages | 2000000 max_fsm_relations | 1000 at least after a vacuum full I see that these numbers are an overkill... REgards Gaetano Mendola From pgsql-performance-owner@postgresql.org Wed Feb 23 06:17:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 595CC8B9E1E for ; Wed, 23 Feb 2005 01:45:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89109-02 for ; Wed, 23 Feb 2005 01:45:51 +0000 (GMT) Received: from mailhub.lss.emc.com (mailhub.lss.emc.com [168.159.2.31]) by svr1.postgresql.org (Postfix) with ESMTP id 2F7538B9E70 for ; Wed, 23 Feb 2005 01:45:53 +0000 (GMT) Received: from mxic2.corp.emc.com (mxic2.corp.emc.com [128.221.12.9]) by mailhub.lss.emc.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id j1N1jpjk016773 for ; Tue, 22 Feb 2005 20:45:51 -0500 (EST) Received: by mxic2.corp.emc.com with Internet Mail Service (5.5.2653.19) id ; Tue, 22 Feb 2005 20:45:50 -0500 Message-ID: <18C6A5982F816D47BFEF7DF47F7B03232E8BD2@corpmx2.corp.emc.com> From: Butkus_Charles@emc.com To: pgsql-performance@postgresql.org Subject: Joins, Deletes and Indexes Date: Tue, 22 Feb 2005 20:45:44 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-PerlMx-Spam: Gauge=, SPAM=7%, Reasons='NO_REAL_NAME 0, __CT 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __IMS_MSGID 0, __IMS_MUA 0, __MIME_VERSION 0, __SANE_MSGID 0' X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200502/308 X-Sequence-Number: 10637 I've got 2 tables defined as follows: CREATE TABLE "cluster" ( id int8 NOT NULL DEFAULT nextval('serial'::text), clusterid varchar(255) NOT NULL, ... CONSTRAINT pk_cluster PRIMARY KEY (id) ) CREATE TABLE sensorreport ( id int8 NOT NULL DEFAULT nextval('serial'::text), clusterid int8 NOT NULL, ... CONSTRAINT pk_sensorreport PRIMARY KEY (id), CONSTRAINT fk_sensorreport_clusterid FOREIGN KEY (clusterid) REFERENCES "cluster" (id) ON UPDATE RESTRICT ON DELETE RESTRICT ) I've defined an Index on the clusterid field of sensorreport. So I've run into 2 issues, one a SELECT, the other a DELETE; SELECT issue: So the following query: EXPLAIN ANALYZE select * from sensorreport where clusterid = 25000114; Yields: "Index Scan using idx_sensorreport_clusterid on sensorreport (cost=0.00..2.01 rows=1 width=129) (actual time=0.000..0.000 rows=38 loops=1)" " Index Cond: (clusterid = 25000114)" "Total runtime: 0.000 ms" However, when using a join as follows (in the cluster table id=25000114 clusterid='clusterid1'): EXPLAIN ANALYZE select * from sensorreport as a join cluster as c on c.id = a.clusterid where c.clusterid = 'clusterid1'; Yields: Hash Join (cost=1.18..566211.51 rows=1071429 width=287) (actual time=150025.000..150025.000 rows=38 loops=1) Hash Cond: ("outer".clusterid = "inner".id) -> Seq Scan on sensorreport a (cost=0.00..480496.03 rows=15000003 width=129) (actual time=10.000..126751.000 rows=15000039 loops=1) -> Hash (cost=1.18..1.18 rows=1 width=158) (actual time=0.000..0.000 rows=0 loops=1) -> Seq Scan on "cluster" c (cost=0.00..1.18 rows=1 width=158) (actual time=0.000..0.000 rows=1 loops=1) Filter: ((clusterid)::text = 'clusterid1'::text) Total runtime: 150025.000 ms My question is can I get the join query to use the idx_sensorreport_clusterid index on the sensorreport table? DELETE issue: The statement: EXPLAIN ANALYZE delete from cluster where clusterid='clusterid99' Yields: Seq Scan on "cluster" (cost=0.00..1.18 rows=1 width=6) (actual time=0.000..0.000 rows=1 loops=1) Filter: ((clusterid)::text = 'clusterid99'::text) Total runtime: 275988.000 ms I'm assuming that the length of the delete is because the "DELETE RESTRICT" on the foreign key from sensortable. Again, is there any way to get the delete to use the idx_sensorreport_clusterid index? From pgsql-performance-owner@postgresql.org Wed Feb 23 05:00:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 57E978B9C8E for ; Wed, 23 Feb 2005 05:00:05 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35511-10 for ; Wed, 23 Feb 2005 04:59:54 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id C34978B9B19 for ; Wed, 23 Feb 2005 04:59:54 +0000 (GMT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id AAD7618CCF1; Tue, 22 Feb 2005 23:59:53 -0500 (EST) Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id 65063-02-4; Tue, 22 Feb 2005 23:59:52 -0500 (EST) Received: from [61.88.101.19] (unknown [61.88.101.19]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailbox.samurai.com (Postfix) with ESMTP id 2A9B918CC12; Tue, 22 Feb 2005 23:59:50 -0500 (EST) Message-ID: <421C0D8B.3090506@samurai.com> Date: Wed, 23 Feb 2005 15:58:51 +1100 From: Neil Conway User-Agent: Debian Thunderbird 1.0 (X11/20050116) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Magnus Hagander Cc: "Vig, Sandor (G/FI-2)" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL is extremely slow on Windows References: <6BCB9D8A16AC4241919521715F4D8BCE476962@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE476962@algol.sollentuna.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/305 X-Sequence-Number: 10634 Magnus Hagander wrote: > You can *never* get above 80 without using write cache, regardless of > your OS, if you have a single disk. Why? Even with, say, a 15K RPM disk? Or the ability to fsync() multiple concurrently-committing transactions at once? -Neil From pgsql-performance-owner@postgresql.org Wed Feb 23 06:06:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 83A668B9BCA for ; Wed, 23 Feb 2005 06:04:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56790-03 for ; Wed, 23 Feb 2005 06:04:05 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3EC038B9B3D for ; Wed, 23 Feb 2005 06:04:04 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 1985F31DD2; Wed, 23 Feb 2005 07:04:04 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: is pg_autovacuum so effective ? Date: Wed, 23 Feb 2005 00:31:58 -0500 Organization: Afilias Canada - Operations Group Lines: 43 Message-ID: <60psyr265t.fsf@dba2.int.libertyrms.com> References: <12400.1109107683@sss.pgh.pa.us> <421BD64E.30803@bigfoot.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:xoPAOJ2UwD6PlbSPMTDUxcS/qF4= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/306 X-Sequence-Number: 10635 Gaetano Mendola writes: > Tom Lane wrote: >> Gaetano Mendola writes: >> >>>I'm using ony pg_autovacuum. I expect that disk usage will reach >>>a steady state but is not. PG engine: 7.4.5 >> >> >> One data point doesn't prove that you're not at a steady state. > > I do a graph about my disk usage and it's a ramp since one week, > I'll continue to wait in order to see if it will decrease. > I was expecting the steady state at something like 4 GB > ( after a full vacuum and reindex ) + 10 % = 4.4 GB > I'm at 4.6 GB and increasing. I'll see how it will continue. You probably want for the "experiment" to last more than a week. After all, it might actually be that with your usage patterns, that table would stabilize at 15% "overhead," and that might take a couple or three weeks. Unless it's clear that it's growing perilously quickly, just leave it alone so that there's actually some possibility of reaching an equilibrium. Any time you "VACUUM FULL" it, that _destroys_ any experimental results or any noticeable patterns, and it guarantees that you'll see "seemingly perilous growth" for a while. And if the table is _TRULY_ growing "perilously quickly," then it is likely that you should add in some scheduled vacuums on the table. Not VACUUM FULLs; just plain VACUUMs. I revised cron scripts yet again today to do hourly and "4x/day" vacuums of certain tables in some of our systems where we know they need the attention. I didn't schedule any VACUUM FULLs; it's unnecessary, and would lead directly to system outages, which is totally unacceptable. -- "cbbrowne","@","ca.afilias.info" Christopher Browne (416) 673-4124 (land) From pgsql-performance-owner@postgresql.org Wed Feb 23 06:06:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 591A48B9CC0 for ; Wed, 23 Feb 2005 06:04:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56143-08 for ; Wed, 23 Feb 2005 06:04:05 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3EAA28B9B3B for ; Wed, 23 Feb 2005 06:04:04 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 5FF1131DA7; Wed, 23 Feb 2005 07:04:04 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: is pg_autovacuum so effective ? Date: Wed, 23 Feb 2005 00:35:26 -0500 Organization: Afilias Canada - Operations Group Lines: 31 Message-ID: <60ll9f2601.fsf@dba2.int.libertyrms.com> References: <421B9CD9.6090703@zeut.net> <421BD6BF.4060007@bigfoot.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:EHaLDR1JrOzHfTbeDEkHQw5ZGEA= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.042 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/307 X-Sequence-Number: 10636 Gaetano Mendola writes: > Matthew T. O'Connor wrote: > >> Well without thinking too much, I would first ask about your FSM >> settings? If they aren't big enought that will cause bloat. Try >> bumping your FSM settings and then see if you reach steady state. > > FSM settings are big enough: > > max_fsm_pages | 2000000 > max_fsm_relations | 1000 > > at least after a vacuum full I see that these numbers are an overkill... When you do a VACUUM FULL, the FSM is made irrelevant because VACUUM FULL takes the time to reclaim all possible space without resorting to _any_ use of the FSM. If you VACUUM FULL, then it's of little value to bother having a free space map because you're obviating the need to use it. In any case, the FSM figures you get out of a VACUUM are only really meaningful if you're moving towards the "equilibrium point" where the FSM is large enough to cope with the growth between VACUUM cycles. VACUUM FULL pushes the system away from equilibrium, thereby making FSM estimates less useful. -- "cbbrowne","@","ca.afilias.info" Christopher Browne (416) 673-4124 (land) From pgsql-performance-owner@postgresql.org Wed Feb 23 08:29:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 605E68B9CF2 for ; Wed, 23 Feb 2005 08:29:57 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06048-10 for ; Wed, 23 Feb 2005 08:29:50 +0000 (GMT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id 3D3DB8B9C8A for ; Wed, 23 Feb 2005 08:29:51 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 4.42) id 1D3rsB-000Gxw-J9; Wed, 23 Feb 2005 08:27:56 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id BD7F1179E2; Wed, 23 Feb 2005 08:29:49 +0000 (GMT) Message-ID: <421C3EFD.1010205@archonet.com> Date: Wed, 23 Feb 2005 08:29:49 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Asatryan, Anahit" Cc: pgsql-performance@postgresql.org Subject: Re: Help me please ! References: <8267A5C8B2C7AD4DBE9C29304C6104DE251408@so1evn001.Office.local> In-Reply-To: <8267A5C8B2C7AD4DBE9C29304C6104DE251408@so1evn001.Office.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/314 X-Sequence-Number: 10643 Asatryan, Anahit wrote: > I am running postgreSQL 8.0.1 under the Windows 2000. I want to use COPY > FROM STDIN function from Java application, but it doesn't work, it > throws: > > "org.postgresql.util.PSQLException: Unknown Response Type G" error. I don't think that there is a "STDIN" if you are executing via JDBC. The only workaround I know of is to create a file and copy from that, which you already have working. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Feb 23 08:40:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3E3408B9BDF for ; Wed, 23 Feb 2005 08:39:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09228-09 for ; Wed, 23 Feb 2005 08:39:49 +0000 (GMT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id CECB48B9B63 for ; Wed, 23 Feb 2005 08:39:50 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 4.42) id 1D3s21-000O5G-5W; Wed, 23 Feb 2005 08:38:06 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id D42331693E; Wed, 23 Feb 2005 08:39:46 +0000 (GMT) Message-ID: <421C4153.60003@archonet.com> Date: Wed, 23 Feb 2005 08:39:47 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Butkus_Charles@emc.com Cc: pgsql-performance@postgresql.org Subject: Re: Joins, Deletes and Indexes References: <18C6A5982F816D47BFEF7DF47F7B03232E8BD2@corpmx2.corp.emc.com> In-Reply-To: <18C6A5982F816D47BFEF7DF47F7B03232E8BD2@corpmx2.corp.emc.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/315 X-Sequence-Number: 10644 Butkus_Charles@emc.com wrote: > I've got 2 tables defined as follows: > > CREATE TABLE "cluster" > ( > id int8 NOT NULL DEFAULT nextval('serial'::text), > clusterid varchar(255) NOT NULL, > ... > CONSTRAINT pk_cluster PRIMARY KEY (id) > ) > > CREATE TABLE sensorreport > ( > id int8 NOT NULL DEFAULT nextval('serial'::text), > clusterid int8 NOT NULL, > ... > CONSTRAINT pk_sensorreport PRIMARY KEY (id), > CONSTRAINT fk_sensorreport_clusterid FOREIGN KEY (clusterid) REFERENCES > "cluster" (id) ON UPDATE RESTRICT ON DELETE RESTRICT > ) > > I've defined an Index on the clusterid field of sensorreport. Looking further down, perhaps an index on cluster.clusterid too. > So I've run into 2 issues, one a SELECT, the other a DELETE; > > SELECT issue: > So the following query: > EXPLAIN ANALYZE select * from sensorreport where clusterid = 25000114; > > Yields: > "Index Scan using idx_sensorreport_clusterid on sensorreport > (cost=0.00..2.01 rows=1 width=129) (actual time=0.000..0.000 rows=38 > loops=1)" > " Index Cond: (clusterid = 25000114)" > "Total runtime: 0.000 ms" > > However, when using a join as follows (in the cluster table id=25000114 > clusterid='clusterid1'): > EXPLAIN ANALYZE select * from sensorreport as a join cluster as c on c.id = > a.clusterid where c.clusterid = 'clusterid1'; You don't say what version you're using, but older versions of PG took a literal join as a request to plan a query in that order. Try rewriting it without the "join" keyword and see if the plan alters. > Yields: > Hash Join (cost=1.18..566211.51 rows=1071429 width=287) (actual > time=150025.000..150025.000 rows=38 loops=1) > Hash Cond: ("outer".clusterid = "inner".id) > -> Seq Scan on sensorreport a (cost=0.00..480496.03 rows=15000003 > width=129) (actual time=10.000..126751.000 rows=15000039 loops=1) > -> Hash (cost=1.18..1.18 rows=1 width=158) (actual time=0.000..0.000 > rows=0 loops=1) > -> Seq Scan on "cluster" c (cost=0.00..1.18 rows=1 width=158) > (actual time=0.000..0.000 rows=1 loops=1) > Filter: ((clusterid)::text = 'clusterid1'::text) > Total runtime: 150025.000 ms > > My question is can I get the join query to use the > idx_sensorreport_clusterid index on the sensorreport table? The only reason to use the index on sensorreport is if it isn't going to match many rows. That means we want to run the restriction on "clisterid1" first, which suggests you want that index on table cluster. > DELETE issue: > The statement: > EXPLAIN ANALYZE delete from cluster where clusterid='clusterid99' > > Yields: > Seq Scan on "cluster" (cost=0.00..1.18 rows=1 width=6) (actual > time=0.000..0.000 rows=1 loops=1) > Filter: ((clusterid)::text = 'clusterid99'::text) > Total runtime: 275988.000 ms > > I'm assuming that the length of the delete is because the "DELETE RESTRICT" > on the foreign key from sensortable. > Again, is there any way to get the delete to use the > idx_sensorreport_clusterid index? No, because this is the cluster table, not sensorreport :-) -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Feb 23 10:41:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C85E98B9CE4 for ; Wed, 23 Feb 2005 10:41:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47638-04 for ; Wed, 23 Feb 2005 10:41:34 +0000 (GMT) Received: from mailin4.audi.de (mailin4.audi.de [143.164.102.18]) by svr1.postgresql.org (Postfix) with ESMTP id 33AD78B9B45 for ; Wed, 23 Feb 2005 10:41:34 +0000 (GMT) Received: from mailin1.audi.de (esilb01b1-proxy-ip2.web.audi.vwg [10.198.7.252]) by mailin4.audi.de (Postfix) with ESMTP id C19F2E94F1; Wed, 23 Feb 2005 11:41:33 +0100 (CET) Message-ID: <977921B17B2F2048AA5AAE9B4CBB713E01423D27@huaudigs0035.audi.de> From: "Vig, Sandor (G/FI-2)" To: 'Magnus Hagander' Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL is extremely slow on Windows Date: Wed, 23 Feb 2005 11:41:32 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/316 X-Sequence-Number: 10645 Hi, I changed fsync to false. It took 8 minutes to restore the full = database. That is 26 times faster than before. :-/ (aprox. 200 tps) With background writer it took 12 minutes. :-( The funny thing is, I had a VMWARE emulation on the same Windows = mashine, running Red Hat, with fsync turned on. It took also 8 minutes to = finish. Probably the Linux code is better + VMWARE optimises (physical) disk access.(?) It seems to me, I need 2 types of operating modes: - For bulk loading (database restore) : fsync=3Dfalse - Normal operation fsync=3Dtrue Am I right? How can I do it "elegantly"? I Think, it should be a "performance tuning guide" in the = docomentation. (not just explaning the settings) Playing with the settings could be = quite anoying.=20 Anyway, thanks for the tips. Bye, Vig S=E1ndor -----Original Message----- From: Magnus Hagander [mailto:mha@sollentuna.net] Sent: Tuesday, February 22, 2005 7:15 PM To: Vig, Sandor (G/FI-2); pgsql-performance@postgresql.org Subject: RE: [PERFORM] PostgreSQL is extremely slow on Windows >I've downloaded the latest release (PostgreSQL 8.0) for windows. >Installation was OK, but I have tried to restore a database. >It had more than ~100.000 records. Usually I use PostgreSQL >under Linux, and it used to be done under 10 minutes. > >Under W2k und XP it took 3 hours(!) Why is it so slow???? > >The commands I used: > >Under Linux: (duration: 1 minute) > pg_dump -D databasename > databasename.db > >Under Windows: (duration: 3 - 3.5 hours(!)) > psql databasename < databasename.db >nul > >It seemed to me, that only 20-30 transactions/sec were >writen to the database. 20-30 transactionsi s about what you'll get on a single disk on Windows today. We have a patch in testing that will bring this up to about 80. You can *never* get above 80 without using write cache, regardless of your OS, if you have a single disk. You might want to look into wether write cacheing is enabled on your linux box, and disable it. (unless = you are using RAID) A lot points towards write cache enabled on your = system. If you need the performance that equals the one with write cache on, = you can set fsync=3Doff. But then you will lose the guarantee that your machine will survive an unclean shutdown or crash. I would strongly advice against it on a production system - same goes for running with write cache! //Magnus The information transmitted is intended only for the person or entity = to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you = received this in error, please contact the sender and delete the material from = any computer. From pgsql-performance-owner@postgresql.org Wed Feb 23 13:06:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 062998B9E2F for ; Wed, 23 Feb 2005 13:06:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87589-10 for ; Wed, 23 Feb 2005 13:06:10 +0000 (GMT) Received: from mailhub.lss.emc.com (mailhub.lss.emc.com [168.159.2.31]) by svr1.postgresql.org (Postfix) with ESMTP id 839F38B9D49 for ; Wed, 23 Feb 2005 13:06:12 +0000 (GMT) Received: from mxic2.corp.emc.com (mxic2.corp.emc.com [128.221.12.9]) by mailhub.lss.emc.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id j1ND68KD022454; Wed, 23 Feb 2005 08:06:09 -0500 (EST) Received: by mxic2.corp.emc.com with Internet Mail Service (5.5.2653.19) id ; Wed, 23 Feb 2005 08:06:08 -0500 Message-ID: <18C6A5982F816D47BFEF7DF47F7B03232E8BD4@corpmx2.corp.emc.com> From: Butkus_Charles@emc.com To: dev@archonet.com Cc: pgsql-performance@postgresql.org Subject: Re: Joins, Deletes and Indexes Date: Wed, 23 Feb 2005 08:06:08 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-PerlMx-Spam: Gauge=, SPAM=0%, Reasons='EMC_BODY_1+ -5, NO_REAL_NAME 0, __CT 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __IMS_MSGID 0, __IMS_MUA 0, __MIME_VERSION 0, __SANE_MSGID 0' X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200502/317 X-Sequence-Number: 10646 > -----Original Message----- > From: Richard Huxton [mailto:dev@archonet.com] > Sent: Wednesday, February 23, 2005 3:40 AM > To: Butkus_Charles@emc.com > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Joins, Deletes and Indexes > > Butkus_Charles@emc.com wrote: > > I've got 2 tables defined as follows: > > > > CREATE TABLE "cluster" > > ( > > id int8 NOT NULL DEFAULT nextval('serial'::text), > > clusterid varchar(255) NOT NULL, > > ... > > CONSTRAINT pk_cluster PRIMARY KEY (id) > > ) > > > > CREATE TABLE sensorreport > > ( > > id int8 NOT NULL DEFAULT nextval('serial'::text), > > clusterid int8 NOT NULL, > > ... > > CONSTRAINT pk_sensorreport PRIMARY KEY (id), > > CONSTRAINT fk_sensorreport_clusterid FOREIGN KEY > (clusterid) REFERENCES > > "cluster" (id) ON UPDATE RESTRICT ON DELETE RESTRICT > > ) > > > > I've defined an Index on the clusterid field of sensorreport. > > Looking further down, perhaps an index on cluster.clusterid too. > > > So I've run into 2 issues, one a SELECT, the other a DELETE; > > > > SELECT issue: > > So the following query: > > EXPLAIN ANALYZE select * from sensorreport where clusterid > = 25000114; > > > > Yields: > > "Index Scan using idx_sensorreport_clusterid on sensorreport > > (cost=0.00..2.01 rows=1 width=129) (actual time=0.000..0.000 rows=38 > > loops=1)" > > " Index Cond: (clusterid = 25000114)" > > "Total runtime: 0.000 ms" > > > > However, when using a join as follows (in the cluster table > id=25000114 > > clusterid='clusterid1'): > > EXPLAIN ANALYZE select * from sensorreport as a join > cluster as c on c.id = > > a.clusterid where c.clusterid = 'clusterid1'; > > You don't say what version you're using, but older versions > of PG took a > literal join as a request to plan a query in that order. Try > rewriting > it without the "join" keyword and see if the plan alters. I'm using version 8.0 on Windows. > > > Yields: > > Hash Join (cost=1.18..566211.51 rows=1071429 width=287) (actual > > time=150025.000..150025.000 rows=38 loops=1) > > Hash Cond: ("outer".clusterid = "inner".id) > > -> Seq Scan on sensorreport a (cost=0.00..480496.03 > rows=15000003 > > width=129) (actual time=10.000..126751.000 rows=15000039 loops=1) > > -> Hash (cost=1.18..1.18 rows=1 width=158) (actual > time=0.000..0.000 > > rows=0 loops=1) > > -> Seq Scan on "cluster" c (cost=0.00..1.18 > rows=1 width=158) > > (actual time=0.000..0.000 rows=1 loops=1) > > Filter: ((clusterid)::text = 'clusterid1'::text) > > Total runtime: 150025.000 ms > > > > My question is can I get the join query to use the > > idx_sensorreport_clusterid index on the sensorreport table? > > The only reason to use the index on sensorreport is if it > isn't going to > match many rows. That means we want to run the restriction on > "clisterid1" first, which suggests you want that index on > table cluster. The cluster table only has 11 rows, so I'm not sure an index would help. The sensorreport table has 15,000,000 rows so that's why I've got the index there. > > > DELETE issue: > > The statement: > > EXPLAIN ANALYZE delete from cluster where clusterid='clusterid99' > > > > Yields: > > Seq Scan on "cluster" (cost=0.00..1.18 rows=1 width=6) (actual > > time=0.000..0.000 rows=1 loops=1) > > Filter: ((clusterid)::text = 'clusterid99'::text) > > Total runtime: 275988.000 ms > > > > I'm assuming that the length of the delete is because the > "DELETE RESTRICT" > > on the foreign key from sensortable. > > Again, is there any way to get the delete to use the > > idx_sensorreport_clusterid index? > > No, because this is the cluster table, not sensorreport :-) True, but the foreign key constraint on the sensorreport table forces Postgres to check if there are any sensorreport's that are currently using this cluster before allowing the cluster to be deleted. > > -- > Richard Huxton > Archonet Ltd > Thanks a lot for the reply. Chuck Butkus EMC From pgsql-performance-owner@postgresql.org Wed Feb 23 13:42:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6FF4A8B9E61 for ; Wed, 23 Feb 2005 13:42:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99432-08 for ; Wed, 23 Feb 2005 13:42:19 +0000 (GMT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id E983B8B9E2F for ; Wed, 23 Feb 2005 13:42:20 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 4.42) id 1D3wkn-000IN5-4T; Wed, 23 Feb 2005 13:40:37 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 7F3BE17B88; Wed, 23 Feb 2005 13:42:18 +0000 (GMT) Message-ID: <421C883A.20708@archonet.com> Date: Wed, 23 Feb 2005 13:42:18 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Butkus_Charles@emc.com Cc: pgsql-performance@postgresql.org Subject: Re: Joins, Deletes and Indexes References: <18C6A5982F816D47BFEF7DF47F7B03232E8BD4@corpmx2.corp.emc.com> In-Reply-To: <18C6A5982F816D47BFEF7DF47F7B03232E8BD4@corpmx2.corp.emc.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/318 X-Sequence-Number: 10647 Butkus_Charles@emc.com wrote: > > The cluster table only has 11 rows, so I'm not sure an index would > help. The sensorreport table has 15,000,000 rows so that's why I've > got the index there. Ah - only 11? >>>on the foreign key from sensortable. >>>Again, is there any way to get the delete to use the >>>idx_sensorreport_clusterid index? >> >>No, because this is the cluster table, not sensorreport :-) > > True, but the foreign key constraint on the sensorreport table forces > Postgres to check if there are any sensorreport's that are currently > using this cluster before allowing the cluster to be deleted. If you only have 11 distinct values in the large table then it's debatable whether it's always quicker to use the index. Since your first example (clusterid = 25000114) returned so few rows, I'm guessing that some other values represent a sizeable percentage of the table. That'd explain the difference between PG's estimates and the actual number of matching rows. You can try "SET enable_seqscan =false;" before running the query and see whether using the index helps things. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Feb 23 14:38:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 319CB8B9EA8 for ; Wed, 23 Feb 2005 14:38:07 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17563-04 for ; Wed, 23 Feb 2005 14:38:00 +0000 (GMT) Received: from mail.logi-track.com (www.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id 5C6808B9EA1 for ; Wed, 23 Feb 2005 14:38:02 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J064b.j.pppool.de [85.74.6.75]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id B18A8307F7; Wed, 23 Feb 2005 15:38:00 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id CE679AB286; Wed, 23 Feb 2005 15:37:54 +0100 (CET) Message-ID: <421C953C.4040907@logi-track.com> Date: Wed, 23 Feb 2005 15:37:48 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Magnus Hagander Cc: "Vig, Sandor (G/FI-2)" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL is extremely slow on Windows References: <6BCB9D8A16AC4241919521715F4D8BCE476962@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE476962@algol.sollentuna.se> X-Enigmail-Version: 0.90.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="------------enig58AF062D4A9664305F60E24A" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/319 X-Sequence-Number: 10648 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig58AF062D4A9664305F60E24A Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, Magnus & all, Magnus Hagander schrieb: > 20-30 transactionsi s about what you'll get on a single disk on Windows= > today. > We have a patch in testing that will bring this up to about 80. > You can *never* get above 80 without using write cache, regardless of > your OS, if you have a single disk. You might want to look into wether > write cacheing is enabled on your linux box, and disable it. (unless yo= u > are using RAID) A lot points towards write cache enabled on your system= =2E Note that you can get higher rates for the server as a whole when using concurrent transactions (that is, several independend connections committing at the same time). The commit delay settings should be tuned accordingly. Markus --=20 markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z=FCrich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com --------------enig58AF062D4A9664305F60E24A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCHJVCOVWsnapT9i0RA+MMAKDUwJAc2MC5OZRzJrhL2WaNi6MIIgCgr8ng /b8INAO6V8wAEeZ0EHVScZU= =nAMz -----END PGP SIGNATURE----- --------------enig58AF062D4A9664305F60E24A-- From pgsql-performance-owner@postgresql.org Wed Feb 23 14:42:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E708A8B9E8D for ; Wed, 23 Feb 2005 14:42:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17008-08 for ; Wed, 23 Feb 2005 14:42:03 +0000 (GMT) Received: from mail.logi-track.com (burro.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id 3F33A8B9E56 for ; Wed, 23 Feb 2005 14:42:05 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J064b.j.pppool.de [85.74.6.75]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id 9D102307F7; Wed, 23 Feb 2005 15:42:09 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id BB425AB286; Wed, 23 Feb 2005 15:42:04 +0100 (CET) Message-ID: <421C963C.8030900@logi-track.com> Date: Wed, 23 Feb 2005 15:42:04 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: "Asatryan, Anahit" Cc: pgsql-performance@postgresql.org Subject: Re: Help me please ! References: <8267A5C8B2C7AD4DBE9C29304C6104DE251408@so1evn001.Office.local> In-Reply-To: <8267A5C8B2C7AD4DBE9C29304C6104DE251408@so1evn001.Office.local> X-Enigmail-Version: 0.90.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="------------enig5669A4450B70791500073159" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/320 X-Sequence-Number: 10649 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig5669A4450B70791500073159 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi, Asatryan, Asatryan, Anahit schrieb: > I am running postgreSQL 8.0.1 under the Windows 2000. I want to use COP= Y > FROM STDIN function from Java application, but it doesn=92t work, it th= rows: >=20 > =93org.postgresql.util.PSQLException: Unknown Response Type G=94 error= =2E Currently, there is no COPY support in the postgresql jdbc driver. There were some patches enabling COPY support floating around on the pgsql-jdbc@postgresql.org mailing list. You can search the archive and try whether one of them fits your needs. AFAIR, COPY support is on the TODO list, but they wait for some other driver reworking to be finished. You can discuss this issue on psql-jdbc list or search the archives if you need more info. Markus --=20 markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z=FCrich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com --------------enig5669A4450B70791500073159 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCHJY8OVWsnapT9i0RA0IIAKDSkQKkrzJjP/9g8QzQR2ur+0TjEQCffUQd 4Jd34Q3yrmn0Yjnd7pGwFqg= =FHoo -----END PGP SIGNATURE----- --------------enig5669A4450B70791500073159-- From pgsql-performance-owner@postgresql.org Wed Feb 23 14:50:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CA9108B9E76 for ; Wed, 23 Feb 2005 14:50:57 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21327-05 for ; Wed, 23 Feb 2005 14:50:45 +0000 (GMT) Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id D79308B9E65 for ; Wed, 23 Feb 2005 14:50:48 +0000 (GMT) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id 5E6128F28B; Wed, 23 Feb 2005 15:50:47 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: PostgreSQL is extremely slow on Windows Date: Wed, 23 Feb 2005 15:50:47 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE476978@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PostgreSQL is extremely slow on Windows Thread-Index: AcUZZIXoKCH9klTQSyW2gSfcyAOb0gAUkj3g From: "Magnus Hagander" To: "Neil Conway" Cc: "Vig, Sandor (G/FI-2)" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.072 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/321 X-Sequence-Number: 10650 > > You can *never* get above 80 without using write cache,=20 > regardless of=20 > > your OS, if you have a single disk. >=20 > Why? Even with, say, a 15K RPM disk? Or the ability to=20 > fsync() multiple concurrently-committing transactions at once? Uh. What I meant was a single *IDE* disk. Sorry. Been too deep into helping ppl with IDE disks lately to remember that SCSI can be a lot faster :-) And we're talking about restore of a dump, so it's a single session. (Strictly, that shuld be a 7200rpm IDE disk. I don't know if any others are common, though) //mha From pgsql-performance-owner@postgresql.org Wed Feb 23 14:55:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C05D28B9E80 for ; Wed, 23 Feb 2005 14:54:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22262-06 for ; Wed, 23 Feb 2005 14:54:47 +0000 (GMT) Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id A84C98B9E98 for ; Wed, 23 Feb 2005 14:54:50 +0000 (GMT) Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) by mx-2.sollentuna.net (Postfix) with ESMTP id E7C888F285; Wed, 23 Feb 2005 15:54:50 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: PostgreSQL is extremely slow on Windows Date: Wed, 23 Feb 2005 15:54:50 +0100 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE47697A@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PostgreSQL is extremely slow on Windows Thread-Index: AcUZlEDOD6ZObNAvQpejvcBkViL5UwAIu3tQ From: "Magnus Hagander" To: "Vig, Sandor (G/FI-2)" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.072 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/322 X-Sequence-Number: 10651 > Hi, >=20 > I changed fsync to false. It took 8 minutes to restore the=20 > full database. > That is 26 times faster than before. :-/ (aprox. 200 tps)=20 > With background writer it took 12 minutes. :-( That seems reasonable. > The funny thing is, I had a VMWARE emulation on the same=20 > Windows mashine, running Red Hat, with fsync turned on. It=20 > took also 8 minutes to finish. > Probably the Linux code is better + VMWARE optimises (physical) disk > access.(?) Vmware makes fsync() into a no-op. It will always cache the disk. (This is vmware workstation. Their server products behave differntly, of course) > It seems to me, I need 2 types of operating modes: > - For bulk loading (database restore) : fsync=3Dfalse > - Normal operation fsync=3Dtrue Yes, fsync=3Dfalse is very good for bulk loading *IFF* you can live with data loss in case you get a crash during load. > Am I right? How can I do it "elegantly"? You'll need to edit postgresql.conf and restart the server for this. > I Think, it should be a "performance tuning guide" in the=20 > docomentation. > (not just explaning the settings) Playing with the settings=20 > could be quite anoying.=20 There is some information on techdocs.postgresql.org you miht be interested in. //Magnus From pgsql-performance-owner@postgresql.org Wed Feb 23 14:55:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9465D8B9E61 for ; Wed, 23 Feb 2005 14:55:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21635-08 for ; Wed, 23 Feb 2005 14:55:45 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 461B58B9D5F for ; Wed, 23 Feb 2005 14:55:46 +0000 (GMT) Received: (qmail 30436 invoked from network); 23 Feb 2005 14:58:30 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 23 Feb 2005 14:58:30 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 28950-47 for ; Wed, 23 Feb 2005 21:58:29 +0700 (ICT) Received: (qmail 30426 invoked from network); 23 Feb 2005 14:58:29 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 23 Feb 2005 14:58:29 -0000 Received: from 203.185.128.19 ([203.185.128.19]) by webmail.moph.go.th (IMP) with HTTP for ; Wed, 23 Feb 2005 21:58:29 +0700 Message-ID: <1109170709.421c9a158c27c@webmail.moph.go.th> Date: Wed, 23 Feb 2005 21:58:29 +0700 From: amrit@health2.moph.go.th To: PGsql-performance Cc: Mark Kirkwood Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function References: <1108914570.4218b18a2cf0d@webmail.moph.go.th> <42191623.7060401@coretech.co.nz> <1108949685.42193ab53e07c@webmail.moph.go.th> <421A4F96.60803@coretech.co.nz> <1109048458.421abc8a280ed@webmail.moph.go.th> <421AC6F3.5010102@coretech.co.nz> <1109086639.421b51af6edd4@webmail.moph.go.th> <421B90F4.9000707@coretech.co.nz> In-Reply-To: <421B90F4.9000707@coretech.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.185.128.19 X-Virus-Scanned: by amavisd-new at moph.go.th X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200502/323 X-Sequence-Number: 10652 > Well, sure looks like you only have one running. Your data directory is > /var/lib/pgsql/data so lets see the files: > > /var/lib/pgsql/data/pg_hba.conf > /var/lib/pgsql/data/pg_ident.conf > /var/lib/pgsql/data/postmaster.opts > > Might also be useful to know any nondefault settings in postgresql.conf too. > > As I understand it, these vendor shipped rpms have ident *enabled*. > I will download FC3 Pg and check this out... I'm a compile it from > source guy :-) > > Mark I got the answer that is in module config of postgresl-webmin , there is a check box for Use DBI to connect if available? yes no the default is yes , but if I choosed no everything went fine. I also test it in the desktop mechine and get the same error and the same solution. Could you explain what happen to the FC3 + postgresql and webmin 1.8? Thanks Amrit ,Thailand From pgsql-performance-owner@postgresql.org Wed Feb 23 16:31:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9B4DC8B9D54 for ; Wed, 23 Feb 2005 16:31:11 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53690-05 for ; Wed, 23 Feb 2005 16:31:01 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1C3F28B9B19 for ; Wed, 23 Feb 2005 16:31:00 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id ECE9331DDF; Wed, 23 Feb 2005 17:30:59 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: is pg_autovacuum so effective ? Date: Wed, 23 Feb 2005 17:30:21 +0100 Organization: Hub.Org Networking Services Lines: 56 Message-ID: <421CAF9D.3030407@bigfoot.com> References: <12400.1109107683@sss.pgh.pa.us> <421BD64E.30803@bigfoot.com> <60psyr265t.fsf@dba2.int.libertyrms.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Christopher Browne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <60psyr265t.fsf@dba2.int.libertyrms.com> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/324 X-Sequence-Number: 10653 Christopher Browne wrote: > Gaetano Mendola writes: > > >>Tom Lane wrote: >> >>>Gaetano Mendola writes: >>> >>> >>>>I'm using ony pg_autovacuum. I expect that disk usage will reach >>>>a steady state but is not. PG engine: 7.4.5 >>> >>> >>>One data point doesn't prove that you're not at a steady state. >> >>I do a graph about my disk usage and it's a ramp since one week, >>I'll continue to wait in order to see if it will decrease. >>I was expecting the steady state at something like 4 GB >>( after a full vacuum and reindex ) + 10 % = 4.4 GB >>I'm at 4.6 GB and increasing. I'll see how it will continue. > > > You probably want for the "experiment" to last more than a week. > > After all, it might actually be that with your usage patterns, that > table would stabilize at 15% "overhead," and that might take a couple > or three weeks. > > Unless it's clear that it's growing perilously quickly, just leave it > alone so that there's actually some possibility of reaching an > equilibrium. Any time you "VACUUM FULL" it, that _destroys_ any > experimental results or any noticeable patterns, and it guarantees > that you'll see "seemingly perilous growth" for a while. > > And if the table is _TRULY_ growing "perilously quickly," then it is > likely that you should add in some scheduled vacuums on the table. > Not VACUUM FULLs; just plain VACUUMs. > > I revised cron scripts yet again today to do hourly and "4x/day" > vacuums of certain tables in some of our systems where we know they > need the attention. I didn't schedule any VACUUM FULLs; it's > unnecessary, and would lead directly to system outages, which is > totally unacceptable. Yes, I'm in this direction too. Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Wed Feb 23 16:39:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 09D888B9EC7 for ; Wed, 23 Feb 2005 16:39:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57495-03 for ; Wed, 23 Feb 2005 16:39:23 +0000 (GMT) Received: from Mercury.turbocorp.com (mercury.turbocorp.com [198.212.166.40]) by svr1.postgresql.org (Postfix) with ESMTP id 074AE8B9E8E for ; Wed, 23 Feb 2005 16:39:22 +0000 (GMT) Received: from [198.212.166.61] (Voyager.turbocorp.com [198.212.166.61]) by Mercury.turbocorp.com (8.12.8/8.12.8) with ESMTP id j1NGdMvD001804 for ; Wed, 23 Feb 2005 11:39:22 -0500 Message-ID: <421CB1BF.2050708@turbocorp.com> Date: Wed, 23 Feb 2005 11:39:27 -0500 From: John Allgood User-Agent: Mozilla Thunderbird 1.0 (X11/20041207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Peformance Tuning Opterons/ Hard Disk Layout Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/325 X-Sequence-Number: 10654 Hello All I am setting up a hardware clustering solution. My hardware is Dual Opteron 550 with 8GB ram. My external storage is a Kingston Fibre channel Infostation. With 14 15000'k 36GB drives. The OS we are running is Redhat ES 3.0. Clustering using Redhat Cluster Suite. Postgres Version is Postgres 7.4.7. We will be setting up about 9 databases which range in size from 100MB to 2.5GB on the config. The postgres application is mostly read intensive. What would be the best way to setup the hardrives on this server. Currently I have it partioned with 2 seperate raid 5 with 1 failover per raid. I have two database clusters configured with a seperate postmaster running for each. Running two postmasters seems like a pain but that is the only way I knew to seperate the load. I am mostly concerned about disk IO and performance. Is my current setup a good way to accomplish the best performance or would it be better to use all the drives in one huge raid five with a couple of failovers. I have looked around in the archives and found some info but I would like to here about some of the configs other people are running and how they have them setup. Thanks John Allgood - ESC Systems Admin From pgsql-performance-owner@postgresql.org Wed Feb 23 16:44:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5161C8B9E21 for ; Wed, 23 Feb 2005 16:44:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57224-10 for ; Wed, 23 Feb 2005 16:44:18 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5FE2E8B9D5A for ; Wed, 23 Feb 2005 16:44:17 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1NGiFaZ020026; Wed, 23 Feb 2005 11:44:15 -0500 (EST) To: "Luke Chambers" Cc: pgsql-performance@postgresql.org Subject: Re: Inefficient Query Plans In-reply-to: <1109110085.769681.93070@g14g2000cwa.googlegroups.com> References: <1109110085.769681.93070@g14g2000cwa.googlegroups.com> Comments: In-reply-to "Luke Chambers" message dated "22 Feb 2005 14:08:05 -0800" Date: Wed, 23 Feb 2005 11:44:15 -0500 Message-ID: <20025.1109177055@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/326 X-Sequence-Number: 10655 "Luke Chambers" writes: > The following query plans both result from the very same query run on > different servers. They obviously differ drastically, but I don't why > as one db is a slonied copy of the other with identical postgresql.conf > files. There's an order-of-magnitude difference in the estimated row counts for some of the joins, so it's hardly surprising that different plans would be chosen. Assuming that these are exactly the same Postgres version, the only explanation would be considerably different ANALYZE statistics stored in the two databases. > Both databases are vacuum analyzed nightly. Maybe you should double-check that. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Feb 23 16:55:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 91E488B9E1A for ; Wed, 23 Feb 2005 16:54:59 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62108-02 for ; Wed, 23 Feb 2005 16:54:53 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id C0A268B9D49 for ; Wed, 23 Feb 2005 16:54:53 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1NGsqY6020118 for ; Wed, 23 Feb 2005 11:54:53 -0500 (EST) Cc: pgsql-performance@postgresql.org Subject: Re: subquery vs join on 7.4.5 In-reply-to: References: Comments: In-reply-to David Haas message dated "Mon, 21 Feb 2005 23:05:08 -0800" Date: Wed, 23 Feb 2005 11:54:52 -0500 Message-ID: <20117.1109177692@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/327 X-Sequence-Number: 10656 David Haas writes: > I'm comparing the speeds of the following two queries on 7.4.5. I was > curious why query 1 was faster than query 2: > query 1: > Select layer_number > FROM batch_report_index > WHERE device_id = (SELECT device_id FROM device_index WHERE device_name > ='CP8M') > AND technology_id = (SELECT technology_id FROM technology_index WHERE > technology_name = 'G12'); > query 2: > Select b.layer_number > FROM batch_report_index b, device_index d, technology_index t > WHERE b.device_id = d.device_id > AND b.technology_id = t.technology_id > AND d.device_name = 'CP8M' > AND t.technology_name = 'G12'; Why didn't you try a two-column index on batch_report_index(device_id, technology_id) ? Whether this would actually be better than a seqscan I'm not sure, given the large number of matching rows. But the planner would surely try it given that it's drastically underestimating that number :-( regards, tom lane From pgsql-performance-owner@postgresql.org Wed Feb 23 17:50:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D71938B9CF2 for ; Wed, 23 Feb 2005 17:50:28 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79712-01 for ; Wed, 23 Feb 2005 17:50:19 +0000 (GMT) Received: from honorio.sinectis.com.ar (honorio.sinectis.com.ar [216.244.192.201]) by svr1.postgresql.org (Postfix) with ESMTP id 98CA78B9B9A for ; Wed, 23 Feb 2005 17:50:18 +0000 (GMT) Received: by honorio.sinectis.com.ar (Postfix, from userid 99) id 8A0016C8B2; Wed, 23 Feb 2005 14:50:16 -0300 (GMT+3) Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 X-Mailer: Sinectis Webmail 5.6.16-1.5.1 From: G u i d o B a r o s i o To: amrit@health2.moph.go.th, pgsql-performance@postgresql.org, markir@coretech.co.nz Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function Reply-To: gbarosio@uolsinectis.com.ar Message-Id: <20050223175016.8A0016C8B2@honorio.sinectis.com.ar> Date: Wed, 23 Feb 2005 14:50:16 -0300 (GMT+3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.28 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/328 X-Sequence-Number: 10657 Sorry, just a fool tip, cause I haven't seen that you already done the pg_ctl stop && pg_ctl start ... (I mean, did you reload your conf settings?) Regards, Guido > > > I used you perl script and found the error => > > > [root@samba tmp]# perl relacl.pl > > > DBI connect('dbname=template1;port=5432','postgres',...) failed: FATAL: > > IDENT > > > authentication failed for user "postgres" at relacl.pl line 21 > > > Error in connect to DBI:Pg:dbname=template1;port=5432: > > > > > > > > Excellent - we know what is going on now! > > > > > > > And my pg_hba.conf is > > > > > > # IPv4-style local connections: > > > host all all 127.0.0.1 255.255.255.255 trust > > > host all all 192.168.0.0 255.255.0.0 trust > > > > > > trusted for every user. > > > > Ok, what I think has happened is that there is another Pg installation > > (or another initdb'ed cluster) on this machine that you are accidentally > > talking to. Try > > > > $ rpm -qa|grep -i postgres > > > > which will spot another software installation, you may just have to > > search for files called pg_hba.conf to find another initdb'ed cluster.... > > > > This other installation should have a pg_hba.conf that looks something > > like : > > > > local all all ident > > host all all 127.0.0.1 255.255.255.255 ident > > > > So a bit of detective work is in order :-) > > > > Mark > After being a detector I found that > [root@samba ~]# rpm -qa|grep -i postgres > postgresql-7.4.5-3.1.tlc > postgresql-python-7.4.5-3.1.tlc > postgresql-jdbc-7.4.5-3.1.tlc > postgresql-tcl-7.4.5-3.1.tlc > postgresql-server-7.4.5-3.1.tlc > postgresql-libs-7.4.5-3.1.tlc > postgresql-docs-7.4.5-3.1.tlc > postgresql-odbc-7.3-8.1.tlc > postgresql-pl-7.4.5-3.1.tlc > postgresql-test-7.4.5-3.1.tlc > postgresql-contrib-7.4.5-3.1.tlc > [root@samba ~]# > > no other pg installation except the pgsql for windows in samba folder which I > think it isn't matter ,is it? > No other pg being run. > [root@samba ~]# ps ax|grep postmaster > 2228 ? S 0:00 /usr/bin/postmaster -p 5432 -D /var/lib/pgsql/data > 3308 pts/0 S+ 0:00 grep postmaster > [root@samba ~]# > > Is it possible that it is related to pg_ident.conf ? > > Any comment please. > Amrit,Thailand > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings From pgsql-performance-owner@postgresql.org Wed Feb 23 18:03:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CED5B8B9E18 for ; Wed, 23 Feb 2005 18:03:46 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82940-08 for ; Wed, 23 Feb 2005 18:03:43 +0000 (GMT) Received: from mail1.panix.com (mail1.panix.com [166.84.1.72]) by svr1.postgresql.org (Postfix) with ESMTP id 60E0F8B9D53 for ; Wed, 23 Feb 2005 18:03:42 +0000 (GMT) Received: from panix1.panix.com (panix1.panix.com [166.84.1.1]) by mail1.panix.com (Postfix) with ESMTP id A323558A9A; Wed, 23 Feb 2005 13:03:41 -0500 (EST) Received: (from adler@localhost) by panix1.panix.com (8.11.6p3/8.8.8/PanixN1.1) id j1NI3fY19847; Wed, 23 Feb 2005 13:03:41 -0500 (EST) Date: Wed, 23 Feb 2005 13:03:38 -0500 From: Michael Adler To: John Allgood Cc: pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout Message-ID: <20050223180338.GA4259@pobox.com> References: <421CB1BF.2050708@turbocorp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <421CB1BF.2050708@turbocorp.com> User-Agent: Mutt/1.4.2.1i X-Hashcash: 1:20:050223:john@turbocorp.com::WnnWWULBd63Erg8F:0000000000000000000 0000000000000000000000005KgE X-Hashcash: 1:20:050223:pgsql-performance@postgresql.org::xJRh2U31jMGDkkat:00000 0000000000000000000000004Q5B X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/329 X-Sequence-Number: 10658 On Wed, Feb 23, 2005 at 11:39:27AM -0500, John Allgood wrote: > Hello All > > I am setting up a hardware clustering solution. My hardware is Dual > Opteron 550 with 8GB ram. My external storage is a Kingston Fibre > channel Infostation. With 14 15000'k 36GB drives. The OS we are running > is Redhat ES 3.0. Clustering using Redhat Cluster Suite. Postgres > Version is Postgres 7.4.7. We will be setting up about 9 databases which > range in size from 100MB to 2.5GB on the config. The postgres > application is mostly read intensive. What would be the best way to > setup the hardrives on this server. Currently I have it partioned with 2 > seperate raid 5 with 1 failover per raid. I have two database clusters > configured with a seperate postmaster running for each. Running two > postmasters seems like a pain but that is the only way I knew to > seperate the load. I am mostly concerned about disk IO and performance. > Is my current setup a good way to accomplish the best performance or > would it be better to use all the drives in one huge raid five with a > couple of failovers. I have looked around in the archives and found some > info but I would like to here about some of the configs other people are > running and how they have them setup. http://www.powerpostgresql.com/PerfList/ Consider a separate array for pg_xlog. With tablespaces in 8.0, you can isolate much of the IO in a single cluster. -Mike Adler From pgsql-performance-owner@postgresql.org Wed Feb 23 18:25:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 602248B9EBA for ; Wed, 23 Feb 2005 18:25:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90011-07 for ; Wed, 23 Feb 2005 18:25:05 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) by svr1.postgresql.org (Postfix) with ESMTP id BC2B58B9EAB for ; Wed, 23 Feb 2005 18:25:04 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 68so1638449wra for ; Wed, 23 Feb 2005 10:25:04 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:cc:subject:date:organization:mime-version:content-type:content-transfer-encoding:x-mailer:in-reply-to:x-mimeole:thread-index:message-id; b=L4YZkp4gZJHitJ59PZlkF63Q8Bcx/JBZLN+4dukETySHL9rC5JdCj55V9up5UkbZyLWlKqKIUvZem1oXeDSIBhA5YNhav5HkOcMo3Vve1PE6qwUh0uUzjN+FuIeI4GdAXBLuyfvijNUPobsGFEQ19RMIAqBmE956qBVRjjU9vcE= Received: by 10.54.53.22 with SMTP id b22mr100658wra; Wed, 23 Feb 2005 10:25:04 -0800 (PST) Received: from sbew318anc22 ([200.184.93.96]) by smtp.gmail.com with ESMTP id g2sm364311wra.2005.02.23.10.25.02; Wed, 23 Feb 2005 10:25:04 -0800 (PST) From: "Bruno Almeida do Lago" To: "'Michael Adler'" Cc: Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout Date: Wed, 23 Feb 2005 15:26:18 -0300 Organization: G&P MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 In-Reply-To: <20050223180338.GA4259@pobox.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcUZ0uJGZ6uw2n4CQ2mGl6iD84LXsgAAa5ww Message-ID: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.09 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/330 X-Sequence-Number: 10659 Is there a real limit for max_connections? Here we've an Oracle server with up to 1200 simultaneous conections over it! "max_connections: exactly like previous versions, this needs to be set to the actual number of simultaneous connections you expect to need. High settings will require more shared memory (shared_buffers). As the per-connection overhead, both from PostgreSQL and the host OS, can be quite high, it's important to use connection pooling if you need to service a large number of users. For example, 150 active connections on a medium-end 32-bit Linux server will consume significant system resources, and 600 is about the limit." C ya, Bruno -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Michael Adler Sent: Wednesday, February 23, 2005 3:04 PM To: John Allgood Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Peformance Tuning Opterons/ Hard Disk Layout On Wed, Feb 23, 2005 at 11:39:27AM -0500, John Allgood wrote: > Hello All > > I am setting up a hardware clustering solution. My hardware is Dual > Opteron 550 with 8GB ram. My external storage is a Kingston Fibre > channel Infostation. With 14 15000'k 36GB drives. The OS we are running > is Redhat ES 3.0. Clustering using Redhat Cluster Suite. Postgres > Version is Postgres 7.4.7. We will be setting up about 9 databases which > range in size from 100MB to 2.5GB on the config. The postgres > application is mostly read intensive. What would be the best way to > setup the hardrives on this server. Currently I have it partioned with 2 > seperate raid 5 with 1 failover per raid. I have two database clusters > configured with a seperate postmaster running for each. Running two > postmasters seems like a pain but that is the only way I knew to > seperate the load. I am mostly concerned about disk IO and performance. > Is my current setup a good way to accomplish the best performance or > would it be better to use all the drives in one huge raid five with a > couple of failovers. I have looked around in the archives and found some > info but I would like to here about some of the configs other people are > running and how they have them setup. http://www.powerpostgresql.com/PerfList/ Consider a separate array for pg_xlog. With tablespaces in 8.0, you can isolate much of the IO in a single cluster. -Mike Adler ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From pgsql-performance-owner@postgresql.org Wed Feb 23 18:36:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AD8088B9CAD for ; Wed, 23 Feb 2005 18:36:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93394-02 for ; Wed, 23 Feb 2005 18:36:13 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 06A408B9B1B for ; Wed, 23 Feb 2005 18:36:13 +0000 (GMT) Received: from dyn-69-234.tor.dsl.tht.net (dyn-69-234.tor.dsl.tht.net [134.22.69.234]) by tht.net (Postfix) with ESMTP id 1531476A47; Wed, 23 Feb 2005 13:36:13 -0500 (EST) Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout From: Rod Taylor To: Bruno Almeida do Lago Cc: 'Michael Adler' , Postgresql Performance In-Reply-To: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> Content-Type: text/plain Date: Wed, 23 Feb 2005 13:35:03 -0500 Message-Id: <1109183703.40753.196.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.017 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/331 X-Sequence-Number: 10660 On Wed, 2005-02-23 at 15:26 -0300, Bruno Almeida do Lago wrote: > Is there a real limit for max_connections? Here we've an Oracle server with > up to 1200 simultaneous conections over it! If you can reduce them by using something like pgpool between PostgreSQL and the client, you'll save some headache. PostgreSQL did not perform as well with a large number of idle connections and it does otherwise (last time I tested was 7.4 though -- perhaps it's better now). The kernel also starts to play a significant role with a high number of connections. Some operating systems don't perform as well with a high number of processes (process handling, scheduling, file handles, etc.). I think you can do it without any technical issues, but you will probably be happier with the result if you can hide idle connections from the database machine. -- From pgsql-performance-owner@postgresql.org Wed Feb 23 18:37:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D0E58B9E80 for ; Wed, 23 Feb 2005 18:37:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92387-08 for ; Wed, 23 Feb 2005 18:37:39 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9E4628B9E7A for ; Wed, 23 Feb 2005 18:37:38 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1NIbSn5021022; Wed, 23 Feb 2005 13:37:28 -0500 (EST) To: "Bruno Almeida do Lago" Cc: "'Michael Adler'" , pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout In-reply-to: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> Comments: In-reply-to "Bruno Almeida do Lago" message dated "Wed, 23 Feb 2005 15:26:18 -0300" Date: Wed, 23 Feb 2005 13:37:28 -0500 Message-ID: <21021.1109183848@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/332 X-Sequence-Number: 10661 "Bruno Almeida do Lago" writes: > Is there a real limit for max_connections? Here we've an Oracle server with > up to 1200 simultaneous conections over it! [ shrug... ] If your machine has the beef to run 1200 simultaneous queries, you can set max_connections to 1200. The point of what you were quoting is that if you want to service 1200 concurrent users but you only expect maybe 100 simultaneously active queries from them (and you have a database box that can only service that many) then you want to put a connection pooler in front of 100 backends, not try to start a backend for every user. Oracle may handle this sort of thing differently, I dunno. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Feb 23 18:51:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CC8D48B9EBC for ; Wed, 23 Feb 2005 18:51:41 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98016-01 for ; Wed, 23 Feb 2005 18:51:33 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3EE0F8B9EB9 for ; Wed, 23 Feb 2005 18:51:33 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1NIpUfk021208; Wed, 23 Feb 2005 13:51:30 -0500 (EST) To: Rod Taylor Cc: Bruno Almeida do Lago , "'Michael Adler'" , Postgresql Performance Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout In-reply-to: <1109183703.40753.196.camel@home> References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> <1109183703.40753.196.camel@home> Comments: In-reply-to Rod Taylor message dated "Wed, 23 Feb 2005 13:35:03 -0500" Date: Wed, 23 Feb 2005 13:51:30 -0500 Message-ID: <21207.1109184690@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/333 X-Sequence-Number: 10662 Rod Taylor writes: > The kernel also starts to play a significant role with a high number of > connections. Some operating systems don't perform as well with a high > number of processes (process handling, scheduling, file handles, etc.). Right; the main problem with having lots more backends than you need is that the idle ones still eat their share of RAM and open file handles. A connection pooler uses relatively few resources per idle connection, so it's a much better impedance match if you want to service lots of connections that are mostly idle. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Feb 23 19:16:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 84ED08B9B1B for ; Wed, 23 Feb 2005 19:16:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04277-08 for ; Wed, 23 Feb 2005 19:15:49 +0000 (GMT) Received: from Mercury.turbocorp.com (mercury.turbocorp.com [198.212.166.40]) by svr1.postgresql.org (Postfix) with ESMTP id 418648B9EB9 for ; Wed, 23 Feb 2005 19:15:49 +0000 (GMT) Received: from [198.212.166.61] (Voyager.turbocorp.com [198.212.166.61]) by Mercury.turbocorp.com (8.12.8/8.12.8) with ESMTP id j1NJFlvD004779; Wed, 23 Feb 2005 14:15:47 -0500 Message-ID: <421CD668.7010503@turbocorp.com> Date: Wed, 23 Feb 2005 14:15:52 -0500 From: John Allgood User-Agent: Mozilla Thunderbird 1.0 (X11/20041207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Bruno Almeida do Lago , "'Michael Adler'" , pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> <21021.1109183848@sss.pgh.pa.us> In-Reply-To: <21021.1109183848@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/334 X-Sequence-Number: 10663 I think maybe I didn't explain myself well enough. At most we will service 200-250 connections across all the 9 databases mentioned. The database we are building is for a trucking company. Each of the databases represents a different division. With one master database that everything is updated to. Most of the access to the database is by simple queries. Most of the IO intensive stuff is done when revenue reports are generated and when we have our month/year end processing. All the trucking loads that are mark as delivered are transferred to our master database during night time processing. All that will be handled using custom scripts. Maybe I have given a better explanation of the application. my biggest concern is how to partition the shared storage for maximum performance. Is there a real benifit to having more that one raid5 partition or am I wasting my time. Thanks John Allgood - ESC Tom Lane wrote: >"Bruno Almeida do Lago" writes: > >>Is there a real limit for max_connections? Here we've an Oracle server with >>up to 1200 simultaneous conections over it! >> > >[ shrug... ] If your machine has the beef to run 1200 simultaneous >queries, you can set max_connections to 1200. > >The point of what you were quoting is that if you want to service >1200 concurrent users but you only expect maybe 100 simultaneously >active queries from them (and you have a database box that can only >service that many) then you want to put a connection pooler in >front of 100 backends, not try to start a backend for every user. > >Oracle may handle this sort of thing differently, I dunno. > > regards, tom lane > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > > From pgsql-performance-owner@postgresql.org Wed Feb 23 19:16:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BE5318B9EBC for ; Wed, 23 Feb 2005 19:16:19 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03283-09 for ; Wed, 23 Feb 2005 19:16:11 +0000 (GMT) Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by svr1.postgresql.org (Postfix) with ESMTP id C50688B9E80 for ; Wed, 23 Feb 2005 19:16:11 +0000 (GMT) Received: from ool-4350c7ad.dyn.optonline.net ([67.80.199.173] helo=[192.168.0.66]) by outbound.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.44) id 1D41zV-0001vD-Qm; Wed, 23 Feb 2005 14:16:09 -0500 Message-ID: <421CD6F0.8010406@zeut.net> Date: Wed, 23 Feb 2005 14:18:08 -0500 From: "Matthew T. O'Connor" Organization: Terrie O'Connor Realtors User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Browne Cc: pgsql-performance@postgresql.org Subject: Re: is pg_autovacuum so effective ? References: <12400.1109107683@sss.pgh.pa.us> <421BD64E.30803@bigfoot.com> <60psyr265t.fsf@dba2.int.libertyrms.com> In-Reply-To: <60psyr265t.fsf@dba2.int.libertyrms.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mail-Handler: MailHop Outbound by DynDNS.org X-Originating-IP: 67.80.199.173 X-Report-Abuse-To: abuse@dyndns.org (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: zeut X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/335 X-Sequence-Number: 10664 Christopher Browne wrote: >Gaetano Mendola writes: > > >>I do a graph about my disk usage and it's a ramp since one week, >>I'll continue to wait in order to see if it will decrease. >>I was expecting the steady state at something like 4 GB >>( after a full vacuum and reindex ) + 10 % = 4.4 GB >>I'm at 4.6 GB and increasing. I'll see how it will continue. >> >> > >You probably want for the "experiment" to last more than a week. > >After all, it might actually be that with your usage patterns, that >table would stabilize at 15% "overhead," and that might take a couple >or three weeks. > >Unless it's clear that it's growing perilously quickly, just leave it >alone so that there's actually some possibility of reaching an >equilibrium. Any time you "VACUUM FULL" it, that _destroys_ any >experimental results or any noticeable patterns, and it guarantees >that you'll see "seemingly perilous growth" for a while. > >And if the table is _TRULY_ growing "perilously quickly," then it is >likely that you should add in some scheduled vacuums on the table. >Not VACUUM FULLs; just plain VACUUMs. > >I revised cron scripts yet again today to do hourly and "4x/day" >vacuums of certain tables in some of our systems where we know they >need the attention. I didn't schedule any VACUUM FULLs; it's >unnecessary, and would lead directly to system outages, which is >totally unacceptable. > > Chris, is this in addition to pg_autovacuum? Or do you not use pg_autovacuum at all?, and if so why not? From pgsql-performance-owner@postgresql.org Wed Feb 23 19:46:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5743E54D2C for ; Wed, 23 Feb 2005 19:46:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13524-03 for ; Wed, 23 Feb 2005 19:46:18 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 0EA9254CF5 for ; Wed, 23 Feb 2005 19:46:16 +0000 (GMT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.2/8.12.9) with ESMTP id j1NJkDBo001670; (envelope-from ) Wed, 23 Feb 2005 13:46:14 -0600 (CST) Received: from [192.168.1.174] (67-41-93-122.cdrr.qwest.net [67.41.93.122]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j1NJkA3X011918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Wed, 23 Feb 2005 13:46:12 -0600 (CST) Message-ID: <421CDD83.3070609@arbash-meinel.com> Date: Wed, 23 Feb 2005 13:46:11 -0600 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Allgood Cc: Tom Lane , Bruno Almeida do Lago , "'Michael Adler'" , pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> <21021.1109183848@sss.pgh.pa.us> <421CD668.7010503@turbocorp.com> In-Reply-To: <421CD668.7010503@turbocorp.com> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigC0883B91617944F7AE152678" X-Virus-Scanned: ClamAV 0.80/682/Mon Jan 24 12:53:43 2005 clamav-milter version 0.80j on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV 0.80/706/Sun Feb 13 18:14:02 2005, clamav-milter version 0.75 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/336 X-Sequence-Number: 10665 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigC0883B91617944F7AE152678 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit John Allgood wrote: > I think maybe I didn't explain myself well enough. At most we will > service 200-250 connections across all the 9 databases mentioned. The > database we are building is for a trucking company. Each of the > databases represents a different division. With one master database > that everything is updated to. Most of the access to the database is > by simple queries. Most of the IO intensive stuff is done when revenue > reports are generated and when we have our month/year end processing. > All the trucking loads that are mark as delivered are transferred to > our master database during night time processing. All that will be > handled using custom scripts. Maybe I have given a better explanation > of the application. my biggest concern is how to partition the shared > storage for maximum performance. Is there a real benifit to having > more that one raid5 partition or am I wasting my time. > > Thanks > > John Allgood - ESC If you read the general advice statements, it's actually better to not use raid5, but to use raid10 (striping and mirroring). Simply because raid5 writing is quite poor. Also, if you have the disks, the next best improvement is to move pg_xlog onto it's own set of disks. I think that gets as much as 25% improvement by itself. pg_xlog is an append process, which must complete before the actual data gets updated, so giving it it's own set of spindles reduces seek time, and lets the log be written quickly. I think there is even some benefit to making pg_xlog be a solid state disk, as it doesn't have to be huge, but having high I/O rates can remove it as a bottleneck. (I'm not positive how large pg_xlog gets, but it is probably small compared with the total db size, and I think it can be flushed periodically as transactions are completed.) I'm not sure what you are considering "shared storage". Are you thinking that all the machines will be mounting a remote drive for writing the DB? They should all have their own local copy (multiple masters on the same database is not supported). I think it is possible to get better performance by having more raid systems. But it is application dependent. If you know that you have 2 tables that are being updated often and independently, then having each one on it's own raid would allow better concurrency. But it sounds like in your app you get concurrency by having a bunch of remote databases, which then do bulk updates on the master database. I think if you are careful to have each of the remote dbs update the master at a slightly different time, you could probably get very good transaction rates. John =:-> --------------enigC0883B91617944F7AE152678 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCHN2DJdeBCYSNAAMRAmhoAJ9IxhOahOT8clbOOe1GBghT55ooFwCePfl+ sKwu/5dJ7hyce3LOx8ZgVLk= =aFBq -----END PGP SIGNATURE----- --------------enigC0883B91617944F7AE152678-- From pgsql-performance-owner@postgresql.org Wed Feb 23 19:51:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 706B854C55 for ; Wed, 23 Feb 2005 19:51:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13656-05 for ; Wed, 23 Feb 2005 19:51:01 +0000 (GMT) Received: from mail3.panix.com (mail3.panix.com [166.84.1.74]) by svr1.postgresql.org (Postfix) with ESMTP id A039F54C58 for ; Wed, 23 Feb 2005 19:51:00 +0000 (GMT) Received: from panix1.panix.com (panix1.panix.com [166.84.1.1]) by mail3.panix.com (Postfix) with ESMTP id E500298214; Wed, 23 Feb 2005 14:51:00 -0500 (EST) Received: (from adler@localhost) by panix1.panix.com (8.11.6p3/8.8.8/PanixN1.1) id j1NJp0g28778; Wed, 23 Feb 2005 14:51:00 -0500 (EST) Date: Wed, 23 Feb 2005 14:50:59 -0500 From: Michael Adler To: John Allgood Cc: pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout Message-ID: <20050223195059.GA5334@pobox.com> References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> <21021.1109183848@sss.pgh.pa.us> <421CD668.7010503@turbocorp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <421CD668.7010503@turbocorp.com> User-Agent: Mutt/1.4.2.1i X-Hashcash: 1:20:050223:john@turbocorp.com::GFVLB3l4ka5B0+85:0000000000000000000 0000000000000000000000000p/h X-Hashcash: 1:20:050223:pgsql-performance@postgresql.org::GFVLB3l4ka5B0+85:00000 0000000000000000000000001+Om X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/337 X-Sequence-Number: 10666 On Wed, Feb 23, 2005 at 02:15:52PM -0500, John Allgood wrote: > using custom scripts. Maybe I have given a better explanation of the > application. my biggest concern is how to partition the shared storage > for maximum performance. Is there a real benifit to having more that one > raid5 partition or am I wasting my time. I think the simplest and most generic solution would be to put the OS and pg_xlog on a RAID 1 pair and dedicate the rest of the drives to RAID 5 or RAID 1+0 (striped set of mirrors) array. Depending on the nature of your work, you may get better performance by placing individual tables/indices on dedicated spindles for parallel access. -Mike Adler From pgsql-performance-owner@postgresql.org Wed Feb 23 20:05:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D145E54E34 for ; Wed, 23 Feb 2005 20:05:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19566-01 for ; Wed, 23 Feb 2005 20:05:47 +0000 (GMT) Received: from Mercury.turbocorp.com (mercury.turbocorp.com [198.212.166.40]) by svr1.postgresql.org (Postfix) with ESMTP id 79CAB54D78 for ; Wed, 23 Feb 2005 20:05:46 +0000 (GMT) Received: from [198.212.166.61] (Voyager.turbocorp.com [198.212.166.61]) by Mercury.turbocorp.com (8.12.8/8.12.8) with ESMTP id j1NK5CvD005652; Wed, 23 Feb 2005 15:05:12 -0500 Message-ID: <421CE1FD.80003@turbocorp.com> Date: Wed, 23 Feb 2005 15:05:17 -0500 From: John Allgood User-Agent: Mozilla Thunderbird 1.0 (X11/20041207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Arbash Meinel Cc: Tom Lane , Bruno Almeida do Lago , "'Michael Adler'" , pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> <21021.1109183848@sss.pgh.pa.us> <421CD668.7010503@turbocorp.com> <421CDD83.3070609@arbash-meinel.com> In-Reply-To: <421CDD83.3070609@arbash-meinel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/338 X-Sequence-Number: 10667 This some good info. The type of attached storage is a Kingston 14 bay Fibre Channel Infostation. I have 14 36GB 15,000 RPM drives. I think the way it is being explained that I should build a mirror with two disk for the pg_xlog and the striping and mirroring the rest and put all my databases into one cluster. Also I might mention that I am running clustering using Redhat Clustering Suite. John Arbash Meinel wrote: > John Allgood wrote: > >> I think maybe I didn't explain myself well enough. At most we will >> service 200-250 connections across all the 9 databases mentioned. The >> database we are building is for a trucking company. Each of the >> databases represents a different division. With one master database >> that everything is updated to. Most of the access to the database is >> by simple queries. Most of the IO intensive stuff is done when revenue >> reports are generated and when we have our month/year end processing. >> All the trucking loads that are mark as delivered are transferred to >> our master database during night time processing. All that will be >> handled using custom scripts. Maybe I have given a better explanation >> of the application. my biggest concern is how to partition the shared >> storage for maximum performance. Is there a real benifit to having >> more that one raid5 partition or am I wasting my time. >> >> Thanks >> >> John Allgood - ESC > > If you read the general advice statements, it's actually better to not > use raid5, but to use raid10 (striping and mirroring). Simply because > raid5 writing is quite poor. > > Also, if you have the disks, the next best improvement is to move > pg_xlog onto it's own set of disks. I think that gets as much as 25% > improvement by itself. pg_xlog is an append process, which must complete > before the actual data gets updated, so giving it it's own set of > spindles reduces seek time, and lets the log be written quickly. > I think there is even some benefit to making pg_xlog be a solid state > disk, as it doesn't have to be huge, but having high I/O rates can > remove it as a bottleneck. (I'm not positive how large pg_xlog gets, but > it is probably small compared with the total db size, and I think it can > be flushed periodically as transactions are completed.) > > I'm not sure what you are considering "shared storage". Are you thinking > that all the machines will be mounting a remote drive for writing the > DB? They should all have their own local copy (multiple masters on the > same database is not supported). > > I think it is possible to get better performance by having more raid > systems. But it is application dependent. If you know that you have 2 > tables that are being updated often and independently, then having each > one on it's own raid would allow better concurrency. > > But it sounds like in your app you get concurrency by having a bunch of > remote databases, which then do bulk updates on the master database. I > think if you are careful to have each of the remote dbs update the > master at a slightly different time, you could probably get very good > transaction rates. > > John > =:-> > From pgsql-performance-owner@postgresql.org Wed Feb 23 20:25:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CDFD256506 for ; Wed, 23 Feb 2005 20:25:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25554-03 for ; Wed, 23 Feb 2005 20:25:17 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 48DD156508 for ; Wed, 23 Feb 2005 20:25:16 +0000 (GMT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.2/8.12.9) with ESMTP id j1NKPH3I003574; (envelope-from ) Wed, 23 Feb 2005 14:25:17 -0600 (CST) Received: from [192.168.1.174] (67-41-93-122.cdrr.qwest.net [67.41.93.122]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j1NKOveC025933 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Wed, 23 Feb 2005 14:25:13 -0600 (CST) Message-ID: <421CE699.1060300@arbash-meinel.com> Date: Wed, 23 Feb 2005 14:24:57 -0600 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Allgood Cc: pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> <21021.1109183848@sss.pgh.pa.us> <421CD668.7010503@turbocorp.com> <421CDD83.3070609@arbash-meinel.com> <421CE1FD.80003@turbocorp.com> In-Reply-To: <421CE1FD.80003@turbocorp.com> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig58874C2859034230FAA51461" X-Virus-Scanned: ClamAV 0.80/682/Mon Jan 24 12:53:43 2005 clamav-milter version 0.80j on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV 0.80/706/Sun Feb 13 18:14:02 2005, clamav-milter version 0.75 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/339 X-Sequence-Number: 10668 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig58874C2859034230FAA51461 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit John Allgood wrote: > This some good info. The type of attached storage is a Kingston 14 bay > Fibre Channel Infostation. I have 14 36GB 15,000 RPM drives. I think > the way it is being explained that I should build a mirror with two > disk for the pg_xlog and the striping and mirroring the rest and put > all my databases into one cluster. Also I might mention that I am > running clustering using Redhat Clustering Suite. So are these 14-disks supposed to be shared across all of your 9 databases? It seems to me that you have a few architectural issues here. First, you can't really have 2 masters writing to the same disk array. I'm not sure if Redhat Clustering gets around this. But second is that you can't run 2 postgres engines on the same database. Postgres doesn't support a clustered setup. There are too many issues with concurancy and keeping everyone in sync. Since you seem to be okay with having a bunch of smaller localized databases, which update a master database 1/day, I would think you would want hardware to go something like this. 1 master server, at least dual opteron with access to lots of disks (likely the whole 14 if you can get away with it). Put 2 as a RAID1 for the OS, 4 as a RAID10 for pg_xlog, and then the other 8 as RAID10 for the rest of the database. 8-9 other servers, these don't need to be as powerful, since they are local domains. Probably a 4-disk RAID10 for the OS and pg_xlog is plenty good, and whatever extra disks you can get for the local database. The master database holds all information for all domains, but the other databases only hold whatever is the local information. Every night your script sequences through the domain databases one-by-one, updating the master database, and synchronizing whatever data is necesary back to the local domain. I would guess that this script could actually just continually run, going to each local db in turn, but you may want nighttime only updating depending on what kind of load they have. John =:-> --------------enig58874C2859034230FAA51461 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCHOaZJdeBCYSNAAMRAv/JAJ0e5Zs4cPApbFr99sQmMgQ+36WhRACdH8BB AhtJaz6Tof8qILgHI2FBUms= =DAxU -----END PGP SIGNATURE----- --------------enig58874C2859034230FAA51461-- From pgsql-performance-owner@postgresql.org Wed Feb 23 20:30:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 78A5D54E05 for ; Wed, 23 Feb 2005 20:30:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26589-05 for ; Wed, 23 Feb 2005 20:30:53 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 9622554DA7 for ; Wed, 23 Feb 2005 20:30:51 +0000 (GMT) Received: (qmail 30693 invoked from network); 23 Feb 2005 20:30:33 -0000 Received: from 218-101-14-37.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.37) by 0 with SMTP; 23 Feb 2005 20:30:33 -0000 Message-ID: <421CE7FA.5020704@coretech.co.nz> Date: Thu, 24 Feb 2005 09:30:50 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Problem with 7.4.5 and webmin 1.8 in grant function References: <1108914570.4218b18a2cf0d@webmail.moph.go.th> <42191623.7060401@coretech.co.nz> <1108949685.42193ab53e07c@webmail.moph.go.th> <421A4F96.60803@coretech.co.nz> <1109048458.421abc8a280ed@webmail.moph.go.th> <421AC6F3.5010102@coretech.co.nz> <1109086639.421b51af6edd4@webmail.moph.go.th> <421B90F4.9000707@coretech.co.nz> <1109170709.421c9a158c27c@webmail.moph.go.th> In-Reply-To: <1109170709.421c9a158c27c@webmail.moph.go.th> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/340 X-Sequence-Number: 10669 amrit@health2.moph.go.th wrote: > > I got the answer that is in module config of postgresl-webmin , there is a check > box for > > Use DBI to connect if available? yes no the default is > yes , but if I choosed no everything went fine. > > I also test it in the desktop mechine and get the same error and the same > solution. Could you explain what happen to the FC3 + postgresql and webmin 1.8? Well, given the error was coming from the postmaster, I don't believe that DBI or webmin have anything to do with it. What I can believe is that DBI=yes and DBI=no are using different parameters for connecting, therefore hitting different parts of your old (see below) pg_hba.conf settings. I concur with the other poster, and suspect that the files *were* using some form of ident identification, but have been subsequently edited to use trust - but the postmaster has not been restarted to know this! Try $ pg_ctl reload to get running with 'trust'. From pgsql-performance-owner@postgresql.org Wed Feb 23 20:42:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D19E3554D6 for ; Wed, 23 Feb 2005 20:42:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29784-07 for ; Wed, 23 Feb 2005 20:42:07 +0000 (GMT) Received: from Mercury.turbocorp.com (mercury.turbocorp.com [198.212.166.40]) by svr1.postgresql.org (Postfix) with ESMTP id 8242054DA7 for ; Wed, 23 Feb 2005 20:42:06 +0000 (GMT) Received: from [198.212.166.61] (Voyager.turbocorp.com [198.212.166.61]) by Mercury.turbocorp.com (8.12.8/8.12.8) with ESMTP id j1NKfavD006292; Wed, 23 Feb 2005 15:41:36 -0500 Message-ID: <421CEA85.50506@turbocorp.com> Date: Wed, 23 Feb 2005 15:41:41 -0500 From: John Allgood User-Agent: Mozilla Thunderbird 1.0 (X11/20041207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Arbash Meinel Cc: pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> <21021.1109183848@sss.pgh.pa.us> <421CD668.7010503@turbocorp.com> <421CDD83.3070609@arbash-meinel.com> <421CE1FD.80003@turbocorp.com> <421CE699.1060300@arbash-meinel.com> In-Reply-To: <421CE699.1060300@arbash-meinel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/341 X-Sequence-Number: 10670 Here is a summary about the cluster suite from redhat. All 9 databases will be on the primary server the secondary server I have is the failover. They don't actually share the partitions at the same time. When you have some type of failure the backup server takes over. Once you setup the hardware and install the clustering software. You then setup a service "ie postgres" and then you tell it what harddrive you will be using. /dev/sde1 and the clustering software takes care of starting and stopping the postgres database. Cluster Manager The Cluster Manager feature of Red Hat Cluster Suite provides an application failover infrastructure that can be used by a wide range of applications, including: * Most custom and mainstream commercial applications * File and print serving * Databases and database applications * Messaging applications * Internet and open source application With Cluster Manager, these applications can be deployed in high availability configurations so that they are always operational�bringing "scale-out" capabilities to enterprise Linux deployments. For high-volume open source applications, such as NFS, Samba, and Apache, Cluster Manager provides a complete ready-to-use failover solution. For most other applications, customers can create custom failover scripts using provided templates. Red Hat Professional Services can provide custom Cluster Manager deployment services where required. Features * Support for up to eight nodes: Allows high availability to be provided for multiple applications simultaneously. * NFS/CIFS Failover: Supports highly available file serving in Unix and Windows environments. * Fully shared storage subsystem: All cluster members have access to the same storage. * Comprehensive Data Integrity guarantees: Uses the latest I/O barrier technology, such as programmable power switches and watchdog timers. * SCSI and Fibre Channel support: Cluster Manager configurations can be deployed using latest SCSI and Fibre Channel technology. Multi-terabyte configurations can readily be made highly available. * Service failover: Cluster Manager not only ensures hardware shutdowns or failures are detected and recovered from automatically, but also will monitor your applications to ensure they are running correctly, and will restart them automatically if they fail. John Arbash Meinel wrote: > John Allgood wrote: > >> This some good info. The type of attached storage is a Kingston 14 bay >> Fibre Channel Infostation. I have 14 36GB 15,000 RPM drives. I think >> the way it is being explained that I should build a mirror with two >> disk for the pg_xlog and the striping and mirroring the rest and put >> all my databases into one cluster. Also I might mention that I am >> running clustering using Redhat Clustering Suite. > > > So are these 14-disks supposed to be shared across all of your 9 > databases? > It seems to me that you have a few architectural issues here. > > First, you can't really have 2 masters writing to the same disk array. > I'm not sure if Redhat Clustering gets around this. But second is that > you can't run 2 postgres engines on the same database. Postgres doesn't > support a clustered setup. There are too many issues with concurancy and > keeping everyone in sync. > > Since you seem to be okay with having a bunch of smaller localized > databases, which update a master database 1/day, I would think you would > want hardware to go something like this. > > 1 master server, at least dual opteron with access to lots of disks > (likely the whole 14 if you can get away with it). Put 2 as a RAID1 for > the OS, 4 as a RAID10 for pg_xlog, and then the other 8 as RAID10 for > the rest of the database. > > 8-9 other servers, these don't need to be as powerful, since they are > local domains. Probably a 4-disk RAID10 for the OS and pg_xlog is plenty > good, and whatever extra disks you can get for the local database. > > The master database holds all information for all domains, but the other > databases only hold whatever is the local information. Every night your > script sequences through the domain databases one-by-one, updating the > master database, and synchronizing whatever data is necesary back to the > local domain. I would guess that this script could actually just > continually run, going to each local db in turn, but you may want > nighttime only updating depending on what kind of load they have. > > John > =:-> > From pgsql-performance-owner@postgresql.org Wed Feb 23 21:02:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F41255650D for ; Wed, 23 Feb 2005 21:02:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36105-06 for ; Wed, 23 Feb 2005 21:01:57 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 6957656509 for ; Wed, 23 Feb 2005 21:01:56 +0000 (GMT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.2/8.12.9) with ESMTP id j1NL1wKj005548; (envelope-from ) Wed, 23 Feb 2005 15:01:58 -0600 (CST) Received: from [192.168.1.174] (67-41-93-122.cdrr.qwest.net [67.41.93.122]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j1NL1unk011035 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Wed, 23 Feb 2005 15:01:57 -0600 (CST) Message-ID: <421CEF43.6030207@arbash-meinel.com> Date: Wed, 23 Feb 2005 15:01:55 -0600 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Allgood Cc: pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> <21021.1109183848@sss.pgh.pa.us> <421CD668.7010503@turbocorp.com> <421CDD83.3070609@arbash-meinel.com> <421CE1FD.80003@turbocorp.com> <421CE699.1060300@arbash-meinel.com> <421CEA85.50506@turbocorp.com> In-Reply-To: <421CEA85.50506@turbocorp.com> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig8765F6D17C216B1B0F2EE386" X-Virus-Scanned: ClamAV 0.80/682/Mon Jan 24 12:53:43 2005 clamav-milter version 0.80j on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV 0.80/706/Sun Feb 13 18:14:02 2005, clamav-milter version 0.75 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/343 X-Sequence-Number: 10672 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8765F6D17C216B1B0F2EE386 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit John Allgood wrote: > Here is a summary about the cluster suite from redhat. All 9 databases > will be on the primary server the secondary server I have is the > failover. They don't actually share the partitions at the same time. > When you have some type of failure the backup server takes over. Once > you setup the hardware and install the clustering software. You then > setup a service "ie postgres" and then you tell it what harddrive you > will be using. /dev/sde1 and the clustering software takes care of > starting and stopping the postgres database. > Okay, I misunderstood your hardware. So you actually only have 1 machine, with a second machine as a potential rollover. But all transactions occur on the same hardware, even if is a separate "database". I was thinking these were alternate machines. So my first question is why are you partitioning into a separate database, and then updating the master one at night. Since everything is restricted to the same machine, why not just have everything performed on the master? However, sticking with your arrangement, it would seem that you might be able to get some extra performance if each database is on it's own raid, since you are fairly likely to have 2 transactions occuring at the same time, that don't affect eachother (since you wouldn't have any foreign keys, etc on 2 separate databases.) But I think the basic OS RAID1, pg_xlog RAID10, database RAID10 is still a good separation of disks. And probably would help you maximize your throughput. I can't say too much about how the Cluster failover stuff will work with postgres. But as long as one is completely shutdown before the next is started, and they are both running binary compatible versions of postgres, it seems like it would be fine. Not much different from having a second machine that is sitting turned off, which you turn on when the first one fails. John =:-> --------------enig8765F6D17C216B1B0F2EE386 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCHO9EJdeBCYSNAAMRAuhwAJsGL4kbAQN6v97zlAkkJqfS+2WC7gCgho1v 14X8PeioYG/8NsQ9qHTOBIg= =oQhb -----END PGP SIGNATURE----- --------------enig8765F6D17C216B1B0F2EE386-- From pgsql-performance-owner@postgresql.org Wed Feb 23 20:58:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0104654EE4 for ; Wed, 23 Feb 2005 20:58:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34176-09 for ; Wed, 23 Feb 2005 20:58:05 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id CA89254E05 for ; Wed, 23 Feb 2005 20:58:04 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [64.81.245.111] (account josh@agliodbs.com HELO temoku.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7060264; Wed, 23 Feb 2005 12:59:52 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Bruno Almeida do Lago" Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout Date: Wed, 23 Feb 2005 13:02:18 -0800 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> In-Reply-To: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502231302.18714.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/342 X-Sequence-Number: 10671 Bruno, > For example, 150 active connections on a medium-end > 32-bit Linux server will consume significant system resources, and 600 is > about the limit." That, is, "is about the limit for a medium-end 32-bit Linux server". Sorry if the implication didn't translate well. If you use beefier hardware, of course, you can manage more connections; personally I've never needed more than 1000, even on a web site that gets 100,000 d.u.v. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Feb 23 22:36:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B552B54D6F for ; Wed, 23 Feb 2005 22:36:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66886-04 for ; Wed, 23 Feb 2005 22:36:51 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id E4FC654CF5 for ; Wed, 23 Feb 2005 22:36:50 +0000 (GMT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id 6244818CC85; Wed, 23 Feb 2005 17:36:52 -0500 (EST) Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id 08548-02-6; Wed, 23 Feb 2005 17:36:49 -0500 (EST) Received: from [61.88.101.19] (unknown [61.88.101.19]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailbox.samurai.com (Postfix) with ESMTP id 80DD218CC63; Wed, 23 Feb 2005 17:36:48 -0500 (EST) Message-ID: <421D0543.6020308@samurai.com> Date: Thu, 24 Feb 2005 09:35:47 +1100 From: Neil Conway User-Agent: Debian Thunderbird 1.0 (X11/20050116) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Magnus Hagander Cc: "Vig, Sandor (G/FI-2)" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL is extremely slow on Windows References: <6BCB9D8A16AC4241919521715F4D8BCE47697A@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE47697A@algol.sollentuna.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.167 tagged_above=0 required=5 tests=AWL, RISK_FREE X-Spam-Level: X-Archive-Number: 200502/344 X-Sequence-Number: 10673 Magnus Hagander wrote: > Yes, fsync=false is very good for bulk loading *IFF* you can live with > data loss in case you get a crash during load. It's not merely data loss -- you could encounter potentially unrecoverable database corruption. There is a TODO item about allowing the delaying of WAL writes. If we maintain the WAL invariant (that is, a WAL record describing a change must hit disk before the change itself does) but simply don't flush the WAL at transaction commit, we should be able to get better performance without the risk of database corruption (so we would need to keep pages modified by the committed transaction pinned in memory until the WAL has been flushed, which might be done on a periodic basis). Naturally, there is a risk of losing data in the period between transaction commit and syncing the WAL, but no risk of database corruption. This seems a reasonable approach to providing better performance for people who don't need the strict guarantees provided by fsync=true. -Neil From pgsql-performance-owner@postgresql.org Wed Feb 23 22:56:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CA8E755CA8 for ; Wed, 23 Feb 2005 22:56:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72598-04 for ; Wed, 23 Feb 2005 22:56:40 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 084785597D for ; Wed, 23 Feb 2005 22:56:39 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1NMufJT023064; Wed, 23 Feb 2005 17:56:41 -0500 (EST) To: Neil Conway Cc: Magnus Hagander , "Vig, Sandor (G/FI-2)" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL is extremely slow on Windows In-reply-to: <421D0543.6020308@samurai.com> References: <6BCB9D8A16AC4241919521715F4D8BCE47697A@algol.sollentuna.se> <421D0543.6020308@samurai.com> Comments: In-reply-to Neil Conway message dated "Thu, 24 Feb 2005 09:35:47 +1100" Date: Wed, 23 Feb 2005 17:56:41 -0500 Message-ID: <23063.1109199401@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/345 X-Sequence-Number: 10674 Neil Conway writes: > There is a TODO item about allowing the delaying of WAL writes. If we > maintain the WAL invariant (that is, a WAL record describing a change > must hit disk before the change itself does) but simply don't flush the > WAL at transaction commit, we should be able to get better performance > without the risk of database corruption (so we would need to keep pages > modified by the committed transaction pinned in memory until the WAL has > been flushed, which might be done on a periodic basis). That interlock already exists, in the form of the bufmgr LSN logic. I think this "feature" might be as simple as XLogFlush(recptr); becomes /* Must flush if we are deleting files... */ if (PerCommitFlush || nrels > 0) XLogFlush(recptr); in RecordTransactionCommit. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Feb 24 03:50:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 15DAD56385 for ; Thu, 24 Feb 2005 03:50:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62914-05 for ; Thu, 24 Feb 2005 03:50:03 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id E983A5637F for ; Thu, 24 Feb 2005 03:50:02 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 62CCA31DE7; Thu, 24 Feb 2005 04:50:07 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout Date: Wed, 23 Feb 2005 22:24:57 -0500 Organization: cbbrowne Computing Inc Lines: 29 Message-ID: References: <20050223180338.GA4259@pobox.com> <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:3hYVTJqzVZ0/ZWwj6/BoJtsam+Y= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.114 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/346 X-Sequence-Number: 10675 teolupus@gmail.com ("Bruno Almeida do Lago") wrote: > Is there a real limit for max_connections? Here we've an Oracle server with > up to 1200 simultaneous conections over it! > > "max_connections: exactly like previous versions, this needs to be set to > the actual number of simultaneous connections you expect to need. High > settings will require more shared memory (shared_buffers). As the > per-connection overhead, both from PostgreSQL and the host OS, can be quite > high, it's important to use connection pooling if you need to service a > large number of users. For example, 150 active connections on a medium-end > 32-bit Linux server will consume significant system resources, and 600 is > about the limit." Right now, I have an Opteron box with: a) A load average of about 0.1, possibly less ;-), and b) 570 concurrent connections. Having so connections is something of a "fool's errand," as it really is ludicrously unnecessary, but I wouldn't be too afraid of having 1000 connections on that box, as long as they're being used for relatively small transactions. You can, of course, kill performance on any not-outrageously-large system if a few of those users are doing big queries... -- wm(X,Y):-write(X),write('@'),write(Y). wm('cbbrowne','gmail.com'). http://cbbrowne.com/info/slony.html I've had a perfectly wonderful evening. But this wasn't it. -- Groucho Marx From pgsql-performance-owner@postgresql.org Thu Feb 24 08:28:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7712E54DAC for ; Thu, 24 Feb 2005 08:28:57 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37178-04 for ; Thu, 24 Feb 2005 08:28:47 +0000 (GMT) Received: from mailin3.audi.de (mailin3.audi.de [143.164.102.17]) by svr1.postgresql.org (Postfix) with ESMTP id 2EA4D55BBC for ; Thu, 24 Feb 2005 08:28:45 +0000 (GMT) Received: from mailin2.audi.de (inwlbesi2n10-proxy-ip1.web.audi.vwg [10.198.7.251]) by mailin3.audi.de (Postfix) with ESMTP id 49935E9473; Thu, 24 Feb 2005 09:28:51 +0100 (CET) Message-ID: <977921B17B2F2048AA5AAE9B4CBB713E01423D2C@huaudigs0035.audi.de> From: "Vig, Sandor (G/FI-2)" To: 'John Allgood' Cc: pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout Date: Thu, 24 Feb 2005 09:28:47 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/347 X-Sequence-Number: 10676 Hi, RAID1 (mirroring) and RAID1+0 (striping and mirroring) seems to be a good choice. (RAID 5 is for saving money, but it doesn't have a good performance)=20 I suggest you to make a different array for: - Operating system - db logs - each database It is a little bit of "wasting" disk storage, but it has the best performance. Forget RAID 5. If your fibre channel card and the external storage = exceeds their throughput limits you should consider to implement +1 fibre = channel and/or +1 external storage unit. (If you had such a load) But it is only the hardware. The database structure, and the = application logic is the other 50% of the performance... Bye Vig S=E1ndor -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of John = Allgood Sent: Wednesday, February 23, 2005 9:42 PM To: John Arbash Meinel Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Peformance Tuning Opterons/ Hard Disk Layout Here is a summary about the cluster suite from redhat. All 9 databases=20 will be on the primary server the secondary server I have is the=20 failover. They don't actually share the partitions at the same time.=20 When you have some type of failure the backup server takes over. Once=20 you setup the hardware and install the clustering software. You then=20 setup a service "ie postgres" and then you tell it what harddrive you=20 will be using. /dev/sde1 and the clustering software takes care of=20 starting and stopping the postgres database. Cluster Manager The Cluster Manager feature of Red Hat Cluster Suite provides an=20 application failover infrastructure that can be used by a wide range of = applications, including: * Most custom and mainstream commercial applications * File and print serving * Databases and database applications * Messaging applications * Internet and open source application With Cluster Manager, these applications can be deployed in high=20 availability configurations so that they are always = operational=97bringing=20 "scale-out" capabilities to enterprise Linux deployments. For high-volume open source applications, such as NFS, Samba, and=20 Apache, Cluster Manager provides a complete ready-to-use failover=20 solution. For most other applications, customers can create custom=20 failover scripts using provided templates. Red Hat Professional = Services=20 can provide custom Cluster Manager deployment services where required. Features * Support for up to eight nodes: Allows high availability to be provided for multiple applications simultaneously. * NFS/CIFS Failover: Supports highly available file serving in Unix and Windows environments. * Fully shared storage subsystem: All cluster members have access = to the same storage. * Comprehensive Data Integrity guarantees: Uses the latest I/O barrier technology, such as programmable power switches and watchdog timers. * SCSI and Fibre Channel support: Cluster Manager configurations = can be deployed using latest SCSI and Fibre Channel technology. Multi-terabyte configurations can readily be made highly = available. * Service failover: Cluster Manager not only ensures hardware shutdowns or failures are detected and recovered from automatically, but also will monitor your applications to ensure they are running correctly, and will restart them automatically = if they fail. John Arbash Meinel wrote: > John Allgood wrote: > >> This some good info. The type of attached storage is a Kingston 14 = bay >> Fibre Channel Infostation. I have 14 36GB 15,000 RPM drives. I think >> the way it is being explained that I should build a mirror with two >> disk for the pg_xlog and the striping and mirroring the rest and put >> all my databases into one cluster. Also I might mention that I am >> running clustering using Redhat Clustering Suite. > > > So are these 14-disks supposed to be shared across all of your 9=20 > databases? > It seems to me that you have a few architectural issues here. > > First, you can't really have 2 masters writing to the same disk = array. > I'm not sure if Redhat Clustering gets around this. But second is = that > you can't run 2 postgres engines on the same database. Postgres = doesn't > support a clustered setup. There are too many issues with concurancy = and > keeping everyone in sync. > > Since you seem to be okay with having a bunch of smaller localized > databases, which update a master database 1/day, I would think you = would > want hardware to go something like this. > > 1 master server, at least dual opteron with access to lots of disks > (likely the whole 14 if you can get away with it). Put 2 as a RAID1 = for > the OS, 4 as a RAID10 for pg_xlog, and then the other 8 as RAID10 for > the rest of the database. > > 8-9 other servers, these don't need to be as powerful, since they are > local domains. Probably a 4-disk RAID10 for the OS and pg_xlog is = plenty > good, and whatever extra disks you can get for the local database. > > The master database holds all information for all domains, but the = other > databases only hold whatever is the local information. Every night = your > script sequences through the domain databases one-by-one, updating = the > master database, and synchronizing whatever data is necesary back to = the > local domain. I would guess that this script could actually just > continually run, going to each local db in turn, but you may want > nighttime only updating depending on what kind of load they have. > > John > =3D:-> > ---------------------------(end of = broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if = your joining column's datatypes do not match The information transmitted is intended only for the person or entity = to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you = received this in error, please contact the sender and delete the material from = any computer. From pgsql-performance-owner@postgresql.org Thu Feb 24 10:59:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D696856394 for ; Thu, 24 Feb 2005 10:59:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80141-04 for ; Thu, 24 Feb 2005 10:59:28 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id D2E5955456 for ; Thu, 24 Feb 2005 10:59:25 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 1DE7431DE7; Thu, 24 Feb 2005 11:59:33 +0100 (MET) From: Gaetano Mendola X-Newsgroups: pgsql.performance Subject: Re: is pg_autovacuum so effective ? Date: Thu, 24 Feb 2005 11:58:51 +0100 Organization: Hub.Org Networking Services Lines: 68 Message-ID: <421DB36B.70004@bigfoot.com> References: <12400.1109107683@sss.pgh.pa.us> <421BD64E.30803@bigfoot.com> <60psyr265t.fsf@dba2.int.libertyrms.com> <421CD6F0.8010406@zeut.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: "Matthew T. O'Connor" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <421CD6F0.8010406@zeut.net> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/348 X-Sequence-Number: 10677 Matthew T. O'Connor wrote: > Christopher Browne wrote: > >> Gaetano Mendola writes: >> >> >>> I do a graph about my disk usage and it's a ramp since one week, >>> I'll continue to wait in order to see if it will decrease. >>> I was expecting the steady state at something like 4 GB >>> ( after a full vacuum and reindex ) + 10 % = 4.4 GB >>> I'm at 4.6 GB and increasing. I'll see how it will continue. >>> >> >> >> You probably want for the "experiment" to last more than a week. >> >> After all, it might actually be that with your usage patterns, that >> table would stabilize at 15% "overhead," and that might take a couple >> or three weeks. >> >> Unless it's clear that it's growing perilously quickly, just leave it >> alone so that there's actually some possibility of reaching an >> equilibrium. Any time you "VACUUM FULL" it, that _destroys_ any >> experimental results or any noticeable patterns, and it guarantees >> that you'll see "seemingly perilous growth" for a while. >> >> And if the table is _TRULY_ growing "perilously quickly," then it is >> likely that you should add in some scheduled vacuums on the table. >> Not VACUUM FULLs; just plain VACUUMs. >> >> I revised cron scripts yet again today to do hourly and "4x/day" >> vacuums of certain tables in some of our systems where we know they >> need the attention. I didn't schedule any VACUUM FULLs; it's >> unnecessary, and would lead directly to system outages, which is >> totally unacceptable. >> >> > > Chris, is this in addition to pg_autovacuum? Or do you not use > pg_autovacuum at all?, and if so why not? I have the same requirement too. Actually pg_autovacuum can not be instructed "per table" so some time the global settings are not good enough. I have a table of logs with 6 milions rows ( 3 years logs ) I insert on that page ~ 6000 rows for day. I'm running pg_autovacuum with setting to ANALYZE or VACUUM table if the 10% is touched. With this setting pg_autovacuum will analyze that table each 3 months!!! So I need to analyze and/or vacuum it manually. Regards Gaetano Mendola From pgsql-performance-owner@postgresql.org Thu Feb 24 12:13:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2658255FA7 for ; Thu, 24 Feb 2005 12:13:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00915-10 for ; Thu, 24 Feb 2005 12:13:08 +0000 (GMT) Received: from mail.logi-track.com (www.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id 9D2FF55C0A for ; Thu, 24 Feb 2005 12:13:04 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J1119.j.pppool.de [85.74.17.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id 35AA3303AE; Thu, 24 Feb 2005 13:13:15 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id DBDAAAB2E5; Thu, 24 Feb 2005 13:13:10 +0100 (CET) Message-ID: <421DC4D5.1070909@logi-track.com> Date: Thu, 24 Feb 2005 13:13:09 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Gaetano Mendola Cc: "Matthew T. O'Connor" , pgsql-performance@postgresql.org Subject: Re: is pg_autovacuum so effective ? References: <12400.1109107683@sss.pgh.pa.us> <421BD64E.30803@bigfoot.com> <60psyr265t.fsf@dba2.int.libertyrms.com> <421CD6F0.8010406@zeut.net> <421DB36B.70004@bigfoot.com> In-Reply-To: <421DB36B.70004@bigfoot.com> X-Enigmail-Version: 0.90.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="------------enig764633B6B2515BA9B21374B6" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/349 X-Sequence-Number: 10678 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig764633B6B2515BA9B21374B6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, Gaetano, Gaetano Mendola schrieb: > I have the same requirement too. Actually pg_autovacuum can not be > instructed "per table" so some time the global settings are not good > enough. I have a table of logs with 6 milions rows ( 3 years logs ) > I insert on that page ~ 6000 rows for day. I'm running pg_autovacuum > with setting to ANALYZE or VACUUM table if the 10% is touched. > With this setting pg_autovacuum will analyze that table each 3 months!!= ! If you have only inserts, and only so few on a large table, you do not need to vacuum such often. Not to reclaim space, only to prevent transaction ID wraparound (which is ensured by pg_autovacuum). And if the data distribution does not change, frequently calling ANALYZE does not help much, either. Markus --=20 markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z=FCrich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com --------------enig764633B6B2515BA9B21374B6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCHcTVOVWsnapT9i0RA2R7AJ4hn/9N6WgAnCRNTs4VGdOdKVNj3QCcDs9s ywpRFAfqDamv7EzTkCd5geY= =IGfj -----END PGP SIGNATURE----- --------------enig764633B6B2515BA9B21374B6-- From pgsql-performance-owner@postgresql.org Thu Feb 24 13:27:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 52D8255E3C for ; Thu, 24 Feb 2005 13:27:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22823-09 for ; Thu, 24 Feb 2005 13:27:09 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by svr1.postgresql.org (Postfix) with ESMTP id 4433355DB1 for ; Thu, 24 Feb 2005 13:27:08 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 49so223219wri for ; Thu, 24 Feb 2005 05:27:17 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:cc:subject:date:organization:mime-version:content-type:content-transfer-encoding:x-mailer:in-reply-to:x-mimeole:thread-index:message-id; b=OepqCeN5EGCNq8v4E2fpqyJyX7RTXCsXppsHHzeZ2vwv9FLzT3sEjuj3MGyhySwIHV1mutKG0L/bJ5j2HTqpXFZT1yhkwGc6y98Z+b06OZYYhsrGffzotUHJ7M4+Z+1wvenvMR3PjH74lu1awmZ1UPWozZHAZX851wzxyc5Ybck= Received: by 10.54.59.24 with SMTP id h24mr26916wra; Thu, 24 Feb 2005 05:27:17 -0800 (PST) Received: from sbew318anc22 ([200.184.93.96]) by smtp.gmail.com with ESMTP id 10sm134969wrl.2005.02.24.05.27.14; Thu, 24 Feb 2005 05:27:17 -0800 (PST) From: "Bruno Almeida do Lago" To: Cc: Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout Date: Thu, 24 Feb 2005 10:28:34 -0300 Organization: G&P MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 In-Reply-To: <200502231302.18714.josh@agliodbs.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcUZ6mGTpRixC/hgQ92gsn0i33wv8QAiflvw Message-ID: <421dd635.7b3d0b0f.1e05.1618@smtp.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.085 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200502/350 X-Sequence-Number: 10679 No problems my friend :P I thought that since the beginning and just sent the e-mail to confirm if there was no software limitation. Best Wishes, Bruno Almeida do Lago -----Original Message----- From: Josh Berkus [mailto:josh@agliodbs.com] Sent: Wednesday, February 23, 2005 6:02 PM To: Bruno Almeida do Lago Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Peformance Tuning Opterons/ Hard Disk Layout Bruno, > For example, 150 active connections on a medium-end > 32-bit Linux server will consume significant system resources, and 600 is > about the limit." That, is, "is about the limit for a medium-end 32-bit Linux server". Sorry if the implication didn't translate well. If you use beefier hardware, of course, you can manage more connections; personally I've never needed more than 1000, even on a web site that gets 100,000 d.u.v. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Feb 24 18:31:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 96A4152A68 for ; Thu, 24 Feb 2005 18:31:54 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71256-07 for ; Thu, 24 Feb 2005 18:31:53 +0000 (GMT) Received: from Mercury.turbocorp.com (mercury.turbocorp.com [198.212.166.40]) by svr1.postgresql.org (Postfix) with ESMTP id 70B3052A52 for ; Thu, 24 Feb 2005 18:31:52 +0000 (GMT) Received: from [198.212.166.61] (Voyager.turbocorp.com [198.212.166.61]) by Mercury.turbocorp.com (8.12.8/8.12.8) with ESMTP id j1OIVZvD021843; Thu, 24 Feb 2005 13:31:35 -0500 Message-ID: <421E1D8A.8050203@turbocorp.com> Date: Thu, 24 Feb 2005 13:31:38 -0500 From: John Allgood User-Agent: Mozilla Thunderbird 1.0 (X11/20041207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org, john@arbash-meinel.com Subject: Peformance Tuning Opterons/ Hard Disk Layout Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/351 X-Sequence-Number: 10680 Hello Again In the below statement you mention putting each database on its own raid mirror. "However, sticking with your arrangement, it would seem that you might be able to get some extra performance if each database is on it's own raid, since you are fairly likely to have 2 transactions occuring at the same time, that don't affect eachother (since you wouldn't have any foreign keys, etc on 2 separate databases.)" That would take alot of disk drives to accomplish. I was thinking maybe putting three or four databases on each raid and dividing the heaviest used databases on each mirrored set. And for each of these sets have its own mirror for pg_xlog. My question is what is the best way to setup postgres databases on different disks. I have setup multiple postmasters on this system as a test. The only problem was configuring each databases "ie postgresql.conf, pg_hba.conf". Is there anyway in postgres to have everything in one cluster and have it seperated onto multiple drives. Here is a example of what is was thinking about. MIRROR1 - Database Group 1 MIRROR2 - pg_xlog for database group 1 MIRROR3 - Database Group 2 MIRROR4 - pg_xlog for database group 2 MIRROR5 - Database Group 3 MIRROR6 - pg_xlog for database group 3 This will take about 12 disk drives. I have a 14 bay Storage Bay I can use two of the drives for hotspare's. Thanks John Allgood - ESC Systems Administrator From pgsql-performance-owner@postgresql.org Thu Feb 24 19:08:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3DE1052A69 for ; Thu, 24 Feb 2005 19:08:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18854-07 for ; Thu, 24 Feb 2005 19:08:21 +0000 (GMT) Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) by svr1.postgresql.org (Postfix) with ESMTP id 57DE352A68 for ; Thu, 24 Feb 2005 19:08:20 +0000 (GMT) Received: from jfradkin ([66.15.127.235]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0ICF00IWZJU7JGW0@vms044.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 24 Feb 2005 13:08:32 -0600 (CST) Date: Thu, 24 Feb 2005 14:12:29 -0500 From: "Joel Fradkin" Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout In-reply-to: <421E1D8A.8050203@turbocorp.com> To: "'John Allgood'" , , Message-id: <005d01c51aa4$c9dd00f0$797ba8c0@jfradkin> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=3.151 tagged_above=0 required=5 tests=AWL, MSGID_DOLLARS X-Spam-Level: *** X-Archive-Number: 200502/352 X-Sequence-Number: 10681 I am no expert, but have been asking them a bunch and I think your = missing a key concept. The data is best on several drives. I could be completely off, but if I understood (I just finished doing = the same kind of thing minus several databases) you want your WAL on fast = drives in raid 1 and your data (as many drives as you can use) on raid 10 (can = be slower drives , but I saw you already have a bunch of 15k drives). So you may get best performance just using one database rather then = several smaller ones on mirrored data drives. Keep in mind if you go with ES4 (I = am using AS4) and postgres 8 you can add spindles and move hard hit tables = to their own spindle. Again I am no expert; just thought I would echo what I was informed. I ended up using 2 15k drives in raid 1 for my WAL and 4 10k drives for = my data in raid 10. I ended up using links to these from the original = install of postgres on the raid 5, 4 15k drives inside the server itself. I = believe this gives me three separate raid arrays for my install with logs and = such on the raid 5, data on the raid 10 and wal on the raid 1. I am in the testing and conversion phase and have found it very fast. I used a 4 processor Dell 6550, but think from what I have been told your computer would have been a better choice (CPU wise). I am not using fibre but do = have a 14 drive powervault which I split to have the 15k's on one side and = the 10k's on the other. So I am using both channels of the controller. I = have been told for me to get best performance I should add as many 10k drives = to my data array as I can (but this was all I had in my budget). I have = room for 3 more drives on that side of the powervault. Best of luck on your project. Joel From pgsql-performance-owner@postgresql.org Thu Feb 24 19:40:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2164854D3A for ; Thu, 24 Feb 2005 19:40:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88122-07 for ; Thu, 24 Feb 2005 19:40:51 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 9E77052A7A for ; Thu, 24 Feb 2005 19:40:50 +0000 (GMT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.2/8.12.9) with ESMTP id j1OJf1Cm013806; (envelope-from ) Thu, 24 Feb 2005 13:41:01 -0600 (CST) Received: from [192.168.1.100] (12-217-241-0.client.mchsi.com [12.217.241.0]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j1OJexxQ016867 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Thu, 24 Feb 2005 13:41:01 -0600 (CST) Message-ID: <421E2DC8.8040701@arbash-meinel.com> Date: Thu, 24 Feb 2005 13:40:56 -0600 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Allgood Cc: pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout References: <421E1D8A.8050203@turbocorp.com> In-Reply-To: <421E1D8A.8050203@turbocorp.com> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9278331C5EC6E982FA783C54" X-Virus-Scanned: ClamAV 0.80/682/Mon Jan 24 12:53:43 2005 clamav-milter version 0.80j on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV 0.80/706/Sun Feb 13 18:14:02 2005, clamav-milter version 0.75 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/353 X-Sequence-Number: 10682 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9278331C5EC6E982FA783C54 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit John Allgood wrote: > Hello Again > > In the below statement you mention putting each database on its own > raid mirror. > > "However, sticking with your arrangement, it would seem that you might be > able to get some extra performance if each database is on it's own raid, > since you are fairly likely to have 2 transactions occuring at the same > time, that don't affect eachother (since you wouldn't have any foreign > keys, etc on 2 separate databases.)" > > That would take alot of disk drives to accomplish. I was thinking > maybe putting three or four databases on each raid and dividing the > heaviest used databases on each mirrored set. And for each of these > sets have its own mirror for pg_xlog. My question is what is the best > way to setup postgres databases on different disks. I have setup > multiple postmasters on this system as a test. The only problem was > configuring each databases "ie postgresql.conf, pg_hba.conf". Is > there anyway in postgres to have everything in one cluster and have it > seperated onto multiple drives. Here is a example of what is was > thinking about. > I think this is something that you would have to try and see what works. My first feeling is that 8-disks in RAID10 is better than 4 sets of RAID1. > MIRROR1 - Database Group 1 > MIRROR2 - pg_xlog for database group 1 > MIRROR3 - Database Group 2 > MIRROR4 - pg_xlog for database group 2 > MIRROR5 - Database Group 3 > MIRROR6 - pg_xlog for database group 3 > > This will take about 12 disk drives. I have a 14 bay Storage Bay I can > use two of the drives for hotspare's. > I would have all of them in 1 database cluster, which means they are all served by the same postgres daemon. Which I believe means that they all use the same pg_xlog. That means you only need 1 raid for pg_xlog, though I would make it a 4-drive RAID10. (RAID1 is redundant, but actually slower on writes, you need the 0 to speed up reading/writing, I could be wrong). I believe you can still split each database onto it's own raid later on if you find that you need to. So this is my proposal 1: OS RAID (sounds like this is not in the Storage Bay). 4-drives RAID10 pg_xlog 8-drives RAID10 database cluster 2-drives Hot spares / RAID1 If you feel like you want to partition your databases, you could also do proposal 2: 4-drives RAID10 pg_xlog 4-drives RAID10 databases master + 1-4 4-drives RAID10 databases 5-9 2-drives hotspare / RAID1 If you think partitioning is better than striping, you could do proposal 3: 4-drives RAID10 pg_xlog 2-drives RAID1 master database 2-drives RAID1 databases 1,2,3 2-drives RAID1 databases 4,5 2-drives RAID1 databases 6,7 2-drives RAID1 databases 8,9 There are certainly a lot of potential arrangements here, and it's not like I've tried a lot of them. pg_xlog seems like a big enough bottleneck that it would be good to put it on it's own RAID10, to make it as fast as possible. It also depends a lot on whether you will be write heavy/read heavy, etc. RAID5 works quite well for reading, very poor for writing. But if the only reason to have the master database is to perform read heavy queries, and all the writing is done at night in bulk fashion with careful tuning to avoid saturation, then maybe you would want to put the master database on a RAID5 so that you can get extra disk space. You could do proposal 4: 4-drive RAID10 pg_xlog 4-drive RAID5 master db 2-drive RAID1 dbs 1-3 2-drive RAID1 dbs 4-6 2-drive RAID1 dbs 7-9 You might also do some testing and find that pg_xlog doesn't deserve it's own 4 disks, and they would be better off in the bulk tables. Unfortunately a lot of this would come down to performance testing on your dataset, with a real data load. Which isn't very easy to do. I personally like the simplicity of proposal 1. John =:-> > > Thanks > > John Allgood - ESC > Systems Administrator --------------enig9278331C5EC6E982FA783C54 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCHi3IJdeBCYSNAAMRAkayAJ4omGQwmIDKNRR/wWFENdoVfHQbxACggKFZ JHfIgewKlJyVCIP+wbaEVKQ= =z+RJ -----END PGP SIGNATURE----- --------------enig9278331C5EC6E982FA783C54-- From pgsql-performance-owner@postgresql.org Thu Feb 24 21:25:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 454D652A5A for ; Thu, 24 Feb 2005 21:25:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69043-05 for ; Thu, 24 Feb 2005 21:25:43 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id CEE4852A4F for ; Thu, 24 Feb 2005 21:25:42 +0000 (GMT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j1OLPYF14343; Thu, 24 Feb 2005 16:25:34 -0500 (EST) From: Bruce Momjian Message-Id: <200502242125.j1OLPYF14343@candle.pha.pa.us> Subject: Re: PostgreSQL is extremely slow on Windows In-Reply-To: <421D0543.6020308@samurai.com> To: Neil Conway Date: Thu, 24 Feb 2005 16:25:34 -0500 (EST) Cc: Magnus Hagander , "Vig, Sandor (G/FI-2)" , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=AWL, RISK_FREE X-Spam-Level: X-Archive-Number: 200502/354 X-Sequence-Number: 10683 Neil Conway wrote: > Magnus Hagander wrote: > > Yes, fsync=false is very good for bulk loading *IFF* you can live with > > data loss in case you get a crash during load. > > It's not merely data loss -- you could encounter potentially > unrecoverable database corruption. > > There is a TODO item about allowing the delaying of WAL writes. If we > maintain the WAL invariant (that is, a WAL record describing a change > must hit disk before the change itself does) but simply don't flush the > WAL at transaction commit, we should be able to get better performance > without the risk of database corruption (so we would need to keep pages > modified by the committed transaction pinned in memory until the WAL has > been flushed, which might be done on a periodic basis). > > Naturally, there is a risk of losing data in the period between > transaction commit and syncing the WAL, but no risk of database > corruption. This seems a reasonable approach to providing better > performance for people who don't need the strict guarantees provided by > fsync=true. Right. Just for clarity, you might lose the last 5 seconds of transactions, but all transactsions would be completely committed or aborted in your datbase. Right now with fsync off you can get transactions partially commited in your database, which is a serious problem (think moving money from one account to another). -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Mon Feb 28 12:05:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9789A56367 for ; Thu, 24 Feb 2005 22:30:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93663-09 for ; Thu, 24 Feb 2005 22:30:08 +0000 (GMT) Received: from pns.mm.eutelsat.org (pns.mm.eutelsat.org [194.214.173.227]) by svr1.postgresql.org (Postfix) with ESMTP id E3AED560F2 for ; Thu, 24 Feb 2005 22:30:04 +0000 (GMT) Received: from nts-03.mm.eutelsat.org (localhost [127.0.0.1]) by pns.mm.eutelsat.org (8.11.6/linuxconf) with ESMTP id j1OMUEo17857; Thu, 24 Feb 2005 23:30:15 +0100 Received: from [127.0.0.1] (accesspoint.mm.eutelsat.org [194.214.173.4]) by nts-03.mm.eutelsat.org (8.11.6/linuxconf) with ESMTP id j1OMUEZ04681; Thu, 24 Feb 2005 23:30:14 +0100 Message-ID: <421E556E.6010202@mbigroup.it> Date: Thu, 24 Feb 2005 23:30:06 +0100 From: Gaetano Mendola User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Markus Schaber Cc: Gaetano Mendola , "Matthew T. O'Connor" , pgsql-performance@postgresql.org Subject: Re: is pg_autovacuum so effective ? References: <12400.1109107683@sss.pgh.pa.us> <421BD64E.30803@bigfoot.com> <60psyr265t.fsf@dba2.int.libertyrms.com> <421CD6F0.8010406@zeut.net> <421DB36B.70004@bigfoot.com> <421DC4D5.1070909@logi-track.com> In-Reply-To: <421DC4D5.1070909@logi-track.com> X-Enigmail-Version: 0.90.1.1 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.103 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/366 X-Sequence-Number: 10695 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Markus Schaber wrote: > Hi, Gaetano, > > Gaetano Mendola schrieb: > > >>I have the same requirement too. Actually pg_autovacuum can not be >>instructed "per table" so some time the global settings are not good >>enough. I have a table of logs with 6 milions rows ( 3 years logs ) >>I insert on that page ~ 6000 rows for day. I'm running pg_autovacuum >>with setting to ANALYZE or VACUUM table if the 10% is touched. >>With this setting pg_autovacuum will analyze that table each 3 months!!! > > > If you have only inserts, and only so few on a large table, you do not > need to vacuum such often. Not to reclaim space, only to prevent > transaction ID wraparound (which is ensured by pg_autovacuum). > > And if the data distribution does not change, frequently calling ANALYZE > does not help much, either. Yes, I'm aware about it indeed I need the analyze because usualy I do on that table select regarding last 24 ours so need to analyze it in order to collect the statistics for this period. Beside that I tried to partition that table, I used both tecnique on my knowledge 1) A view with UNION ALL on all tables collecting these logs 2) Using inheritance and both cases are working in theory but in practice are not ( the index scan is lost as soon you use this view/table inside others views or joining them) I heard that next version of pg_autovacuum can be instructed "per table"; is it true ? Regards Gaetano Mendola -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCHlVu7UpzwH2SGd4RAqQfAKCatX9qbf5fmTN7RbapWj6BgAcwQgCfRy2R ApeFl9jezm/4YyVN/4fY3Jg= =wBIK -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Fri Feb 25 05:02:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6545056411 for ; Fri, 25 Feb 2005 05:02:41 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20494-10 for ; Fri, 25 Feb 2005 05:02:40 +0000 (GMT) Received: from stark.xeocode.com (i216-58-44-227.avalonworks.net [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 0E23956381 for ; Fri, 25 Feb 2005 05:02:39 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1D4XcP-0001MU-00; Fri, 25 Feb 2005 00:02:25 -0500 To: Bruce Momjian Cc: Neil Conway , Magnus Hagander , "Vig, Sandor (G/FI-2)" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL is extremely slow on Windows References: <200502242125.j1OLPYF14343@candle.pha.pa.us> In-Reply-To: <200502242125.j1OLPYF14343@candle.pha.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 25 Feb 2005 00:02:25 -0500 Message-ID: <87ekf5qljy.fsf@stark.xeocode.com> Lines: 14 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/355 X-Sequence-Number: 10684 Bruce Momjian writes: > Right now with fsync off you can get transactions partially commited in your > database, which is a serious problem (think moving money from one account to > another). It's worse than that. You can get a totally corrupted database. Things like duplicated records (the before and after image of an update). Or indexes that are out of sync with the table. This can cause strange inconsistent results depending on the plan queries use, or outright database crashes. -- greg From pgsql-performance-owner@postgresql.org Fri Feb 25 07:41:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F24AB52A59 for ; Fri, 25 Feb 2005 07:41:50 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64141-08 for ; Fri, 25 Feb 2005 07:41:45 +0000 (GMT) Received: from hotmail.com (bay14-dav7.bay14.hotmail.com [64.4.48.111]) by svr1.postgresql.org (Postfix) with ESMTP id EA56852A54 for ; Fri, 25 Feb 2005 07:41:44 +0000 (GMT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 24 Feb 2005 23:42:01 -0800 Message-ID: Received: from 144.136.239.156 by BAY14-DAV7.phx.gbl with DAV; Fri, 25 Feb 2005 07:41:56 +0000 X-Originating-IP: [144.136.239.156] X-Originating-Email: [space_ball_one@hotmail.com] X-Sender: space_ball_one@hotmail.com From: "SpaceBallOne" To: Subject: gah! sudden slowdown?? Date: Fri, 25 Feb 2005 15:41:58 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0025_01C51B50.8A4839D0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-OriginalArrivalTime: 25 Feb 2005 07:42:01.0021 (UTC) FILETIME=[7DDEDED0:01C51B0D] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=4.555 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST, FORGED_MUA_OUTLOOK, HTML_50_60, HTML_MESSAGE, MSGID_FROM_MTA_HEADER, PLING_QUERY X-Spam-Level: **** X-Archive-Number: 200502/356 X-Sequence-Number: 10685 This is a multi-part message in MIME format. ------=_NextPart_000_0025_01C51B50.8A4839D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Our dual opteron has been performing well for many weeks now (after some = simple tuning) when all of a sudden the queries have slowed right down! ie: DUAL 246 OPTERON: select count(*) from job_archieve; - Time: 107.24 ms explain analyse select count(*) from job_archieve; Aggregate (cost=3D2820.50..2820.50 rows=3D1 width=3D0) (actual = time=3D153.53..153.53 rows=3D1 loops=3D1) -> Seq Scan on job_archieve (cost=3D0.00..2789.20 rows=3D12520 = width=3D0) (actual time=3D1.39..132.98 rows=3D12520 loops=3D1) Total runtime: 153.74 msec Time: 156.94 ms CRAPPY AMD ATHLON XP 1700+: select count(*) from job_archieve; - Time: 23.30 ms explain analyse select count(*) from job_archieve; Aggregate (cost=3D2816.50..2816.50 rows=3D1 width=3D0) (actual = time=3D133.83..133.84 rows=3D1 loops=3D1) -> Seq Scan on job_archieve (cost=3D0.00..2785.20 rows=3D12520 = width=3D0) (actual time=3D0.02..72.64 rows=3D12520 loops=3D1) Total runtime: 133.92 msec Time: 134.79 ms The ratio of these simple query times is about accurate for most queries = performed on the same database on the different machines... Any ideas = what may have suddenly caused this and where to start troubleshooting??? = Both dbs have already been fully vacuumed. The opteron is going to get a overhaul (4 port raid going in, fresh = install of freebsd, postgres etc) but would be handy to know for future = reference in case this happens again.... (ps, yes i know archive is not spelt archieve ;) Cheers! Dave. ------=_NextPart_000_0025_01C51B50.8A4839D0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Our dual opteron has been performing = well for many=20 weeks now (after some simple tuning) when all of a sudden the queries = have=20 slowed right down!

ie:
 
DUAL 246 OPTERON:
 
select count(*) from job_archieve; - = Time: 107.24 ms
 
explain analyse select count(*) from=20 job_archieve;
Aggregate  (cost=3D2820.50..2820.50 rows=3D1 = width=3D0) (actual=20 time=3D153.53..153.53 rows=3D1 loops=3D1)
   ->  = Seq Scan on=20 job_archieve  (cost=3D0.00..2789.20 rows=3D12520 width=3D0) (actual = time=3D1.39..132.98 rows=3D12520 loops=3D1)
 Total runtime: = 153.74=20 msec
Time: 156.94 ms
 
 
 
CRAPPY AMD ATHLON XP = 1700+:
 
select count(*) from job_archieve; - = Time: 23.30 ms
 
explain analyse select count(*) from=20 job_archieve;
Aggregate  = (cost=3D2816.50..2816.50 rows=3D1=20 width=3D0) (actual time=3D133.83..133.84 rows=3D1 = loops=3D1)
   -> =20 Seq Scan on job_archieve  (cost=3D0.00..2785.20 rows=3D12520 = width=3D0) (actual=20 time=3D0.02..72.64 rows=3D12520 loops=3D1)
 Total runtime: = 133.92=20 msec
Time: 134.79 ms
 
 
 
 
 
The ratio of these simple query times = is about=20 accurate for most queries performed on the same database on the = different=20 machines... Any ideas what may have suddenly caused this and where to = start=20 troubleshooting??? Both dbs have already been fully = vacuumed.
 
The opteron is going to get a overhaul = (4 port raid=20 going in, fresh install of freebsd, postgres etc) but would be handy to = know for=20 future reference in case this happens again....
 
(ps, yes i know archive is not spelt = archieve=20 ;)
 
Cheers!
Dave.
 



------=_NextPart_000_0025_01C51B50.8A4839D0-- From pgsql-performance-owner@postgresql.org Fri Feb 25 10:10:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D9DFF52A88 for ; Fri, 25 Feb 2005 10:10:38 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03303-01 for ; Fri, 25 Feb 2005 10:10:33 +0000 (GMT) Received: from mailin4.audi.de (mailin4.audi.de [143.164.102.18]) by svr1.postgresql.org (Postfix) with ESMTP id 169B352A9A for ; Fri, 25 Feb 2005 10:10:31 +0000 (GMT) Received: from mailin1.audi.de (inwlbesi2n10-proxy-ip2.web.audi.vwg [10.198.7.252]) by mailin4.audi.de (Postfix) with ESMTP id 2FEF8E96DC for ; Fri, 25 Feb 2005 11:10:47 +0100 (CET) Message-ID: <977921B17B2F2048AA5AAE9B4CBB713E01423D42@huaudigs0035.audi.de> From: "Vig, Sandor (G/FI-2)" To: pgsql-performance@postgresql.org Subject: IS NULL vs IS NOT NULL Date: Fri, 25 Feb 2005 11:10:35 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C51B22.3F9452ED" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.033 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, WEIRD_QUOTING X-Spam-Level: * X-Archive-Number: 200502/357 X-Sequence-Number: 10686 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C51B22.3F9452ED Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, Another "funny" thing: I have a query which runs on (Linux) PostgreSQL 7.4.x under 10 sec. I tried to run it on (Windows) PostgreSQL 8.0 yesterday. It didn't finished at all! (I shoot it down after 10 minutes) I made various tests and I figured out something interesting: The same query with: A, "history.undo_action_id > 0" runs in 10 sec.=09 B, "history.undo_action_id is not null" runs in 10 sec.=09 C, "history.undo_action_id is null" runs forever (?!) I used EXPLAIN but I couldn't figure out what the problem was. In every explain output are 3 lines: " -> Index Scan using speed_3 on history = (.........)" " Index Cond: (type_id =3D 6)" " Filter: (undo_action_id IS NOT NULL)" where "speed_3" is a btree index on history.type_id. There is also an = index for history.undo_action_id (btree) but it is not used. The tables are well indexed, and have about 200.000 records. The SQL file and the 3 scenarios are in attachment. Help, anyone? Vig S=E1ndor The information transmitted is intended only for the person or entity = to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you = received this in error, please contact the sender and delete the material from = any computer. =20 ------_=_NextPart_000_01C51B22.3F9452ED Content-Type: text/plain; name="_is_null.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="_is_null.txt" QUERY PLAN=0A= "Nested Loop (cost=3D1.10..6331.32 rows=3D1 width=3D84)"=0A= " -> Nested Loop (cost=3D1.10..6325.56 rows=3D1 width=3D62)"=0A= " -> Nested Loop (cost=3D1.10..6319.53 rows=3D1 = width=3D70)"=0A= " Join Filter: ((""inner"".snumber =3D ""outer"".snumber) = AND (""outer"".event_id =3D ""inner"".event_id))"=0A= " -> Index Scan using speed_3 on history = (cost=3D0.00..393.33 rows=3D1 width=3D24)"=0A= " Index Cond: (type_id =3D 6)"=0A= " Filter: (undo_action_id IS NULL)"=0A= " -> Hash Join (cost=3D1.10..5822.46 rows=3D6916 = width=3D54)"=0A= " Hash Cond: (""outer"".field_id =3D = ""inner"".field_id)"=0A= " -> Seq Scan on seats (cost=3D0.00..4887.80 = rows=3D172880 width=3D24)"=0A= " -> Hash (cost=3D1.08..1.08 rows=3D8 = width=3D46)"=0A= " -> Seq Scan on fields (cost=3D0.00..1.08 = rows=3D8 width=3D46)"=0A= " -> Index Scan using i_action_id2 on actions = (cost=3D0.00..6.02 rows=3D1 width=3D8)"=0A= " Index Cond: (""outer"".action_id =3D = actions.action_id)"=0A= " Filter: (((created)::date =3D '2005-02-24'::date) AND = (user_id =3D 23))"=0A= " -> Index Scan using events_pkey on events (cost=3D0.00..5.75 = rows=3D1 width=3D46)"=0A= " Index Cond: (""outer"".event_id =3D events.event_id)"=0A= ------_=_NextPart_000_01C51B22.3F9452ED Content-Type: text/plain; name="_is_not_null.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="_is_not_null.txt" QUERY PLAN=0A= "Nested Loop (cost=3D395.03..6833.12 rows=3D1 width=3D84)"=0A= " -> Nested Loop (cost=3D395.03..6827.36 rows=3D1 width=3D62)"=0A= " -> Hash Join (cost=3D395.03..6700.72 rows=3D21 = width=3D70)"=0A= " Hash Cond: ((""outer"".snumber =3D ""inner"".snumber) = AND (""outer"".event_id =3D ""inner"".event_id))"=0A= " -> Hash Join (cost=3D1.10..5822.46 rows=3D6916 = width=3D54)"=0A= " Hash Cond: (""outer"".field_id =3D = ""inner"".field_id)"=0A= " -> Seq Scan on seats (cost=3D0.00..4887.80 = rows=3D172880 width=3D24)"=0A= " -> Hash (cost=3D1.08..1.08 rows=3D8 = width=3D46)"=0A= " -> Seq Scan on fields (cost=3D0.00..1.08 = rows=3D8 width=3D46)"=0A= " -> Hash (cost=3D393.33..393.33 rows=3D121 = width=3D24)"=0A= " -> Index Scan using speed_3 on history = (cost=3D0.00..393.33 rows=3D121 width=3D24)"=0A= " Index Cond: (type_id =3D 6)"=0A= " Filter: (undo_action_id IS NOT NULL)"=0A= " -> Index Scan using i_action_id2 on actions = (cost=3D0.00..6.02 rows=3D1 width=3D8)"=0A= " Index Cond: (""outer"".action_id =3D = actions.action_id)"=0A= " Filter: (((created)::date =3D '2005-02-24'::date) AND = (user_id =3D 23))"=0A= " -> Index Scan using events_pkey on events (cost=3D0.00..5.75 = rows=3D1 width=3D46)"=0A= " Index Cond: (""outer"".event_id =3D events.event_id)"=0A= ------_=_NextPart_000_01C51B22.3F9452ED Content-Type: text/plain; name="_greater_than_null.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="_greater_than_null.txt" QUERY PLAN=0A= "Nested Loop (cost=3D394.93..6477.86 rows=3D1 width=3D84)"=0A= " -> Nested Loop (cost=3D394.93..6472.10 rows=3D1 width=3D62)"=0A= " -> Hash Join (cost=3D394.93..6423.85 rows=3D8 = width=3D70)"=0A= " Hash Cond: ((""outer"".snumber =3D ""inner"".snumber) = AND (""outer"".event_id =3D ""inner"".event_id))"=0A= " -> Hash Join (cost=3D1.10..5822.46 rows=3D6916 = width=3D54)"=0A= " Hash Cond: (""outer"".field_id =3D = ""inner"".field_id)"=0A= " -> Seq Scan on seats (cost=3D0.00..4887.80 = rows=3D172880 width=3D24)"=0A= " -> Hash (cost=3D1.08..1.08 rows=3D8 = width=3D46)"=0A= " -> Seq Scan on fields (cost=3D0.00..1.08 = rows=3D8 width=3D46)"=0A= " -> Hash (cost=3D393.63..393.63 rows=3D41 = width=3D24)"=0A= " -> Index Scan using speed_3 on history = (cost=3D0.00..393.63 rows=3D41 width=3D24)"=0A= " Index Cond: (type_id =3D 6)"=0A= " Filter: (undo_action_id > 0)"=0A= " -> Index Scan using i_action_id2 on actions = (cost=3D0.00..6.02 rows=3D1 width=3D8)"=0A= " Index Cond: (""outer"".action_id =3D = actions.action_id)"=0A= " Filter: (((created)::date =3D '2005-02-24'::date) AND = (user_id =3D 23))"=0A= " -> Index Scan using events_pkey on events (cost=3D0.00..5.75 = rows=3D1 width=3D46)"=0A= " Index Cond: (""outer"".event_id =3D events.event_id)"=0A= ------_=_NextPart_000_01C51B22.3F9452ED Content-Type: application/octet-stream; name="query.sql" Content-Disposition: attachment; filename="query.sql" explain Select events.name, fields.name, seats.snumber , 'Jegy' from events, fields, seats, history, actions where seats.field_id = fields.field_id AND history.event_id = events.event_id and seats.snumber=history.snumber and history.event_id=seats.event_id and history.action_id=actions.action_id and history.type_id = 6 -- ******************************** and history.undo_action_id > 0 -- ******************************** and cast(actions.created as date)='2005.02.24' and actions.user_id in (23) ------_=_NextPart_000_01C51B22.3F9452ED-- From pgsql-performance-owner@postgresql.org Fri Feb 25 11:19:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6651F52A59 for ; Fri, 25 Feb 2005 11:19:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21069-02 for ; Fri, 25 Feb 2005 11:19:09 +0000 (GMT) Received: from mailin4.audi.de (mailin4.audi.de [143.164.102.18]) by svr1.postgresql.org (Postfix) with ESMTP id 03F4852A4D for ; Fri, 25 Feb 2005 11:19:07 +0000 (GMT) Received: from mailin2.audi.de (esilb01b1-proxy-ip1.web.audi.vwg [10.198.7.251]) by mailin4.audi.de (Postfix) with ESMTP id 51F1EE9575 for ; Fri, 25 Feb 2005 12:19:25 +0100 (CET) Message-ID: <977921B17B2F2048AA5AAE9B4CBB713E01423D46@huaudigs0035.audi.de> From: "Vig, Sandor (G/FI-2)" To: pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout Date: Fri, 25 Feb 2005 12:19:19 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.254 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/358 X-Sequence-Number: 10687 -huh- A lot of High-Tech ideas. But there is another way: Simply measure the current IO load (pro DB if you must),=20 make an estimation how it could change in the future=20 (max. 3 years) and make a worst case scenario. Than you should make a new array each time the worst case scenario hits the IO bottleneck of your config. (I mean the random read/write bandwith of a raid array) than make so many raid arrays you=20 need. It's just that simple. :-))) You should/must redesign it in every 3 years, that's for sure. Vig S=E1ndor -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of John Arbash Meinel Sent: Thursday, February 24, 2005 8:41 PM To: John Allgood Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Peformance Tuning Opterons/ Hard Disk Layout John Allgood wrote: > Hello Again > > In the below statement you mention putting each database on its own > raid mirror. > > "However, sticking with your arrangement, it would seem that you = might be > able to get some extra performance if each database is on it's own = raid, > since you are fairly likely to have 2 transactions occuring at the = same > time, that don't affect eachother (since you wouldn't have any = foreign > keys, etc on 2 separate databases.)" > > That would take alot of disk drives to accomplish. I was thinking > maybe putting three or four databases on each raid and dividing the > heaviest used databases on each mirrored set. And for each of these > sets have its own mirror for pg_xlog. My question is what is the best > way to setup postgres databases on different disks. I have setup > multiple postmasters on this system as a test. The only problem was > configuring each databases "ie postgresql.conf, pg_hba.conf". Is > there anyway in postgres to have everything in one cluster and have = it > seperated onto multiple drives. Here is a example of what is was > thinking about. > I think this is something that you would have to try and see what = works. My first feeling is that 8-disks in RAID10 is better than 4 sets of = RAID1. > MIRROR1 - Database Group 1 > MIRROR2 - pg_xlog for database group 1 > MIRROR3 - Database Group 2 > MIRROR4 - pg_xlog for database group 2 > MIRROR5 - Database Group 3 > MIRROR6 - pg_xlog for database group 3 > > This will take about 12 disk drives. I have a 14 bay Storage Bay I = can > use two of the drives for hotspare's. > I would have all of them in 1 database cluster, which means they are = all served by the same postgres daemon. Which I believe means that they all use the same pg_xlog. That means you only need 1 raid for pg_xlog, though I would make it a 4-drive RAID10. (RAID1 is redundant, but actually slower on writes, you need the 0 to speed up reading/writing, = I could be wrong). I believe you can still split each database onto it's own raid later on if you find that you need to. So this is my proposal 1: OS RAID (sounds like this is not in the Storage Bay). 4-drives RAID10 pg_xlog 8-drives RAID10 database cluster 2-drives Hot spares / RAID1 If you feel like you want to partition your databases, you could also = do proposal 2: 4-drives RAID10 pg_xlog 4-drives RAID10 databases master + 1-4 4-drives RAID10 databases 5-9 2-drives hotspare / RAID1 If you think partitioning is better than striping, you could do = proposal 3: 4-drives RAID10 pg_xlog 2-drives RAID1 master database 2-drives RAID1 databases 1,2,3 2-drives RAID1 databases 4,5 2-drives RAID1 databases 6,7 2-drives RAID1 databases 8,9 There are certainly a lot of potential arrangements here, and it's not like I've tried a lot of them. pg_xlog seems like a big enough bottleneck that it would be good to put it on it's own RAID10, to make it as fast as possible. It also depends a lot on whether you will be write heavy/read heavy, etc. RAID5 works quite well for reading, very poor for writing. But if the only reason to have the master database is to perform read heavy queries, and all the writing is done at night in bulk fashion with careful tuning to avoid saturation, then maybe you would want to put = the master database on a RAID5 so that you can get extra disk space. You could do proposal 4: 4-drive RAID10 pg_xlog 4-drive RAID5 master db 2-drive RAID1 dbs 1-3 2-drive RAID1 dbs 4-6 2-drive RAID1 dbs 7-9 You might also do some testing and find that pg_xlog doesn't deserve it's own 4 disks, and they would be better off in the bulk tables. Unfortunately a lot of this would come down to performance testing on your dataset, with a real data load. Which isn't very easy to do. I personally like the simplicity of proposal 1. John =3D:-> > > Thanks > > John Allgood - ESC > Systems Administrator The information transmitted is intended only for the person or entity = to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you = received this in error, please contact the sender and delete the material from = any computer. From pgsql-performance-owner@postgresql.org Fri Feb 25 11:19:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B1C0F563BB for ; Fri, 25 Feb 2005 11:19:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19686-08 for ; Fri, 25 Feb 2005 11:19:39 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id B4BCE52A50 for ; Fri, 25 Feb 2005 11:19:37 +0000 (GMT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1D4dVk-0006dB-2Q for pgsql-performance@postgresql.org; Fri, 25 Feb 2005 12:19:56 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1D4dVj-00032x-00 for ; Fri, 25 Feb 2005 12:19:55 +0100 Date: Fri, 25 Feb 2005 12:19:55 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: gah! sudden slowdown?? Message-ID: <20050225111955.GC11045@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Operating-System: Linux 2.6.11-rc3 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.428 tagged_above=0 required=5 tests=AWL, PLING_QUERY X-Spam-Level: X-Archive-Number: 200502/359 X-Sequence-Number: 10688 On Fri, Feb 25, 2005 at 03:41:58PM +0800, SpaceBallOne wrote: > Our dual opteron has been performing well for many weeks now (after some > simple tuning) when all of a sudden the queries have slowed right down! Are you running regular VACUUMs? Looks like you have a lot of dead rows or something. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Fri Feb 25 13:47:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 97161563C9 for ; Fri, 25 Feb 2005 13:47:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56480-09 for ; Fri, 25 Feb 2005 13:46:57 +0000 (GMT) Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) by svr1.postgresql.org (Postfix) with ESMTP id 4A16E55D73 for ; Fri, 25 Feb 2005 13:46:56 +0000 (GMT) Received: from jefftrout.com ([24.128.242.167]) by comcast.net (rwcrmhc13) with SMTP id <2005022513471501500l1rcme>; Fri, 25 Feb 2005 13:47:16 +0000 Received: (qmail 32528 invoked from network); 25 Feb 2005 13:47:15 -0000 Received: from waltham-nat.ma.lycos.com (HELO ?10.124.7.194?) (209.202.205.1) by 192.168.0.105 with SMTP; 25 Feb 2005 13:47:15 -0000 Mime-Version: 1.0 (Apple Message framework v619.2) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; format=flowed To: performance pgsql From: Jeff Subject: Possible interesting extra information for explain analyze? Date: Fri, 25 Feb 2005 08:49:23 -0500 X-Mailer: Apple Mail (2.619.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.93 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: X-Archive-Number: 200502/360 X-Sequence-Number: 10689 Given some recent posts / irc issues with dead tuple bloat.. And given that a lot of these people have at least been smart enough to explain analyze would it be A. possible B. useful C. None of the above to have various "scan" nodes of explain analyze also report how many invisible / dead tuples they had to disqualify (Just to clarify, they matched the search criteria, but were invisible due to MVCC rules). Some thing like: Seq Scan on boards (cost=0.00..686.30 rows=25430 width=0) (actual time=8.866..5407.693 rows=18636 loops=1 invisiblerows=8934983098294) This may help us to point out tuple bloat issues quicker... or it may give the developer enough of a clue to search around and find out he needs to vacuum... hmm.. but once we have an integrated autovacuum it will be a moot point..... Also another thing I started working on back in the day and hope to finish when I get time (that is a funny idea) is having explain analyze report when a step required the use of temp files. -- Jeff Trout http://www.jefftrout.com/ http://www.stuarthamm.net/ From pgsql-performance-owner@postgresql.org Fri Feb 25 14:55:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2A998564CE for ; Fri, 25 Feb 2005 14:55:57 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78153-08 for ; Fri, 25 Feb 2005 14:55:54 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 8E7D9564BF for ; Fri, 25 Feb 2005 14:55:51 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 4DA1D356F3; Fri, 25 Feb 2005 06:56:10 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 4BF08356F1; Fri, 25 Feb 2005 06:56:10 -0800 (PST) Date: Fri, 25 Feb 2005 06:56:10 -0800 (PST) From: Stephan Szabo To: "Vig, Sandor (G/FI-2)" Cc: pgsql-performance@postgresql.org Subject: Re: IS NULL vs IS NOT NULL In-Reply-To: <977921B17B2F2048AA5AAE9B4CBB713E01423D42@huaudigs0035.audi.de> Message-ID: <20050225065133.B92053@megazone.bigpanda.com> References: <977921B17B2F2048AA5AAE9B4CBB713E01423D42@huaudigs0035.audi.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/361 X-Sequence-Number: 10690 On Fri, 25 Feb 2005, Vig, Sandor (G/FI-2) wrote: > Hi, > > Another "funny" thing: I have a query which runs > on (Linux) PostgreSQL 7.4.x under 10 sec. I tried > to run it on (Windows) PostgreSQL 8.0 yesterday. > It didn't finished at all! (I shoot it down after 10 minutes) > I made various tests and I figured out something interesting: > The same query with: > A, "history.undo_action_id > 0" runs in 10 sec. > B, "history.undo_action_id is not null" runs in 10 sec. > C, "history.undo_action_id is null" runs forever (?!) > I used EXPLAIN but I couldn't figure out what the problem was. EXPLAIN ANALYZE would be more useful. My first guess would be that the IS NULL is returning many more than the estimated 1 row and as such a nested loop is a bad plan. How many history rows match type_id=6 and undo_action_id is null? From pgsql-performance-owner@postgresql.org Fri Feb 25 16:04:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6E02156380 for ; Fri, 25 Feb 2005 16:04:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09812-06 for ; Fri, 25 Feb 2005 16:04:50 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E802C563B4 for ; Fri, 25 Feb 2005 16:04:49 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1PG5Bv6005600; Fri, 25 Feb 2005 11:05:11 -0500 (EST) To: Jeff Cc: performance pgsql Subject: Re: Possible interesting extra information for explain analyze? In-reply-to: References: Comments: In-reply-to Jeff message dated "Fri, 25 Feb 2005 08:49:23 -0500" Date: Fri, 25 Feb 2005 11:05:10 -0500 Message-ID: <5599.1109347510@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/362 X-Sequence-Number: 10691 Jeff writes: > Given some recent posts / irc issues with dead tuple bloat.. > And given that a lot of these people have at least been smart enough to > explain analyze would it be A. possible B. useful C. None of the above > to have various "scan" nodes of explain analyze also report how many > invisible / dead tuples they had to disqualify (Just to clarify, they > matched the search criteria, but were invisible due to MVCC rules). I think this would not help a whole lot because (particularly on indexscans) you won't get a very accurate picture of the true extent of bloat. The contrib/pgstattuple utility is more useful for measuring that sort of thing. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Feb 25 16:19:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8E8795638A for ; Fri, 25 Feb 2005 16:19:52 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14607-09 for ; Fri, 25 Feb 2005 16:19:45 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id 9368856394 for ; Fri, 25 Feb 2005 16:19:44 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 9EC1D1C902; Fri, 25 Feb 2005 10:20:05 -0600 (CST) Date: Fri, 25 Feb 2005 10:20:05 -0600 From: "Jim C. Nasby" To: Tom Lane Cc: Bruno Almeida do Lago , 'Michael Adler' , pgsql-performance@postgresql.org Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout Message-ID: <20050225162005.GK84483@decibel.org> References: <421cca80.3da18bb5.6940.3b12@smtp.gmail.com> <21021.1109183848@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21021.1109183848@sss.pgh.pa.us> X-Operating-System: FreeBSD 4.10-RELEASE-p3 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.02 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/363 X-Sequence-Number: 10692 On Wed, Feb 23, 2005 at 01:37:28PM -0500, Tom Lane wrote: > "Bruno Almeida do Lago" writes: > > Is there a real limit for max_connections? Here we've an Oracle server with > > up to 1200 simultaneous conections over it! > > [ shrug... ] If your machine has the beef to run 1200 simultaneous > queries, you can set max_connections to 1200. > > The point of what you were quoting is that if you want to service > 1200 concurrent users but you only expect maybe 100 simultaneously > active queries from them (and you have a database box that can only > service that many) then you want to put a connection pooler in > front of 100 backends, not try to start a backend for every user. > > Oracle may handle this sort of thing differently, I dunno. > > regards, tom lane Oracle has some form of built-in connection pooling. I don't remember the exact details of it off the top of my head, but I think it was a 'wedge' that clients would connect to as if it was the database, and the wedge would then find an available database process to use. -- Jim C. Nasby, Database Consultant decibel@decibel.org Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?" From pgsql-performance-owner@postgresql.org Fri Feb 25 17:54:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 17EBF563C8 for ; Fri, 25 Feb 2005 17:54:57 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42624-02 for ; Fri, 25 Feb 2005 17:54:46 +0000 (GMT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by svr1.postgresql.org (Postfix) with ESMTP id AD8B1563FD for ; Fri, 25 Feb 2005 17:54:46 +0000 (GMT) Received: from mail.logi-track.com (www.logi-track.com [213.239.193.212]) by svr4.postgresql.org (Postfix) with ESMTP id 3ACC45B0239 for ; Fri, 25 Feb 2005 16:35:04 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (pD95DCE36.dip0.t-ipconnect.de [217.93.206.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id 1D63B308D6; Fri, 25 Feb 2005 17:29:09 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id 86465AB0E1; Fri, 25 Feb 2005 17:28:59 +0100 (CET) Message-ID: <421F524A.1010804@logi-track.com> Date: Fri, 25 Feb 2005 17:28:58 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Gaetano Mendola Subject: Re: is pg_autovacuum so effective ? References: <12400.1109107683@sss.pgh.pa.us> <421BD64E.30803@bigfoot.com> <60psyr265t.fsf@dba2.int.libertyrms.com> <421CD6F0.8010406@zeut.net> <421DB36B.70004@bigfoot.com> <421DC4D5.1070909@logi-track.com> <421E556E.6010202@mbigroup.it> In-Reply-To: <421E556E.6010202@mbigroup.it> X-Enigmail-Version: 0.90.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="------------enig58BDD744D93A60C6ABB35002" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/364 X-Sequence-Number: 10693 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig58BDD744D93A60C6ABB35002 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi, Gaetano, Gaetano Mendola schrieb: > Yes, I'm aware about it indeed I need the analyze because usualy I do = on that > table select regarding last 24 ours so need to analyze it in order to > collect the statistics for this period. If you tend to do lots of queries for the last 24 hours, and there is only a very small percentage of such young rows, partial indices could be helpful. You could include all rows that are not older than 24 hours, and recreate them via cron script daily, so they grow from 24 to 48 hours between recreations. To avoid a gap in recreation, you could first create the new index, and then drop the old one, using alternating names.= BTW, a small question for the gurus: does postgres make use of other indices when creating partial indices? HTH, Markus --=20 markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z=FCrich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com --------------enig58BDD744D93A60C6ABB35002 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCH1JKOVWsnapT9i0RA+OlAKC0M0u3V7RtWWH4gLyLOHCA78K3cACfbdww ILk2vrhd/gOXl88j2znwUhU= =cQRs -----END PGP SIGNATURE----- --------------enig58BDD744D93A60C6ABB35002-- From pgsql-performance-owner@postgresql.org Mon Feb 28 11:31:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9B07755818 for ; Sat, 26 Feb 2005 14:04:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33310-08 for ; Sat, 26 Feb 2005 14:04:56 +0000 (GMT) Received: from hub.org (hub.org [200.46.204.220]) by svr1.postgresql.org (Postfix) with ESMTP id 4761C52A67 for ; Sat, 26 Feb 2005 14:04:56 +0000 (GMT) Received: from localhost (unknown [200.46.204.144]) by hub.org (Postfix) with ESMTP id 35F4A12B079 for ; Sat, 26 Feb 2005 10:04:54 -0400 (AST) Received: from hub.org ([200.46.204.220]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34752-02 for ; Sat, 26 Feb 2005 14:04:47 +0000 (GMT) Received: from ganymede.hub.org (blk-222-231-176.eastlink.ca [24.222.231.176]) by hub.org (Postfix) with ESMTP id 8D6B912B074 for ; Sat, 26 Feb 2005 10:04:45 -0400 (AST) Received: by ganymede.hub.org (Postfix, from userid 1000) id 4694C8B12B; Sat, 26 Feb 2005 10:05:29 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 459FF8B106 for ; Sat, 26 Feb 2005 10:05:29 -0400 (AST) X-Return-Path: X-Received: from localhost ([unix socket]) by ganymede.hub.org (Cyrus v2.2.10) with LMTPA; Sat, 26 Feb 2005 08:16:34 -0400 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id E70CE8AB44 for ; Sat, 26 Feb 2005 08:15:44 -0400 (AST) X-Received: from mail.postgresql.org [200.46.204.71] by localhost with IMAP (fetchmail-6.2.5) for scrappy@localhost (single-drop); Sat, 26 Feb 2005 08:15:44 -0400 (AST) X-Received: from svr1.postgresql.org ([unix socket]) by svr1.postgresql.org (Cyrus v2.2.10) with LMTPA; Sat, 26 Feb 2005 12:12:53 +0000 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AA84B56438 for ; Sat, 26 Feb 2005 12:12:53 +0000 (GMT) X-Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05452-09 for ; Sat, 26 Feb 2005 12:12:50 +0000 (GMT) X-Received: from mail.kusardi.de (server19320154105.serverpool.info [193.201.54.105]) by svr1.postgresql.org (Postfix) with SMTP id 556F156433 for ; Sat, 26 Feb 2005 12:12:48 +0000 (GMT) X-Received: (qmail 6226 invoked by uid 1012); 26 Feb 2005 12:13:16 -0000 X-Received: from postgresql@kusardi.de by debianimage by uid 1001 with qmail-scanner-1.20 (clamscan: 0.67. spamassassin: 2.63. Clear:RC:0(84.56.131.214):SA:0(?/?):. Processed in 3.581851 secs); 26 Feb 2005 12:13:16 -0000 X-Received: from unknown (HELO Common) (glenn@kusardi.de@kusardi.de@84.56.131.214) by server19320154105.serverpool.info with SMTP; 26 Feb 2005 12:13:12 -0000 Date: Sat, 26 Feb 2005 13:13:07 +0100 From: Glenn Kusardi X-Mailer: The Bat! (v2.00) CD5BF9353B3B7091 Reply-To: Glenn Kusardi X-Priority: 3 (Normal) Message-ID: <1035996232.20050226131307@kusardi.de> To: psql-performance@postgresql.org Subject: PostgreSQL 7.4.3 Performance issues on OpenBSD MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-DCC: : X-Spam-Pyzor: ReSent-Date: Sat, 26 Feb 2005 10:05:24 -0400 (AST) Resent-From: "Marc G. Fournier" Resent-To: pgsql-performance@postgresql.org ReSent-Subject: PostgreSQL 7.4.3 Performance issues on OpenBSD ReSent-Message-ID: <20050226100524.N75321@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at hub.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.946 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/365 X-Sequence-Number: 10694 Hello, I'm experiencing performance problems with 7.4.3 on OpenBSD 3.6, at least I think so. It is running on a Xeon 3 GHz with 2 GB RAM. I have a table with 22 columns, all integer, timestamp or varchar and 10 indizes on integer, timestamp and varchar columns. The table got 8500 rows (but growing). I try to make an UPDATE on the table with 7000 affected rows. This update takes about 2-6 seconds. Has it to be that slow? I'm running the same query on MySQL or Oracle databases faster on similar machines. EXPLAIN ANALYZE UPDATE ... tells me: QUERY PLAN: Seq Scan on table (cost=0.00..286.57 rows=4804 width=146) (actual time=405.206..554.433 rows=7072 loops=1) Filter: (system_knoten_links > 3501) Total runtime: 2928.500 ms So that looks fine to me, except the runtime. Without indizes the query is fast with 456 ms. Trying to disable fsync to avoid some disc operations aren't helping. Sincerely TIA, Glenn From pgsql-performance-owner@postgresql.org Mon Feb 28 18:03:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BD1C85661C for ; Sun, 27 Feb 2005 20:31:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30783-02 for ; Sun, 27 Feb 2005 20:31:40 +0000 (GMT) Received: from cmailm1.svr.pol.co.uk (cmailm1.svr.pol.co.uk [195.92.193.18]) by svr1.postgresql.org (Postfix) with ESMTP id DB629565F5 for ; Sun, 27 Feb 2005 20:31:45 +0000 (GMT) Received: from modem-1762.leopard.dialup.pol.co.uk ([217.135.150.226] helo=192.168.0.102) by cmailm1.svr.pol.co.uk with esmtp (Exim 4.41) id 1D5V54-0002QE-B3; Sun, 27 Feb 2005 20:31:58 +0000 Subject: Re: Possible interesting extra information for explain From: Simon Riggs To: Jeff Cc: performance pgsql In-Reply-To: References: Content-Type: text/plain Organization: 2nd Quadrant Date: Sun, 27 Feb 2005 20:25:45 +0000 Message-Id: <1109535945.20045.180.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.042 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/371 X-Sequence-Number: 10700 On Fri, 2005-02-25 at 08:49 -0500, Jeff wrote: > Also another thing I started working on back in the day and hope to > finish when I get time (that is a funny idea) is having explain analyze > report when a step required the use of temp files. Sounds useful. Please work on it... Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Mon Feb 28 13:11:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B0A0F56408 for ; Sun, 27 Feb 2005 22:32:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56916-01 for ; Sun, 27 Feb 2005 22:32:21 +0000 (GMT) Received: from mail.jobflash.com (mail.jobflash.com [64.62.211.41]) by svr1.postgresql.org (Postfix) with ESMTP id 84F4F56411 for ; Sun, 27 Feb 2005 22:32:22 +0000 (GMT) Received: from [192.168.2.23] (user-38lc14d.dialup.mindspring.com [209.86.4.141]) by mail.jobflash.com (Postfix) with ESMTP id 08552420C5 for ; Sun, 27 Feb 2005 14:32:35 -0800 (PST) Message-ID: <42224A61.3080707@jobflash.com> Date: Sun, 27 Feb 2005 14:32:01 -0800 From: Tom Arthurs User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: PG block sizes Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/367 X-Sequence-Number: 10696 Hi, All I'm trying to tune a software RAID 0 (striped) on a solaris 9, sparc box. Currently I'm using a raid 1 (mirrored) array on two discs for the data area, and I put in 4 new drives last night (all are f-cal). On the new array I have a width of 4, and used the default interleave factor of 32k. I believe a smaller interleave factor may get me better read performance (I'm seeing a bulk load performance increase of about 35% but a 7-8x worse read performance between the two RAID setups.) Conventional wisdom is using an interleave factor < = db default block size gives the best read performance. I would like to try that (though this testing is burning a lot of daylight, since I'll have to reload the db every time I remake the RAID.) Question: what't the best block size to use for postgresql on solaris? (I'm using 7.4.5) From pgsql-performance-owner@postgresql.org Mon Feb 28 17:54:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 99E7156570 for ; Mon, 28 Feb 2005 08:10:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02755-08 for ; Mon, 28 Feb 2005 08:10:40 +0000 (GMT) Received: from mail.logi-track.com (burro.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id A60CD5656B for ; Mon, 28 Feb 2005 08:10:39 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (pD95DD1F9.dip0.t-ipconnect.de [217.93.209.249]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id A1882307F7; Mon, 28 Feb 2005 09:10:41 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id F04C1AB2A4; Mon, 28 Feb 2005 09:10:36 +0100 (CET) Message-ID: <4222D1FC.1020007@logi-track.com> Date: Mon, 28 Feb 2005 09:10:36 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: John Allgood Cc: pgsql-performance@postgresql.org, john@arbash-meinel.com Subject: Re: Peformance Tuning Opterons/ Hard Disk Layout References: <421E1D8A.8050203@turbocorp.com> In-Reply-To: <421E1D8A.8050203@turbocorp.com> X-Enigmail-Version: 0.90.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/370 X-Sequence-Number: 10699 Hi, John, John Allgood schrieb: > My question is what is the best way to setup > postgres databases on different disks. I have setup multiple postmasters > on this system as a test. The only problem was configuring each > databases "ie postgresql.conf, pg_hba.conf". Is there anyway in > postgres to have everything in one cluster and have it seperated onto > multiple drives. Using PostgreSQL 8.0, the newly introduced "tablespaces" solve all this: http://www.postgresql.org/docs/8.0/interactive/manage-ag-tablespaces.html Using PostgreSQL 7.4, you can relatively easy create single databases on different drives. However, separating out single tables or indices involves some black symlink magic. See google and http://www.postgresql.org/docs/7.4/interactive/manage-ag-alternate-locs.html HTH, Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z�rich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com From pgsql-performance-owner@postgresql.org Mon Feb 28 17:18:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3E31356478 for ; Mon, 28 Feb 2005 14:31:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09455-05 for ; Mon, 28 Feb 2005 14:31:06 +0000 (GMT) Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by svr1.postgresql.org (Postfix) with ESMTP id B20B25646D for ; Mon, 28 Feb 2005 14:31:06 +0000 (GMT) Received: from ool-43529386.dyn.optonline.net ([67.82.147.134] helo=[192.168.1.100]) by outbound.mailhop.org with esmtpa (Exim 4.44) id 1D5lvF-000AkJ-BT; Mon, 28 Feb 2005 09:30:57 -0500 Message-ID: <42232B22.4030302@zeut.net> Date: Mon, 28 Feb 2005 09:30:58 -0500 From: "Matthew T. O'Connor" User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gaetano Mendola Cc: Markus Schaber , Gaetano Mendola , pgsql-performance@postgresql.org Subject: Re: is pg_autovacuum so effective ? References: <12400.1109107683@sss.pgh.pa.us> <421BD64E.30803@bigfoot.com> <60psyr265t.fsf@dba2.int.libertyrms.com> <421CD6F0.8010406@zeut.net> <421DB36B.70004@bigfoot.com> <421DC4D5.1070909@logi-track.com> <421E556E.6010202@mbigroup.it> In-Reply-To: <421E556E.6010202@mbigroup.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mail-Handler: MailHop Outbound by DynDNS.org X-Originating-IP: 67.82.147.134 X-Report-Abuse-To: abuse@dyndns.org (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: zeut X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/369 X-Sequence-Number: 10698 Gaetano Mendola wrote: >Yes, I'm aware about it indeed I need the analyze because usualy I do on that >table select regarding last 24 ours so need to analyze it in order to >collect the statistics for this period. >Beside that I tried to partition that table, I used both tecnique on >my knowledge > >1) A view with UNION ALL on all tables collecting these logs >2) Using inheritance > >and both cases are working in theory but in practice are not ( the index scan >is lost as soon you use this view/table inside others views or joining them) > >I heard that next version of pg_autovacuum can be instructed "per table"; >is it true ? > The version of pg_autovacuum that I submitted for 8.0 could be instructed "per table" but it didn't make the cut. Aside from moved out of contrib and integrated into the backend, per table autovacuum settings is probably the next highest priority. From pgsql-performance-owner@postgresql.org Mon Feb 28 17:07:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B4D885669C for ; Mon, 28 Feb 2005 15:46:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32386-07 for ; Mon, 28 Feb 2005 15:46:35 +0000 (GMT) Received: from mail.logi-track.com (burro.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id 6257D56443 for ; Mon, 28 Feb 2005 15:46:31 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (pD95DCEAC.dip0.t-ipconnect.de [217.93.206.172]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id DEFDB307F7; Mon, 28 Feb 2005 16:46:39 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id A3B53AB3A9; Mon, 28 Feb 2005 16:46:34 +0100 (CET) Message-ID: <42233CDA.3030407@logi-track.com> Date: Mon, 28 Feb 2005 16:46:34 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20050116) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: "Matthew T. O'Connor" Cc: pgsql-performance@postgresql.org Subject: Re: is pg_autovacuum so effective ? References: <12400.1109107683@sss.pgh.pa.us> <421BD64E.30803@bigfoot.com> <60psyr265t.fsf@dba2.int.libertyrms.com> <421CD6F0.8010406@zeut.net> <421DB36B.70004@bigfoot.com> <421DC4D5.1070909@logi-track.com> <421E556E.6010202@mbigroup.it> <42232B22.4030302@zeut.net> In-Reply-To: <42232B22.4030302@zeut.net> X-Enigmail-Version: 0.90.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.074 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/368 X-Sequence-Number: 10697 Hi, Matthew, Matthew T. O'Connor schrieb: > The version of pg_autovacuum that I submitted for 8.0 could be > instructed "per table" but it didn't make the cut. Aside from moved out > of contrib and integrated into the backend, per table autovacuum > settings is probably the next highest priority. What was the reason for non-acceptance? Is it available as a standalone project? Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z�rich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com From pgsql-performance-owner@postgresql.org Mon Feb 28 18:22:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8548E5649E for ; Mon, 28 Feb 2005 18:22:47 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96705-03 for ; Mon, 28 Feb 2005 18:22:45 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id E84BE55F51 for ; Mon, 28 Feb 2005 18:22:44 +0000 (GMT) Received: (qmail 28518 invoked by uid 500); 28 Feb 2005 18:38:18 -0000 Date: Mon, 28 Feb 2005 12:38:18 -0600 From: Bruno Wolff III To: Markus Schaber Cc: "Matthew T. O'Connor" , pgsql-performance@postgresql.org Subject: Re: is pg_autovacuum so effective ? Message-ID: <20050228183818.GC27212@wolff.to> Mail-Followup-To: Markus Schaber , "Matthew T. O'Connor" , pgsql-performance@postgresql.org References: <12400.1109107683@sss.pgh.pa.us> <421BD64E.30803@bigfoot.com> <60psyr265t.fsf@dba2.int.libertyrms.com> <421CD6F0.8010406@zeut.net> <421DB36B.70004@bigfoot.com> <421DC4D5.1070909@logi-track.com> <421E556E.6010202@mbigroup.it> <42232B22.4030302@zeut.net> <42233CDA.3030407@logi-track.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42233CDA.3030407@logi-track.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/372 X-Sequence-Number: 10701 On Mon, Feb 28, 2005 at 16:46:34 +0100, Markus Schaber wrote: > Hi, Matthew, > > Matthew T. O'Connor schrieb: > > > The version of pg_autovacuum that I submitted for 8.0 could be > > instructed "per table" but it didn't make the cut. Aside from moved out > > of contrib and integrated into the backend, per table autovacuum > > settings is probably the next highest priority. > > What was the reason for non-acceptance? It wasn't reviewed until very close to freeze due to people who could do the review being busy and then there wasn't enough time to iron some things out before the freeze. From pgsql-performance-owner@postgresql.org Mon Feb 28 21:24:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B0DBB54D70 for ; Mon, 28 Feb 2005 21:24:02 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57879-09 for ; Mon, 28 Feb 2005 21:23:54 +0000 (GMT) Received: from popmail.space.net (popmail.Space.Net [195.30.0.14]) by svr1.postgresql.org (Postfix) with SMTP id 5861256463 for ; Mon, 28 Feb 2005 21:23:52 +0000 (GMT) Received: (qmail 82587 invoked from network); 28 Feb 2005 21:23:53 -0000 Received: from pd9e8a223.dip0.t-ipconnect.de (HELO pc1) (217.232.162.35) by popmail.space.net with SMTP; 28 Feb 2005 21:23:53 -0000 X-SpaceNet-Authentification: SMTPafterPOP verified Message-ID: <178601c51ddb$b7423520$bf01a8c0@pc1> From: "Stefan Hans" To: Subject: wal_sync_methods Date: Mon, 28 Feb 2005 22:23:10 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_1783_01C51DE4.15F23130" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200502/373 X-Sequence-Number: 10702 This is a multi-part message in MIME format. ------=_NextPart_000_1783_01C51DE4.15F23130 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi *, I am looking for the fastest wal_sync_method (postgres 8, Linux (Redhat) = 2.4.29, ext3, SCSI HW-Raid 5). Any experiences and/or tips?. Thanks in advance Stefan ------=_NextPart_000_1783_01C51DE4.15F23130 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi *,
 
I am looking for the fastest = wal_sync_method=20 (postgres 8, Linux (Redhat) 2.4.29, ext3, SCSI HW-Raid 5).
 
Any experiences and/or = tips?.
 
Thanks in advance
 
Stefan
------=_NextPart_000_1783_01C51DE4.15F23130-- From pgsql-performance-owner@postgresql.org Mon Feb 28 21:47:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1988156400 for ; Mon, 28 Feb 2005 21:47:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65203-07 for ; Mon, 28 Feb 2005 21:47:10 +0000 (GMT) Received: from smtp3.libero.it (smtp3.libero.it [193.70.192.127]) by svr1.postgresql.org (Postfix) with ESMTP id 72389545F2 for ; Mon, 28 Feb 2005 21:47:06 +0000 (GMT) Received: from localhost (172.16.1.84) by smtp3.libero.it (7.0.027-DD01) id 42078669004E5FEE for pgsql-performance@postgresql.org; Mon, 28 Feb 2005 22:47:08 +0100 Received: from [62.98.85.112] (62.98.85.112) by smtp2.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41BF65E404BA07EC for pgsql-performance@postgresql.org; Mon, 28 Feb 2005 22:47:28 +0100 Message-ID: <42239156.6090108@streppone.it> Date: Mon, 28 Feb 2005 22:47:02 +0100 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgresql Performance list Subject: Re: High end server and storage for a PostgreSQL OLTP system References: <6EE64EF3AB31D5448D0007DD34EEB3412A7603@Herge.rcsinc.local> <420141A8.2090800@streppone.it> In-Reply-To: <420141A8.2090800@streppone.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at libero.it serv5 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.153 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/374 X-Sequence-Number: 10703 Cosimo Streppone wrote: > Merlin Moncure wrote: > > > If everything is working the way it's supposed to, 8.0 should be faster > > than 7.1 (like, twice faster) for what you are probably trying to do. > > In the next days I will be testing the entire application with the > same database only changing the backend from 7.1 to 8.0, so this is > a somewhat perfect condition to have a "real-world" benchmark > of Pg 8.0 vs 7.1.x performances. The "next days" have come. I did a complete migration to Pg 8.0.1 from 7.1.3. It was a *huge* jump. The application is exactly the same, also the database structure is the same. I only dumped the entire 7.1.3 db, changed the backend version, and restored the data in the 8.0.1 db. The performance level of Pg 8 is at least *five* times higher (faster!) than 7.1.3 in "query-intensive" transactions, which is absolutely astounding. In my experience, Pg8 handles far better non-unique indexes with low cardinality built on numeric and integer types, which is very common in our application. -- Cosimo From pgsql-performance-owner@postgresql.org Mon Feb 28 22:16:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 465C0545F7 for ; Mon, 28 Feb 2005 22:15:31 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73045-04 for ; Mon, 28 Feb 2005 22:15:21 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3610152AA6 for ; Mon, 28 Feb 2005 22:15:20 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j1SMFMc2003254; Mon, 28 Feb 2005 17:15:22 -0500 (EST) To: Cosimo Streppone Cc: Postgresql Performance list Subject: Re: High end server and storage for a PostgreSQL OLTP system In-reply-to: <42239156.6090108@streppone.it> References: <6EE64EF3AB31D5448D0007DD34EEB3412A7603@Herge.rcsinc.local> <420141A8.2090800@streppone.it> <42239156.6090108@streppone.it> Comments: In-reply-to Cosimo Streppone message dated "Mon, 28 Feb 2005 22:47:02 +0100" Date: Mon, 28 Feb 2005 17:15:22 -0500 Message-ID: <3253.1109628922@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/375 X-Sequence-Number: 10704 Cosimo Streppone writes: > The performance level of Pg 8 is at least *five* times higher > (faster!) than 7.1.3 in "query-intensive" transactions, > which is absolutely astounding. Cool. > In my experience, Pg8 handles far better non-unique indexes > with low cardinality built on numeric and integer types, which > is very common in our application. Yes, we've fixed a number of places where the btree code was inefficient with large numbers of equal keys. I'm not sure that that explains a 5x speedup all by itself, though. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Feb 28 23:59:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EEF08563DF for ; Mon, 28 Feb 2005 23:58:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99937-05 for ; Mon, 28 Feb 2005 23:58:10 +0000 (GMT) Received: from smtp-gw-cl-c.dmv.com (smtp-gw-cl-c.dmv.com [216.240.97.41]) by svr1.postgresql.org (Postfix) with ESMTP id D501E565DD for ; Mon, 28 Feb 2005 23:58:08 +0000 (GMT) Received: from lanshark.dmv.com (lanshark.dmv.com [216.240.97.46]) by smtp-gw-cl-c.dmv.com (8.12.10/8.12.10) with ESMTP id j210EsEo087620 for ; Mon, 28 Feb 2005 19:14:54 -0500 (EST) (envelope-from sven@dmv.com) Subject: Inheritence versus delete from From: Sven Willenberger To: Postgresql Performance list Content-Type: text/plain Date: Mon, 28 Feb 2005 18:59:13 -0500 Message-Id: <1109635153.4620.44.camel@lanshark.dmv.com> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.39 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.329 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200502/376 X-Sequence-Number: 10705 Trying to determine the best overall approach for the following scenario: Each month our primary table accumulates some 30 million rows (which could very well hit 60+ million rows per month by year's end). Basically there will end up being a lot of historical data with little value beyond archival. The question arises then as the best approach of which I have enumerated three: 1) Just allow the records to accumulate and maintain constant vacuuming, etc allowing for the fact that most queries will only be from a recent subset of data and should be mostly cached. 2) Each month: SELECT * INTO 3monthsago_dynamically_named_table FROM bigtable WHERE targetdate < $3monthsago; DELETE FROM bigtable where targetdate < $3monthsago; VACUUM ANALYZE bigtable; pg_dump 3monthsago_dynamically_named_table for archiving; 3) Each month: CREATE newmonth_dynamically_named_table (like mastertable) INHERITS (mastertable); modify the copy.sql script to copy newmonth_dynamically_named_table; pg_dump 3monthsago_dynamically_named_table for archiving; drop table 3monthsago_dynamically_named_table; Any takes on which approach makes most sense from a performance and/or maintenance point of view and are there other options I may have missed? Sven Willenberger