From pgsql-performance-owner@postgresql.org Wed Jun 1 02:36: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 DC86952824 for ; Wed, 1 Jun 2005 02:36:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61465-03 for ; Wed, 1 Jun 2005 05:36:26 +0000 (GMT) Received: from smtp3.libero.it (smtp3.libero.it [193.70.192.127]) by svr1.postgresql.org (Postfix) with ESMTP id 87ADF52802 for ; Wed, 1 Jun 2005 02:36:24 -0300 (ADT) Received: from localhost (172.16.1.79) by smtp3.libero.it (7.0.027-DD01) id 428B9D5C0031D76D; Wed, 1 Jun 2005 07:36:21 +0200 Received: from [151.25.91.208] (151.25.91.208) by smtp0.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41BF5F4807E5E49A; Wed, 1 Jun 2005 07:36:20 +0200 Message-ID: <429D47FD.7090501@streppone.it> Date: Wed, 01 Jun 2005 07:30:37 +0200 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Martin Fandel Cc: Postgresql Performance list Subject: Re: postgresql-8.0.1 performance tuning References: <1117201312.7060.6.camel@fandelm.ecommit.de> In-Reply-To: <1117201312.7060.6.camel@fandelm.ecommit.de> Content-Type: text/plain; charset=UTF-8; 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.24 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200506/1 X-Sequence-Number: 12639 Martin Fandel wrote: > i'm trying to tune my postgresql-db but i don't know if the values are > I use the following environment for the postgres-db: I assumed you're running Linux here, you don't mention it. > ######### Hardware ############ > cpu: 2x P4 3Ghz > ram: 1024MB DDR 266Mhz I think 1Gb RAM is quite minimal, nowadays. Read below. > partitions: > /dev/sda3 23G 9,6G 13G 44% / > /dev/sda1 11G 156M 9,9G 2% /var > /dev/sdb1 69G 13G 57G 19% /var/lib/pgsql > > /dev/sda is in raid 1 (2x 35GB / 10000upm / sca) > /dev/sdb is in raid 10 (4x 35GB / 10000upm / sca) I've seen good performance boost (and machine load lowered) switching to 15k rpm disks. > ######### Config ############ > /etc/sysctl.conf: > kernel.shmall = 786432000 > kernel.shmmax = 786432000 I think you have a problem here. kernel.shmmax should *not* be set to an amount of RAM, but to maximum number of shared memory pages, which on a typical linux system is 4kb. Google around: http://www.google.com/search?q=kernel.shmall+tuning+postgresql+shared+memory > /etc/fstab: > /dev/sdb1 /var/lib/pgsql reiserfs acl,user_xattr,noatime,data=writeback 1 2 I use similar settings on ext3 (which I'm told it is slower than reiser or xfs or jfs). I indicate the values I use for a machine with 4Gb RAM and more 15 krpm disks but layout similar to yours. (3 x RAID1 arrays for os, logs, ... and 1 x RAID10 array with 12 disks) For Pg configuration (others please comment on these values, it is invaluable to have feedback from this list). > /var/lib/pgsql/data/postgresql.conf > superuser_reserved_connections = 2 > shared_buffers = 3000 16384 > work_mem = 131072 32768 > maintenance_work_mem = 131072 262144 > max_fsm_pages = 20000 200000 > fsync = true false > commit_delay = 0 > commit_siblings = 5 If you have an high transactions volume, you should really investigate on these ones. > effective_cache_size = 10000 40000 > random_page_cost = 4 Check out for unwanted "seq scans". If you have really fast disks, you should experiment lowering a little this parameter. > max_locks_per_transaction = 64 512 > I'm really new at using postgres. So i need some experience to set this > parameters in the postgresql- and the system-config. I can't find standard > calculations for this. :/ The postgresql-documentation doesn't help me to > set the best values for this. There's no such thing as "standard calculations" :-) > The database must be high-availble. I configured rsync to sync the complete > /var/lib/pgsql-directory to my hot-standby > [...] > In my tests the synchronization works fine. I synchronised the hole > consistent. > [...] > Is this solution recommended? Or must i use archived wal's with > real system-snapshots? In some situations, I also used rsync to do the job. Obviously, always stop the postmaster before syncing. Maybe you can look at "slony", if you haven't yet. http://www.slony.info -- Cosimo From pgsql-performance-owner@postgresql.org Wed Jun 1 02:43: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 233E852824 for ; Wed, 1 Jun 2005 02:43:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45987-08 for ; Wed, 1 Jun 2005 05:43:37 +0000 (GMT) Received: from exobox.exoweb.net (unknown [221.122.43.98]) by svr1.postgresql.org (Postfix) with SMTP id 01DA25282A for ; Wed, 1 Jun 2005 02:43:24 -0300 (ADT) Received: (qmail 5924 invoked from network); 1 Jun 2005 05:43:01 -0000 Received: from exo185.exoweb.net (HELO tobias.nordicbet.invalid) (192.168.0.185) by 0 with SMTP; 1 Jun 2005 05:43:01 -0000 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id 81473E09C7; Wed, 1 Jun 2005 13:42:53 +0800 (CST) Date: Wed, 1 Jun 2005 13:42:51 +0800 From: Tobias Brox To: Tobias Brox Cc: pgsql-performance@postgresql.org Subject: Re: Index on a NULL-value Message-ID: <20050601054251.GT26100@tobias.exoweb.net> References: <20050531030207.GD26100@tobias.exoweb.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050531030207.GD26100@tobias.exoweb.net> Organization: Group Nordicbet 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: 200506/2 X-Sequence-Number: 12640 [Tobias Brox - Tue at 11:02:07AM +0800] > I read in the manual today: > > Indexes are not used for IS NULL clauses by default. The best way to use > indexes in such cases is to create a partial index using an IS NULL > predicate. I have summarized this thread in a postgresql doc user comment, posted at http://www.postgresql.org/docs/current/interactive/sql-createindex.html I think it's a good thing to do, since it can be difficult to search the mailing list archives :-) -- Tobias Brox, Beijing From pgsql-performance-owner@postgresql.org Wed Jun 1 03:33: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 4DBB4528C1 for ; Wed, 1 Jun 2005 03:33:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48147-02 for ; Wed, 1 Jun 2005 06:33:27 +0000 (GMT) Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz [202.0.58.21]) by svr1.postgresql.org (Postfix) with ESMTP id 584A952887 for ; Wed, 1 Jun 2005 03:33:26 -0300 (ADT) Received: from smtp-2.paradise.net.nz (smtp-2b.paradise.net.nz [202.0.32.211]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IHE00K467JPAL@linda-2.paradise.net.nz> for pgsql-performance@postgresql.org; Wed, 01 Jun 2005 18:33:26 +1200 (NZST) Received: from [192.168.1.11] (218-101-13-29.paradise.net.nz [218.101.13.29]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 29B7F9E91F; Wed, 01 Jun 2005 18:33:25 +1200 (NZST) Date: Wed, 01 Jun 2005 18:33:22 +1200 From: Mark Kirkwood Subject: Re: postgresql-8.0.1 performance tuning In-reply-to: <429D47FD.7090501@streppone.it> To: Cosimo Streppone Cc: Martin Fandel , Postgresql Performance list Message-id: <429D56B2.9070302@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050511) References: <1117201312.7060.6.camel@fandelm.ecommit.de> <429D47FD.7090501@streppone.it> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.069 tagged_above=0 required=5 tests=AWL, RCVD_IN_BL_SPAMCOP_NET X-Spam-Level: * X-Archive-Number: 200506/3 X-Sequence-Number: 12641 Cosimo Streppone wrote: > ######### Config ############ >> /etc/sysctl.conf: >> kernel.shmall = 786432000 >> kernel.shmmax = 786432000 > > > I think you have a problem here. > kernel.shmmax should *not* be set to an amount of RAM, but > to maximum number of shared memory pages, which on a typical linux system > is 4kb. Google around: > > > This is somewhat confusing : kernel.shmmax is in bytes (max single segment size) kernel.shmall is in (4k) pages (max system wide allocated segment pages) cheers Mark From pgsql-performance-owner@postgresql.org Wed Jun 1 03:45: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 E19E45287E for ; Wed, 1 Jun 2005 03:45:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05147-03 for ; Wed, 1 Jun 2005 06:45:43 +0000 (GMT) Received: from ebrsrv01.ebravo.it (host53-205.pool8534.interbusiness.it [85.34.205.53]) by svr1.postgresql.org (Postfix) with ESMTP id 021FF5287A for ; Wed, 1 Jun 2005 03:45:37 -0300 (ADT) Received: from [192.168.11.103] ([192.168.11.103]) (authenticated) by ebrsrv01.ebravo.it (8.11.6/8.12.5) with ESMTP id j516iKY25988; Wed, 1 Jun 2005 08:44:20 +0200 Message-ID: <429D5942.6020502@streppone.it> Date: Wed, 01 Jun 2005 08:44:18 +0200 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: it, it-it, en-us, en MIME-Version: 1.0 To: Mark Kirkwood Cc: Postgresql Performance Subject: Re: postgresql-8.0.1 performance tuning References: <1117201312.7060.6.camel@fandelm.ecommit.de> <429D47FD.7090501@streppone.it> <429D56B2.9070302@paradise.net.nz> In-Reply-To: <429D56B2.9070302@paradise.net.nz> 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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/4 X-Sequence-Number: 12642 Mark Kirkwood ha scritto: > Cosimo Streppone wrote: > >> ######### Config ############ >> >>> /etc/sysctl.conf: >>> kernel.shmall = 786432000 >>> kernel.shmmax = 786432000 >> >> I think you have a problem here. >> kernel.shmmax should *not* be set to an amount of RAM, but Sorry, I thought "shmall" but written "shmmax". Thanks Mark! -- Cosimo From pgsql-performance-owner@postgresql.org Wed Jun 1 04:23: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 D6F4E528BB for ; Wed, 1 Jun 2005 04:23:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57676-01 for ; Wed, 1 Jun 2005 07:23:47 +0000 (GMT) Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz [202.0.58.23]) by svr1.postgresql.org (Postfix) with ESMTP id 260BE5287E for ; Wed, 1 Jun 2005 04:23:42 -0300 (ADT) Received: from smtp-1.paradise.net.nz (smtp-1a.paradise.net.nz [202.0.32.194]) by linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IHE00J1X9VI6L@linda-4.paradise.net.nz> for pgsql-performance@postgresql.org; Wed, 01 Jun 2005 19:23:42 +1200 (NZST) Received: from [192.168.1.11] (218-101-13-29.paradise.net.nz [218.101.13.29]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 0C92E83725; Wed, 01 Jun 2005 19:22:45 +1200 (NZST) Date: Wed, 01 Jun 2005 19:22:42 +1200 From: Mark Kirkwood Subject: Re: postgresql-8.0.1 performance tuning In-reply-to: <429D5942.6020502@streppone.it> To: Cosimo Streppone Cc: Postgresql Performance Message-id: <429D6242.6000804@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050511) References: <1117201312.7060.6.camel@fandelm.ecommit.de> <429D47FD.7090501@streppone.it> <429D56B2.9070302@paradise.net.nz> <429D5942.6020502@streppone.it> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/5 X-Sequence-Number: 12643 Cosimo Streppone wrote: > Mark Kirkwood ha scritto: > >> Cosimo Streppone wrote: >> >>> ######### Config ############ >>> >>>> /etc/sysctl.conf: >>>> kernel.shmall = 786432000 >>>> kernel.shmmax = 786432000 >>> >>> >>> I think you have a problem here. >>> kernel.shmmax should *not* be set to an amount of RAM, but > > > Sorry, I thought "shmall" but written "shmmax". > Thanks Mark! > Hehe - happens to me all the time! On the shmall front - altho there is *probably* no real performance impact setting it to the same as shmmax (i.e. allowing 4096 allocations of size shmmax!), it is overkill. In addition it does allow for a DOS by a program that allocates thousands of segments (or somehow starts thousands of Pg servers on different ports...)! For a dedicated Pg server I would size shmall using a calculation along the lines of: shmall = (no. of postgresql servers) * (shmmax/4096) If there are other daemons on the box that need to use shared memory, then add their likely requirements to shmall too! cheers Mark From pgsql-performance-owner@postgresql.org Wed Jun 1 04:43: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 F208552806 for ; Wed, 1 Jun 2005 04:43:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56739-08 for ; Wed, 1 Jun 2005 07:43:09 +0000 (GMT) Received: from ns1.bi.lt (ns.bi.lt [213.226.131.131]) by svr1.postgresql.org (Postfix) with ESMTP id 94635528BB for ; Wed, 1 Jun 2005 04:43:06 -0300 (ADT) Received: from B027543 (inet.bee.lt [213.226.131.30]) by ns1.bi.lt (8.12.11/8.12.11) with SMTP id j517h6jr020132 for ; Wed, 1 Jun 2005 10:43:06 +0300 Message-ID: <00d501c5667d$8cc12320$f20214ac@bite.lt> From: "Mindaugas Riauba" To: Subject: How to avoid database bloat Date: Wed, 1 Jun 2005 10:43:06 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1257" Content-Transfer-Encoding: 7bit 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.162 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/6 X-Sequence-Number: 12644 Hello, Our database increases in size 2.5 times during the day. What to do to avoid this? Autovacuum running with quite aggressive settings, FSM settings are high enough. Database size should be more or less constant but it has high turnover rate (100+ insert/update/delete per second). Below is "du -sk" of database dir during the day. On 4:05 full vacuum+reindex runs and database size is once again reduced. Thanks, Mindaugas Tue May 31 11:00:01 EEST 2005 533808 /ora/pgsql/base/465436/ Tue May 31 11:30:01 EEST 2005 567344 /ora/pgsql/base/465436/ Tue May 31 12:00:01 EEST 2005 578632 /ora/pgsql/base/465436/ Tue May 31 12:30:01 EEST 2005 586336 /ora/pgsql/base/465436/ Tue May 31 13:00:01 EEST 2005 594716 /ora/pgsql/base/465436/ Tue May 31 13:30:01 EEST 2005 604932 /ora/pgsql/base/465436/ Tue May 31 14:00:01 EEST 2005 613668 /ora/pgsql/base/465436/ Tue May 31 14:30:01 EEST 2005 625752 /ora/pgsql/base/465436/ Tue May 31 15:00:01 EEST 2005 637704 /ora/pgsql/base/465436/ Tue May 31 15:30:01 EEST 2005 649700 /ora/pgsql/base/465436/ Tue May 31 16:00:01 EEST 2005 657392 /ora/pgsql/base/465436/ Tue May 31 16:30:02 EEST 2005 668228 /ora/pgsql/base/465436/ Tue May 31 17:00:01 EEST 2005 676332 /ora/pgsql/base/465436/ Tue May 31 17:30:01 EEST 2005 686376 /ora/pgsql/base/465436/ Tue May 31 18:00:01 EEST 2005 694080 /ora/pgsql/base/465436/ Tue May 31 18:30:02 EEST 2005 705876 /ora/pgsql/base/465436/ Tue May 31 19:00:01 EEST 2005 713916 /ora/pgsql/base/465436/ Tue May 31 19:30:01 EEST 2005 725460 /ora/pgsql/base/465436/ Tue May 31 20:00:01 EEST 2005 733892 /ora/pgsql/base/465436/ Tue May 31 20:30:01 EEST 2005 745344 /ora/pgsql/base/465436/ Tue May 31 21:00:01 EEST 2005 753048 /ora/pgsql/base/465436/ Tue May 31 21:30:02 EEST 2005 768228 /ora/pgsql/base/465436/ Tue May 31 22:00:01 EEST 2005 804796 /ora/pgsql/base/465436/ Tue May 31 22:30:01 EEST 2005 858840 /ora/pgsql/base/465436/ Tue May 31 23:00:02 EEST 2005 902684 /ora/pgsql/base/465436/ Tue May 31 23:30:01 EEST 2005 939796 /ora/pgsql/base/465436/ Wed Jun 1 00:00:02 EEST 2005 990840 /ora/pgsql/base/465436/ Wed Jun 1 00:30:11 EEST 2005 1005316 /ora/pgsql/base/465436/ Wed Jun 1 01:00:02 EEST 2005 1011408 /ora/pgsql/base/465436/ Wed Jun 1 01:30:01 EEST 2005 1010888 /ora/pgsql/base/465436/ Wed Jun 1 02:00:01 EEST 2005 1010872 /ora/pgsql/base/465436/ Wed Jun 1 02:30:01 EEST 2005 1010784 /ora/pgsql/base/465436/ Wed Jun 1 03:00:02 EEST 2005 1003260 /ora/pgsql/base/465436/ Wed Jun 1 03:30:02 EEST 2005 1003372 /ora/pgsql/base/465436/ Wed Jun 1 04:00:01 EEST 2005 1003380 /ora/pgsql/base/465436/ Wed Jun 1 04:30:01 EEST 2005 426508 /ora/pgsql/base/465436/ Wed Jun 1 05:00:01 EEST 2005 429036 /ora/pgsql/base/465436/ Wed Jun 1 05:30:01 EEST 2005 432156 /ora/pgsql/base/465436/ Wed Jun 1 06:00:01 EEST 2005 433332 /ora/pgsql/base/465436/ Wed Jun 1 06:30:01 EEST 2005 435052 /ora/pgsql/base/465436/ Wed Jun 1 07:00:02 EEST 2005 439908 /ora/pgsql/base/465436/ Wed Jun 1 07:30:01 EEST 2005 450144 /ora/pgsql/base/465436/ Wed Jun 1 08:00:01 EEST 2005 471120 /ora/pgsql/base/465436/ Wed Jun 1 08:30:02 EEST 2005 490712 /ora/pgsql/base/465436/ Wed Jun 1 09:00:01 EEST 2005 501652 /ora/pgsql/base/465436/ Wed Jun 1 09:30:01 EEST 2005 530128 /ora/pgsql/base/465436/ Wed Jun 1 10:00:01 EEST 2005 541580 /ora/pgsql/base/465436/ Wed Jun 1 10:30:01 EEST 2005 571204 /ora/pgsql/base/465436/ From pgsql-performance-owner@postgresql.org Sun Jun 5 22:32: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 77B055281C for ; Wed, 1 Jun 2005 05:13:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18082-02 for ; Wed, 1 Jun 2005 08:13:08 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5F49852817 for ; Wed, 1 Jun 2005 05:13:06 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 7188330952; Wed, 1 Jun 2005 10:09:42 +0200 (MET DST) From: stig erikson X-Newsgroups: pgsql.performance Subject: Re: How to avoid database bloat Date: Wed, 01 Jun 2005 10:13:02 +0200 Organization: Hub.Org Networking Services Lines: 124 Message-ID: References: <00d501c5667d$8cc12320$f20214ac@bite.lt> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1257; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/20050518 In-Reply-To: <00d501c5667d$8cc12320$f20214ac@bite.lt> 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: 200506/100 X-Sequence-Number: 12737 Mindaugas Riauba wrote: > Hello, > > Our database increases in size 2.5 times during the day. > What to do to avoid this? Autovacuum running with quite > aggressive settings, FSM settings are high enough. > > Database size should be more or less constant but it > has high turnover rate (100+ insert/update/delete per second). > > Below is "du -sk" of database dir during the day. On 4:05 > full vacuum+reindex runs and database size is once again > reduced. > > Thanks, > > Mindaugas > > Tue May 31 11:00:01 EEST 2005 > 533808 /ora/pgsql/base/465436/ > Tue May 31 11:30:01 EEST 2005 > 567344 /ora/pgsql/base/465436/ > Tue May 31 12:00:01 EEST 2005 > 578632 /ora/pgsql/base/465436/ > Tue May 31 12:30:01 EEST 2005 > 586336 /ora/pgsql/base/465436/ > Tue May 31 13:00:01 EEST 2005 > 594716 /ora/pgsql/base/465436/ > Tue May 31 13:30:01 EEST 2005 > 604932 /ora/pgsql/base/465436/ > Tue May 31 14:00:01 EEST 2005 > 613668 /ora/pgsql/base/465436/ > Tue May 31 14:30:01 EEST 2005 > 625752 /ora/pgsql/base/465436/ > Tue May 31 15:00:01 EEST 2005 > 637704 /ora/pgsql/base/465436/ > Tue May 31 15:30:01 EEST 2005 > 649700 /ora/pgsql/base/465436/ > Tue May 31 16:00:01 EEST 2005 > 657392 /ora/pgsql/base/465436/ > Tue May 31 16:30:02 EEST 2005 > 668228 /ora/pgsql/base/465436/ > Tue May 31 17:00:01 EEST 2005 > 676332 /ora/pgsql/base/465436/ > Tue May 31 17:30:01 EEST 2005 > 686376 /ora/pgsql/base/465436/ > Tue May 31 18:00:01 EEST 2005 > 694080 /ora/pgsql/base/465436/ > Tue May 31 18:30:02 EEST 2005 > 705876 /ora/pgsql/base/465436/ > Tue May 31 19:00:01 EEST 2005 > 713916 /ora/pgsql/base/465436/ > Tue May 31 19:30:01 EEST 2005 > 725460 /ora/pgsql/base/465436/ > Tue May 31 20:00:01 EEST 2005 > 733892 /ora/pgsql/base/465436/ > Tue May 31 20:30:01 EEST 2005 > 745344 /ora/pgsql/base/465436/ > Tue May 31 21:00:01 EEST 2005 > 753048 /ora/pgsql/base/465436/ > Tue May 31 21:30:02 EEST 2005 > 768228 /ora/pgsql/base/465436/ > Tue May 31 22:00:01 EEST 2005 > 804796 /ora/pgsql/base/465436/ > Tue May 31 22:30:01 EEST 2005 > 858840 /ora/pgsql/base/465436/ > Tue May 31 23:00:02 EEST 2005 > 902684 /ora/pgsql/base/465436/ > Tue May 31 23:30:01 EEST 2005 > 939796 /ora/pgsql/base/465436/ > Wed Jun 1 00:00:02 EEST 2005 > 990840 /ora/pgsql/base/465436/ > Wed Jun 1 00:30:11 EEST 2005 > 1005316 /ora/pgsql/base/465436/ > Wed Jun 1 01:00:02 EEST 2005 > 1011408 /ora/pgsql/base/465436/ > Wed Jun 1 01:30:01 EEST 2005 > 1010888 /ora/pgsql/base/465436/ > Wed Jun 1 02:00:01 EEST 2005 > 1010872 /ora/pgsql/base/465436/ > Wed Jun 1 02:30:01 EEST 2005 > 1010784 /ora/pgsql/base/465436/ > Wed Jun 1 03:00:02 EEST 2005 > 1003260 /ora/pgsql/base/465436/ > Wed Jun 1 03:30:02 EEST 2005 > 1003372 /ora/pgsql/base/465436/ > Wed Jun 1 04:00:01 EEST 2005 > 1003380 /ora/pgsql/base/465436/ > Wed Jun 1 04:30:01 EEST 2005 > 426508 /ora/pgsql/base/465436/ > Wed Jun 1 05:00:01 EEST 2005 > 429036 /ora/pgsql/base/465436/ > Wed Jun 1 05:30:01 EEST 2005 > 432156 /ora/pgsql/base/465436/ > Wed Jun 1 06:00:01 EEST 2005 > 433332 /ora/pgsql/base/465436/ > Wed Jun 1 06:30:01 EEST 2005 > 435052 /ora/pgsql/base/465436/ > Wed Jun 1 07:00:02 EEST 2005 > 439908 /ora/pgsql/base/465436/ > Wed Jun 1 07:30:01 EEST 2005 > 450144 /ora/pgsql/base/465436/ > Wed Jun 1 08:00:01 EEST 2005 > 471120 /ora/pgsql/base/465436/ > Wed Jun 1 08:30:02 EEST 2005 > 490712 /ora/pgsql/base/465436/ > Wed Jun 1 09:00:01 EEST 2005 > 501652 /ora/pgsql/base/465436/ > Wed Jun 1 09:30:01 EEST 2005 > 530128 /ora/pgsql/base/465436/ > Wed Jun 1 10:00:01 EEST 2005 > 541580 /ora/pgsql/base/465436/ > Wed Jun 1 10:30:01 EEST 2005 > 571204 /ora/pgsql/base/465436/ > > > ---------------------------(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 > run autovacuum more often. From pgsql-performance-owner@postgresql.org Wed Jun 1 05:51: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 F2261528B2 for ; Wed, 1 Jun 2005 05:51:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75472-02 for ; Wed, 1 Jun 2005 08:51:29 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id 972F55280B for ; Wed, 1 Jun 2005 05:51:24 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j518pC0A001748; Wed, 1 Jun 2005 10:51:17 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j518pCwj001747; Wed, 1 Jun 2005 10:51:12 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Wed, 01 Jun 2005 10:51:11 +0200 (CEST) Date: Wed, 1 Jun 2005 10:50:31 +0200 From: "Martin Fandel" To: John A Meinel Cc: pgsql-performance@postgresql.org Message-ID: <1117615831.7612.113.camel@fandelm.ecommit.de> In-Reply-To: <429CB109.5080908@arbash-meinel.com> References: <1117201312.7060.6.camel@fandelm.ecommit.de> References: <429CB109.5080908@arbash-meinel.com> Subject: Re: postgresql-8.0.1 performance tuning x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.255 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200506/7 X-Sequence-Number: 12645 Hi John, thank you very much for the answer :). I moved the pg_xlog to another partition and made a symlink to it. Know the database is much more faster than before. A sample select which was finished in 68seconds before, is now finished in 58seconds :). I will test the other changes today also and will write a feedback after testing. :) Thanks a lot. I'm very confusing to tuning the postgresql-db. #:-) best regards Martin Am Dienstag, den 31.05.2005, 13:46 -0500 schrieb John A Meinel: > Martin Fandel wrote: > > > Hi @ all, > > > > i'm trying to tune my postgresql-db but i don't know if the values are > > right > > set. > > > > I use the following environment for the postgres-db: > > > > ######### Hardware ############ > > cpu: 2x P4 3Ghz > > ram: 1024MB DDR 266Mhz > > > > partitions: > > /dev/sda3 23G 9,6G 13G 44% / > > /dev/sda1 11G 156M 9,9G 2% /var > > /dev/sdb1 69G 13G 57G 19% /var/lib/pgsql > > > > /dev/sda is in raid 1 (2x 35GB / 10000upm / sca) > > /dev/sdb is in raid 10 (4x 35GB / 10000upm / sca) > > ######### /Hardware ############ > > You probably want to put the pg_xlog file onto /dev/sda rather than > having it in /dev/sdb. Having it separate from the data usually boosts > performance a lot. I believe you can just mv it to a different > directory, and then recreate it as a symlink. (Stop the database first :) > > > > > ######### Config ############ > > /etc/sysctl.conf: > > kernel.shmall = 786432000 > > kernel.shmmax = 786432000 > > > Not really sure about these two. > > > /etc/fstab: > > /dev/sdb1 /var/lib/pgsql reiserfs > > acl,user_xattr,noatime,data=writeback 1 2 > > > Seems decent. > > > /var/lib/pgsql/data/postgresql.conf > > superuser_reserved_connections = 2 > > shared_buffers = 3000 > > work_mem = 131072 > > maintenance_work_mem = 131072 > > These both seem pretty large. But it depends on how many concurrent > connections doing sorting/hashing/etc you expect. If you are only > expecting 1 connection, these are probably fine. Otherwise with 1GB of > RAM I would probably make work_mem more like 4096/8192. > Remember, running out of work_mem means postgres will spill to disk, > slowing that query. Running out of RAM causes the system to swap, making > everything slow. > > > max_stack_depth = 2048 > > max_fsm_pages = 20000 > > max_fsm_relations = 1000 > > max_files_per_process = 1000 > > vacuum_cost_delay = 10 > > vacuum_cost_page_hit = 1 > > vacuum_cost_page_miss = 10 > > vacuum_cost_page_dirty = 20 > > vacuum_cost_limit = 200 > > bgwriter_delay = 200 > > bgwriter_percent = 1 > > bgwriter_maxpages = 100 > > fsync = true > > wal_sync_method = fsync > > wal_buffers = 64 > > commit_delay = 0 > > commit_siblings = 5 > > checkpoint_segments = 256 > > checkpoint_timeout = 900 > > checkpoint_warning = 30 > > effective_cache_size = 10000 > > random_page_cost = 4 > > cpu_tuple_cost = 0.01 > > cpu_index_tuple_cost = 0.001 > > cpu_operator_cost = 0.0025 > > geqo = true > > geqo_threshold = 12 > > geqo_effort = 5 > > geqo_pool_size = 0 > > geqo_generations = 0 > > geqo_selection_bias = 2.0 > > deadlock_timeout = 1000 > > max_locks_per_transaction = 64 > > ######### /Config ############ > > > > ######### Transactions ############ > > we have about 115-300 transactions/min in about 65 tables. > > ######### /Transactions ############ > > > > I'm really new at using postgres. So i need some experience to set this > > parameters in the postgresql- and the system-config. I can't find standard > > calculations for this. :/ The postgresql-documentation doesn't help me to > > set the best values for this. > > > > The database must be high-availble. I configured rsync to sync the > > complete > > /var/lib/pgsql-directory to my hot-standby. On the hotstandby i will > > make the > > dumps of the database to improve the performance of the master-db. > > > I didn't think an rsync was completely valid. Probably you should look > more into Slony. > http://slony.info > > It is a single-master asynchronous replication system. I believe it is > pretty easy to setup, and does what you really want. > > > In my tests the synchronization works fine. I synchronised the hole > > directory > > and restarted the database of the hotstandby. While restarting, > > postgresql turned > > back the old (not archived) wals and the database of my hotstandby was > > consistent. Is this solution recommended? Or must i use archived wal's > > with > > real system-snapshots? > > > > best regards, > > > > Martin Fandel > > John > =:-> > From pgsql-performance-owner@postgresql.org Wed Jun 1 06:01: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 DDCA15292B for ; Wed, 1 Jun 2005 06:01:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13064-02 for ; Wed, 1 Jun 2005 09:01:44 +0000 (GMT) Received: from cmailg1.svr.pol.co.uk (cmailg1.svr.pol.co.uk [195.92.195.171]) by svr1.postgresql.org (Postfix) with ESMTP id 6724952944 for ; Wed, 1 Jun 2005 06:01:43 -0300 (ADT) Received: from modem-2676.leopard.dialup.pol.co.uk ([217.135.154.116] helo=192.168.0.102) by cmailg1.svr.pol.co.uk with esmtp (Exim 4.41) id 1DdP6f-0003aC-Fd; Wed, 01 Jun 2005 10:01:45 +0100 Subject: Re: very large table From: Simon Riggs To: Praveen Raja Cc: pgsql-performance@postgresql.org In-Reply-To: <022801c565c4$6b1ac8c0$541510ac@sek.se> References: <022801c565c4$6b1ac8c0$541510ac@sek.se> Content-Type: text/plain; charset=UTF-8 Organization: 2nd Quadrant Date: Wed, 01 Jun 2005 09:57:19 +0100 Message-Id: <1117616239.3844.898.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) 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: 200506/8 X-Sequence-Number: 12646 On Tue, 2005-05-31 at 11:37 +0200, Praveen Raja wrote: > I=E2=80=99m trying to move an existing solution from MySQL to PostgreSQL.= As > it is now the solution has 4 tables where data in inserted by an > application. At regular intervals (10min) data from these tables is > consolidated and moved to another table for reporting purposes. There > exist many instances of these reporting tables and in total they are > expected to hold about 500 million rows. There are about 200 of these > reporting tables at the moment with data split among them. When a > request comes in all these tables are searched.=20 > While moving to PostgreSQL is it a good idea to move from using > multiple tables to one table for so many rows?=20 No. All of the same reasoning applies.=20 Try to keep each table small enough to fit easily in RAM. Make sure you specify WITHOUT OIDS on the main data tables. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Jun 1 06:10: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 854F252802 for ; Wed, 1 Jun 2005 06:10:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59987-01 for ; Wed, 1 Jun 2005 09:10:43 +0000 (GMT) Received: from cmailg1.svr.pol.co.uk (cmailg1.svr.pol.co.uk [195.92.195.171]) by svr1.postgresql.org (Postfix) with ESMTP id A6A5252806 for ; Wed, 1 Jun 2005 06:10:43 -0300 (ADT) Received: from modem-2676.leopard.dialup.pol.co.uk ([217.135.154.116] helo=192.168.0.102) by cmailg1.svr.pol.co.uk with esmtp (Exim 4.41) id 1DdPFN-0005w3-4j; Wed, 01 Jun 2005 10:10:45 +0100 Subject: Re: slow queries, possibly disk io From: Simon Riggs To: Josh Close Cc: POSTGRES-PERFORMANCE In-Reply-To: <4a0cafe205052705526fccfe75@mail.gmail.com> References: <4a0cafe205052613242e0d4d10@mail.gmail.com> <42963C3F.4000905@arbash-meinel.com> <4a0cafe205052705526fccfe75@mail.gmail.com> Content-Type: text/plain Organization: 2nd Quadrant Date: Wed, 01 Jun 2005 10:06:19 +0100 Message-Id: <1117616779.3844.903.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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/9 X-Sequence-Number: 12647 On Fri, 2005-05-27 at 07:52 -0500, Josh Close wrote: > > Setting shared buffers above something like 10-30% of memory is counter > > productive. > > What is the reason behind it being counter productive? If shared > buffers are at 30%, should effective cache size be at 70%? How do > those two relate? They don't relate. shared_buffers = 50000 is enough. More than that will give bgwriter issues. effective_cache_size changes whether indexes are selected or not. Higher settings favour indexed access. > > > > Increasing sort_mem can help with various activities, but increasing it > > too much can cause you to swap, which kills performance. The caution is > > that you will likely use at least 1 sort_mem per connection, and can > > likely use more than one if the query is complicated. > > I have a max of 100 connections and 2 gigs of mem. Right now the sort > mem is a 4 megs. How much higher could I put that? > Please post your server hardware config all in one go. You have more than 2 CPUs, yes? Also, mention what bgwriter settings are. You may need to turn those down a bit. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Jun 1 06:45: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 7C10D528D0 for ; Wed, 1 Jun 2005 06:45:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35465-06 for ; Wed, 1 Jun 2005 09:45:06 +0000 (GMT) Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id 08C0F528B2 for ; Wed, 1 Jun 2005 06:45:05 -0300 (ADT) Received: (qmail 4135 invoked by uid 0); 1 Jun 2005 09:45:06 -0000 Received: from 217.17.202.254 by www18.gmx.net with HTTP; Wed, 1 Jun 2005 11:45:06 +0200 (MEST) Date: Wed, 1 Jun 2005 11:45:06 +0200 (MEST) From: "Marc Mamin" To: pgsql-performance@postgresql.org MIME-Version: 1.0 References: <1117616779.3844.903.camel@localhost.localdomain> Subject: TIP 9: the planner will ignore... & datatypes X-Priority: 3 (Normal) X-Authenticated: #3793498 Message-ID: <29804.1117619106@www18.gmx.net> X-Mailer: WWW-Mail 1.6 (Global Message Exchange) X-Flags: 0001 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.033 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/10 X-Sequence-Number: 12648 TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match But INT2, INT4, INT8 and "SERIAL" are considered to be a unique datatype. Am I Right? Thanks, Marc -- Geschenkt: 3 Monate GMX ProMail gratis + 3 Ausgaben stern gratis ++ Jetzt anmelden & testen ++ http://www.gmx.net/de/go/promail ++ From pgsql-performance-owner@postgresql.org Wed Jun 1 06:58: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 EC81052934 for ; Wed, 1 Jun 2005 06:57:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35495-09 for ; Wed, 1 Jun 2005 09:57:57 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 476FE5292F for ; Wed, 1 Jun 2005 06:57:56 -0300 (ADT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1DdPz2-0000qb-Fb for pgsql-performance@postgresql.org; Wed, 01 Jun 2005 11:57:57 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1DdPz0-0006Yf-00 for ; Wed, 01 Jun 2005 11:57:54 +0200 Date: Wed, 1 Jun 2005 11:57:54 +0200 From: "Steinar H. Gunderson" To: Postgresql Performance list Subject: Re: postgresql-8.0.1 performance tuning Message-ID: <20050601095754.GA24585@uio.no> Mail-Followup-To: Postgresql Performance list References: <1117201312.7060.6.camel@fandelm.ecommit.de> <429D47FD.7090501@streppone.it> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <429D47FD.7090501@streppone.it> X-Operating-System: Linux 2.6.11.8 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.022 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/11 X-Sequence-Number: 12649 On Wed, Jun 01, 2005 at 07:30:37AM +0200, Cosimo Streppone wrote: >>fsync = true > false Just setting fsync=false without considering the implications is a _bad_ idea... /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Wed Jun 1 07:22: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 5A5155280A for ; Wed, 1 Jun 2005 07:22:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79299-04 for ; Wed, 1 Jun 2005 10:22:19 +0000 (GMT) Received: from ebrsrv01.ebravo.it (host53-205.pool8534.interbusiness.it [85.34.205.53]) by svr1.postgresql.org (Postfix) with ESMTP id 6BFCA52806 for ; Wed, 1 Jun 2005 07:22:16 -0300 (ADT) Received: from [192.168.11.103] ([192.168.11.103]) (authenticated) by ebrsrv01.ebravo.it (8.11.6/8.12.5) with ESMTP id j51AMCY20850; Wed, 1 Jun 2005 12:22:12 +0200 Message-ID: <429D8C50.6080207@streppone.it> Date: Wed, 01 Jun 2005 12:22:08 +0200 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: it, it-it, en-us, en MIME-Version: 1.0 To: "Steinar H. Gunderson" Cc: Postgresql Performance Subject: Re: postgresql-8.0.1 performance tuning References: <1117201312.7060.6.camel@fandelm.ecommit.de> <429D47FD.7090501@streppone.it> <20050601095754.GA24585@uio.no> In-Reply-To: <20050601095754.GA24585@uio.no> 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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/12 X-Sequence-Number: 12650 Steinar wrote: > On Wed, Jun 01, 2005 at 07:30:37AM +0200, Cosimo Streppone wrote: > > > > fsync = true > > false > > Just setting fsync=false without considering the implications is a _bad_ > idea... I totally agree on that. -- Cosimo From pgsql-performance-owner@postgresql.org Wed Jun 1 07:27: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 A9C6C52896 for ; Wed, 1 Jun 2005 07:27:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42955-01 for ; Wed, 1 Jun 2005 10:27:16 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id CDA3A5287E for ; Wed, 1 Jun 2005 07:27:14 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j51ARC0A029763; Wed, 1 Jun 2005 12:27:12 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j51ARCj6029762; Wed, 1 Jun 2005 12:27:12 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Wed, 01 Jun 2005 12:27:10 +0200 (CEST) Date: Wed, 1 Jun 2005 12:26:29 +0200 From: "Martin Fandel" To: "Steinar H. Gunderson" Cc: Postgresql Performance list Message-ID: <1117621589.7612.140.camel@fandelm.ecommit.de> In-Reply-To: <20050601095754.GA24585@uio.no> References: <1117201312.7060.6.camel@fandelm.ecommit.de> References: <429D47FD.7090501@streppone.it> References: <20050601095754.GA24585@uio.no> Subject: Re: postgresql-8.0.1 performance tuning x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.127 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/13 X-Sequence-Number: 12651 Yes, i think also that this setting should be enabled :). Am Mittwoch, den 01.06.2005, 11:57 +0200 schrieb Steinar H. Gunderson: > On Wed, Jun 01, 2005 at 07:30:37AM +0200, Cosimo Streppone wrote: > >>fsync = true > > false > > Just setting fsync=false without considering the implications is a _bad_ > idea... > > /* Steinar */ From pgsql-performance-owner@postgresql.org Wed Jun 1 10:40: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 0891952896 for ; Wed, 1 Jun 2005 10:40:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83727-07 for ; Wed, 1 Jun 2005 13:40:03 +0000 (GMT) Received: from mr1.surnet.cl (smtp1.surnet.cl [216.155.73.162]) by svr1.postgresql.org (Postfix) with ESMTP id E054652887 for ; Wed, 1 Jun 2005 10:39:59 -0300 (ADT) Received: from smtp1.surnet.cl (216.155.73.168) by mr1.surnet.cl (7.0.031.3) id 42587EDE00B17C0F; Wed, 1 Jun 2005 09:39:30 -0400 Received: from smtp1.surnet.cl (mr1.surnet.cl []) by mr1.surnet.cl ([216.155.73.168]); Wed, 01 Jun 2005 13:39:30 +0000 Received: from cluster.surnet.cl (216.155.73.164) by smtp1.surnet.cl (7.0.031.3) id 42587C6E0091A528; Wed, 1 Jun 2005 09:39:29 -0400 Received: from localhost (200.85.219.91) by cluster.surnet.cl (7.0.024) id 4276578F0041C51A; Wed, 1 Jun 2005 09:40:00 -0400 Received: by localhost (Postfix, from userid 1000) id 7D35DC00205; Wed, 1 Jun 2005 09:40:09 -0400 (CLT) Date: Wed, 1 Jun 2005 09:40:09 -0400 From: Alvaro Herrera To: Marc Mamin Cc: pgsql-performance@postgresql.org Subject: Re: TIP 9: the planner will ignore... & datatypes Message-ID: <20050601134009.GA23141@surnet.cl> References: <1117616779.3844.903.camel@localhost.localdomain> <29804.1117619106@www18.gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29804.1117619106@www18.gmx.net> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.668 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/14 X-Sequence-Number: 12652 On Wed, Jun 01, 2005 at 11:45:06AM +0200, Marc Mamin wrote: > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match > > > But INT2, INT4, INT8 and "SERIAL" are considered to be a unique datatype. > Am I Right? No, they weren't when this tip was written. As of 8.0 however this tip is no longer the complete truth; we do allow cross-type index scans. -- Alvaro Herrera () "I suspect most samba developers are already technically insane... Of course, since many of them are Australians, you can't tell." (L. Torvalds) From pgsql-performance-owner@postgresql.org Wed Jun 1 11: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 6CB9E52931 for ; Wed, 1 Jun 2005 11:40:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53133-08 for ; Wed, 1 Jun 2005 14:39:59 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A3CD452935 for ; Wed, 1 Jun 2005 11:39:58 -0300 (ADT) 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 j51EdxmV013879; Wed, 1 Jun 2005 10:39:59 -0400 (EDT) To: "Mindaugas Riauba" Cc: pgsql-performance@postgresql.org Subject: Re: How to avoid database bloat In-reply-to: <00d501c5667d$8cc12320$f20214ac@bite.lt> References: <00d501c5667d$8cc12320$f20214ac@bite.lt> Comments: In-reply-to "Mindaugas Riauba" message dated "Wed, 01 Jun 2005 10:43:06 +0300" Date: Wed, 01 Jun 2005 10:39:59 -0400 Message-ID: <13878.1117636799@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: 200506/15 X-Sequence-Number: 12653 "Mindaugas Riauba" writes: > Our database increases in size 2.5 times during the day. > What to do to avoid this? Autovacuum running with quite > aggressive settings, FSM settings are high enough. First thing I'd suggest is to get a more detailed idea of exactly what is bloating --- which tables/indexes are the problem? regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 1 12:31: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 5F4C252817 for ; Wed, 1 Jun 2005 12:31:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55383-07 for ; Wed, 1 Jun 2005 15:31:18 +0000 (GMT) Received: from mail.99main.com (mail.99main.com [208.28.184.11]) by svr1.postgresql.org (Postfix) with ESMTP id B8FC652876 for ; Wed, 1 Jun 2005 12:31:16 -0300 (ADT) Received: from 99main.com (localhost [127.0.0.1]) by mail.99main.com (8.12.8+Sun/8.12.8) with ESMTP id j51FVDxl025819 for ; Wed, 1 Jun 2005 11:31:13 -0400 (EDT) From: "Keith Worthington" To: "PostgreSQL Perform" Reply-To: KeithW@narrowpathinc.com Subject: Moving pg_xlog Date: Wed, 1 Jun 2005 11:31:13 -0400 Message-Id: <20050601151618.M48325@narrowpathinc.com> X-Mailer: Open WebMail 2.50 20050106 X-OriginatingIP: 68.235.22.242 (npkeithw) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 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: 200506/16 X-Sequence-Number: 12654 Hi All, I have been reading about increasing PostgreSQL performance by relocating the pg_xlog to a disk other than the one where the database resides. I have the following pg_xlogs on my system. /raid02/databases/pg_xlog /raid02/rhdb_databases/pg_xlog /raid02/databases-8.0.0/pg_xlog /var/lib/pgsql/data/pg_xlog The second and third entries are from backups that were made before major upgrades so I am expecting that I can blow them away. The first entry is in the directory where my databases are located. I have no idea why the forth entry is there. It is in the PostgreSQL installation directory. Here is my filesystem. # df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda6 9052552 2605292 5987404 31% / /dev/sda1 101089 32688 63182 35% /boot none 1282880 0 1282880 0% /dev/shm /dev/sdb2 16516084 32836 15644256 1% /raid01 /dev/sdb3 16516084 1156160 14520932 8% /raid02 /dev/sda5 2063504 32916 1925768 2% /tmp /dev/sda3 4127108 203136 3714324 6% /var /dev/cdrom 494126 494126 0 100% /mnt/cdrom Can I 1) stop the postmaster 2) rm -rf /var/lib/pgsql/data/pg_xlog 3) mv /raid02/databases/pg_xlog /var/lib/pgsql/data/pg_xlog 4) ln -s /var/lib/pgsql/data/pg_xlog /raid02/databases/pg_xlog 5) start postmaster If I can do that and place the pg_xlog in the installation directory will I create any installation issues the next time I upgrade PostgreSQL? TIA Kind Regards, Keith From pgsql-performance-owner@postgresql.org Wed Jun 1 13:20: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 0B40552923 for ; Wed, 1 Jun 2005 13:19:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31559-05 for ; Wed, 1 Jun 2005 16:19:43 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7938E52943 for ; Wed, 1 Jun 2005 13:19:41 -0300 (ADT) 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 j51GJeV9014826; Wed, 1 Jun 2005 12:19:40 -0400 (EDT) To: KeithW@narrowpathinc.com Cc: "PostgreSQL Perform" Subject: Re: Moving pg_xlog In-reply-to: <20050601151618.M48325@narrowpathinc.com> References: <20050601151618.M48325@narrowpathinc.com> Comments: In-reply-to "Keith Worthington" message dated "Wed, 01 Jun 2005 11:31:13 -0400" Date: Wed, 01 Jun 2005 12:19:40 -0400 Message-ID: <14825.1117642780@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: 200506/17 X-Sequence-Number: 12655 "Keith Worthington" writes: > I have been reading about increasing PostgreSQL performance by relocating the > pg_xlog to a disk other than the one where the database resides. I have the > following pg_xlogs on my system. > /raid02/databases/pg_xlog > /raid02/rhdb_databases/pg_xlog > /raid02/databases-8.0.0/pg_xlog > /var/lib/pgsql/data/pg_xlog > I have no idea why the forth entry is there. It is in the PostgreSQL > installation directory. It's there because the RPM sets up a database under /var/lib/pgsql/data. > 1) stop the postmaster > 2) rm -rf /var/lib/pgsql/data/pg_xlog > 3) mv /raid02/databases/pg_xlog /var/lib/pgsql/data/pg_xlog > 4) ln -s /var/lib/pgsql/data/pg_xlog /raid02/databases/pg_xlog > 5) start postmaster Put the xlog anywhere BUT there!!!!!!!!! > If I can do that and place the pg_xlog in the installation directory will I > create any installation issues the next time I upgrade PostgreSQL? Oh, the installation will be just fine ... but your database will not be after the upgrade wipes out your WAL. Put the xlog under some non-system-defined directory. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jun 5 22:32: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 D936752816 for ; Wed, 1 Jun 2005 16:28:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78758-02 for ; Wed, 1 Jun 2005 19:27:55 +0000 (GMT) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by svr1.postgresql.org (Postfix) with ESMTP id 650AF528AE for ; Wed, 1 Jun 2005 16:27:54 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DdYnH-0003UD-8L for pgsql-performance@postgresql.org; Wed, 01 Jun 2005 21:22:23 +0200 Received: from simba.summersault.com ([12.161.105.182]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Jun 2005 21:22:23 +0200 Received: from mark by simba.summersault.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 01 Jun 2005 21:22:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Mark Stosberg Subject: Most effective tuning choices for busy website? Date: Wed, 1 Jun 2005 19:19:03 +0000 (UTC) Lines: 64 Message-ID: X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: simba.summersault.com X-Archive: encrypt User-Agent: slrn/0.9.8.0 (Linux) 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: 200506/98 X-Sequence-Number: 12736 Hello, I'm the fellow who was interviewed in the fall about using PostgreSQL on 1-800-Save-A-Pet.com: http://techdocs.postgresql.org/techdocs/interview-stosberg.php The site traffic continues to grow, and we are now seeing parts of the day where the CPU load (according to MRTG graphs) on the database server is stuck at 100%. I would like to improve this, and I'm not sure where to look first. The machine is a dedicated PostgreSQL server which two web server boxes talk to. I've used PQA to analyze my queries and happy overall with how they are running. About 55% of the query time is going to variations of the pet searching query, which seems like where it should be going. The query is frequent and complex. It has already been combed over for appropriate indexing. I'm more interested at this point in tuning the software and hardware infrastructure, but would like to get a sense about which choices will bring the greatest reward. Let me explain some avenues I'm considering. - We are currently running 7.4. If I upgrade to 8.0 and DBD::Pg 1.42, then the "server side prepare" feature will be available for use. We do run the same queries a number of times. - PhpPgAds seems to sucking up about 7.5% of our query time and is unrelated to the core application. We could move this work to another machine. The queries it generates seem like they have some room to optimized, or simply don't need to be run in some cases. However, I would like to stay out of modifying third-party code and PHP if possible. - I saw the hardware tip to "Separate the Transaction Log from the Database". We have about 60% SELECT statements and 14% UPDATE statements. Focusing more on SELECT performance seems more important for us. - We have tried to tune 'shared_buffers' some, but haven't seen a noticeable performance improvement. Our hardware: Dual 3 Ghz processors 3 GB RAM, running on FreeBSD. I'm not quite sure how to check our average connection usage, but maybe this is helpful: When I do: select count(*) from pg_stat_activity ; I get values around 170. We have these values: max_connections = 400 shared_buffers = 4096 Most other values in postgresql.conf are still at the their defaults. Any suggestions are which avenues might offer the most bang for the buck are appreciated! ( I have already found: http://www.powerpostgresql.com/PerfList/ and it has been a very helpful source of suggestions. ) Mark From pgsql-performance-owner@postgresql.org Wed Jun 1 17:11: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 D3CAA52945 for ; Wed, 1 Jun 2005 17:11:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58945-08 for ; Wed, 1 Jun 2005 20:11:44 +0000 (GMT) Received: from mail.99main.com (mail.99main.com [208.28.184.11]) by svr1.postgresql.org (Postfix) with ESMTP id AC20A5292D for ; Wed, 1 Jun 2005 17:11:42 -0300 (ADT) Received: from 99main.com (localhost [127.0.0.1]) by mail.99main.com (8.12.8+Sun/8.12.8) with ESMTP id j51KBhxl029760; Wed, 1 Jun 2005 16:11:43 -0400 (EDT) From: "Keith Worthington" To: Tom Lane Cc: "PostgreSQL Perform" Reply-To: KeithW@narrowpathinc.com Subject: Re: Moving pg_xlog Date: Wed, 1 Jun 2005 16:11:43 -0400 Message-Id: <20050601200610.M12354@narrowpathinc.com> In-Reply-To: <14825.1117642780@sss.pgh.pa.us> References: <20050601151618.M48325@narrowpathinc.com> <14825.1117642780@sss.pgh.pa.us> X-Mailer: Open WebMail 2.50 20050106 X-OriginatingIP: 68.235.22.242 (npkeithw) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 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: 200506/18 X-Sequence-Number: 12656 On Wed, 01 Jun 2005 12:19:40 -0400, Tom Lane wrote > "Keith Worthington" writes: > > I have been reading about increasing PostgreSQL performance > > by relocating the pg_xlog to a disk other than the one > > where the database resides. I have the following pg_xlogs > > on my system. > > > > /raid02/databases/pg_xlog > > /raid02/rhdb_databases/pg_xlog > > /raid02/databases-8.0.0/pg_xlog > > /var/lib/pgsql/data/pg_xlog > > > > I have no idea why the forth entry is there. It is in the PostgreSQL > > installation directory. > > It's there because the RPM sets up a database under /var/lib/pgsql/data. > > > 1) stop the postmaster > > 2) rm -rf /var/lib/pgsql/data/pg_xlog > > 3) mv /raid02/databases/pg_xlog /var/lib/pgsql/data/pg_xlog > > 4) ln -s /var/lib/pgsql/data/pg_xlog /raid02/databases/pg_xlog > > 5) start postmaster > > Put the xlog anywhere BUT there!!!!!!!!! > > > If I can do that and place the pg_xlog in the installation > > directory will I create any installation issues the next > > time I upgrade PostgreSQL? > > Oh, the installation will be just fine ... but your database will not > be after the upgrade wipes out your WAL. Put the xlog under some > non-system-defined directory. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings Thanks Tom. I am glad I asked before I leaped. 8-0 Is there a convention that most people follow. It would seem that anywhere in the installation directory is a bad idea. From what I have read on other threads it does not want to be in the database directory since in most cases that would put it on the same disk as the database. I am assuming due to lack of reaction that the symbolic link is not an issue. Is there a cleaner or more appropriate way of moving the pg_xlog. Finally, am I correct in assuming that as long as the postmaster is shut down moving the log is safe? Kind Regards, Keith From pgsql-performance-owner@postgresql.org Sun Jun 5 22:35: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 2BE3752800 for ; Wed, 1 Jun 2005 17:19:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11864-01 for ; Wed, 1 Jun 2005 20:19:19 +0000 (GMT) Received: from spieden.seattleserver.com (spieden.seattleserver.com [216.57.201.54]) by svr1.postgresql.org (Postfix) with ESMTP id 9F5A15292D for ; Wed, 1 Jun 2005 17:19:15 -0300 (ADT) Received: (qmail 29943 invoked from network); 1 Jun 2005 20:17:11 +0000 Received: from pool-71-113-2-184.sttlwa.dsl-w.verizon.net (HELO ?192.168.2.5?) (cshobe@seattleserver.com@71.113.2.184) by spieden.seattleserver.com with RC4-MD5 encrypted SMTP; 1 Jun 2005 20:17:11 +0000 From: Casey Allen Shobe Organization: SeattleServer.com, Inc. To: Postgresql Performance Subject: Performance nightmare with dspam (urgent) Date: Wed, 1 Jun 2005 20:19:13 +0000 User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506012019.13218.cshobe@seattleserver.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.481 tagged_above=0 required=5 tests=INFO_TLD X-Spam-Level: X-Archive-Number: 200506/101 X-Sequence-Number: 12738 We've seen PostgreSQL performance as a dspam database be simply stellar on some machines with absolutely no tuning to the postgres.conf, and no statistics target altering. Some months ago, I moved my domains from a crusty old generic PIII 733 to a brand new Athlon 3000+ server that I was leasing. The load was very high, and it was all PostgreSQL. I cried and screamed on #postgresql for hours, and eventually it was discovered that the following command fixed everything and suddenly performance was lightning fast again: alter table "dspam_token_data" alter "token" set statistics 200; analyze; We had set up about 200 domains on a SuperMicro P4 2.4GHz server, and it was working great too (without the above tweak!), but then the motherboard started having issues and the machine would lock up every few weeks. So we moved everything to a brand new SuperMicro P4 3.0GHz server last week, and now performance is simply appalling. Whereas before the load average was something around 0.02, it's now regularly at 4 (all postgres), and there's hundreds of messages in the queue waiting. Lots of people are complaining about slow mail delivery, and I've been up for 2 days trying to fix this with no success. Originally, the problem was a lot worse, but I spent a lot of time tuning the postgresql.conf, and changed the statistics target shown above, and this made things okay (by okay I mean that it's okay at night, but during the day several hundred messages will regularly be waiting for delivery). I found this response to my original post, and tried every single suggestion in it, which has not helped: http://archives.postgresql.org/pgsql-performance/2004-11/msg00416.php I'm sorry to come begging for help, but this is a MAJOR problem with no logical explanation, and is almost certainly the fault of PostgreSQL, because the database and contents have been identical across all the hosts, and some work beautifully with no tuning whatsoever; so I don't feel I'm wrong in placing blame... All machines run Gentoo Linux. All have the same package versions. Disk I/O doesn't seem to be related - the 733MHz server had a 33MB/s IDE drive, the 2.4GHz server had a RAID 5 with 3 ultra320 drives: neither of those required any tuning. The new 3.0GHz has a mirror raid with 2 ultra320 drives, and the 3000+ that tuning fixed had an ultra160 disk not in a RAID. I really like PostgreSQL, and really don't want to use MySQL for dspam, but if I can't get this worked out ASAP I'm going to have to change for the sake of our customers. Any help is GREATLY appreciated! I'm online on instant messengers (contact IDs shown below), monitoring my email, and will be on #postgresql on Freenode. Cheers, -- Casey Allen Shobe | http://casey.shobe.info cshobe@seattleserver.com | cell 425-443-4653 AIM & Yahoo: SomeLinuxGuy | ICQ: 1494523 SeattleServer.com, Inc. | http://www.seattleserver.com From pgsql-performance-owner@postgresql.org Wed Jun 1 17:31: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 699925287E for ; Wed, 1 Jun 2005 17:31:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16693-01 for ; Wed, 1 Jun 2005 20:30:54 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2D40A52843 for ; Wed, 1 Jun 2005 17:30:53 -0300 (ADT) 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 j51KUsco018211; Wed, 1 Jun 2005 16:30:54 -0400 (EDT) To: KeithW@narrowpathinc.com Cc: "PostgreSQL Perform" Subject: Re: Moving pg_xlog In-reply-to: <20050601200610.M12354@narrowpathinc.com> References: <20050601151618.M48325@narrowpathinc.com> <14825.1117642780@sss.pgh.pa.us> <20050601200610.M12354@narrowpathinc.com> Comments: In-reply-to "Keith Worthington" message dated "Wed, 01 Jun 2005 16:11:43 -0400" Date: Wed, 01 Jun 2005 16:30:54 -0400 Message-ID: <18210.1117657854@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: 200506/19 X-Sequence-Number: 12657 "Keith Worthington" writes: > On Wed, 01 Jun 2005 12:19:40 -0400, Tom Lane wrote >> Put the xlog anywhere BUT there!!!!!!!!! > Is there a convention that most people follow. It would seem that > anywhere in the installation directory is a bad idea. From what I > have read on other threads it does not want to be in the database > directory since in most cases that would put it on the same disk as > the database. I don't know of any fixed convention. The way I would be inclined to do it, given that I wanted the data on disk 1 (with mount point /disk1) and xlog on disk 2 (with mount point /disk2) is to create postgres-owned directories /disk1/postgres/ and /disk2/postgres/, and then within those put the data directory (thus, /disk1/postgres/data/) and xlog directory (/disk2/postgres/pg_xlog/). Having an extra level of postgres-owned directory is handy since it makes it easier to do database admin work without being root --- once you've created those two directories and chown'd them to postgres, everything else can be done as the postgres user. Now that I think about it, you were (if I understood your layout correctly) proposing to put the xlog on your system's root disk. This is probably a bad idea for performance, because there will always be other traffic to the root disk. What you are really trying to accomplish is to make sure the xlog is on a disk spindle that has no other traffic besides xlog, so that the disk heads never have to move off the current xlog file. The xlog traffic is 100% sequential writes and so you can cut the seeks involved to near nil if you can dedicate a spindle to it. > I am assuming due to lack of reaction that the symbolic link is not an issue. > Is there a cleaner or more appropriate way of moving the pg_xlog. No, that's exactly the way to do it. > Finally, am I correct in assuming that as long as the postmaster is shut down > moving the log is safe? Right. You can move the data directory too if you want. AFAIR the only position-dependent stuff in there is (if you are using tablespaces in 8.0) the tablespace symlinks under data/pg_tblspc/. You can fix those by hand if you have a need to move a tablespace. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 1 17:31: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 4F1575287E for ; Wed, 1 Jun 2005 17:31:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09610-10 for ; Wed, 1 Jun 2005 20:31:39 +0000 (GMT) Received: from mail.libertyrms.com (unknown [207.219.45.62]) by svr1.postgresql.org (Postfix) with ESMTP id BC92552802 for ; Wed, 1 Jun 2005 17:31:37 -0300 (ADT) Received: from dba5.int.libertyrms.com ([10.1.3.44]) by mail.libertyrms.com with esmtp (Exim 4.22) id 1DdZsI-0005wK-V5 for pgsql-performance@postgresql.org; Wed, 01 Jun 2005 16:31:38 -0400 Message-ID: <429E1B2A.1000605@ca.afilias.info> Date: Wed, 01 Jun 2005 16:31:38 -0400 From: Brad Nicholson User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Perform Subject: Re: Moving pg_xlog References: <20050601151618.M48325@narrowpathinc.com> <14825.1117642780@sss.pgh.pa.us> <20050601200610.M12354@narrowpathinc.com> In-Reply-To: <20050601200610.M12354@narrowpathinc.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Mail-From: bnichols@ca.afilias.info X-SA-Exim-Scanned: No; SAEximRunCond expanded to false X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/20 X-Sequence-Number: 12658 Keith Worthington wrote: >On Wed, 01 Jun 2005 12:19:40 -0400, Tom Lane wrote > > >>"Keith Worthington" writes: >> >> >>>I have been reading about increasing PostgreSQL performance >>>by relocating the pg_xlog to a disk other than the one >>>where the database resides. I have the following pg_xlogs >>>on my system. >>> >>>/raid02/databases/pg_xlog >>>/raid02/rhdb_databases/pg_xlog >>>/raid02/databases-8.0.0/pg_xlog >>>/var/lib/pgsql/data/pg_xlog >>> >>>I have no idea why the forth entry is there. It is in the PostgreSQL >>>installation directory. >>> >>> >>It's there because the RPM sets up a database under /var/lib/pgsql/data. >> >> >> >>>1) stop the postmaster >>>2) rm -rf /var/lib/pgsql/data/pg_xlog >>>3) mv /raid02/databases/pg_xlog /var/lib/pgsql/data/pg_xlog >>>4) ln -s /var/lib/pgsql/data/pg_xlog /raid02/databases/pg_xlog >>>5) start postmaster >>> >>> >>Put the xlog anywhere BUT there!!!!!!!!! >> >> >> >>>If I can do that and place the pg_xlog in the installation >>>directory will I create any installation issues the next >>>time I upgrade PostgreSQL? >>> >>> >>Oh, the installation will be just fine ... but your database will not >>be after the upgrade wipes out your WAL. Put the xlog under some >>non-system-defined directory. >> >> regards, tom lane >> >>---------------------------(end of broadcast)--------------------------- >>TIP 7: don't forget to increase your free space map settings >> >> > >Thanks Tom. I am glad I asked before I leaped. 8-0 > >Is there a convention that most people follow. It would seem that anywhere in >the installation directory is a bad idea. From what I have read on other >threads it does not want to be in the database directory since in most cases >that would put it on the same disk as the database. > > > We tend to use somthing that associates the WAL with the appropriate cluster, like /var/lib/CLUSTER for the data /var/lib/CLUSTER_WAL for WAL files. >I am assuming due to lack of reaction that the symbolic link is not an issue. > Is there a cleaner or more appropriate way of moving the pg_xlog. > > > A symbolic link is the standard way to do it. >Finally, am I correct in assuming that as long as the postmaster is shut down >moving the log is safe? > > You are correct. Moving the WAL files with the postmaster running would be a very bad thing. -- Brad Nicholson 416-673-4106 Database Administrator, Afilias Canada Corp. From pgsql-performance-owner@postgresql.org Wed Jun 1 18:27: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 7596C5287E for ; Wed, 1 Jun 2005 18:27:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29388-10 for ; Wed, 1 Jun 2005 21:27: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 7A9CF52876 for ; Wed, 1 Jun 2005 18:27:50 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j51LRo0X004243; (envelope-from ) Wed, 1 Jun 2005 16:27:50 -0500 (CDT) Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com [12.215.118.172]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j51LRmND017603 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Wed, 1 Jun 2005 16:27:49 -0500 (CDT) Message-ID: <429E2854.1050209@arbash-meinel.com> Date: Wed, 01 Jun 2005 16:27:48 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: KeithW@narrowpathinc.com, PostgreSQL Perform Subject: Re: Moving pg_xlog References: <20050601151618.M48325@narrowpathinc.com> <14825.1117642780@sss.pgh.pa.us> <20050601200610.M12354@narrowpathinc.com> <18210.1117657854@sss.pgh.pa.us> In-Reply-To: <18210.1117657854@sss.pgh.pa.us> X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig939E8471C3AFB202FA85FB09" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean 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: 200506/21 X-Sequence-Number: 12659 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig939E8471C3AFB202FA85FB09 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Tom Lane wrote: ... >Now that I think about it, you were (if I understood your layout >correctly) proposing to put the xlog on your system's root disk. >This is probably a bad idea for performance, because there will always >be other traffic to the root disk. What you are really trying to >accomplish is to make sure the xlog is on a disk spindle that has no >other traffic besides xlog, so that the disk heads never have to move >off the current xlog file. The xlog traffic is 100% sequential writes >and so you can cut the seeks involved to near nil if you can dedicate >a spindle to it. > > I certainly agree with what you wrote. But my understanding is that if you only have 2 arrays, then moving xlog onto the array not on the database is better than having it with the database. It isn't optimum, but it is better. Because that way there isn't as much contention between the database and xlog. John =:-> --------------enig939E8471C3AFB202FA85FB09 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCnihUJdeBCYSNAAMRAtHTAKCjq3chgZZR2lBkqFS822kqUs4gXQCgw9Ex eYSZCIqa5qr2MjHlu0pZBPA= =XzcO -----END PGP SIGNATURE----- --------------enig939E8471C3AFB202FA85FB09-- From pgsql-performance-owner@postgresql.org Wed Jun 1 23:05: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 85A4152820 for ; Wed, 1 Jun 2005 23:05:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12818-08 for ; Thu, 2 Jun 2005 02:05:36 +0000 (GMT) Received: from exobox.exoweb.net (unknown [221.122.43.98]) by svr1.postgresql.org (Postfix) with SMTP id DA0CE52819 for ; Wed, 1 Jun 2005 23:05:27 -0300 (ADT) Received: (qmail 14471 invoked from network); 2 Jun 2005 02:05:28 -0000 Received: from exo185.exoweb.net (HELO tobias.nordicbet.invalid) (192.168.0.185) by 0 with SMTP; 2 Jun 2005 02:05:28 -0000 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id 4C509E09C7; Thu, 2 Jun 2005 10:05:28 +0800 (CST) Date: Thu, 2 Jun 2005 10:05:28 +0800 From: Tobias Brox To: pgsql-performance@postgresql.org Subject: Forcing use of specific index Message-ID: <20050602020528.GL26100@tobias.exoweb.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Organization: Group Nordicbet 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: 200506/22 X-Sequence-Number: 12660 Is it any way to attempt to force the planner to use some specific index while creating the plan? Other than eventually dropping all the other indices (which is obiously not a solution in production setting anyway)? I have one case where I have added 16 indices to a table, many of them beeing partial indices. The table itself has only 50k of rows, but are frequently used in heavy joins. I imagine there can be exponential order on the number of alternative paths the planner must examinate as function of the number of indices? It seems to me that the planner is quite often not choosing the "best" index, so I wonder if there is any easy way for me to check out what the planner think about a specific index :-) -- Tobias Brox, Beijing From pgsql-performance-owner@postgresql.org Thu Jun 2 00:46: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 704CD5287A for ; Thu, 2 Jun 2005 00:42:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33303-10 for ; Thu, 2 Jun 2005 03:42:32 +0000 (GMT) Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) by svr1.postgresql.org (Postfix) with ESMTP id 7829152805 for ; Thu, 2 Jun 2005 00:42:28 -0300 (ADT) Received: from grownups (c-24-21-166-228.hsd1.or.comcast.net[24.21.166.228]) by comcast.net (sccrmhc11) with SMTP id <2005060203422601100mj5qne>; Thu, 2 Jun 2005 03:42:27 +0000 Message-ID: <002601c56725$2bdd2010$0200a8c0@grownups> From: "Stacy White" To: Subject: Adaptec/LSI/?? RAID Date: Wed, 1 Jun 2005 20:42:58 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.264 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200506/23 X-Sequence-Number: 12661 We're in the process of buying another Opteron server to run Postgres, and based on the suggestions in this list I've asked our IT director to get an LSI MegaRaid controller rather than one of the Adaptecs. But when we tried to place our order, our vendor (Penguin Computing) advised us: "we find LSI does not work well with 4GB of RAM. Our engineering find that LSI card could cause system crashes. One of our customer ... has found that Adaptec cards works well on PostGres SQL -- they're using it as a preforce server with xfs and post-gress." Any comments? Suggestions for other RAID controllers? From pgsql-performance-owner@postgresql.org Thu Jun 2 01:35: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 3380F52849 for ; Thu, 2 Jun 2005 01:34:07 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53139-03 for ; Thu, 2 Jun 2005 04:34:01 +0000 (GMT) Received: from smtp-gw-cl-d.dmv.com (smtp-gw-cl-d.dmv.com [216.240.97.42]) by svr1.postgresql.org (Postfix) with ESMTP id 0756A52875 for ; Thu, 2 Jun 2005 01:33:59 -0300 (ADT) Received: from mail-gw-cl-b.dmv.com (mail-gw-cl-b.dmv.com [216.240.97.39]) by smtp-gw-cl-d.dmv.com (8.12.10/8.12.10) with ESMTP id j524Xvm4060284; Thu, 2 Jun 2005 00:33:57 -0400 (EDT) (envelope-from sven@dmv.com) Received: from [64.45.134.154] (dogpound.dyndns.org [64.45.134.154]) by mail-gw-cl-b.dmv.com (8.12.9/8.12.9) with ESMTP id j524Xu2Q060798; Thu, 2 Jun 2005 00:33:57 -0400 (EDT) (envelope-from sven@dmv.com) Message-ID: <429E8CA7.7080805@dmv.com> Date: Thu, 02 Jun 2005 00:35:51 -0400 From: Sven Willenberger User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stacy White Cc: pgsql-performance@postgresql.org Subject: Re: Adaptec/LSI/?? RAID References: <002601c56725$2bdd2010$0200a8c0@grownups> In-Reply-To: <002601c56725$2bdd2010$0200a8c0@grownups> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.48 on 216.240.97.42 X-Scanned-By: MIMEDefang 2.48 on 216.240.97.39 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.331 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_WHOIS X-Spam-Level: X-Archive-Number: 200506/24 X-Sequence-Number: 12662 Stacy White presumably uttered the following on 06/01/05 23:42: > We're in the process of buying another Opteron server to run Postgres, and > based on the suggestions in this list I've asked our IT director to get an > LSI MegaRaid controller rather than one of the Adaptecs. > > But when we tried to place our order, our vendor (Penguin Computing) advised > us: > > "we find LSI does not work well with 4GB of RAM. Our engineering find that > LSI card could cause system crashes. One of our customer ... has found that > Adaptec cards works well on PostGres SQL -- they're using it as a preforce > server with xfs and post-gress." > > Any comments? Suggestions for other RAID controllers? > > > ---------------------------(end of broadcast)--------------------------- We use the LSI MegaRaid 320-2x with the battery-backed cache on a dual opteron system that uses 8G of RAM. OS is FreeBSD amd64 (5.4) and runs without hesitation. Database currently over 100GB and it performs admirably. So chalk one anecdotal item towards the LSI column. To be fair I have not tried an Adaptec card with this setup so I cannot comment positively or negatively on that card. As a side note, we did have issues with this setup with Linux (2.6 kernel - 64bit) and XFS file system (we generally use FreeBSD but I wanted to try other 64bit OSes before committing). Whether the linux issues were due to the LSI, memory, Tyan mobo, or something else was never determined -- FreeBSD ran it and did so without flinching so our choice was easy. HTH Sven From pgsql-performance-owner@postgresql.org Thu Jun 2 02:00: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 1DD9C528AE for ; Thu, 2 Jun 2005 02:00:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54349-09 for ; Thu, 2 Jun 2005 05:00:16 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6DB665286E for ; Thu, 2 Jun 2005 02:00:13 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id EE6EF30952; Thu, 2 Jun 2005 06:56:44 +0200 (MET DST) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Adaptec/LSI/?? RAID Date: Wed, 01 Jun 2005 22:00:09 -0700 Organization: Hub.Org Networking Services Lines: 32 Message-ID: References: <002601c56725$2bdd2010$0200a8c0@grownups> 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: <002601c56725$2bdd2010$0200a8c0@grownups> 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: 200506/25 X-Sequence-Number: 12663 I've used LSI MegaRAIDs successfully in the following systems with both Redhat 9 and FC3 64bit. Arima HDAMA/8GB RAM Tyan S2850/4GB RAM Tyan S2881/4GB RAM I've previously stayed away from Adaptec because we used to run Solaris x86 and the driver was somewhat buggy. For Linux and FreeBSD, I'd be less worried as open source development of drivers usually lead to better testing & bug-fixing. Stacy White wrote: > We're in the process of buying another Opteron server to run Postgres, and > based on the suggestions in this list I've asked our IT director to get an > LSI MegaRaid controller rather than one of the Adaptecs. > > But when we tried to place our order, our vendor (Penguin Computing) advised > us: > > "we find LSI does not work well with 4GB of RAM. Our engineering find that > LSI card could cause system crashes. One of our customer ... has found that > Adaptec cards works well on PostGres SQL -- they're using it as a preforce > server with xfs and post-gress." > > Any comments? Suggestions for other RAID controllers? > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > From pgsql-performance-owner@postgresql.org Thu Jun 2 03: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 AC0E65286E for ; Thu, 2 Jun 2005 03:06:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68949-10 for ; Thu, 2 Jun 2005 06:06: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 9AFCA52864 for ; Thu, 2 Jun 2005 03:06:33 -0300 (ADT) 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 j5266VpV010260; Thu, 2 Jun 2005 02:06:31 -0400 (EDT) To: John A Meinel Cc: KeithW@narrowpathinc.com, PostgreSQL Perform Subject: Re: Moving pg_xlog In-reply-to: <429E2854.1050209@arbash-meinel.com> References: <20050601151618.M48325@narrowpathinc.com> <14825.1117642780@sss.pgh.pa.us> <20050601200610.M12354@narrowpathinc.com> <18210.1117657854@sss.pgh.pa.us> <429E2854.1050209@arbash-meinel.com> Comments: In-reply-to John A Meinel message dated "Wed, 01 Jun 2005 16:27:48 -0500" Date: Thu, 02 Jun 2005 02:06:31 -0400 Message-ID: <10259.1117692391@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: 200506/26 X-Sequence-Number: 12664 John A Meinel writes: > Tom Lane wrote: >> Now that I think about it, you were (if I understood your layout >> correctly) proposing to put the xlog on your system's root disk. >> This is probably a bad idea for performance, ... > I certainly agree with what you wrote. But my understanding is that if > you only have 2 arrays, then moving xlog onto the array not on the > database is better than having it with the database. It isn't optimum, > but it is better. Because that way there isn't as much contention > between the database and xlog. If the machine isn't doing much else than running the database, then yeah, that may be the best available option. If there are other things going on then you have to think about how much competition there is for the root disk. But the impression I had from the OP's df listing is that he has several disks available ... so he ought to be able to find one that doesn't need to do anything except xlog. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 2 03:38: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 6074F52864 for ; Thu, 2 Jun 2005 03:38:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82277-04 for ; Thu, 2 Jun 2005 06:38:37 +0000 (GMT) Received: from p0f.net (p0f.net [193.77.154.190]) by svr1.postgresql.org (Postfix) with ESMTP id 8E6F852867 for ; Thu, 2 Jun 2005 03:38:35 -0300 (ADT) Received: from [10.10.105.30] ([193.77.165.58]) (authenticated bits=0) by p0f.net (8.13.3/8.13.3) with ESMTP id j526TY47015124 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Jun 2005 08:29:40 +0200 Message-ID: <429EA7E0.3070507@p0f.net> Date: Thu, 02 Jun 2005 08:32:00 +0200 From: Grega Bremec Organization: P0F User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Justin Davis Cc: pgsql-performance@postgresql.org Subject: Re: 'Fastest' PC's are slowest in the house References: <200505311701.j4VH1oFl055853@zod.pns.networktel.net> In-Reply-To: <200505311701.j4VH1oFl055853@zod.pns.networktel.net> X-Enigmail-Version: 0.91.0.0 Content-Type: text/plain; charset=windows-1250; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.339 tagged_above=0 required=5 tests=AWL, RCVD_IN_NJABL_DUL X-Spam-Level: * X-Archive-Number: 200506/27 X-Sequence-Number: 12665 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Justin Davis wrote: | I have five PC's accessing a PG database that is mounted on a | Dell Windows 2003 server. The PC's are accessing the database with a | Fujitsu cobol program via ODBC (all machines have same (newest) ODBC | driver from PG). 2 of the machines are the newest I have and both | pretty identically configured but are very slow by comparison to the | others. My colleagues and I are still in the exploration / decision | process, we have been working with and learning the database about 2 months. | | I'm looking to see if anyone knows of O/S or hardware issues right off | the bat or can recommend a debug method, log checking, etc. path we | might follow. | | The program in question reads the PG database and displays matching | query results on a cobol screen, for the point of this topic that is all | it is doing. We run the same query from each PC which returns 15 | records out of a 6,000 record customer DB. | | The machines: | | - 2 are 2.0 Ghz Dells with 512 Ram & XP SP2 - they take just over 2 minutes | - 1 AMD 2.4 with 256 Ram & XP SP2 - just under 2 secs. | - 1 AMD 900 Mhz with 256 Ram & XP SP 1 - just under 2 secs | - 1 Intel 266 Mhz with 256 Ram & Windows 2000 - 11-13 secs | Hello, Justin. While re-reading your post, I was (still) under the impression that those machines are all client machines and that there is only one database they are all accessing. Is my impression true? If so, then I'm afraid there must be some other issue you've been hitting, because from the viewpoint of a postmaster, it is completely irrelevant who the client is. Unless so, can you please provide some evidence that the issue at hand really has to do with the PostgreSQL query shipping to those Dells (profiling, for example), so we have something to work from? My assertion though is that there's either an issue in the ODBC layer, or the COBOL program you're running (be it your code or the runtime). While at it, and completely unrelated, I'm not sure that, both from the performance and reliability viewpoint, running production PostgreSQL on a Windows machine may be the best possible decision. If you have the luxury of experimenting, and unless your side-goal is to run-proof the Windows version of PostgreSQL, I'd suggest you try a couple of alternatives, such as Linux, BSD or even Solaris, whichever you feel will offer you better future support. If you choose to run it on Windows afterall, I'd kindly advise you to do your best to stay on the safe side of the story with a double-checked backup strategy, solely because the Windows version of PostgreSQL is a new product and not widely used in production environments, so there is not much expertise yet in the specifics of keeping it performant, stable and most of all, how to tackle things after the worst has happened. Kind regards, - -- Grega Bremec gregab at p0f dot net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFCnqfgfu4IwuB3+XoRApSRAJ0aJYEIEnJZlw2TeLtSO/1+qmoLHACbBAjS LahS3A/YMgVthkvnQ3AJcXg= =Cl6f -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Thu Jun 2 04:02: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 2433D52874 for ; Thu, 2 Jun 2005 04:02:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87619-03 for ; Thu, 2 Jun 2005 07:02:12 +0000 (GMT) Received: from web51005.mail.yahoo.com (web51005.mail.yahoo.com [206.190.38.136]) by svr1.postgresql.org (Postfix) with SMTP id 94DE852869 for ; Thu, 2 Jun 2005 04:02:10 -0300 (ADT) Received: (qmail 96755 invoked by uid 60001); 2 Jun 2005 07:02:09 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=dhB3Z+mGbLTZcmi2Zqr6OYizrYy+K1u1TjovQaZwgv3+Z9pP9dQtliXTjwkp51m+h0ts08UpomyUmOdSWoQTbV+qXCO9l5ZIAhVVxzFU+UyUo4zqMgQ5Klne1DxyUjhoXeZAY3Z0YdfmK8D+71ydUmFiLUn56UQJLcuB0KfyBLg= ; Message-ID: <20050602070209.96753.qmail@web51005.mail.yahoo.com> Received: from [203.101.103.131] by web51005.mail.yahoo.com via HTTP; Thu, 02 Jun 2005 00:02:09 PDT Date: Thu, 2 Jun 2005 00:02:09 -0700 (PDT) From: Himanshu Baweja Subject: Re: Moving pg_xlog To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1003934382-1117695729=:94860" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.4 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, HTML_10_20, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200506/28 X-Sequence-Number: 12666 --0-1003934382-1117695729=:94860 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit My database has two scsi disks.... my current configuration has pg_xlog on disk1 and data on disk2.... the machine is used for database only.... now did some logging and came to a conclusion that my disk2(data disk) is getting used around 3 times more than disk1(pg_xlog).... so wht is recommended... move some of the data to disk1 so that both disks are equally used... by creating tablespaces or let my configuration be whts its currently... iowait is one of the bottlenecks in my application performance..... thx Himanshu __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --0-1003934382-1117695729=:94860 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
My database has two scsi disks....
my current configuration has pg_xlog on disk1 and data on disk2....
the machine is used for database only....
now did some logging and came to a conclusion that my disk2(data disk) is getting used around 3 times more than disk1(pg_xlog)....
 
so wht is recommended... move some of the data to disk1 so that both disks are equally used... by creating tablespaces or let my configuration be whts its currently... iowait is one of the bottlenecks in my application performance.....
 
thx
Himanshu

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com --0-1003934382-1117695729=:94860-- From pgsql-performance-owner@postgresql.org Thu Jun 2 04:28: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 C41A052855 for ; Thu, 2 Jun 2005 04:28:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92013-10 for ; Thu, 2 Jun 2005 07:28:05 +0000 (GMT) Received: from ns1.bi.lt (ns.bi.lt [213.226.131.131]) by svr1.postgresql.org (Postfix) with ESMTP id 2F52C52869 for ; Thu, 2 Jun 2005 04:28:03 -0300 (ADT) Received: from B027543 (inet.bee.lt [213.226.131.30]) by ns1.bi.lt (8.12.11/8.12.11) with SMTP id j527S4aq023984; Thu, 2 Jun 2005 10:28:04 +0300 Message-ID: <018601c56744$9d5aae50$f20214ac@bite.lt> From: "Mindaugas Riauba" To: "Tom Lane" Cc: References: <00d501c5667d$8cc12320$f20214ac@bite.lt> <13878.1117636799@sss.pgh.pa.us> Subject: Re: How to avoid database bloat Date: Thu, 2 Jun 2005 10:28:03 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1257" Content-Transfer-Encoding: 7bit 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.148 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/29 X-Sequence-Number: 12667 > > Our database increases in size 2.5 times during the day. > > What to do to avoid this? Autovacuum running with quite > > aggressive settings, FSM settings are high enough. > > First thing I'd suggest is to get a more detailed idea of exactly > what is bloating --- which tables/indexes are the problem? I think the most problematic table is this one. After vacuum full/reindex it was 20MB in size now (after 6 hours) it is already 70MB and counting. vacuum verbose output below. msg_id is integer, next_retry - timestamp, recipient - varchar(20). max_fsm_pages = 200000. Another table has foregn key which referenced msg_id in this one. Thanks, Mindaugas $ vacuumdb -v -z -U postgres -t queue database INFO: vacuuming "queue" INFO: index "queue_msg_id_pk" now contains 110531 row versions in 5304 pages DETAIL: 31454 index row versions were removed. 95 index pages have been deleted, 63 are currently reusable. CPU 0.03s/0.07u sec elapsed 2.50 sec. INFO: index "queue_next_retry" now contains 110743 row versions in 3551 pages DETAIL: 31454 index row versions were removed. 1163 index pages have been deleted, 560 are currently reusable. CPU 0.04s/0.06u sec elapsed 4.93 sec. INFO: index "queue_recipient_idx" now contains 111596 row versions in 1802 pages DETAIL: 31454 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.05u sec elapsed 0.16 sec. INFO: "queue": removed 31454 row versions in 1832 pages DETAIL: CPU 0.00s/0.01u sec elapsed 0.27 sec. INFO: "queue": found 31454 removable, 110096 nonremovable row versions in 9133 pages DETAIL: 119 dead row versions cannot be removed yet. There were 258407 unused item pointers. 0 pages are entirely empty. CPU 0.12s/0.25u sec elapsed 8.20 sec. INFO: analyzing "queue" INFO: "queue": scanned 3000 of 9133 pages, containing 34585 live rows and 1808 dead rows; 3000 rows in sample, 105288 estimated total rows VACUUM From pgsql-performance-owner@postgresql.org Thu Jun 2 05:28: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 572445286E for ; Thu, 2 Jun 2005 05:28:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07964-05 for ; Thu, 2 Jun 2005 08:28:06 +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 93C1252867 for ; Thu, 2 Jun 2005 05:28:04 -0300 (ADT) Received: from [192.168.2.12] (port-83-236-156-26.static.qsc.de [83.236.156.26]) by mail2.aeccom.com (Postfix) with ESMTP id 86586484 for ; Thu, 2 Jun 2005 10:28:03 +0200 (CEST) Message-ID: <429EC313.4090103@aeccom.com> Date: Thu, 02 Jun 2005 10:28:03 +0200 From: =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= Organization: AEC/communications GmbH User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: SURVEY: who is running postgresql on 8 or more CPUs? References: <429C63B5.4060403@aeccom.com> In-Reply-To: <429C63B5.4060403@aeccom.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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/30 X-Sequence-Number: 12668 Hi, I just got one reply for this survey. Is almost nobody using postgresql on 8+ machines? Regards, Dirk Dirk Lutzeb�ck wrote: > Hi, > > I would like to start a little survey who is running postgresql on an > 8way or more machine (Intel, Sparc, AMD no matter). Purpose: find out > how postgresql runs in high performance areas. > > Please fillout: > > Machine (Vendor, Product): > Architecture (Intel/Sparc/AMD/IBM): > Processors (Type/Number/GHz): > RAM: > Operating System: > PostgreSQL Version: > Database size (GB): > Disk system: > Type of application: > Your email contact: > Willing to answer questions in this group: > Comments: > > > Please answer here or to me. I compile the results and feed them back > here. > > Regards, > > Dirk > > > ---------------------------(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 -- Dirk Lutzeb�ck Tel +49.30.5362.1635 Fax .1638 CTO AEC/communications GmbH, Berlin, Germany, http://www.aeccom.com From pgsql-performance-owner@postgresql.org Thu Jun 2 06:16: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 5CC3652800 for ; Thu, 2 Jun 2005 06:16:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20872-02 for ; Thu, 2 Jun 2005 09:15:47 +0000 (GMT) Received: from mail1.catalyst.net.nz (godel.catalyst.net.nz [202.49.159.12]) by svr1.postgresql.org (Postfix) with ESMTP id AEB1852840 for ; Thu, 2 Jun 2005 06:15:45 -0300 (ADT) Received: from 210-86-100-240.jetstream.xtra.co.nz ([210.86.100.240] helo=lamb.mcmillan.net.nz) by mail1.catalyst.net.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1Ddlnl-0007Il-Mn; Thu, 02 Jun 2005 21:15:46 +1200 Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) by lamb.mcmillan.net.nz (Postfix) with ESMTP id 327FAAD98581; Thu, 2 Jun 2005 21:15:14 +1200 (NZST) Subject: Re: Adaptec/LSI/?? RAID From: Andrew McMillan To: Stacy White Cc: pgsql-performance@postgresql.org In-Reply-To: <002601c56725$2bdd2010$0200a8c0@grownups> References: <002601c56725$2bdd2010$0200a8c0@grownups> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-Yut3X9GXCEv7ESR/1/zR" Date: Thu, 02 Jun 2005 21:15:13 +1200 Message-Id: <1117703713.10586.6.camel@lamb.mcmillan.net.nz> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 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: 200506/31 X-Sequence-Number: 12669 --=-Yut3X9GXCEv7ESR/1/zR Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2005-06-01 at 20:42 -0700, Stacy White wrote: > We're in the process of buying another Opteron server to run Postgres, an= d > based on the suggestions in this list I've asked our IT director to get a= n > LSI MegaRaid controller rather than one of the Adaptecs. >=20 > But when we tried to place our order, our vendor (Penguin Computing) advi= sed > us: >=20 > "we find LSI does not work well with 4GB of RAM. Our engineering find tha= t > LSI card could cause system crashes. One of our customer ... has found th= at > Adaptec cards works well on PostGres SQL -- they're using it as a preforc= e > server with xfs and post-gress." >=20 > Any comments? Suggestions for other RAID controllers? Hi, We're using the Megaraid (Intel branded model) on a dual Opteron system with 8G RAM very happily. The motherboard is a RioWorks one, the OS is Debian "Sarge" AMD64 with kernel 2.6.11.8 and PostgreSQL 7.4.7. Cheers, Andrew. ------------------------------------------------------------------------- Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 ------------------------------------------------------------------------- --=-Yut3X9GXCEv7ESR/1/zR Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBCns4hjJA0f48GgBIRAn4EAJ91/YrBTtlcb/u/AstqWLuUvZv+ugCffghU 5MeATt+FNiC+J1+ivmvRKoc= =bAZo -----END PGP SIGNATURE----- --=-Yut3X9GXCEv7ESR/1/zR-- From pgsql-bugs-owner@postgresql.org Thu Jun 2 09:39:47 2005 X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 95C705288E for ; Thu, 2 Jun 2005 08:08:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50909-05 for ; Thu, 2 Jun 2005 11:08:31 +0000 (GMT) Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id ACDF952874 for ; Thu, 2 Jun 2005 08:08:31 -0300 (ADT) Received: by svr2.postgresql.org (Postfix, from userid 80) id 59D47F0B00; Thu, 2 Jun 2005 12:05:00 +0100 (BST) To: pgsql-bugs@postgresql.org Subject: BUG #1697: Select getting slower on continously updating data From: "Bahadur Singh" Message-Id: <20050602110500.59D47F0B00@svr2.postgresql.org> Date: Thu, 2 Jun 2005 12:05:00 +0100 (BST) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.174 tagged_above=0 required=5 tests=FORGED_YAHOO_RCVD X-Spam-Level: ** X-Archive-Number: 200506/14 X-Sequence-Number: 11973 The following bug has been logged online: Bug reference: 1697 Logged by: Bahadur Singh Email address: bahadursingh@yahoo.com PostgreSQL version: 8.0 Operating system: Windows 2000 server Description: Select getting slower on continously updating data Details: Hello, I found situtation that, when I am selecting data from a table of 200 records, getting slower as I do continous update to the same existing data. CREATE TABLE salesarticle ( articlenumber char(20) NOT NULL, price int4 NOT NULL, eodid int4 NOT NULL, departmentnumber char(4) NOT NULL, keycounter int4 NOT NULL, scancounter int4 NOT NULL, grosssalescounter int8 NOT NULL, grosssalesamount int8 NOT NULL, discountcounter int8 NOT NULL, discountamount int8 NOT NULL, reductioncounter int8 NOT NULL, reductionamount int8 NOT NULL, transactioncounter int4 NOT NULL, promotionamount int8 NOT NULL, promotioncounter int8 NOT NULL, datelastsale char(14) NOT NULL, CONSTRAINT salesarticle_pkey PRIMARY KEY (articlenumber, price, eodid), CONSTRAINT salesarticle_eodid_fkey FOREIGN KEY (eodid) REFERENCES eodinfo (eodid) ON UPDATE NO ACTION ON DELETE NO ACTION ) WITH OIDS; This is my select statement: EXPLAIN ANALYZE SELECT ArticleNumber, Price, EodId FROM SalesArticle WHERE ArticleNumber IN (' 9502', ' 9500',' 9501',' 9505',' 9506',' 9507',' 9515', ' 9516',' 9518',' 9520',' 9472',' 9508',' 9546', ' 3322',' 9521' ) AND EodId = 12 "Index Scan using salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticle_pkey, salesarticl (..)" " Index Cond: ((articlenumber = ' 9502'::bpchar) OR (articlenumber = ' 9500'::bpchar) OR (articlenumber = ' 9501'::bpchar) OR (articlenumber = ' 9505'::bpchar) OR (articlenumber = ' (..)" " Filter: (eodid = 12)" "Total runtime: 47.000 ms" The first iteration(400 times selects and update that selected data ) say 400 are within 2 sec, then it keep on increasing at the end, it take 9 seconds to execute 100 selects and updates on the database. No new records are added during this operation. perfromace of above select degrade as follows = 16 ms ==> yealds 1600 ms for 100 iteration. = 32 ms ==> yealds 3200 ms for 100 it... = 47 ms ==> yealds 4700 ms for 100 it... = 80 ms ==> yealds 80000 ms for 100 it... = 104 ms ==> yealds 10400 ms for 100 it... when I create an index on PK of this table, it boosts select performance to 16 ms, but update stmts are slowing down. I do insert only once in begining and then update them continously as long I recieve same input data. (means no insert take place in between on this salesArticle table.) Please advice me some solution or any trick. Thanks in Advance, Bahadur From pgsql-performance-owner@postgresql.org Thu Jun 2 08:53: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 E59B852819 for ; Thu, 2 Jun 2005 08:53:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69170-01 for ; Thu, 2 Jun 2005 11:53:07 +0000 (GMT) Received: from krusty-motorsports.com (krusty-motorsports.com [192.94.170.8]) by svr1.postgresql.org (Postfix) with ESMTP id CC5CE52816 for ; Thu, 2 Jun 2005 08:53:05 -0300 (ADT) Received: from [24.194.112.77] (helo=skipper.averillpark.net) by krusty-motorsports.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.43) id 1DdoG3-0005J4-HY for pgsql-performance@postgresql.org; Thu, 02 Jun 2005 11:53:07 +0000 Received: from [127.0.0.1] (helo=localhost) by skipper.averillpark.net with esmtp (Exim 4.22) id 1DdoDP-0003eM-9X for pgsql-performance@postgresql.org; Thu, 02 Jun 2005 07:50:23 -0400 Date: Thu, 2 Jun 2005 07:50:22 -0400 (EDT) From: Richard Welty Subject: Re: Adaptec/LSI/?? RAID To: pgsql-performance@postgresql.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Disposition: INLINE References: <002601c56725$2bdd2010$0200a8c0@grownups> In-Reply-To: Organization: Averill Park Networking X-Mailer: Mahogany 0.66.0 'Clio', compiled for Linux 2.4.22-1.2194.nptl i686 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/32 X-Sequence-Number: 12670 On Wed, 01 Jun 2005 22:00:09 -0700 William Yu wrote: > I've previously stayed away from Adaptec because we used to run Solaris > x86 and the driver was somewhat buggy. For Linux and FreeBSD, I'd be > less worried as open source development of drivers usually lead to > better testing & bug-fixing. Adaptec is in the doghouse in some corners of the community because they have behaved badly about releasing documentation on some of their current RAID controllers to *BSD developers. FreeBSD has a not-quite-free driver for those latest Adaptecs. OpenBSD wants nothing to do with them. richard -- Richard Welty rwelty@averillpark.net Averill Park Networking Java, PHP, PostgreSQL, Unix, Linux, IP Network Engineering, Security "Well, if you're not going to expect unexpected flames, what's the point of going anywhere?" -- Truckle the Uncivil From pgsql-performance-owner@postgresql.org Thu Jun 2 09:12: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 8AE2D52824 for ; Thu, 2 Jun 2005 09:12:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72983-07 for ; Thu, 2 Jun 2005 12:11:59 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.202]) by svr1.postgresql.org (Postfix) with ESMTP id 9A659528BB for ; Thu, 2 Jun 2005 09:11:58 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id 12so323241nzp for ; Thu, 02 Jun 2005 05:12:02 -0700 (PDT) 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:content-disposition:references; b=q3mCTxZG+cyk3Lp9MeoBaVavbz4kPuN9bOBN9hHZQOY0NucR5fSEVRW1Sb2SpHVq1X9iw07h6U/wH/1xVnXp8OY8KNbtfMRv+M6lzV2e7mfPeEJGL1PziBQVi5rXci17nAy9LYz+5Xx7FxrQzi5zIzRib26Fdk6MwxtsUmg2530= Received: by 10.36.222.64 with SMTP id u64mr506670nzg; Thu, 02 Jun 2005 05:12:01 -0700 (PDT) Received: by 10.36.22.20 with HTTP; Thu, 2 Jun 2005 05:12:01 -0700 (PDT) Message-ID: <758d5e7f05060205126fa33140@mail.gmail.com> Date: Thu, 2 Jun 2005 14:12:01 +0200 From: Dawid Kuroczko Reply-To: Dawid Kuroczko To: =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= Subject: Re: SURVEY: who is running postgresql on 8 or more CPUs? Cc: pgsql-performance@postgresql.org In-Reply-To: <429EC313.4090103@aeccom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <429C63B5.4060403@aeccom.com> <429EC313.4090103@aeccom.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.82 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/33 X-Sequence-Number: 12671 On 6/2/05, Dirk Lutzeb=E4ck wrote: > I just got one reply for this survey. Is almost nobody using postgresql > on 8+ machines? My guess is when someone is using PostgreSQL on 8+ machine, she's in highly competitive (or sensitive) market and either cannot give company's work details to everyone or simply doesn't want to. Probably if you asked 'I am thinking about buying 8-way Opteron box, does PostgreSQL have problems with such hardware' you would get a response. But surveys are awfully close to statistics and many people simply doesn't like them. (They say that 46.7% of statisticts are just made up ;-)). Regards, Dawid From pgsql-performance-owner@postgresql.org Thu Jun 2 09:28: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 543E752862 for ; Thu, 2 Jun 2005 09:28:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83396-08 for ; Thu, 2 Jun 2005 12:28:11 +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 3FCC752892 for ; Thu, 2 Jun 2005 09:28:09 -0300 (ADT) Received: from [192.168.2.12] (port-83-236-156-26.static.qsc.de [83.236.156.26]) by mail2.aeccom.com (Postfix) with ESMTP id 40E6D484; Thu, 2 Jun 2005 14:28:13 +0200 (CEST) Message-ID: <429EFB5C.8070704@aeccom.com> Date: Thu, 02 Jun 2005 14:28:12 +0200 From: =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= Organization: AEC/communications GmbH User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dawid Kuroczko Cc: pgsql-performance@postgresql.org Subject: Re: SURVEY: who is running postgresql on 8 or more CPUs? References: <429C63B5.4060403@aeccom.com> <429EC313.4090103@aeccom.com> <758d5e7f05060205126fa33140@mail.gmail.com> In-Reply-To: <758d5e7f05060205126fa33140@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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/34 X-Sequence-Number: 12672 Hi Dawid, postgresql is open source and we also want it to be used in high performance areas. What's wrong with people telling on which machines they use it? I don't care about business details but techinal details would be quite interesting. In the end it is interesting to know how you need to tune postgresql on high end machines and how well they perform on the different highend platforms. This is meant to be more a field study and not a benchmark. We know that Opteron performs well but what are people actually using in high performance areas? Does postgresql run on an E10000? Who did it? Regards, Dirk Dawid Kuroczko wrote: >On 6/2/05, Dirk Lutzeb�ck wrote: > > >>I just got one reply for this survey. Is almost nobody using postgresql >>on 8+ machines? >> >> > >My guess is when someone is using PostgreSQL on 8+ machine, she's >in highly competitive (or sensitive) market and either cannot give >company's work details to everyone or simply doesn't want to. > >Probably if you asked 'I am thinking about buying 8-way Opteron >box, does PostgreSQL have problems with such hardware' you >would get a response. > >But surveys are awfully close to statistics and many people simply >doesn't like them. (They say that 46.7% of statisticts are just made >up ;-)). > > Regards, > Dawid > > -- Dirk Lutzeb�ck Tel +49.30.5362.1635 Fax .1638 CTO AEC/communications GmbH, Berlin, Germany, http://www.aeccom.com From pgsql-performance-owner@postgresql.org Thu Jun 2 09:51: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 D2BDF52824 for ; Thu, 2 Jun 2005 09:50:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89655-07 for ; Thu, 2 Jun 2005 12:50:50 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id 9F9CB52862 for ; Thu, 2 Jun 2005 09:50:48 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j52Cok0A024818; Thu, 2 Jun 2005 14:50:46 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j52CojW7024779; Thu, 2 Jun 2005 14:50:45 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Thu, 02 Jun 2005 14:50:42 +0200 (CEST) Date: Thu, 2 Jun 2005 14:50:00 +0200 From: "Martin Fandel" To: "Steinar H. Gunderson" Cc: Postgresql Performance list Message-ID: <1117716600.4380.13.camel@fandelm.ecommit.de> In-Reply-To: <20050601095754.GA24585@uio.no> References: <1117201312.7060.6.camel@fandelm.ecommit.de> References: <429D47FD.7090501@streppone.it> References: <20050601095754.GA24585@uio.no> Subject: Re: postgresql-8.0.1 performance tuning x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline 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: 200506/35 X-Sequence-Number: 12673 Hi, hmmm i don't understand which are the best values for shmmax and shmall. I've googled around but every site says something different. I've 2GB of RAM now and set it to: kernel.shmmax=715827882 kernel.shmall=2097152 Is that value ok for 2GB of RAM? I've set the shared_buffers in my postgresql.conf to 87381 (87381*8*1024 = ~715827882). Can I use www.powerpostgresql.com as reference to set this parameters? Or which site can i use? Best regards, Martin Am Mittwoch, den 01.06.2005, 11:57 +0200 schrieb Steinar H. Gunderson: > On Wed, Jun 01, 2005 at 07:30:37AM +0200, Cosimo Streppone wrote: > >>fsync = true > > false > > Just setting fsync=false without considering the implications is a _bad_ > idea... > > /* Steinar */ Am Mittwoch, den 01.06.2005, 11:57 +0200 schrieb Steinar H. Gunderson: > On Wed, Jun 01, 2005 at 07:30:37AM +0200, Cosimo Streppone wrote: > >>fsync = true > > false > > Just setting fsync=false without considering the implications is a _bad_ > idea... > > /* Steinar */ From pgsql-bugs-owner@postgresql.org Thu Jun 2 10:04:05 2005 X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1E25B52824 for ; Thu, 2 Jun 2005 10:04:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94683-02 for ; Thu, 2 Jun 2005 13:03:54 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id AB9CA52872 for ; Thu, 2 Jun 2005 10:03:53 -0300 (ADT) Received: (qmail 11094 invoked by uid 500); 2 Jun 2005 13:02:59 -0000 Date: Thu, 2 Jun 2005 08:02:59 -0500 From: Bruno Wolff III To: Bahadur Singh Cc: pgsql-bugs@postgresql.org, pgsql-novice@postgresql.org Subject: Re: BUG #1697: Select getting slower on continously updating data Message-ID: <20050602130259.GB9716@wolff.to> Mail-Followup-To: pgsql-novice@postgresql.org, Bahadur Singh , Bruno Wolff III References: <20050602110500.59D47F0B00@svr2.postgresql.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050602110500.59D47F0B00@svr2.postgresql.org> 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: 200506/15 X-Sequence-Number: 11974 This does not belong on the pgsql-bugs list. The pgsql-novice or pgsql-performance lists seem more appropiate. I have set followups to the pgsql-novice list. On Thu, Jun 02, 2005 at 12:05:00 +0100, Bahadur Singh wrote: > > Hello, > > I found situtation that, when I am selecting data from a table of 200 > records, getting slower as I do continous update to the same existing data. You need to be vacuuming (and possibly analyzing) the table more often as the updates will leave dead rows in the table which will bloat the table size and slow down access, particularly sequential scans. If the updates modify the data value distributions significantly, then you will also need to reanalyze the table to help the planner make good decisions. From pgsql-performance-owner@postgresql.org Thu Jun 2 10:10: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 0662752825 for ; Thu, 2 Jun 2005 10:10:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96064-05 for ; Thu, 2 Jun 2005 13:10:45 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id 9F45352824 for ; Thu, 2 Jun 2005 10:10:43 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j52DAl0A028677 for ; Thu, 2 Jun 2005 15:10:47 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j52DAlvA028676 for ; Thu, 2 Jun 2005 15:10:47 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Thu, 02 Jun 2005 15:10:45 +0200 (CEST) Date: Thu, 2 Jun 2005 15:10:03 +0200 From: "Martin Fandel" To: "Martin Fandel" Cc: Postgresql Performance list Message-ID: <1117717803.4380.23.camel@fandelm.ecommit.de> In-Reply-To: <1117716600.4380.13.camel@fandelm.ecommit.de> References: <1117201312.7060.6.camel@fandelm.ecommit.de> References: <1117716600.4380.13.camel@fandelm.ecommit.de> Subject: Re: postgresql-8.0.1 performance tuning x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.064 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/36 X-Sequence-Number: 12674 Ups, i'm sorry. i've set the following values: postgresql.conf: shared_buffers = 70000 effective_cache_size = 1744762 work_mem = 32768 maintenance_work_mem = 262144 max_fsm_pages = 200000 sysctl.conf: vm.swappiness=10 kernel.shmmax=715827882 kernel.shmall=2097152 Are the values ok for a 2 GB machine? I'm testing these settings with contrib/pgbench. With this configuration i become up to 200tps including connection establishing. Is that value ok for this hardware?: 1xP4 3Ghz (hyperthreading enabled) 2GB 266 Mhz RAM CL2.5 pg_xlog is on sda (raid1 with two 10k discs) and the database on sdb(raid10 with four 10k discs). My Linux distribution is Suse Linux 9.3 with postgresql 8.0.1. best regards, Martin Am Donnerstag, den 02.06.2005, 14:50 +0200 schrieb Martin Fandel: > Hi, > > hmmm i don't understand which are the best values for shmmax and shmall. > I've googled around but every site says something different. > > I've 2GB of RAM now and set it to: > > kernel.shmmax=715827882 > kernel.shmall=2097152 > > Is that value ok for 2GB of RAM? > > I've set the shared_buffers in my postgresql.conf to 87381 > (87381*8*1024 = ~715827882). > > Can I use www.powerpostgresql.com as reference to set this > parameters? Or which site can i use? > > Best regards, > Martin > > Am Mittwoch, den 01.06.2005, 11:57 +0200 schrieb Steinar H. Gunderson: > > On Wed, Jun 01, 2005 at 07:30:37AM +0200, Cosimo Streppone wrote: > > >>fsync = true > > > false > > > > Just setting fsync=false without considering the implications is a > _bad_ > > idea... > > > > /* Steinar */ > > > Am Mittwoch, den 01.06.2005, 11:57 +0200 schrieb Steinar H. Gunderson: > > On Wed, Jun 01, 2005 at 07:30:37AM +0200, Cosimo Streppone wrote: > > >>fsync = true > > > false > > > > Just setting fsync=false without considering the implications is a _bad_ > > idea... > > > > /* Steinar */ > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Thu Jun 2 10:13: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 84C6752862 for ; Thu, 2 Jun 2005 10:13:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94290-07 for ; Thu, 2 Jun 2005 13:12:51 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id 2544752825 for ; Thu, 2 Jun 2005 10:12:50 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j52DCs0A029191 for ; Thu, 2 Jun 2005 15:12:54 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j52DCsAa029190 for ; Thu, 2 Jun 2005 15:12:54 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Thu, 02 Jun 2005 15:12:53 +0200 (CEST) Date: Thu, 2 Jun 2005 15:12:10 +0200 From: "Martin Fandel" To: "Martin Fandel" Cc: Postgresql Performance list Message-ID: <1117717930.4380.25.camel@fandelm.ecommit.de> In-Reply-To: <1117717803.4380.23.camel@fandelm.ecommit.de> References: <1117201312.7060.6.camel@fandelm.ecommit.de> References: <1117716600.4380.13.camel@fandelm.ecommit.de> References: <1117717803.4380.23.camel@fandelm.ecommit.de> Subject: Re: postgresql-8.0.1 performance tuning x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/37 X-Sequence-Number: 12675 I've forgotten the settings for the pgbench-tests. I use 150 clients with 5 transactions each. Am Donnerstag, den 02.06.2005, 15:10 +0200 schrieb Martin Fandel: > Ups, > i'm sorry. i've set the following values: > > postgresql.conf: > shared_buffers = 70000 > effective_cache_size = 1744762 > work_mem = 32768 > maintenance_work_mem = 262144 > max_fsm_pages = 200000 > > sysctl.conf: > vm.swappiness=10 > kernel.shmmax=715827882 > kernel.shmall=2097152 > > Are the values ok for a 2 GB machine? I'm testing these settings > with contrib/pgbench. With this configuration i become up to 200tps > including connection establishing. Is that value ok for this hardware?: > > 1xP4 3Ghz (hyperthreading enabled) > 2GB 266 Mhz RAM CL2.5 > > pg_xlog is on sda (raid1 with two 10k discs) and the database on > sdb(raid10 with four 10k discs). > > My Linux distribution is Suse Linux 9.3 with postgresql 8.0.1. > > best regards, > Martin > > Am Donnerstag, den 02.06.2005, 14:50 +0200 schrieb Martin Fandel: > > Hi, > > > > hmmm i don't understand which are the best values for shmmax and shmall. > > I've googled around but every site says something different. > > > > I've 2GB of RAM now and set it to: > > > > kernel.shmmax=715827882 > > kernel.shmall=2097152 > > > > Is that value ok for 2GB of RAM? > > > > I've set the shared_buffers in my postgresql.conf to 87381 > > (87381*8*1024 = ~715827882). > > > > Can I use www.powerpostgresql.com as reference to set this > > parameters? Or which site can i use? > > > > Best regards, > > Martin > > > > Am Mittwoch, den 01.06.2005, 11:57 +0200 schrieb Steinar H. Gunderson: > > > On Wed, Jun 01, 2005 at 07:30:37AM +0200, Cosimo Streppone wrote: > > > >>fsync = true > > > > false > > > > > > Just setting fsync=false without considering the implications is a > > _bad_ > > > idea... > > > > > > /* Steinar */ > > > > > > Am Mittwoch, den 01.06.2005, 11:57 +0200 schrieb Steinar H. Gunderson: > > > On Wed, Jun 01, 2005 at 07:30:37AM +0200, Cosimo Streppone wrote: > > > >>fsync = true > > > > false > > > > > > Just setting fsync=false without considering the implications is a _bad_ > > > idea... > > > > > > /* Steinar */ > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Thu Jun 2 10:45: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 B07FB5281C for ; Thu, 2 Jun 2005 10:45:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04920-06 for ; Thu, 2 Jun 2005 13:45: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 5CB4A52875 for ; Thu, 2 Jun 2005 10:45:37 -0300 (ADT) 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 j52Djde8013179; Thu, 2 Jun 2005 09:45:40 -0400 (EDT) To: "Mindaugas Riauba" Cc: pgsql-performance@postgresql.org Subject: Re: How to avoid database bloat In-reply-to: <018601c56744$9d5aae50$f20214ac@bite.lt> References: <00d501c5667d$8cc12320$f20214ac@bite.lt> <13878.1117636799@sss.pgh.pa.us> <018601c56744$9d5aae50$f20214ac@bite.lt> Comments: In-reply-to "Mindaugas Riauba" message dated "Thu, 02 Jun 2005 10:28:03 +0300" Date: Thu, 02 Jun 2005 09:45:39 -0400 Message-ID: <13178.1117719939@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: 200506/38 X-Sequence-Number: 12676 "Mindaugas Riauba" writes: >> First thing I'd suggest is to get a more detailed idea of exactly >> what is bloating --- which tables/indexes are the problem? > I think the most problematic table is this one. After vacuum full/reindex > it was 20MB in size now (after 6 hours) it is already 70MB and counting. AFAICT the vacuum is doing what it is supposed to, and the problem has to be just that it's not being done often enough. Which suggests either an autovacuum bug or your autovacuum settings aren't aggressive enough. Which PG version is this exactly? Some of the earlier autovacuum releases do have known bugs, so it'd be worth your while to update if you're not on the latest point release of your series. I don't know much about autovacuum settings, but if you'll show what you're using someone can probably comment on them. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 2 11:23: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 9290B5281C for ; Thu, 2 Jun 2005 11:23:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12641-09 for ; Thu, 2 Jun 2005 14:23: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 96FAB52802 for ; Thu, 2 Jun 2005 11:23:18 -0300 (ADT) 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 j52ENNXX013549; Thu, 2 Jun 2005 10:23:23 -0400 (EDT) To: Himanshu Baweja Cc: pgsql-performance@postgresql.org Subject: Re: Moving pg_xlog In-reply-to: <20050602070209.96753.qmail@web51005.mail.yahoo.com> References: <20050602070209.96753.qmail@web51005.mail.yahoo.com> Comments: In-reply-to Himanshu Baweja message dated "Thu, 02 Jun 2005 00:02:09 -0700" Date: Thu, 02 Jun 2005 10:23:23 -0400 Message-ID: <13548.1117722203@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: 200506/39 X-Sequence-Number: 12677 Himanshu Baweja writes: > My database has two scsi disks.... > my current configuration has pg_xlog on disk1 and data on disk2.... > the machine is used for database only.... > now did some logging and came to a conclusion that my disk2(data disk) is getting used around 3 times more than disk1(pg_xlog).... > so wht is recommended... move some of the data to disk1 so that both disks are equally used... by creating tablespaces or let my configuration be whts its currently... iowait is one of the bottlenecks in my application performance..... It seems highly unlikely that putting more stuff on the xlog disk will improve performance --- at least not if your bottleneck is update speed. If it's a read-mostly workload then optimizing xlog writes may not be the most important thing to you. In that case you might want to ignore xlog and try something along the lines of tables on one disk, indexes on the other. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 2 11:24: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 F36BA52862 for ; Thu, 2 Jun 2005 11:24:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17706-02 for ; Thu, 2 Jun 2005 14:24:45 +0000 (GMT) Received: from ns1.bi.lt (ns.bi.lt [213.226.131.131]) by svr1.postgresql.org (Postfix) with ESMTP id 05B60528F3 for ; Thu, 2 Jun 2005 11:24:43 -0300 (ADT) Received: from B027543 (inet.bee.lt [213.226.131.30]) by ns1.bi.lt (8.12.11/8.12.11) with SMTP id j52EOlA5026007; Thu, 2 Jun 2005 17:24:47 +0300 Message-ID: <02db01c5677e$d43d3b10$f20214ac@bite.lt> From: "Mindaugas Riauba" To: "Tom Lane" Cc: References: <00d501c5667d$8cc12320$f20214ac@bite.lt> <13878.1117636799@sss.pgh.pa.us> <018601c56744$9d5aae50$f20214ac@bite.lt> <13178.1117719939@sss.pgh.pa.us> Subject: Re: How to avoid database bloat Date: Thu, 2 Jun 2005 17:24:47 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1257" Content-Transfer-Encoding: 7bit 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.137 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/40 X-Sequence-Number: 12678 > >> First thing I'd suggest is to get a more detailed idea of exactly > >> what is bloating --- which tables/indexes are the problem? > > > I think the most problematic table is this one. After vacuum full/reindex > > it was 20MB in size now (after 6 hours) it is already 70MB and counting. > > AFAICT the vacuum is doing what it is supposed to, and the problem has > to be just that it's not being done often enough. Which suggests either > an autovacuum bug or your autovacuum settings aren't aggressive enough. -D -d 1 -v 1000 -V 0.5 -a 1000 -A 0.1 -s 10 That is autovacuum settings. Should be aggressive enough I think? > Which PG version is this exactly? Some of the earlier autovacuum > releases do have known bugs, so it'd be worth your while to update > if you're not on the latest point release of your series. 8.0.3 > I don't know much about autovacuum settings, but if you'll show what > you're using someone can probably comment on them. And what in vacuum verbose output suggests that vacuum is not done often enough? Current output (table is 100MB already) is below. Thanks, Mindaugas $ vacuumdb -v -z -U postgres -t queue database INFO: vacuuming "queue" INFO: index "queue_msg_id_pk" now contains 302993 row versions in 18129 pages DETAIL: 102763 index row versions were removed. 1 index pages have been deleted, 1 are currently reusable. CPU 0.87s/0.46u sec elapsed 76.40 sec. INFO: index "queue_next_retry" now contains 310080 row versions in 9092 pages DETAIL: 102763 index row versions were removed. 675 index pages have been deleted, 658 are currently reusable. CPU 0.38s/0.31u sec elapsed 79.47 sec. INFO: index "queue_recipient_idx" now contains 323740 row versions in 2900 pages DETAIL: 102763 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.27u sec elapsed 9.06 sec. INFO: "queue": removed 102763 row versions in 9623 pages DETAIL: CPU 0.16s/0.39u sec elapsed 29.26 sec. INFO: "queue": found 102763 removable, 292342 nonremovable row versions in 12452 pages DETAIL: 14 dead row versions cannot be removed yet. There were 183945 unused item pointers. 0 pages are entirely empty. CPU 1.56s/1.51u sec elapsed 194.39 sec. INFO: analyzing "queue" INFO: "queue": scanned 3000 of 12452 pages, containing 72850 live rows and 7537 dead rows; 3000 rows in sample, 302376 estimated total rows VACUUM From pgsql-performance-owner@postgresql.org Thu Jun 2 11:47: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 8092B52875 for ; Thu, 2 Jun 2005 11:47:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22057-08 for ; Thu, 2 Jun 2005 14:47:19 +0000 (GMT) Received: from web51004.mail.yahoo.com (web51004.mail.yahoo.com [206.190.38.135]) by svr1.postgresql.org (Postfix) with SMTP id E88D452862 for ; Thu, 2 Jun 2005 11:47:17 -0300 (ADT) Received: (qmail 15004 invoked by uid 60001); 2 Jun 2005 14:47:21 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=MZzPM2GEqHh0Q0fqeQJf+dPkEJpIsYbQUvPSojdQwHv+5lgzLNF8GmUmFYLGnsuqMXdgSbJNr7eMlb0ESHFwJuw1szZjVrKuS//6EkjyoJrGQOZp3ertjnTeHdBvezfjpWzg4bgO6sp83RH6vgb9EeKhpDnvVf+M+1PivTNmJgU= ; Message-ID: <20050602144721.15002.qmail@web51004.mail.yahoo.com> Received: from [203.101.103.131] by web51004.mail.yahoo.com via HTTP; Thu, 02 Jun 2005 07:47:21 PDT Date: Thu, 2 Jun 2005 07:47:21 -0700 (PDT) From: Himanshu Baweja Subject: Re: Moving pg_xlog To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <13548.1117722203@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-162673045-1117723641=:14988" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.522 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, HTML_20_30, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200506/41 X-Sequence-Number: 12679 --0-162673045-1117723641=:14988 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Tom Lane wrote: >It seems highly unlikely that putting more stuff on the xlog disk will >improve performance --- at least not if your bottleneck is update speed. Tom you are right.. i did some testing... 1) default config--- xlog on disk1 and data on disk2=> 27 mins and 22 secs 2) xlog and some tables on disk1 and rest of tables on disk2=> 28 mins and 38 secs but the most startling of the results is.... 3) xlog on disk1 and half the tables on partition 1 of disk2 and other half on partition 2 of disk2 24 mins and 14 secs ?????????? shouldnt moving data to diff partitions degrade performance instead of enhancing it.... also in configuration 1, my heap_blks_hit/heap_blks_fetched was good enough.... but in configuration 3, its was really low.. something of the order of 1/15... still the performance improved.... any ideas..... does moving across partitions help... Regards Himanshu __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --0-162673045-1117723641=:14988 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit

Tom Lane <tgl@sss.pgh.pa.us> wrote:
>It seems highly unlikely that putting more stuff on the xlog disk will
>improve performance --- at least not if your bottleneck is update speed.
 
Tom you are right.. i did some testing...
1) default config--- xlog on disk1 and data on disk2=>
    27 mins and 22 secs
2) xlog and some tables on disk1 and rest of tables on disk2=>
    28 mins and 38 secs
 
but the most startling of the results is....
3) xlog on disk1 and half the tables on partition 1 of disk2 and other half on partition 2 of disk2
   24 mins and 14 secs
 
 ??????????
shouldnt moving data to diff partitions degrade performance instead of enhancing it....
 
also  in configuration 1, my heap_blks_hit/heap_blks_fetched was good enough....
but in configuration 3, its was really low.. something of the order of 1/15...
still the performance improved....
 
any ideas.....
does moving across partitions help...
 
Regards
Himanshu
 

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com --0-162673045-1117723641=:14988-- From pgsql-performance-owner@postgresql.org Thu Jun 2 12:03: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 18A8E52806 for ; Thu, 2 Jun 2005 12:03:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26808-08 for ; Thu, 2 Jun 2005 15:03:40 +0000 (GMT) Received: from blanco.deepfile.com (66-194-80-196.gen.twtelecom.net [66.194.80.196]) by svr1.postgresql.org (Postfix) with ESMTP id 72FEE52802 for ; Thu, 2 Jun 2005 12:03:39 -0300 (ADT) Received: from dc1.storediq.com (dc1.deepfile.com [192.168.123.7]) by blanco.deepfile.com (8.12.8/8.12.8) with ESMTP id j52F2EhX030503 for ; Thu, 2 Jun 2005 10:02:14 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.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: Specific query performance problem help requested - postgresql 7.4 Date: Thu, 2 Jun 2005 10:03:43 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Specific query performance problem help requested - postgresql 7.4 Thread-Index: AcViITSceL7atpQ9SROXk3qlChz8FwFYvg8A From: "Brad Might" To: 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: 200506/42 X-Sequence-Number: 12680 =20 How is it that the index scan has such poor performance? Shouldn't index lookups be quicker? -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20 Sent: Thursday, May 26, 2005 1:32 PM To: Brad Might Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Specific query performance problem help requested - postgresql 7.4=20 "Brad Might" writes: > Can someone help me break this down and figure out why the one query=20 > takes so much longer than the other? It looks to me like there's a correlation between filename and bucket, such that the indexscan in filename order takes much longer to run across the first 25 rows with bucket =3D 3 than it does to run across = the first 25 with bucket =3D 7 or bucket =3D 8. It's not just a matter of = there being fewer rows with bucket =3D 3 ... the cost differential is much larger than is explained by the count ratios. The bucket =3D 3 rows = have to be lurking further to the back of the filename order than the others. > Here's the bucket distribution..i have clustered the index on the=20 > bucket value. If you have an index on bucket, it's not doing you any good here anyway, since you wrote the constraint as a crosstype operator ("3" is int4 not int8). It might help to explicitly cast the constant to int8. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 2 12:25: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 E0D6F52806 for ; Thu, 2 Jun 2005 12:25:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33130-09 for ; Thu, 2 Jun 2005 15:25:24 +0000 (GMT) Received: from mail3.vodafone.ie (lughnasa.vodafone.ie [213.233.128.5]) by svr1.postgresql.org (Postfix) with ESMTP id A60DB5286E for ; Thu, 2 Jun 2005 12:25:22 -0300 (ADT) Received: from iecsai19 (10.163.136.100) by mail3.vodafone.ie (7.2.033.1) id 428A1D1200062C8D for pgsql-performance@postgresql.org; Thu, 2 Jun 2005 16:25:25 +0100 Message-ID: <17165144.1117725925709.JavaMail.tomcat@iecsai19> Date: Thu, 2 Jun 2005 16:25:25 +0100 (IST) From: Reply-To: To: pgsql-performance@postgresql.org Subject: Query plan for very large number of joins Mime-Version: 1.0 Content-Type: text/plain;charset="UTF-8" Content-Transfer-Encoding: 7bit X-CP-Disclaimer: 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: 200506/43 X-Sequence-Number: 12681 Hi, I am using PostgreSQL (7.4) with a schema that was generated automatically (using hibernate). The schema consists of about 650 relations. One particular query (also generated automatically) consists of left joining approximately 350 tables. At this stage, most tables are empty and those with values have less than 50 entries. The query takes about 90 seconds to execute (on a P4, 2.6Ghz). All of the relations have a primary key which is indexed and all of the joins are on foreign keys which are explicitly declared. I've checked the obvious tunables (effective_cache_size, shared_memory and sort_buffer) but changing these has had no effect. The system has a total of 750MB RAM, I've varied the shared memory up to 256MB and the sort buffer up to 128MB without affecting the performance. Running the query as a JDBC prepared statement indicates that the query optimiser is spending a negligable amount of time on the task (~ 36 ms) compared to the executor (~ 90 seconds). The output of EXPLAIN indicates (AFAICT) that all of the joins are of type "Nested Loop Left Join" and all of the scans are of type "Seq Scan". I have refrained from posting the query and the query plan since these are 80K and 100K apiece but if anyone wants to see them I can certainly forward them on. My (uninformed) suspicion is that the optimiser has failed over to the default plan on the basis of the number of tables in the join. My question is, is there anyone out there using PostgreSQL with this size of schema? Is there anything that can be done to bring about the order of magnitude increase in speed that I need? Thanks for your help, -phil I'm using Vodafone Mail - to get your free mobile email account go to http://www.vodafone.ie Use of Vodafone Mail is subject to Terms and Conditions http://www.vodafone.ie/terms/website From pgsql-performance-owner@postgresql.org Thu Jun 2 12:57: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 A851052892 for ; Thu, 2 Jun 2005 12:57:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42845-01 for ; Thu, 2 Jun 2005 15:57:04 +0000 (GMT) Received: from server.pyrenet.fr (server.pyrenet.fr [194.116.145.1]) by svr1.postgresql.org (Postfix) with ESMTP id 8308452816 for ; Thu, 2 Jun 2005 12:57:03 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by localhost.pyrenet.fr (Postfix) with ESMTP id 4B9F62F632; Thu, 2 Jun 2005 17:57:08 +0200 (MET DST) Received: from server.pyrenet.fr ([127.0.0.1]) by localhost (server [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07795-05; Thu, 2 Jun 2005 17:57:05 +0200 (MET DST) Received: from sun.pyrenet (unknown [80.65.236.174]) by server.pyrenet.fr (Postfix) with ESMTP id 4AA702F630; Thu, 2 Jun 2005 17:57:05 +0200 (MET DST) Received: from localhost (localhost [127.0.0.1]) by sun.pyrenet (Postfix) with ESMTP id B36CD16248; Thu, 2 Jun 2005 17:57:04 +0200 (MET DST) Date: Thu, 2 Jun 2005 17:57:04 +0200 (MET DST) From: ohp@pyrenet.fr X-X-Sender: ohp@sun.pyrenet Reply-To: ohp@pyrenet.fr To: =?ISO-8859-1?Q?Dirk_Lutzeb=E4ck?= Cc: pgsql-performance@postgresql.org Subject: Re: SURVEY: who is running postgresql on 8 or more CPUs? In-Reply-To: <429C63B5.4060403@aeccom.com> Message-ID: References: <429C63B5.4060403@aeccom.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at pyrenet.fr 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: 200506/44 X-Sequence-Number: 12682 On Tue, 31 May 2005, Dirk Lutzeb�ck wrote: > Date: Tue, 31 May 2005 15:16:37 +0200 > From: Dirk Lutzeb�ck > To: pgsql-performance@postgresql.org > Subject: [PERFORM] SURVEY: who is running postgresql on 8 or more CPUs? > > Hi, > > I would like to start a little survey who is running postgresql on an > 8way or more machine (Intel, Sparc, AMD no matter). Purpose: find out > how postgresql runs in high performance areas. > > Please fillout: > > Machine (Vendor, Product): TX200 Fujitsu siemens > Architecture (Intel/Sparc/AMD/IBM): Intel > Processors (Type/Number/GHz): bi-Xeon 2.8G > RAM: 3g > Operating System: Unixware 714 > PostgreSQL Version: 8.0.3 > Database size (GB): 6G > Disk system: 6xU320 36G SCSI (software raid) > Type of application: from accounting to game > Your email contact: ohp@pyrenet.fr > Willing to answer questions in this group: yes > Comments: > > > Please answer here or to me. I compile the results and feed them back here. > > Regards, > > Dirk > > > ---------------------------(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 > > -- Olivier PRENANT Tel: +33-5-61-50-97-00 (Work) 6, Chemin d'Harraud Turrou +33-5-61-50-97-01 (Fax) 31190 AUTERIVE +33-6-07-63-80-64 (GSM) FRANCE Email: ohp@pyrenet.fr ------------------------------------------------------------------------------ Make your life a dream, make your dream a reality. (St Exupery) From pgsql-performance-owner@postgresql.org Thu Jun 2 13:05: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 BBAFF528C1 for ; Thu, 2 Jun 2005 13:05:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42270-09 for ; Thu, 2 Jun 2005 16:05:21 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 45DD75289D for ; Thu, 2 Jun 2005 13:05:18 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id A81C04157E1; Thu, 2 Jun 2005 17:05:09 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 9CFBE15ED6; Thu, 2 Jun 2005 17:02:33 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 32664-08; Thu, 2 Jun 2005 17:02:29 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 2C1DF15ED5; Thu, 2 Jun 2005 17:02:29 +0100 (BST) Message-ID: <429F2D94.3030805@archonet.com> Date: Thu, 02 Jun 2005 17:02:28 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: philb@vodafone.ie Cc: pgsql-performance@postgresql.org Subject: Re: Query plan for very large number of joins References: <17165144.1117725925709.JavaMail.tomcat@iecsai19> In-Reply-To: <17165144.1117725925709.JavaMail.tomcat@iecsai19> 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.053 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/45 X-Sequence-Number: 12683 philb@vodafone.ie wrote: > Hi, > > I am using PostgreSQL (7.4) with a schema that was generated > automatically (using hibernate). The schema consists of about 650 > relations. One particular query (also generated automatically) > consists of left joining approximately 350 tables. May I be the first to offer an "ouch"! > At this stage, most tables are empty and those with values have less > than 50 entries. The query takes about 90 seconds to execute (on a > P4, 2.6Ghz). > > All of the relations have a primary key which is indexed and all of > the joins are on foreign keys which are explicitly declared. I've > checked the obvious tunables (effective_cache_size, shared_memory and > sort_buffer) but changing these has had no effect. The system has a > total of 750MB RAM, I've varied the shared memory up to 256MB and the > sort buffer up to 128MB without affecting the performance. The sort-mem is the only thing I can see helping with a single query. > Running the query as a JDBC prepared statement indicates that the > query optimiser is spending a negligable amount of time on the task > (~ 36 ms) compared to the executor (~ 90 seconds). The output of > EXPLAIN indicates (AFAICT) that all of the joins are of type "Nested > Loop Left Join" and all of the scans are of type "Seq Scan". I have > refrained from posting the query and the query plan since these are > 80K and 100K apiece but if anyone wants to see them I can certainly > forward them on. Well, if most tables are small then a seq-scan makes sense. Does it look like it's estimating the number of rows badly anywhere? I'm not sure the list will accept attachments that large - is it possible to upload them somewhere accessible? > My (uninformed) suspicion is that the optimiser has failed over to > the default plan on the basis of the number of tables in the join. My > question is, is there anyone out there using PostgreSQL with this > size of schema? Is there anything that can be done to bring about the > order of magnitude increase in speed that I need? Well - the genetic planner must surely be kicking in here (see the run-time configuration chapter of the manuals, query-planning, geqo_threshold). However, I'm not sure how much leeway there is in planning a largely left-joined query. It could be there's some overhead in the executor that's only noticable with hundreds of tables involved, you're running at about 0.25 secs per join. I take it you have no control over the schema or query, so there's not much fiddling you can do. You've tried sort_mem, so there are only two things I can think of: 1. Try the various enable_xxx config settings and see if disabling seq-scan or the relevant join-type does anything (I'm not sure it will) 2. Try against 8.0 - there may be some improvement there. Other people on this list have experience on larger systems than me, so they may be able to help more. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jun 2 13:10: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 A65AC528C1 for ; Thu, 2 Jun 2005 13:10:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47356-05 for ; Thu, 2 Jun 2005 16:10:28 +0000 (GMT) Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by svr1.postgresql.org (Postfix) with ESMTP id DB7795289D for ; Thu, 2 Jun 2005 13:10:26 -0300 (ADT) 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.51) id 1DdsH8-000AMO-5C; Thu, 02 Jun 2005 12:10:30 -0400 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 Message-ID: <429F2F73.8050406@zeut.net> Date: Thu, 02 Jun 2005 12:10:27 -0400 From: "Matthew T. O'Connor" Organization: Terrie O'Connor Realtors User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mindaugas Riauba Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: How to avoid database bloat References: <00d501c5667d$8cc12320$f20214ac@bite.lt> <13878.1117636799@sss.pgh.pa.us> <018601c56744$9d5aae50$f20214ac@bite.lt> <13178.1117719939@sss.pgh.pa.us> <02db01c5677e$d43d3b10$f20214ac@bite.lt> In-Reply-To: <02db01c5677e$d43d3b10$f20214ac@bite.lt> Content-Type: text/plain; charset=windows-1257; format=flowed Content-Transfer-Encoding: 7bit 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: 200506/46 X-Sequence-Number: 12684 Mindaugas Riauba wrote: >>AFAICT the vacuum is doing what it is supposed to, and the problem has >>to be just that it's not being done often enough. Which suggests either >>an autovacuum bug or your autovacuum settings aren't aggressive enough. >> >> > > -D -d 1 -v 1000 -V 0.5 -a 1000 -A 0.1 -s 10 > > That is autovacuum settings. Should be aggressive enough I think? > > Might e aggressive enough, but might not. I have seen some people run -V 0.1. Also you probably don't need -A that low. This could an issue where analyze results in an inaccurate reltuples value which is preventing autovacuum from doing it's job. Could you please run it with -d 2 and show us the relevant log output. >>Which PG version is this exactly? Some of the earlier autovacuum >>releases do have known bugs, so it'd be worth your while to update >>if you're not on the latest point release of your series. >> >> > > 8.0.3 > > That should be fine. From pgsql-performance-owner@postgresql.org Thu Jun 2 13: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 7F70752867 for ; Thu, 2 Jun 2005 13:10:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47265-05 for ; Thu, 2 Jun 2005 16:10: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 7478052806 for ; Thu, 2 Jun 2005 13:10:35 -0300 (ADT) 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 j52GAd2A014704; Thu, 2 Jun 2005 12:10:39 -0400 (EDT) To: "Mindaugas Riauba" Cc: pgsql-performance@postgresql.org Subject: Re: How to avoid database bloat In-reply-to: <02db01c5677e$d43d3b10$f20214ac@bite.lt> References: <00d501c5667d$8cc12320$f20214ac@bite.lt> <13878.1117636799@sss.pgh.pa.us> <018601c56744$9d5aae50$f20214ac@bite.lt> <13178.1117719939@sss.pgh.pa.us> <02db01c5677e$d43d3b10$f20214ac@bite.lt> Comments: In-reply-to "Mindaugas Riauba" message dated "Thu, 02 Jun 2005 17:24:47 +0300" Date: Thu, 02 Jun 2005 12:10:39 -0400 Message-ID: <14703.1117728639@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: 200506/47 X-Sequence-Number: 12685 "Mindaugas Riauba" writes: > And what in vacuum verbose output suggests that vacuum is not done > often enough? Current output (table is 100MB already) is below. The output shows vacuum cleaning up about a third of the table. Usually people like to keep the overhead down to 10% or so ... regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 2 13:26: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 CADFA5288E for ; Thu, 2 Jun 2005 13:26:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49576-10 for ; Thu, 2 Jun 2005 16:26: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 E8FED528CB for ; Thu, 2 Jun 2005 13:26:22 -0300 (ADT) 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 j52GQQxo014835; Thu, 2 Jun 2005 12:26:26 -0400 (EDT) To: Richard Huxton Cc: philb@vodafone.ie, pgsql-performance@postgresql.org Subject: Re: Query plan for very large number of joins In-reply-to: <429F2D94.3030805@archonet.com> References: <17165144.1117725925709.JavaMail.tomcat@iecsai19> <429F2D94.3030805@archonet.com> Comments: In-reply-to Richard Huxton message dated "Thu, 02 Jun 2005 17:02:28 +0100" Date: Thu, 02 Jun 2005 12:26:26 -0400 Message-ID: <14834.1117729586@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: 200506/48 X-Sequence-Number: 12686 Richard Huxton writes: > philb@vodafone.ie wrote: >> I am using PostgreSQL (7.4) with a schema that was generated >> automatically (using hibernate). The schema consists of about 650 >> relations. One particular query (also generated automatically) >> consists of left joining approximately 350 tables. > May I be the first to offer an "ouch"! Seconded. > However, I'm not sure how much leeway there is in > planning a largely left-joined query. Not much. The best hope for a better result is to order the LEFT JOIN clauses in a way that will produce a good plan. One thought is that I am not sure I believe the conclusion that planning is taking only 36 ms; even realizing that the exclusive use of left joins eliminates options for join order, there are still quite a lot of plans to consider. You should try both EXPLAIN and EXPLAIN ANALYZE from psql and see how long each takes. It'd also be interesting to keep an eye on how large the backend process grows while doing this --- maybe it's being driven into swap. Also: I'm not sure there *is* such a thing as a good plan for a 350-way join. It may be time to reconsider your data representation. If Hibernate really forces this on you, it may be time to reconsider your choice of tool. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 2 14: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 BEE9F528C5 for ; Thu, 2 Jun 2005 14:10:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62120-06 for ; Thu, 2 Jun 2005 17:10:14 +0000 (GMT) Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) by svr1.postgresql.org (Postfix) with ESMTP id D19AF5288E for ; Thu, 2 Jun 2005 14:10:10 -0300 (ADT) Received: from [65.87.16.98] (account jrogers@neopolitan.com) by mx1.neopolitan.us (CommuniGate Pro WebUser 4.2.10) with HTTP id 9615727; Thu, 02 Jun 2005 10:10:14 -0700 From: "J. Andrew Rogers" Subject: Re: Adaptec/LSI/?? RAID To: "Stacy White" , X-Mailer: CommuniGate Pro WebUser Interface v.4.2.10 Date: Thu, 02 Jun 2005 10:10:14 -0700 Message-ID: In-Reply-To: <002601c56725$2bdd2010$0200a8c0@grownups> References: <002601c56725$2bdd2010$0200a8c0@grownups> MIME-Version: 1.0 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=1.312 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200506/49 X-Sequence-Number: 12687 I've got a bunch of mission-critical Postgres servers on Opterons, all with no less than 4GB RAM, running Linux + XFS, and most with LSI MegaRAID cards. We've never had a single system crash or failure on our postgres servers, and some of them are well-used and with uptimes in excess of a year. It may be anecdotal, but LSI MegaRAID cards generally seem to work pretty well with Linux. The only problem I've ever seen was a BIOS problem between the LSI and the motherboard, which was solved by flashing the BIOS on the motherboard with the latest version (it was grossly out of date anyway). J. Andrew Rogers From pgsql-performance-owner@postgresql.org Thu Jun 2 14:42: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 71F7C5289D for ; Thu, 2 Jun 2005 14:42:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67325-08 for ; Thu, 2 Jun 2005 17:42:42 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 36AAE52892 for ; Thu, 2 Jun 2005 14:42:41 -0300 (ADT) Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j52HXOa3009023; Thu, 2 Jun 2005 10:33:24 -0700 Message-ID: <429F4516.3070804@commandprompt.com> Date: Thu, 02 Jun 2005 10:42:46 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "J. Andrew Rogers" Cc: Stacy White , pgsql-performance@postgresql.org Subject: Re: Adaptec/LSI/?? RAID References: <002601c56725$2bdd2010$0200a8c0@grownups> 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.015 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/50 X-Sequence-Number: 12688 > It may be anecdotal, but LSI MegaRAID cards generally seem to work > pretty well with Linux. The only problem I've ever seen was a BIOS > problem between the LSI and the motherboard, which was solved by > flashing the BIOS on the motherboard with the latest version (it was > grossly out of date anyway). At Command Prompt we have also had some great success with the LSI cards. The only thing we didn't like is the obscure way you have to configure RAID 10. Sincerely, Joshua D. Drake > > > J. Andrew Rogers > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org -- Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 PostgreSQL Replication, Consulting, Custom Programming, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ From pgsql-performance-owner@postgresql.org Thu Jun 2 14:47: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 662485288E for ; Thu, 2 Jun 2005 14:47:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72660-03 for ; Thu, 2 Jun 2005 17:47:43 +0000 (GMT) Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by svr1.postgresql.org (Postfix) with ESMTP id 2FE3B52887 for ; Thu, 2 Jun 2005 14:47:42 -0300 (ADT) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id DB637B80C for ; Thu, 2 Jun 2005 13:47:48 -0400 (EDT) In-Reply-To: <002601c56725$2bdd2010$0200a8c0@grownups> References: <002601c56725$2bdd2010$0200a8c0@grownups> Mime-Version: 1.0 (Apple Message framework v730) X-Priority: 3 Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-6--159167880; protocol="application/pkcs7-signature" Message-Id: From: Vivek Khera Subject: Re: Adaptec/LSI/?? RAID Date: Thu, 2 Jun 2005 13:47:49 -0400 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/51 X-Sequence-Number: 12689 --Apple-Mail-6--159167880 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Jun 1, 2005, at 11:42 PM, Stacy White wrote: > "we find LSI does not work well with 4GB of RAM. Our engineering > find that > LSI card could cause system crashes. One of our customer ... has > found that > Adaptec cards works well on PostGres SQL -- they're using it as a > preforce > server with xfs and post-gress." > > Any comments? Suggestions for other RAID controllers? > I have twin dual opteron, 4GB RAM, LSI MegaRAID-2X cards with 8 disks (2@RAID0 system+pg_xlog, 6@RAID10 data) running FreeBSD 5.4-RELEASE. Works just perfectly fine under some very heavy insert/update/delete load. Database + indexes hovers at about 50Gb. I don't use the adaptec controllers because they don't support FreeBSD well (and vice versa) and the management tools are not there for FreeBSD in a supported fashion like they are for LSI. Vivek Khera, Ph.D. +1-301-869-4449 x806 --Apple-Mail-6--159167880 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA xKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6Y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jELMAkGA1UEBhMCWkExJTAj BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEANDhvi6aS0h3l VyhBHpo4DHxe4WdNLgvl4HtBxnrtBsVoLsjiYNp1OCWWaH4BryGzGEwlxmS6/oW3KXNfkx/Y4pYE oR0YcEzp7dX+L5vqqYCgxzEQJ4zHAhZWggBdQ0ms8tggyiiQXH6RnCq9eNvsf8TlU508ouHsS4VG i1TNr6VXPkzP5dyLIfh1/c2ycTR3x9z5gQhkVDGqlvXFE6yebecOWXZj4EJZVwap29+uPt33UM3m zZtimeDCz1WVf5Hf6bZGuxXCtVPpzrZmqLALIPWsbTwYKxRK2jszntlIQYfa4l5/oTJmywusXQko sDyeRz7tLDyQHcg4LGF7El/pdQAAAAAAAA== --Apple-Mail-6--159167880-- From pgsql-performance-owner@postgresql.org Thu Jun 2 17:15: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 BD75152872 for ; Thu, 2 Jun 2005 17:15:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06847-02 for ; Thu, 2 Jun 2005 20:15:35 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 469EB52838 for ; Thu, 2 Jun 2005 17:15:32 -0300 (ADT) Received: (qmail 3907 invoked from network); 2 Jun 2005 22:15:39 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 2 Jun 2005 22:15:39 +0200 To: philb@vodafone.ie, pgsql-performance@postgresql.org Subject: Re: Query plan for very large number of joins References: <17165144.1117725925709.JavaMail.tomcat@iecsai19> Message-ID: Date: Thu, 02 Jun 2005 22:15:36 +0200 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: <17165144.1117725925709.JavaMail.tomcat@iecsai19> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/52 X-Sequence-Number: 12690 > I am using PostgreSQL (7.4) with a schema that was generated > automatically (using hibernate). > The schema consists of about 650 relations. One particular query (also > generated > automatically) consists of left joining approximately 350 tables. At this Just out of curiosity, what application is this ? And what are the reasons for so many tables ...and especially such a query ? Not criticizing, but curious. From pgsql-performance-owner@postgresql.org Thu Jun 2 18: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 E320C5286A for ; Thu, 2 Jun 2005 18:02:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17248-01 for ; Thu, 2 Jun 2005 21:02:01 +0000 (GMT) Received: from mail0.rawbw.com (mail0.rawbw.com [198.144.192.41]) by svr1.postgresql.org (Postfix) with ESMTP id D23E5528A9 for ; Thu, 2 Jun 2005 18:01:56 -0300 (ADT) Received: (from www@localhost) by mail0.rawbw.com (8.11.6p2/8.11.6) id j52L23D33892; Thu, 2 Jun 2005 14:02:03 -0700 (PDT) Received: from 198.144.203.173 ([198.144.203.173]) by webmail.rawbw.com (IMP) with HTTP for ; Thu, 2 Jun 2005 14:02:03 -0700 Message-ID: <1117746123.429f73cb81fed@webmail.rawbw.com> Date: Thu, 2 Jun 2005 14:02:03 -0700 From: mudfoot@rawbw.com To: pgsql-performance@postgresql.org Cc: pgsql-performance@postgresql.org Subject: Re: Adaptec/LSI/?? RAID (what about JBOD?) References: <002601c56725$2bdd2010$0200a8c0@grownups> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.1 X-Originating-IP: 198.144.203.173 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: 200506/53 X-Sequence-Number: 12691 I have a similar question about what to choose (either LSI or Adaptec U320), but plan to use them just for JBOD drivers. I expect to be using either net or freebsd. The system CPU will be Opteron. My impression is that both the ahd and mpt drivers (for U320 Adaptec and LSI, respectively) are quite stable, but not from personal experience. Like I said, I don't plan to have the cards doing RAID in hardware. Should I be pretty safe with either choice of HBA then? Thanks (and sorry for the semi-hijack). Quoting Vivek Khera : > > On Jun 1, 2005, at 11:42 PM, Stacy White wrote: > > > "we find LSI does not work well with 4GB of RAM. Our engineering > > find that > > LSI card could cause system crashes. One of our customer ... has > > found that > > Adaptec cards works well on PostGres SQL -- they're using it as a > > preforce > > server with xfs and post-gress." > > > > Any comments? Suggestions for other RAID controllers? > > > > I have twin dual opteron, 4GB RAM, LSI MegaRAID-2X cards with 8 disks > (2@RAID0 system+pg_xlog, 6@RAID10 data) running FreeBSD 5.4-RELEASE. > > Works just perfectly fine under some very heavy insert/update/delete > load. Database + indexes hovers at about 50Gb. > > I don't use the adaptec controllers because they don't support > FreeBSD well (and vice versa) and the management tools are not there > for FreeBSD in a supported fashion like they are for LSI. > > > Vivek Khera, Ph.D. > +1-301-869-4449 x806 > > > From pgsql-performance-owner@postgresql.org Thu Jun 2 19:22: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 BB3A1528C1 for ; Thu, 2 Jun 2005 19:22:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36447-05 for ; Thu, 2 Jun 2005 22:21:58 +0000 (GMT) Received: from dd01.profihoster.net (dd01.profihoster.net [80.86.168.71]) by svr1.postgresql.org (Postfix) with ESMTP id 3E01F52887 for ; Thu, 2 Jun 2005 19:21:57 -0300 (ADT) Received: from [192.168.54.114] (G12ff.g.pppool.de [80.185.18.255]) by dd01.profihoster.net (Postfix) with ESMTP id 1CDDC2383EE for ; Fri, 3 Jun 2005 00:16:20 +0200 (CEST) Message-ID: <429F86FB.9020103@laliluna.de> Date: Fri, 03 Jun 2005 00:23:55 +0200 From: Sebastian Hennebrueder User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Query plan for very large number of joins References: <17165144.1117725925709.JavaMail.tomcat@iecsai19> <429F2D94.3030805@archonet.com> <14834.1117729586@sss.pgh.pa.us> In-Reply-To: <14834.1117729586@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15; 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: 200506/54 X-Sequence-Number: 12692 Tom Lane schrieb: >Richard Huxton writes: > > >>philb@vodafone.ie wrote: >> >> >>>I am using PostgreSQL (7.4) with a schema that was generated >>>automatically (using hibernate). The schema consists of about 650 >>>relations. One particular query (also generated automatically) >>>consists of left joining approximately 350 tables. >>> >>> > > > >>May I be the first to offer an "ouch"! >> >> > >Seconded. > > > >>However, I'm not sure how much leeway there is in >>planning a largely left-joined query. >> >> > >Not much. The best hope for a better result is to order the LEFT JOIN >clauses in a way that will produce a good plan. > > If this is the best way, you should consider to use an sql query and not the hibernate ql language in this case. This is possible with Hibernate! I suppose you could also consider a view in Postgre and let Hibernate read from this view. This is also possible. >One thought is that I am not sure I believe the conclusion that planning >is taking only 36 ms; even realizing that the exclusive use of left >joins eliminates options for join order, there are still quite a lot of >plans to consider. You should try both EXPLAIN and EXPLAIN ANALYZE >from psql and see how long each takes. It'd also be interesting to keep >an eye on how large the backend process grows while doing this --- maybe >it's being driven into swap. > >Also: I'm not sure there *is* such a thing as a good plan for a 350-way >join. It may be time to reconsider your data representation. If >Hibernate really forces this on you, it may be time to reconsider your >choice of tool. > > regards, tom lane > >---------------------------(end of broadcast)--------------------------- >TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > > > -- Kind Regards / Viele Gr��e Sebastian Hennebrueder ----- http://www.laliluna.de/tutorials.html Tutorials for Java, Struts, JavaServer Faces, JSP, Hibernate, EJB and more. From pgsql-performance-owner@postgresql.org Thu Jun 2 20: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 2B8B7528BB for ; Thu, 2 Jun 2005 20:19:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50720-03 for ; Thu, 2 Jun 2005 23:19:25 +0000 (GMT) Received: from mail1.catalyst.net.nz (godel.catalyst.net.nz [202.49.159.12]) by svr1.postgresql.org (Postfix) with ESMTP id DF2D5528C1 for ; Thu, 2 Jun 2005 20:19:24 -0300 (ADT) Received: from leibniz.catalyst.net.nz ([202.49.159.7] helo=lamb.mcmillan.net.nz) by mail1.catalyst.net.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1DdyyH-00016T-It; Fri, 03 Jun 2005 11:19:29 +1200 Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) by lamb.mcmillan.net.nz (Postfix) with ESMTP id 2EF24AD98581; Fri, 3 Jun 2005 11:19:29 +1200 (NZST) Subject: Re: Adaptec/LSI/?? RAID (what about JBOD?) From: Andrew McMillan To: mudfoot@rawbw.com Cc: pgsql-performance@postgresql.org In-Reply-To: <1117746123.429f73cb81fed@webmail.rawbw.com> References: <002601c56725$2bdd2010$0200a8c0@grownups> <1117746123.429f73cb81fed@webmail.rawbw.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-RWH3DfycrLNpRMoFJgi7" Date: Fri, 03 Jun 2005 11:19:28 +1200 Message-Id: <1117754368.10586.32.camel@lamb.mcmillan.net.nz> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 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: 200506/55 X-Sequence-Number: 12693 --=-RWH3DfycrLNpRMoFJgi7 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Thu, 2005-06-02 at 14:02 -0700, mudfoot@rawbw.com wrote: > I have a similar question about what to choose (either LSI or Adaptec U32= 0), but > plan to use them just for JBOD drivers. I expect to be using either net = or > freebsd. The system CPU will be Opteron. My impression is that both the= ahd > and mpt drivers (for U320 Adaptec and LSI, respectively) are quite stable= , but > not from personal experience. Like I said, I don't plan to have the card= s doing > RAID in hardware. Should I be pretty safe with either choice of HBA then= ? On the machine I mentioned earlier in this thread we use the Megaraid for JBOD, but the card setup to use the disks that way was somewhat confusing, requiring us to configure logical drives that in fact matched the physical ones. The card still wanted to write that information onto the disks, reducing the total disk space available by some amount, but also meaning that we were unable to migrate our system from a previous non-RAID card cleanly. Regards, Andrew. ------------------------------------------------------------------------- Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 Whereof one cannot speak, thereon one must remain silent. -- Wittgenstein ------------------------------------------------------------------------- --=-RWH3DfycrLNpRMoFJgi7 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBCn5QAjJA0f48GgBIRAr4KAJ9TKue692A+6Jf+ob7dPyQVdFyyIgCgr2vi Aw7fnuqqT8t4YpNb/bF8Q0c= =b4Pe -----END PGP SIGNATURE----- --=-RWH3DfycrLNpRMoFJgi7-- From pgsql-performance-owner@postgresql.org Thu Jun 2 21:30: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 167695290C for ; Thu, 2 Jun 2005 21:30:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61928-06 for ; Fri, 3 Jun 2005 00:30:24 +0000 (GMT) Received: from mail0.rawbw.com (mail0.rawbw.com [198.144.192.41]) by svr1.postgresql.org (Postfix) with ESMTP id 1B23252874 for ; Thu, 2 Jun 2005 21:30:21 -0300 (ADT) Received: (from www@localhost) by mail0.rawbw.com (8.11.6p2/8.11.6) id j530UUL89786 for pgsql-performance@postgresql.org; Thu, 2 Jun 2005 17:30:30 -0700 (PDT) Received: from 198.144.203.173 ([198.144.203.173]) by webmail.rawbw.com (IMP) with HTTP for ; Thu, 2 Jun 2005 17:30:30 -0700 Message-ID: <1117758630.429fa4a66825f@webmail.rawbw.com> Date: Thu, 2 Jun 2005 17:30:30 -0700 From: mudfoot@rawbw.com To: pgsql-performance@postgresql.org Subject: Re: Adaptec/LSI/?? RAID (what about JBOD?) References: <002601c56725$2bdd2010$0200a8c0@grownups> <1117746123.429f73cb81fed@webmail.rawbw.com> <1117754368.10586.32.camel@lamb.mcmillan.net.nz> In-Reply-To: <1117754368.10586.32.camel@lamb.mcmillan.net.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.1 X-Originating-IP: 198.144.203.173 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: 200506/56 X-Sequence-Number: 12694 Thanks, Andrew. I expect to choose between HBAs with no RAID functionality or with the option to completely bypass RAID functionality--meaning that I'll hopefully avoid the situation that you've described. I'm mostly curious as to whether the driver problems described for U320 Adaptec RAID controllers also apply to the regular SCSI drivers. Thanks. Quoting Andrew McMillan : > On Thu, 2005-06-02 at 14:02 -0700, mudfoot@rawbw.com wrote: > > I have a similar question about what to choose (either LSI or Adaptec > U320), but > > plan to use them just for JBOD drivers. I expect to be using either net > or > > freebsd. The system CPU will be Opteron. My impression is that both the > ahd > > and mpt drivers (for U320 Adaptec and LSI, respectively) are quite stable, > but > > not from personal experience. Like I said, I don't plan to have the cards > doing > > RAID in hardware. Should I be pretty safe with either choice of HBA > then? > > On the machine I mentioned earlier in this thread we use the Megaraid > for JBOD, but the card setup to use the disks that way was somewhat > confusing, requiring us to configure logical drives that in fact matched > the physical ones. The card still wanted to write that information onto > the disks, reducing the total disk space available by some amount, but > also meaning that we were unable to migrate our system from a previous > non-RAID card cleanly. > > Regards, > Andrew. > > ------------------------------------------------------------------------- > Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington > WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St > DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 > Whereof one cannot speak, thereon one must remain silent. -- Wittgenstein > ------------------------------------------------------------------------- > > From pgsql-performance-owner@postgresql.org Sun Jun 5 22:32: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 AD79152802 for ; Thu, 2 Jun 2005 22:57:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85648-04 for ; Fri, 3 Jun 2005 01:56:57 +0000 (GMT) Received: from imsm058dat.netvigator.com (imsm058.netvigator.com [218.102.48.211]) by svr1.postgresql.org (Postfix) with ESMTP id 7D70252816 for ; Thu, 2 Jun 2005 22:56:54 -0300 (ADT) Received: from n2.netvigator.com ([218.102.224.145]) by imsm058dat.netvigator.com (InterMail vM.6.01.04.01 201-2131-118-101-20041129) with ESMTP id <20050603015702.NZMS3558.imsm058dat.netvigator.com@n2.netvigator.com> for ; Fri, 3 Jun 2005 09:57:02 +0800 Message-Id: <6.2.1.2.0.20050602190756.05ab2c70@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.1.2 Date: Fri, 03 Jun 2005 09:56:49 +0800 To: pgsql-performance@postgresql.org From: K C Lau Subject: SELECT DISTINCT Performance Issue 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/99 X-Sequence-Number: 12736 Hi All, We are testing PostgreSQL 8.0.3 on MS Windows for porting an OLTP system from MS SqlServer. We got a major performance issue which seems to boil down to the following type of query: select DISTINCT ON (PlayerID) PlayerID,AtDate from Player where PlayerID='22220' order by PlayerID desc, AtDate desc; The Player table has primary key (PlayerID, AtDate) representing data over time and the query gets the latest data for a player. With enable_seqscan forced off (which I'm not sure if that should be done for a production system), the average query still takes a very long time to return a record: esdt=> explain analyze select DISTINCT ON (PlayerID) PlayerID,AtDate from Player where PlayerID='22220' order by PlayerID desc, AtDate desc; Unique (cost=0.00..2507.66 rows=1 width=23) (actual time=0.000..187.000 rows=1 loops=1) -> Index Scan Backward using pk_player on player (cost=0.00..2505.55 rows=8 43 width=23) (actual time=0.000..187.000 rows=1227 loops=1) Index Cond: ((playerid)::text = '22220'::text) Total runtime: 187.000 ms It appears that all the 1227 data records for that player were searched, even when doing a backward index scan. I would presume that, after locating the index for the highest AtDate, only the first data record needs to be retrieved. The following summary of tests seems to confirm my observation. They were done on a quiet system (MS Windows 2000 Server, P4 3.0GHz with Hyperthreading, 1GB Memory, PostgreSQL shared_buffers = 50000), starting with a test database before doing a vacuum: set enable_seqscan = off; select Total runtime: 187.000 ms again: Total runtime: 78.000 ms vacuum analyze verbose player; select Total runtime: 47.000 ms again: Total runtime: 47.000 ms reindex table player; select Total runtime: 78.000 ms again: Total runtime: 63.000 ms cluster pk_player on player; select Total runtime: 16.000 ms again: Total runtime: 0.000 ms set enable_seqscan = on; analyze verbose player; select Total runtime: 62.000 ms again: Total runtime: 78.000 ms Previously, we have also tried to use LIMIT 1 instead of DISTINCT, but the performance was no better: select PlayerID,AtDate from Player where PlayerID='22220' order by PlayerID desc, AtDate desc LIMIT 1 Any clue or suggestions would be most appreciated. If you need further info or the full explain logs, please let me know. Regards, KC. From pgsql-performance-owner@postgresql.org Sun Jun 5 22:29: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 5346E528CB for ; Fri, 3 Jun 2005 00:36:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14000-03 for ; Fri, 3 Jun 2005 03:36:19 +0000 (GMT) Received: from snappy.tocr.com (snappy.tocr.com [64.34.164.72]) by svr1.postgresql.org (Postfix) with ESMTP id 0132B52851 for ; Fri, 3 Jun 2005 00:36:16 -0300 (ADT) Received: by snappy.tocr.com (Postfix, from userid 48) id 3F56895026F; Thu, 2 Jun 2005 23:38:18 -0400 (EDT) Received: from 68.175.84.212 (SquirrelMail authenticated user matthew) by mail.tocr.com with HTTP; Thu, 2 Jun 2005 23:38:18 -0400 (EDT) Message-ID: <31520.68.175.84.212.1117769898.squirrel@mail.tocr.com> In-Reply-To: <14703.1117728639@sss.pgh.pa.us> References: <00d501c5667d$8cc12320$f20214ac@bite.lt> <13878.1117636799@sss.pgh.pa.us> <018601c56744$9d5aae50$f20214ac@bite.lt> <13178.1117719939@sss.pgh.pa.us> <02db01c5677e$d43d3b10$f20214ac@bite.lt> <14703.1117728639@sss.pgh.pa.us> Date: Thu, 2 Jun 2005 23:38:18 -0400 (EDT) Subject: Re: How to avoid database bloat From: matthew@tocr.com To: "Tom Lane" Cc: "Mindaugas Riauba" , pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.4-1.FC2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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: 200506/97 X-Sequence-Number: 12735 > "Mindaugas Riauba" writes: >> And what in vacuum verbose output suggests that vacuum is not done >> often enough? Current output (table is 100MB already) is below. > > The output shows vacuum cleaning up about a third of the table. Usually > people like to keep the overhead down to 10% or so ... He was running with -V 0.5 which should transalate to roughly 50% of the table being touched before a vacuum is issued.j Matt From pgsql-performance-owner@postgresql.org Fri Jun 3 00:49: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 1D86B528BB for ; Fri, 3 Jun 2005 00:46:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11324-08 for ; Fri, 3 Jun 2005 03:45:44 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id 8D5F152802 for ; Fri, 3 Jun 2005 00:45:43 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so663611wra for ; Thu, 02 Jun 2005 20:45:38 -0700 (PDT) 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:content-disposition:references; b=hqYdIPCd1Vefe4fx559zZutIL05EuPajyuIR7dcGTn+sQ3oaXbZa5y2STt5WXJtJFH5YSV8il+/d146boIDed0/Hs1mUSUW52TZPJ42n6keaDnWkLkwNDk2w0vCvGjespDO88doESq6CFOYaYKS0ayrodub/JbIaE0ECaBHMldQ= Received: by 10.54.150.2 with SMTP id x2mr962802wrd; Thu, 02 Jun 2005 20:45:38 -0700 (PDT) Received: by 10.54.91.14 with HTTP; Thu, 2 Jun 2005 20:45:37 -0700 (PDT) Message-ID: Date: Fri, 3 Jun 2005 13:45:38 +1000 From: Paul McGarry Reply-To: paul@paulmcgarry.com To: Mark Kirkwood Subject: SHMMAX / SHMALL Was (Re: postgresql-8.0.1 performance tuning) Cc: Cosimo Streppone , Martin Fandel , Postgresql Performance list In-Reply-To: <429D56B2.9070302@paradise.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1117201312.7060.6.camel@fandelm.ecommit.de> <429D47FD.7090501@streppone.it> <429D56B2.9070302@paradise.net.nz> X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/57 X-Sequence-Number: 12695 On 6/1/05, Mark Kirkwood wrote: > Cosimo Streppone wrote: > > ######### Config ############ > >> /etc/sysctl.conf: > >> kernel.shmall =3D 786432000 > >> kernel.shmmax =3D 786432000 > > > > I think you have a problem here. > > kernel.shmmax should *not* be set to an amount of RAM, but > > to maximum number of shared memory pages, which on a typical linux syst= em > > is 4kb. Google around: > > > This is somewhat confusing : >=20 > kernel.shmmax is in bytes (max single segment size) > kernel.shmall is in (4k) pages (max system wide allocated segment pages) Can someone resummarize the situation with these linux parameters for the dummies? I thought I had my calculations all sorted out but now I've confused myself again. The documentation at http://www.postgresql.org/docs/8.0/interactive/kernel-resources.html puts the same figure into both values but the posts here seem to suggest that is wrong? Or is it different on a 2.4 kernel and the documentation needs updating? In my specific case I have about 800meg of memory on a linux 2.4 kernel box= . Based on the powerpostgresql.com Performance Checklist [1] and Annotated Postgresql.conf [2] I understand that: -I should have less than 1/3 of my total memory as shared_buffers -For my server 15000 is a fairly reasonable starting point for shared_buffers which is ~120MB -I have 100 max_connections. So I was going to set SHMMAX to 134217728 (ie 128 Meg) What should SHMALL be? The current system values are postgres@localhost:~/data$ cat /proc/sys/kernel/shmmax 33554432 postgres@localhost:~/data$ cat /proc/sys/kernel/shmall 2097152 ie SHMALL seems to be 1/16 of SHMMAX Paul [1] http://www.powerpostgresql.com/PerfList/ [2] http://www.powerpostgresql.com/Downloads/annotated_conf_80.html From pgsql-performance-owner@postgresql.org Fri Jun 3 03:12: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 C869D52874 for ; Fri, 3 Jun 2005 03:12:07 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46021-06 for ; Fri, 3 Jun 2005 06:11:58 +0000 (GMT) Received: from linda-5.paradise.net.nz (bm-5a.paradise.net.nz [202.0.58.24]) by svr1.postgresql.org (Postfix) with ESMTP id 9E5E55281D for ; Fri, 3 Jun 2005 03:11:57 -0300 (ADT) Received: from smtp-2.paradise.net.nz (smtp-2b.paradise.net.nz [202.0.32.211]) by linda-5.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IHH00KLQVVWZQ@linda-5.paradise.net.nz> for pgsql-performance@postgresql.org; Fri, 03 Jun 2005 18:11:57 +1200 (NZST) Received: from [192.168.1.11] (218-101-13-183.paradise.net.nz [218.101.13.183]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id A4B369E6A5; Fri, 03 Jun 2005 18:11:55 +1200 (NZST) Date: Fri, 03 Jun 2005 18:11:54 +1200 From: Mark Kirkwood Subject: Re: SHMMAX / SHMALL Was (Re: postgresql-8.0.1 performance In-reply-to: To: paul@paulmcgarry.com Cc: Cosimo Streppone , Martin Fandel , Postgresql Performance list Message-id: <429FF4AA.7090200@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050511) References: <1117201312.7060.6.camel@fandelm.ecommit.de> <429D47FD.7090501@streppone.it> <429D56B2.9070302@paradise.net.nz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.172 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/58 X-Sequence-Number: 12696 Paul McGarry wrote: > Based on the powerpostgresql.com Performance Checklist [1] and > Annotated Postgresql.conf [2] I understand that: > -I should have less than 1/3 of my total memory as shared_buffers > -For my server 15000 is a fairly reasonable starting point for > shared_buffers which is ~120MB > -I have 100 max_connections. > > So I was going to set SHMMAX to 134217728 (ie 128 Meg) > > What should SHMALL be? > > The current system values are > postgres@localhost:~/data$ cat /proc/sys/kernel/shmmax > 33554432 > postgres@localhost:~/data$ cat /proc/sys/kernel/shmall > 2097152 > > ie SHMALL seems to be 1/16 of SHMMAX > No - shmall is in 4k pages _ so this amounts to 8G! This is fine - unless you wish to decrease it in order to prevent too many shared memory applications running. BTW - the docs have been amended for 8.1 to suggest shmmax=134217728 and shmall=2097152 (was going to point you at them - but I cannot find them on the Postgresql site anymore...). There seems to be some longstanding confusion in the Linux community about the units for shmall (some incorrect documentation from Oracle on the issue does not help I am sure....) - to the point where I downloaded kernel source to check (reproducing here): linux-2.6.11.1/include/linux/shm.h:13-> #define SHMMAX 0x2000000 /* max shared seg size (bytes) */ #define SHMMIN 1 /* min shared seg size (bytes) */ #define SHMMNI 4096 /* max num of segs system wide */ #define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */ #define SHMSEG SHMMNI Hope that helps Best wishes Mark From pgsql-performance-owner@postgresql.org Fri Jun 3 03:35: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 31D3B52867 for ; Fri, 3 Jun 2005 03:35:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53821-05 for ; Fri, 3 Jun 2005 06:35:33 +0000 (GMT) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id E116052806 for ; Fri, 3 Jun 2005 03:35:28 -0300 (ADT) Received: (qmail 1073 invoked by uid 0); 3 Jun 2005 06:35:28 -0000 Received: from 217.17.202.254 by www35.gmx.net with HTTP; Fri, 3 Jun 2005 08:35:28 +0200 (MEST) Date: Fri, 3 Jun 2005 08:35:28 +0200 (MEST) From: "Marc Mamin" To: pgsql-performance@postgresql.org MIME-Version: 1.0 References: <1117758630.429fa4a66825f@webmail.rawbw.com> Subject: Query limitations (size, number of UNIONs ...) X-Priority: 3 (Normal) X-Authenticated: #3793498 Message-ID: <30384.1117780528@www35.gmx.net> X-Mailer: WWW-Mail 1.6 (Global Message Exchange) X-Flags: 0001 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.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/59 X-Sequence-Number: 12697 Hello, I've split my data in daily tables to keep them in an acceptable size. Now I have quite complex queries which may be very long if I need to query a large number of daily tables. I've just made a first test wich resulted in a query being 15KB big annd containing 63 UNION. The Query plan in PGAdmin is about 100KB big with 800 lines :-) The performance is not such bad, but I'm wondering if there are some POSTGRES limitations I should take care of with this strategy. Thanks, Marc -- Geschenkt: 3 Monate GMX ProMail gratis + 3 Ausgaben stern gratis ++ Jetzt anmelden & testen ++ http://www.gmx.net/de/go/promail ++ From pgsql-performance-owner@postgresql.org Fri Jun 3 04:07: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 3DC4E52806 for ; Fri, 3 Jun 2005 04:07:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61940-01 for ; Fri, 3 Jun 2005 07:07:28 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id AECFA52802 for ; Fri, 3 Jun 2005 04:07:26 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j5377Q0A018025 for ; Fri, 3 Jun 2005 09:07:27 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j5377QqO018024 for ; Fri, 3 Jun 2005 09:07:26 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Fri, 03 Jun 2005 09:07:25 +0200 (CEST) Date: Fri, 3 Jun 2005 09:06:41 +0200 From: "Martin Fandel" To: pgsql-performance@postgresql.org Message-ID: <1117782401.4380.37.camel@fandelm.ecommit.de> Subject: Filesystem x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline 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: 200506/60 X-Sequence-Number: 12698 Hi @ all, i have only a little question. Which filesystem is preferred for postgresql? I'm plan to use xfs (before i used reiserfs). The reason is the xfs_freeze Tool to make filesystem-snapshots. Is the performance better than reiserfs, is it reliable? best regards, Martin From pgsql-bugs-owner@postgresql.org Fri Jun 3 10:22:30 2005 X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 00FBE528BB for ; Fri, 3 Jun 2005 04:09:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59949-05 for ; Fri, 3 Jun 2005 07:09:01 +0000 (GMT) Received: from web50805.mail.yahoo.com (web50805.mail.yahoo.com [206.190.38.114]) by svr1.postgresql.org (Postfix) with SMTP id 72132528A8 for ; Fri, 3 Jun 2005 04:08:59 -0300 (ADT) Received: (qmail 62048 invoked by uid 60001); 3 Jun 2005 07:09:00 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=zWW389gXjecBw+2YZX8Us5l3ceqljEyg3pWwPB6YgbKiiYALI3Xfn74TL/qWq/JbYVGDtwxpzFbPjG5u9WW7OZKdl973K5LglUF2lUnHSUoVvChCgmgk/Gp5OCCHhH9z8R6MFz2uUvqFNac/lLB43tKQ+WGPcze5gR9gaGtPzSQ= ; Message-ID: <20050603070900.62046.qmail@web50805.mail.yahoo.com> Received: from [195.33.105.17] by web50805.mail.yahoo.com via HTTP; Fri, 03 Jun 2005 00:09:00 PDT Date: Fri, 3 Jun 2005 00:09:00 -0700 (PDT) From: Bahadur Singh Subject: Re: BUG #1697: Select getting slower on continously updating data To: Bruno Wolff III Cc: pgsql-bugs@postgresql.org, pgsql-novice@postgresql.org, pgsql-performance@postgresql.org In-Reply-To: <20050602130259.GB9716@wolff.to> 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.969 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST X-Spam-Level: X-Archive-Number: 200506/25 X-Sequence-Number: 11984 --- Bruno Wolff III wrote: > This does not belong on the pgsql-bugs list. The > pgsql-novice or > pgsql-performance lists seem more appropiate. I have > set followups > to the pgsql-novice list. > > On Thu, Jun 02, 2005 at 12:05:00 +0100, > Bahadur Singh wrote: > > > > Hello, > > > > I found situtation that, when I am selecting data > from a table of 200 > > records, getting slower as I do continous update > to the same existing data. > > You need to be vacuuming (and possibly analyzing) > the table more often as the > updates will leave dead rows in the table which will > bloat the table size and > slow down access, particularly sequential scans. If > the updates modify the > data value distributions significantly, then you > will also need to > reanalyze the table to help the planner make good > decisions. > Many thanks for this tip ! But is this good idea to analyse/vacuuming the database tables while updates are taking place.. Since, I update continuously say (100,000 ) times or more the same data set. This is the result of analyze command. INFO: analyzing "public.salesarticle" INFO: "salesarticle": scanned 3000 of 20850 pages, containing 62 live rows and 134938 dead rows; 62 rows in sample, 431 estimated total rows Gesamtlaufzeit der Abfrage: 5531 ms. Total Time Taken : 5531 ms. Can you suggest me some clever way to so, because I would prefer to do vaccumming while database is not loaded with queries/transactions. Regards Bahadur __________________________________ Discover Yahoo! Find restaurants, movies, travel and more fun for the weekend. Check it out! http://discover.yahoo.com/weekend.html From pgsql-performance-owner@postgresql.org Fri Jun 3 04:43: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 E9C30528CE for ; Fri, 3 Jun 2005 04:43:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71253-01 for ; Fri, 3 Jun 2005 07:43:03 +0000 (GMT) Received: from smtp3.libero.it (smtp3.libero.it [193.70.192.127]) by svr1.postgresql.org (Postfix) with ESMTP id 40294528C7 for ; Fri, 3 Jun 2005 04:43:01 -0300 (ADT) Received: from localhost (172.16.1.79) by smtp3.libero.it (7.0.027-DD01) id 428B9D5C003836A9; Fri, 3 Jun 2005 09:43:00 +0200 Received: from [151.25.102.133] (151.25.102.133) by smtp2.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41BF65E407F51417; Fri, 3 Jun 2005 09:43:20 +0200 Message-ID: <42A008AD.7010307@streppone.it> Date: Fri, 03 Jun 2005 09:37:17 +0200 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stacy White Cc: Postgresql Performance list Subject: Re: Adaptec/LSI/?? RAID References: <002601c56725$2bdd2010$0200a8c0@grownups> In-Reply-To: <002601c56725$2bdd2010$0200a8c0@grownups> 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.048 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/61 X-Sequence-Number: 12699 Stacy White wrote: > We're in the process of buying another Opteron server to run Postgres, and > based on the suggestions in this list I've asked our IT director to get an > LSI MegaRaid controller rather than one of the Adaptecs. > > But when we tried to place our order, our vendor (Penguin Computing) advised > "we find LSI does not work well with 4GB of RAM. Our engineering find that > LSI card could cause system crashes. One of our customer ... has found that > Adaptec cards works well on PostGres SQL Probably, your vendor is trying to avoid problems at all, but "one of our customers" is not a pretty general case, and "we find LSI does not work well", but is there a documented reason? Anyway, my personal experience has been with an Acer Altos R701 + S300 external storage unit, equipped with LSI Logic Megaraid U320 aka AMI Megaraid aka LSI Elite 1600 (honestly, these cards come with zillions of names and subnames, that I don't know exactly how to call them). This system was configured in various ways. The final layout is 3 x RAID1 arrays (each of 2 disks) and 1 x RAID10 array (12 disks). This configuration is only available when you use 2 LSI cards (one for each S300 scsi bus). The system behaves pretty well, with a sustained sequential write rate of 80Mb/s, and more importantly, a quite high load in our environment of 10 oltp transactions per second, without any problems and `cat /proc/loadavg` < 1. I don't like the raid configuration system of LSI, that is counter-intuitive for raid 10 arrays. It got me 4 hours and a tech support call to figure out how to do it right. Also, I think LSI cards don't behave well with particular raid configurations, like RAID 0 with 4 disks, or RAID 10 with also 4 disks. It seemed that these configurations put the controller under heavy load, thus behaving unreasonably worse than, for example, 6-disks-RAID0 or 6-disks-RAID1. Sorry, I can't be more "scientific" on this. For Adaptec, I don't have any direct experience. -- Cosimo From pgsql-performance-owner@postgresql.org Fri Jun 3 05:41: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 10A855286E for ; Fri, 3 Jun 2005 05:41:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83641-04 for ; Fri, 3 Jun 2005 08:41:09 +0000 (GMT) Received: from ns1.bi.lt (ns.bi.lt [213.226.131.131]) by svr1.postgresql.org (Postfix) with ESMTP id 3977C52851 for ; Fri, 3 Jun 2005 05:41:07 -0300 (ADT) Received: from B027543 (inet.bee.lt [213.226.131.30]) by ns1.bi.lt (8.12.11/8.12.11) with SMTP id j538f866028729; Fri, 3 Jun 2005 11:41:09 +0300 Message-ID: <010701c56817$fd543d20$f20214ac@bite.lt> From: "Mindaugas Riauba" To: "Matthew T. O'Connor" Cc: "Tom Lane" , References: <00d501c5667d$8cc12320$f20214ac@bite.lt> <13878.1117636799@sss.pgh.pa.us> <018601c56744$9d5aae50$f20214ac@bite.lt> <13178.1117719939@sss.pgh.pa.us> <02db01c5677e$d43d3b10$f20214ac@bite.lt> <429F2F73.8050406@zeut.net> Subject: Re: How to avoid database bloat Date: Fri, 3 Jun 2005 11:41:08 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1257" Content-Transfer-Encoding: 7bit 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.129 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/62 X-Sequence-Number: 12700 > >>AFAICT the vacuum is doing what it is supposed to, and the problem has > >>to be just that it's not being done often enough. Which suggests either > >>an autovacuum bug or your autovacuum settings aren't aggressive enough. > > > > -D -d 1 -v 1000 -V 0.5 -a 1000 -A 0.1 -s 10 > > > > That is autovacuum settings. Should be aggressive enough I think? > > Might e aggressive enough, but might not. I have seen some people run > -V 0.1. Also you probably don't need -A that low. This could an issue > where analyze results in an inaccurate reltuples value which is > preventing autovacuum from doing it's job. Could you please run it with > -d 2 and show us the relevant log output. Relevant parts are below. And we had to set so aggressive analyze because otherwise planer statistics were getting old too fast. As I said table has very high turnover most of the records live here only for a few seconds. And one more question - anyway why table keeps growing? It is shown that it occupies <10000 pages and max_fsm_pages = 200000 so vacuum should keep up with the changes? Or is it too low according to pg_class system table? What should be the reasonable value? select sum(relpages) from pg_class; sum ------- 77994 (1 row) Thanks, Mindaugas [2005-06-03 09:30:31 EEST] DEBUG: Performing: ANALYZE "queue" [2005-06-03 09:30:31 EEST] INFO: table name: database."queue" [2005-06-03 09:30:31 EEST] INFO: relid: 465440; relisshared: 0 [2005-06-03 09:30:31 EEST] INFO: reltuples: 98615.000000; relpages: 6447 [2005-06-03 09:30:31 EEST] INFO: curr_analyze_count: 39475111; curr_vacuum_count: 30 953987 [2005-06-03 09:30:31 EEST] INFO: last_analyze_count: 39475111; last_vacuum_count: 30 913733 [2005-06-03 09:30:31 EEST] INFO: analyze_threshold: 10861; vacuum_threshold: 43700 [2005-06-03 09:31:11 EEST] DEBUG: Performing: VACUUM ANALYZE "queue" [2005-06-03 09:31:12 EEST] INFO: table name: database."queue" [2005-06-03 09:31:12 EEST] INFO: relid: 465440; relisshared: 0 [2005-06-03 09:31:12 EEST] INFO: reltuples: 99355.000000; relpages: 6447 [2005-06-03 09:31:12 EEST] INFO: curr_analyze_count: 39480332; curr_vacuum_count: 30 957872 [2005-06-03 09:31:12 EEST] INFO: last_analyze_count: 39480332; last_vacuum_count: 30 957872 [2005-06-03 09:31:12 EEST] INFO: analyze_threshold: 10935; vacuum_threshold: 50677 From pgsql-performance-owner@postgresql.org Fri Jun 3 05:50: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 25D5F5286E for ; Fri, 3 Jun 2005 05:50:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84059-06 for ; Fri, 3 Jun 2005 08:50:25 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id ECE0052851 for ; Fri, 3 Jun 2005 05:50:23 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j538no0A025123; Fri, 3 Jun 2005 10:49:51 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j538nopV025122; Fri, 3 Jun 2005 10:49:50 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Fri, 03 Jun 2005 10:49:48 +0200 (CEST) Date: Fri, 3 Jun 2005 10:49:04 +0200 From: "Martin Fandel" To: Mark Kirkwood Cc: pgsql-performance@postgresql.org Message-ID: <1117788544.4380.79.camel@fandelm.ecommit.de> In-Reply-To: <429FF4AA.7090200@paradise.net.nz> References: <1117201312.7060.6.camel@fandelm.ecommit.de> References: <429D47FD.7090501@streppone.it> References: <429D56B2.9070302@paradise.net.nz> References: References: <429FF4AA.7090200@paradise.net.nz> Subject: Re: SHMMAX / SHMALL Was (Re: postgresql-8.0.1 performance tuning) x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/63 X-Sequence-Number: 12701 Aah ok :) I've set my values now as follow (2GB RAM): SHMMAX=`cat /proc/meminfo | grep MemTotal | cut -d: -f 2 | awk '{print $1*1024/3}'` echo kernel.shmmax=${SHMMAX} >> /etc/sysctl.conf SHMALL=`expr ${SHMALL} / 4096 \* \( 4096 / 16 \)` echo kernel.shmall=${SHMALL} >> /etc/sysctl.conf sysctl.conf: kernel.shmmax=708329472 kernel.shmall=44270592 postgresql.conf: max_connections=500 shared_buffers=40000 # ~312MB, min. 1000, max ~ 83000 best regards, Martin Am Freitag, den 03.06.2005, 18:11 +1200 schrieb Mark Kirkwood: > Paul McGarry wrote: > > > Based on the powerpostgresql.com Performance Checklist [1] and > > Annotated Postgresql.conf [2] I understand that: > > -I should have less than 1/3 of my total memory as shared_buffers > > -For my server 15000 is a fairly reasonable starting point for > > shared_buffers which is ~120MB > > -I have 100 max_connections. > > > > So I was going to set SHMMAX to 134217728 (ie 128 Meg) > > > > What should SHMALL be? > > > > The current system values are > > postgres@localhost:~/data$ cat /proc/sys/kernel/shmmax > > 33554432 > > postgres@localhost:~/data$ cat /proc/sys/kernel/shmall > > 2097152 > > > > ie SHMALL seems to be 1/16 of SHMMAX > > > > No - shmall is in 4k pages _ so this amounts to 8G! This is fine - > unless you wish to decrease it in order to prevent too many shared > memory applications running. > > BTW - the docs have been amended for 8.1 to suggest shmmax=134217728 and > shmall=2097152 (was going to point you at them - but I cannot find them > on the Postgresql site anymore...). > > There seems to be some longstanding confusion in the Linux community > about the units for shmall (some incorrect documentation from Oracle on > the issue does not help I am sure....) - to the point where I downloaded > kernel source to check (reproducing here): > > > linux-2.6.11.1/include/linux/shm.h:13-> > > #define SHMMAX 0x2000000 /* max shared seg size (bytes) */ > #define SHMMIN 1 /* min shared seg size (bytes) */ > #define SHMMNI 4096 /* max num of segs system wide */ > #define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide > (pages) */ > #define SHMSEG SHMMNI > > > Hope that helps > > Best wishes > > Mark From pgsql-performance-owner@postgresql.org Fri Jun 3 06:11: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 EB08A5286E for ; Fri, 3 Jun 2005 06:11:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86915-10 for ; Fri, 3 Jun 2005 09:11:42 +0000 (GMT) Received: from linda-3.paradise.net.nz (bm-3a.paradise.net.nz [202.0.58.22]) by svr1.postgresql.org (Postfix) with ESMTP id 02D1E52851 for ; Fri, 3 Jun 2005 06:11:38 -0300 (ADT) Received: from smtp-2.paradise.net.nz (smtp-2b.paradise.net.nz [202.0.32.211]) by linda-3.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IHI00HAD47F24@linda-3.paradise.net.nz> for pgsql-performance@postgresql.org; Fri, 03 Jun 2005 21:11:39 +1200 (NZST) Received: from [192.168.1.11] (218-101-13-183.paradise.net.nz [218.101.13.183]) by smtp-2.paradise.net.nz (Postfix) with ESMTP id 004569F569; Fri, 03 Jun 2005 21:10:26 +1200 (NZST) Date: Fri, 03 Jun 2005 21:10:24 +1200 From: Mark Kirkwood Subject: Re: SHMMAX / SHMALL Was (Re: postgresql-8.0.1 performance In-reply-to: <1117788544.4380.79.camel@fandelm.ecommit.de> To: Martin Fandel Cc: pgsql-performance@postgresql.org Message-id: <42A01E80.2030507@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050511) References: <1117201312.7060.6.camel@fandelm.ecommit.de> <1117788544.4380.79.camel@fandelm.ecommit.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.167 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/64 X-Sequence-Number: 12702 Martin Fandel wrote: > Aah ok :) > > I've set my values now as follow (2GB RAM): > > SHMMAX=`cat /proc/meminfo | grep MemTotal | cut -d: -f 2 | awk '{print > $1*1024/3}'` > echo kernel.shmmax=${SHMMAX} >> /etc/sysctl.conf > SHMALL=`expr ${SHMALL} / 4096 \* \( 4096 / 16 \)` > echo kernel.shmall=${SHMALL} >> /etc/sysctl.conf > > sysctl.conf: > kernel.shmmax=708329472 > kernel.shmall=44270592 > > postgresql.conf: > max_connections=500 > shared_buffers=40000 # ~312MB, min. 1000, max ~ 83000 > Hmmm - shmall set to 168G... err why? Apologies for nit picking a little - but shmall seems unreasonably high. I can't see much reason for setting it bigger than (physical RAM in bytes)/4096 myself. So in your case this is 2*(1024*1024*1024)/4096 = 524288 Cheers Mark From pgsql-performance-owner@postgresql.org Fri Jun 3 06:20: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 8C5A8528CE for ; Fri, 3 Jun 2005 06:19:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93536-08 for ; Fri, 3 Jun 2005 09:19:52 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id 270825286A for ; Fri, 3 Jun 2005 06:19:51 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j539Jn0A002424; Fri, 3 Jun 2005 11:19:49 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j539JntS002385; Fri, 3 Jun 2005 11:19:49 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Fri, 03 Jun 2005 11:19:48 +0200 (CEST) Date: Fri, 3 Jun 2005 11:19:03 +0200 From: "Martin Fandel" To: Mark Kirkwood Cc: pgsql-performance@postgresql.org Message-ID: <1117790343.4380.89.camel@fandelm.ecommit.de> In-Reply-To: <42A01E80.2030507@paradise.net.nz> References: <1117201312.7060.6.camel@fandelm.ecommit.de> References: <1117788544.4380.79.camel@fandelm.ecommit.de> References: <42A01E80.2030507@paradise.net.nz> Subject: Re: SHMMAX / SHMALL Was (Re: postgresql-8.0.1 performance tuning) x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.032 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/65 X-Sequence-Number: 12703 ok i set it to 524288. ;) Am Freitag, den 03.06.2005, 21:10 +1200 schrieb Mark Kirkwood: > Martin Fandel wrote: > > Aah ok :) > > > > I've set my values now as follow (2GB RAM): > > > > SHMMAX=`cat /proc/meminfo | grep MemTotal | cut -d: -f 2 | awk '{print > > $1*1024/3}'` > > echo kernel.shmmax=${SHMMAX} >> /etc/sysctl.conf > > SHMALL=`expr ${SHMALL} / 4096 \* \( 4096 / 16 \)` > > echo kernel.shmall=${SHMALL} >> /etc/sysctl.conf > > > > sysctl.conf: > > kernel.shmmax=708329472 > > kernel.shmall=44270592 > > > > postgresql.conf: > > max_connections=500 > > shared_buffers=40000 # ~312MB, min. 1000, max ~ 83000 > > > > Hmmm - shmall set to 168G... err why? Apologies for nit picking a little > - but shmall seems unreasonably high. I can't see much reason for > setting it bigger than (physical RAM in bytes)/4096 myself. So in your > case this is 2*(1024*1024*1024)/4096 = 524288 > > Cheers > > Mark > From pgsql-performance-owner@postgresql.org Fri Jun 3 07: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 734C252816 for ; Fri, 3 Jun 2005 07:41:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09291-10 for ; Fri, 3 Jun 2005 10:41:23 +0000 (GMT) Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz [202.0.58.23]) by svr1.postgresql.org (Postfix) with ESMTP id 638625280A for ; Fri, 3 Jun 2005 07:41:22 -0300 (ADT) Received: from smtp-1.paradise.net.nz (smtp-1a.paradise.net.nz [202.0.32.194]) by linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IHI00EPX8D0L8@linda-4.paradise.net.nz> for pgsql-performance@postgresql.org; Fri, 03 Jun 2005 22:41:24 +1200 (NZST) Received: from [192.168.1.11] (218-101-13-183.paradise.net.nz [218.101.13.183]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 60E7782CF6; Fri, 03 Jun 2005 22:41:24 +1200 (NZST) Date: Fri, 03 Jun 2005 22:41:22 +1200 From: Mark Kirkwood Subject: Re: Filesystem In-reply-to: <1117782401.4380.37.camel@fandelm.ecommit.de> To: Martin Fandel Cc: pgsql-performance@postgresql.org Message-id: <42A033D2.3080609@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050511) References: <1117782401.4380.37.camel@fandelm.ecommit.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.162 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/66 X-Sequence-Number: 12704 Martin Fandel wrote: > Hi @ all, > > i have only a little question. Which filesystem is preferred for > postgresql? I'm plan to use xfs (before i used reiserfs). The reason > is the xfs_freeze Tool to make filesystem-snapshots. > > Is the performance better than reiserfs, is it reliable? > I used postgresql with xfs on mandrake 9.0/9.1 a while ago - reliability was great, performance seemed better than ext3. I didn't compare with reiserfs - the only time I have ever lost data from a Linux box has been when I used reiserfs, hence I am not a fan :-( best wishes Mark From pgsql-performance-owner@postgresql.org Fri Jun 3 09:22: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 0EDA152861 for ; Fri, 3 Jun 2005 09:22:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42006-01 for ; Fri, 3 Jun 2005 12:22:47 +0000 (GMT) Received: from mail3.vodafone.ie (lughnasa.vodafone.ie [213.233.128.5]) by svr1.postgresql.org (Postfix) with ESMTP id 17F8E52802 for ; Fri, 3 Jun 2005 09:22:45 -0300 (ADT) Received: from iecsai19 (10.163.136.100) by mail3.vodafone.ie (7.2.033.1) id 428A1D1200068C74; Fri, 3 Jun 2005 13:22:42 +0100 Message-ID: <189960.1117801361979.JavaMail.tomcat@iecsai19> Date: Fri, 3 Jun 2005 13:22:41 +0100 (IST) From: Reply-To: To: tgl@sss.pgh.pa.us Subject: Re: Query plan for very large number of joins Cc: pgsql-performance@postgresql.org Mime-Version: 1.0 Content-Type: text/plain;charset="UTF-8" Content-Transfer-Encoding: 7bit X-CP-Disclaimer: 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: 200506/67 X-Sequence-Number: 12705 >>> I am using PostgreSQL (7.4) with a schema that was generated >>> automatically (using hibernate). The schema consists of about 650 >>> relations. One particular query (also generated automatically) >>> consists of left joining approximately 350 tables. [snip] >One thought is that I am not sure I believe the conclusion that planning >is taking only 36 ms; even realizing that the exclusive use of left >joins eliminates options for join order, there are still quite a lot of >plans to consider. You should try both EXPLAIN and EXPLAIN ANALYZE >from psql and see how long each takes. It'd also be interesting to keep >an eye on how large the backend process grows while doing this --- maybe >it's being driven into swap. Thanks for the suggestion. I've timed both the EXPLAIN and the EXPLAIN ANALYZE operations. Both operations took 1m 37s. The analyze output indicates that the query execution time was 950ms. This doesn't square with the JDBC prepareStatement executing in 36ms. My guess is that the prepare was actually a no-op but I haven't found anything about this yet. So, is it correct to interpret this as the query planner taking an awful long time? Is it possible to force the query planner to adopt a specific strategy and not search for alternatives (I'm aware of the noXX options, it's the reverse logic that I'm thinking of here). Alternatively, is there some way to check if the query planner is bottlenecking on a specific resource? Finally, PFC was asking about the nature of the application, it's not a specific application just a generic bit of infrastructure consisting of a transformation of the UBL schema. Despite being fairly restricted in scope, the schema is highly denormalized hence the large number of tables. Thanks for all your help. -phil I'm using Vodafone Mail - to get your free mobile email account go to http://www.vodafone.ie Use of Vodafone Mail is subject to Terms and Conditions http://www.vodafone.ie/terms/website From pgsql-performance-owner@postgresql.org Fri Jun 3 10:15: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 A9D5052855 for ; Fri, 3 Jun 2005 10:15:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55984-01 for ; Fri, 3 Jun 2005 13:14:59 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 39F9C5280A for ; Fri, 3 Jun 2005 10:14:56 -0300 (ADT) 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 j53DF0Nc003979; Fri, 3 Jun 2005 09:15:00 -0400 (EDT) To: philb@vodafone.ie Cc: pgsql-performance@postgresql.org Subject: Re: Query plan for very large number of joins In-reply-to: <189960.1117801361979.JavaMail.tomcat@iecsai19> References: <189960.1117801361979.JavaMail.tomcat@iecsai19> Comments: In-reply-to message dated "Fri, 03 Jun 2005 13:22:41 +0100" Date: Fri, 03 Jun 2005 09:15:00 -0400 Message-ID: <3978.1117804500@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: 200506/68 X-Sequence-Number: 12706 writes: > Thanks for the suggestion. I've timed both the EXPLAIN and the EXPLAIN ANALYZE operations. > Both operations took 1m 37s. The analyze output indicates that the query > execution time was 950ms. This doesn't square with the JDBC prepareStatement > executing in 36ms. My guess is that the prepare was actually a no-op but > I haven't found anything about this yet. Only in very recent JDBCs does prepareStatement do much of anything. > So, is it correct to interpret this as the query planner taking an > awful long time? Looks that way. > Is it possible to force the query planner to adopt a specific strategy > and not search for alternatives (I'm aware of the noXX options, it's the > reverse logic that I'm thinking of here). There's no positive forcing method. But you could probably save some time by disabling both mergejoin and hashjoin, now that you know it's going to end up picking nestloop for each join anyway. Even more important: are you sure that *every* one of the joins is a LEFT JOIN? Even a couple of regular joins will let it fool around choosing different join orders. > Alternatively, is there some way to check if the query planner is > bottlenecking on a specific resource? I think it would be interesting to try profiling it. I'm not really expecting to find anything easily-fixable, but you never know. From what you said before, the database is not all that large --- would you be willing to send me a database dump and the text of the query off-list? regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jun 3 10:18: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 AD02B528BB for ; Fri, 3 Jun 2005 10:18:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52210-08 for ; Fri, 3 Jun 2005 13:18:25 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id ED5E65287A for ; Fri, 3 Jun 2005 10:18:21 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so284436wra for ; Fri, 03 Jun 2005 06:18:26 -0700 (PDT) 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:references; b=VAruUZuOJae9UajrCkzhpG03VARvykhNhXdVS3fkqo3uHFYLy2uzLSXLUdqI3J6Eerh2YGumPAf+U73IMteNZKTviOPFMFzQhxlSOcB3vR2yXvVLwQXVSkzxUSeiopXAAmvmPW7kviur//Pi6pmlpO3YXtQ6z3eIq87EBCGQPNM= Received: by 10.54.13.44 with SMTP id 44mr1115957wrm; Fri, 03 Jun 2005 06:18:10 -0700 (PDT) Received: by 10.54.86.15 with HTTP; Fri, 3 Jun 2005 06:18:10 -0700 (PDT) Message-ID: <33c6269f050603061824b0cdbf@mail.gmail.com> Date: Fri, 3 Jun 2005 09:18:10 -0400 From: Alex Turner Reply-To: Alex Turner To: Martin Fandel Subject: Re: Filesystem Cc: pgsql-performance@postgresql.org In-Reply-To: <1117782401.4380.37.camel@fandelm.ecommit.de> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5480_19158441.1117804690189" References: <1117782401.4380.37.camel@fandelm.ecommit.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.354 tagged_above=0 required=5 tests=AWL, HTML_20_30, HTML_MESSAGE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/69 X-Sequence-Number: 12707 ------=_Part_5480_19158441.1117804690189 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline We have been using XFS for about 6 months now and it has even tolerated a= =20 controller card crash. So far we have mostly good things to report about=20 XFS. I benchmarked raw throughputs at various stripe sizes, and XFS came ou= t=20 on top for us against reiser and ext3. I also used it because of it's=20 supposed good support for large files, which was verified somewhat by the= =20 benchmarks. I have noticed a problem though - if you have 800000 files in a directory,= =20 it seems that XFS chokes on simple operations like 'ls' or 'chmod -R ...'= =20 where ext3 doesn't, don't know about reiser, I went straight back to defaul= t=20 after that problem (that partition is not on a DB server though). Alex Turner netEconomist On 6/3/05, Martin Fandel wrote: >=20 > Hi @ all, >=20 > i have only a little question. Which filesystem is preferred for > postgresql? I'm plan to use xfs (before i used reiserfs). The reason > is the xfs_freeze Tool to make filesystem-snapshots. >=20 > Is the performance better than reiserfs, is it reliable? >=20 > best regards, > Martin >=20 >=20 > ---------------------------(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 > ------=_Part_5480_19158441.1117804690189 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline We have been using XFS for about 6 months now and it has even tolerated a controller card crash.  So far we have mostly good things to report about XFS.  I benchmarked raw throughputs at various stripe sizes, and XFS came out on top for us against reiser and ext3.  I also used it because of it's supposed good support for large files, which was verified somewhat by the benchmarks.

I have noticed a problem though - if you have 800000 files in a directory, it seems that XFS chokes on simple operations like 'ls' or 'chmod -R ...' where ext3 doesn't, don't know about reiser, I went straight back to default after that problem (that partition is not on a DB server though).

Alex Turner
netEconomist

On 6/3/05, Martin Fandel <martin.fandel@alphyra-evs.de> wrote: Hi @ all,

i have only a little question. Which filesystem is preferr= ed for
postgresql? I'm plan to use xfs (before i used reiserfs). The rea= son
is the xfs_freeze Tool to make filesystem-snapshots.

Is the p= erformance better than reiserfs, is it reliable?

best regards,
Martin


---------------------------(end = of broadcast)---------------------------
TIP 3: if posting/reading throu= gh Usenet, please send an appropriate
     &nbs= p;subscribe-nomail command to=20 majordomo@postgresql.org so= that your
      message can get through t= o the mailing list cleanly

------=_Part_5480_19158441.1117804690189-- From pgsql-performance-owner@postgresql.org Fri Jun 3 10: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 3429452851 for ; Fri, 3 Jun 2005 10:27:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57384-08 for ; Fri, 3 Jun 2005 13:27:30 +0000 (GMT) Received: from relay.snowman.net (relay.snowman.net [66.92.160.56]) by svr1.postgresql.org (Postfix) with ESMTP id 1201652872 for ; Fri, 3 Jun 2005 10:27:29 -0300 (ADT) Received: from ns.snowman.net (ns.snowman.net [10.10.0.2]) by relay.snowman.net (8.13.1/8.13.1/Debian-19) with ESMTP id j53DRI4j003358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 3 Jun 2005 09:27:18 -0400 Received: from ns.snowman.net (localhost [127.0.0.1]) by ns.snowman.net (8.13.4/8.13.4/Debian-2) with ESMTP id j53DRLsX026853 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 3 Jun 2005 09:27:21 -0400 Received: (from sfrost@localhost) by ns.snowman.net (8.13.4/8.13.4/Submit) id j53DRKhT026851; Fri, 3 Jun 2005 09:27:20 -0400 Date: Fri, 3 Jun 2005 09:27:20 -0400 From: Stephen Frost To: Marc Mamin Cc: pgsql-performance@postgresql.org Subject: Re: Query limitations (size, number of UNIONs ...) Message-ID: <20050603132720.GB30011@ns.snowman.net> Mail-Followup-To: Marc Mamin , pgsql-performance@postgresql.org References: <1117758630.429fa4a66825f@webmail.rawbw.com> <30384.1117780528@www35.gmx.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hs0MrtevJDaC/yEQ" Content-Disposition: inline In-Reply-To: <30384.1117780528@www35.gmx.net> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/2.4.24ns.3.0 (i686) X-Uptime: 09:26:34 up 489 days, 8:15, 8 users, load average: 0.34, 0.35, 0.24 User-Agent: Mutt/1.5.6+20040907i 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: 200506/70 X-Sequence-Number: 12708 --hs0MrtevJDaC/yEQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Marc Mamin (m.mamin@gmx.net) wrote: > I've just made a first test wich resulted in a query being 15KB big annd > containing 63 UNION. If the data is distinct from each other or you don't mind duplicate records you might try using 'union all' instead of 'union'. Just a thought. Stephen --hs0MrtevJDaC/yEQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCoFq4rzgMPqB3kigRAnxrAKCN7D/pVpVt7SBJln7+8tO4ihiswQCdFQzu stx3eWWzw0ivbgRhPPX8n9k= =1cxA -----END PGP SIGNATURE----- --hs0MrtevJDaC/yEQ-- From pgsql-performance-owner@postgresql.org Fri Jun 3 10:53: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 12A0E52861 for ; Fri, 3 Jun 2005 10:53:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65936-04 for ; Fri, 3 Jun 2005 13:52:53 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id 9843952841 for ; Fri, 3 Jun 2005 10:52:51 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j53Dqo0A003337; Fri, 3 Jun 2005 15:52:50 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j53Dqocc003336; Fri, 3 Jun 2005 15:52:50 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Fri, 03 Jun 2005 15:52:45 +0200 (CEST) Date: Fri, 3 Jun 2005 15:52:00 +0200 From: "Martin Fandel" To: Alex Turner Cc: pgsql-performance@postgresql.org Message-ID: <1117806720.4380.129.camel@fandelm.ecommit.de> In-Reply-To: <33c6269f050603061824b0cdbf@mail.gmail.com> References: <1117782401.4380.37.camel@fandelm.ecommit.de> References: <33c6269f050603061824b0cdbf@mail.gmail.com> Subject: Re: Filesystem x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.028 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/71 X-Sequence-Number: 12709 Hi i have tested a xfs+LVM installation with the scalix (HP OpenMail) Mailserver (it's a little time ago). I had at that time some problems using xfs_freeze. I used a script for freezing the fs and making storing the snapshots. Sometimes the complete Server hangs (no blinking cursor, no possible logins, no network). I don't know if it was a hardware problem or if it was the xfs-software. I installed/compiled the newest kernel for this system (i think it was a 2.6.9) to check out if it's maybe a kernel-problem. But on the next days, the system hangs again. After that i used reiserfs again. I tested it with Suse Linux Enterprise Server 8. Has someone heared about such problems? That is the only reason that i have a bit fear to use xfs for a critical database :/. Best regards, Martin Am Freitag, den 03.06.2005, 09:18 -0400 schrieb Alex Turner: > We have been using XFS for about 6 months now and it has even > tolerated a controller card crash. So far we have mostly good things > to report about XFS. I benchmarked raw throughputs at various stripe > sizes, and XFS came out on top for us against reiser and ext3. I also > used it because of it's supposed good support for large files, which > was verified somewhat by the benchmarks. > > I have noticed a problem though - if you have 800000 files in a > directory, it seems that XFS chokes on simple operations like 'ls' or > 'chmod -R ...' where ext3 doesn't, don't know about reiser, I went > straight back to default after that problem (that partition is not on > a DB server though). > > Alex Turner > netEconomist > > On 6/3/05, Martin Fandel wrote: > Hi @ all, > > i have only a little question. Which filesystem is preferred > for > postgresql? I'm plan to use xfs (before i used reiserfs). The > reason > is the xfs_freeze Tool to make filesystem-snapshots. > > Is the performance better than reiserfs, is it reliable? > > best regards, > Martin > > > ---------------------------(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 Fri Jun 3 11: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 17D4E52872 for ; Fri, 3 Jun 2005 11:24:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71877-07 for ; Fri, 3 Jun 2005 14:23:59 +0000 (GMT) Received: from mail3.vodafone.ie (lughnasa.vodafone.ie [213.233.128.5]) by svr1.postgresql.org (Postfix) with ESMTP id 74A545280A for ; Fri, 3 Jun 2005 11:23:58 -0300 (ADT) Received: from iecsai19 (10.163.136.100) by mail3.vodafone.ie (7.2.033.1) id 428A1D1200069A4B; Fri, 3 Jun 2005 15:24:02 +0100 Message-ID: <16345223.1117808642877.JavaMail.tomcat@iecsai19> Date: Fri, 3 Jun 2005 15:24:02 +0100 (IST) From: Reply-To: To: pgsql-performance@postgresql.org Subject: Re: Query plan for very large number of joins Cc: tgl@sss.pgh.pa.us Mime-Version: 1.0 Content-Type: text/plain;charset="UTF-8" Content-Transfer-Encoding: 7bit X-CP-Disclaimer: 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: 200506/72 X-Sequence-Number: 12710 Anyone following this thread might be interested to know that disabling the merge and hash joins (as suggested below) resulted in the execution time dropping from ~90 seconds to ~35 seconds. Disabling GEQO has brought about a marginal reduction (~1 second, pretty much within the the margin of error) Tom, a quick grep indicates that all of the joins are left joins so there's no scope for tweaking there. I'll send you the schema + query offlist, anyone else curious about it, let me know. Thanks again, -phil > writes: >> Thanks for the suggestion. I've timed both the EXPLAIN and the EXPLAIN ANALYZE operations. >> Both operations took 1m 37s. The analyze output indicates that the query >> execution time was 950ms. This doesn't square with the JDBC prepareStatement >> executing in 36ms. My guess is that the prepare was actually a no-op but >> I haven't found anything about this yet. > >Only in very recent JDBCs does prepareStatement do much of anything. > >> So, is it correct to interpret this as the query planner taking an >> awful long time? > >Looks that way. > >> Is it possible to force the query planner to adopt a specific strategy >> and not search for alternatives (I'm aware of the noXX options, it's the >> reverse logic that I'm thinking of here). > >There's no positive forcing method. But you could probably save some >time by disabling both mergejoin and hashjoin, now that you know it's >going to end up picking nestloop for each join anyway. Even more >important: are you sure that *every* one of the joins is a LEFT JOIN? >Even a couple of regular joins will let it fool around choosing >different join orders. > >> Alternatively, is there some way to check if the query planner is >> bottlenecking on a specific resource? > >I think it would be interesting to try profiling it. I'm not really >expecting to find anything easily-fixable, but you never know. From >what you said before, the database is not all that large --- would >you be willing to send me a database dump and the text of the query >off-list? I'm using Vodafone Mail - to get your free mobile email account go to http://www.vodafone.ie Use of Vodafone Mail is subject to Terms and Conditions http://www.vodafone.ie/terms/website From pgsql-bugs-owner@postgresql.org Fri Jun 3 11:50:49 2005 X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 98B82528AD for ; Fri, 3 Jun 2005 11:50:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82204-05 for ; Fri, 3 Jun 2005 14:50:45 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 6747F52874 for ; Fri, 3 Jun 2005 11:50:44 -0300 (ADT) Received: (qmail 10896 invoked by uid 500); 3 Jun 2005 14:49:51 -0000 Date: Fri, 3 Jun 2005 09:49:51 -0500 From: Bruno Wolff III To: Bahadur Singh Cc: pgsql-bugs@postgresql.org, pgsql-novice@postgresql.org, pgsql-performance@postgresql.org Subject: Re: BUG #1697: Select getting slower on continously updating data Message-ID: <20050603144951.GA10195@wolff.to> Mail-Followup-To: Bruno Wolff III , Bahadur Singh , pgsql-bugs@postgresql.org, pgsql-novice@postgresql.org, pgsql-performance@postgresql.org References: <20050602130259.GB9716@wolff.to> <20050603070900.62046.qmail@web50805.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050603070900.62046.qmail@web50805.mail.yahoo.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: 200506/31 X-Sequence-Number: 11990 On Fri, Jun 03, 2005 at 00:09:00 -0700, Bahadur Singh wrote: > > Many thanks for this tip ! > But is this good idea to analyse/vacuuming the > database tables while updates are taking place.. > Since, I update continuously say (100,000 ) times or > more the same data set. > > This is the result of analyze command. > > INFO: analyzing "public.salesarticle" > INFO: "salesarticle": scanned 3000 of 20850 pages, > containing 62 live rows and 134938 dead rows; 62 rows > in sample, 431 estimated total rows > > Gesamtlaufzeit der Abfrage: 5531 ms. > Total Time Taken : 5531 ms. > > Can you suggest me some clever way to so, because I > would prefer to do vaccumming while database is not > loaded with queries/transactions. While that may be a nice preference, under your usage pattern that does not appear to be a good idea. As long as your disk I/O isn't saturated you want to be running vacuums a lot more often than you are. (Analyze should only be needed if the distrution of values is changing constantly. An example would be timestamps indicating when an update occured.) From pgsql-performance-owner@postgresql.org Fri Jun 3 13:43: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 6139152802 for ; Fri, 3 Jun 2005 13:43:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14399-02 for ; Fri, 3 Jun 2005 16:43:13 +0000 (GMT) Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by svr1.postgresql.org (Postfix) with ESMTP id 2E1A552918 for ; Fri, 3 Jun 2005 13:43:12 -0300 (ADT) 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.51) id 1DeFGI-0001nx-6I; Fri, 03 Jun 2005 12:43:10 -0400 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 Message-ID: <42A0889A.2050200@zeut.net> Date: Fri, 03 Jun 2005 12:43:06 -0400 From: "Matthew T. O'Connor" Organization: Terrie O'Connor Realtors User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mindaugas Riauba Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: How to avoid database bloat References: <00d501c5667d$8cc12320$f20214ac@bite.lt> <13878.1117636799@sss.pgh.pa.us> <018601c56744$9d5aae50$f20214ac@bite.lt> <13178.1117719939@sss.pgh.pa.us> <02db01c5677e$d43d3b10$f20214ac@bite.lt> <429F2F73.8050406@zeut.net> <010701c56817$fd543d20$f20214ac@bite.lt> In-Reply-To: <010701c56817$fd543d20$f20214ac@bite.lt> Content-Type: text/plain; charset=windows-1257; format=flowed Content-Transfer-Encoding: 7bit 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: 200506/74 X-Sequence-Number: 12712 Mindaugas Riauba wrote: >>Might e aggressive enough, but might not. I have seen some people run >>-V 0.1. Also you probably don't need -A that low. This could an issue >>where analyze results in an inaccurate reltuples value which is >>preventing autovacuum from doing it's job. Could you please run it with >>-d 2 and show us the relevant log output. >> >> > > Relevant parts are below. And we had to set so aggressive analyze because >otherwise planer statistics were getting old too fast. As I said table has >very >high turnover most of the records live here only for a few seconds. > > Looked like pg_autovacuum is operating as expected. One of the annoying limitations of pg_autovacuum in current releases is that you can't set thresholds on a per table basis. It looks like this table might require an even more aggressive vacuum threshold. Couple of thoughts, are you sure it's the table that is growing and not the indexes? (assuming this table has indexes on it). > And one more question - anyway why table keeps growing? It is shown that >it occupies ><10000 pages and max_fsm_pages = 200000 so vacuum should keep up with the >changes? >Or is it too low according to pg_class system table? What should be the >reasonable value? > > Does the table keep growing? Or does it grow to a point an then stop growing? It's normal for a table to operate at a steady state size that is bigger that it's fresly "vacuum full"'d size. And with -V set at 0.5 it should be at a minimum 50% larger than it's minimum size. Your email before said that this table went from 20M to 70M but does it keep going? Perhaps it would start leveling off at this point, or some point shortly there-after. Anyway, I'm not sure if there is something else going on here, but from the log it looks as though pg_autovacuum is working as advertised. From pgsql-performance-owner@postgresql.org Fri Jun 3 14:18: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 18D4A528D1 for ; Fri, 3 Jun 2005 14:18:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22808-04 for ; Fri, 3 Jun 2005 17:18:46 +0000 (GMT) Received: from mx1.neopolitan.us (mx1.neopolitan.us [65.87.16.224]) by svr1.postgresql.org (Postfix) with ESMTP id 9C9F75287E for ; Fri, 3 Jun 2005 14:18:45 -0300 (ADT) Received: from [65.87.16.98] (account jrogers@neopolitan.com) by mx1.neopolitan.us (CommuniGate Pro WebUser 4.2.10) with HTTP id 9626787; Fri, 03 Jun 2005 10:18:45 -0700 From: "J. Andrew Rogers" Subject: Re: Filesystem To: "Martin Fandel" , pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro WebUser Interface v.4.2.10 Date: Fri, 03 Jun 2005 10:18:45 -0700 Message-ID: In-Reply-To: <1117782401.4380.37.camel@fandelm.ecommit.de> References: <1117782401.4380.37.camel@fandelm.ecommit.de> MIME-Version: 1.0 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=1.312 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200506/75 X-Sequence-Number: 12713 On Fri, 3 Jun 2005 09:06:41 +0200 "Martin Fandel" wrote: > i have only a little question. Which filesystem is >preferred for postgresql? I'm plan to use xfs >(before i used reiserfs). The reason > is the xfs_freeze Tool to make filesystem-snapshots. XFS has worked great for us, and has been both reliable and fast. Zero problems and currently our standard server filesystem. Reiser, on the other hand, has on rare occasion eaten itself on the few systems where someone was running a Reiser partition, though none were running Postgres at the time. We have deprecated the use of Reiser on all systems where it is not already running. In terms of performance for Postgres, the rumor is that XFS and JFS are at the top of the heap, definitely better than ext3 and somewhat better than Reiser. I've never used JFS, but I've seen a few benchmarks that suggest it is at least as fast as XFS for Postgres. Since XFS is more mature than JFS on Linux, I go with XFS by default. If some tragically bad problems develop with XFS I may reconsider that position, but we've been very happy with it so far. YMMV. cheers, J. Andrew Rogers From pgsql-performance-owner@postgresql.org Fri Jun 3 14:29: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 805DF52875 for ; Fri, 3 Jun 2005 14:29:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25905-06 for ; Fri, 3 Jun 2005 17:29: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 504655281A for ; Fri, 3 Jun 2005 14:29:03 -0300 (ADT) 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 j53HT3ll006293; Fri, 3 Jun 2005 13:29:03 -0400 (EDT) To: philb@vodafone.ie Cc: pgsql-performance@postgreSQL.org Subject: Re: Query plan for very large number of joins In-reply-to: <28184313.1117809262031.JavaMail.tomcat@iecsai19> References: <28184313.1117809262031.JavaMail.tomcat@iecsai19> Comments: In-reply-to message dated "Fri, 03 Jun 2005 15:34:22 +0100" Date: Fri, 03 Jun 2005 13:29:03 -0400 Message-ID: <6292.1117819743@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: 200506/76 X-Sequence-Number: 12714 writes: > I've attached the schema and query text, hopefully it will be of some use > to you. Note that both are taken from the HyperUBL project > (https://hyperubl.dev.java.net/). Sadly, at this stage I think it's > time for me to try alternatives to either Hibernate or Postgresql. Thanks. Profiling on 7.4 I get this for an EXPLAIN (after vacuum analyzing the database): % cumulative self self total time seconds seconds calls Ks/call Ks/call name 61.66 618.81 618.81 2244505819 0.00 0.00 compare_path_costs 15.01 769.44 150.63 1204882 0.00 0.00 add_path 8.08 850.57 81.13 772077 0.00 0.00 nth 3.76 888.27 37.70 1113598 0.00 0.00 nconc 2.59 914.30 26.03 233051 0.00 0.00 find_joininfo_node 2.23 936.70 22.40 30659124 0.00 0.00 bms_equal 1.14 948.14 11.44 39823463 0.00 0.00 equal 0.77 955.84 7.70 83300 0.00 0.00 find_base_rel This is with no special planner settings. Obviously the problem is that it's considering way too many different paths. We did do something about that in 8.0 (basically, throw away paths with "nearly the same" cost) ... but the bottom line didn't improve a whole lot. CVS tip profile for the same case is % cumulative self self total time seconds seconds calls s/call s/call name 38.37 176.41 176.41 53344348 0.00 0.00 list_nth_cell 35.26 338.52 162.11 196481 0.00 0.00 get_rte_attribute_is_dropped 5.42 363.44 24.92 233051 0.00 0.00 find_joininfo_node 4.72 385.14 21.70 30659416 0.00 0.00 bms_equal 4.09 403.95 18.81 53344348 0.00 0.00 list_nth 2.31 414.58 10.63 37347920 0.00 0.00 equal 1.40 421.03 6.45 83299 0.00 0.00 find_base_rel 1.08 426.01 4.98 617917 0.00 0.00 SearchCatCache 0.90 430.13 4.12 5771640 0.00 0.00 AllocSetAlloc The get_rte_attribute_is_dropped calls (and list_nth/list_nth_cell, which are mostly being called from there) arise from a rather hastily added patch that prevents failure when a JOIN list in a stored view refers to a since-dropped column of an underlying relation. I had not realized that that check could have O(N^2) behavior in deeply nested joins, but it does. Obviously we'll have to rethink that. After that it looks like the next hotspot is find_joininfo_node (and bms_equal which is mostly getting called from there). We could maybe fix that by rethinking the joininfo data structure --- right now it's a collection of simple Lists, which betrays the planner's Lispy heritage ;-). Again, that's not something I've ever seen at the top of a profile before --- there may be some O(N^2) behavior involved here too, but I've not analyzed it in detail. It does look like 8.0 would be about a factor of 2 faster for you than 7.4, but the real fix will probably have to wait for 8.1. Also: the 8.0 problem is definitely an O(N^2) type of deal, which means if you could reduce the depth of nesting by a factor of 2 the cost would go down 4x. You said this was an automatically generated query, so there may not be much you can do about it, but if you could parenthesize the FROM list a bit more intelligently the problem would virtually go away. What you have is effectively FROM ((((a left join b) left join c) left join d) .... so the nesting goes all the way down. With something like FROM ((a left join b) left join c ...) left join ((d left join e) left join f ...) the max nesting depth would be halved. I don't understand your schema at all so I'm not sure what an appropriate nesting might look like, but maybe there is a short-term workaround to be found there. (This will *not* help on 7.4, as the bottleneck there is completely different.) regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jun 3 15:47: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 287D2528CD for ; Fri, 3 Jun 2005 15:47:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50656-10 for ; Fri, 3 Jun 2005 18:47:31 +0000 (GMT) Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net [66.238.115.135]) by svr1.postgresql.org (Postfix) with ESMTP id 8160C528AD for ; Fri, 3 Jun 2005 15:47:29 -0300 (ADT) Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; Fri, 3 Jun 2005 11:50:35 -0700 Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Fri, 3 Jun 2005 11:50:33 -0700 Received: from barracuda.tecarta.com ([192.168.160.200]) by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id M2005060311503315664 for ; Fri, 03 Jun 2005 11:50:33 -0700 X-ASG-Debug-ID: 1117824434-14286-25-0 X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi Received: from mail2 (mail2.hq.corp [192.168.160.6]) by barracuda.tecarta.com (Spam Firewall) with SMTP id 1DC672022085 for ; Fri, 3 Jun 2005 11:47:14 -0700 (PDT) Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 3 Jun 2005 11:50:25 -0700 Message-ID: <42A0A549.6070501@sfnet.cc> Date: Fri, 03 Jun 2005 11:45:29 -0700 From: Steve Poe User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050516) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org X-ASG-Orig-Subj: Postgresql and Software RAID/LVM Subject: Postgresql and Software RAID/LVM Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Jun 2005 18:50:25.0075 (UTC) FILETIME=[1A3B6030:01C5686D] X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=4.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_50 X-Barracuda-Spam-Report: Code version 3.02, rules version 3.0.1482 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 BAYES_50 BODY: Bayesian spam probability is 40 to 60% [score: 0.5445] 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: 200506/77 X-Sequence-Number: 12715 I have a small business client that cannot afford high-end/high quality RAID cards for their next server. That's a seperate argument/issue right there for me, but what the client wants is what the client wants. Has anyone ran Postgres with software RAID or LVM on a production box? What have been your experience? I don't forsee more 10-15 concurrent sessions running for an their OLTP application. Thanks. Steve Poe From pgsql-performance-owner@postgresql.org Sun Jun 5 22:28: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 06D64528D0 for ; Fri, 3 Jun 2005 22:51:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45983-05 for ; Sat, 4 Jun 2005 01:51:20 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id BB4455280B for ; Fri, 3 Jun 2005 22:51:19 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 6FF3330952; Sat, 4 Jun 2005 03:47:49 +0200 (MET DST) From: Bill Ewing X-Newsgroups: pgsql.performance Subject: Re: Need help to decide Mysql vs Postgres Date: Fri, 3 Jun 2005 15:01:29 -0500 Organization: Database Forum Lines: 62 Message-ID: X-Complaints-To: usenet@news.hub.org User-Agent: droptable.com news gateway X-Newsreader: droptable.com news gateway X-Originating-IP: 206.111.112.115 To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.298 tagged_above=0 required=5 tests=FROM_HAS_MIXED_NUMS X-Spam-Level: X-Archive-Number: 200506/95 X-Sequence-Number: 12733 A consultant did a project for us and chose MySQL. We thought it was cool that MySQL was free. Turns out, MySQL costs over $500 (USD) if you are a commercial organization like us! Even worse, we have to formally transfer licenses to customers and any further transfers must include involvement of the MySQL organization. Since we are a reputable organization, we diligently track the license numbers- I make my mfg group log them, print them and include them in the BOM of systems we ship. Occassionally, I audit them to make sure we are staying legal. I spent many hours studying the MySQL license agreements, I found ambiguitites and questions and called their rep several times. As usual, licenses punish the honest people. What a PITA. The cost for us to do that work and tracking is hard to measure but is certainly not free. This prompted me to look around and find another open source database that did not go over to the dark side and turn greedy. Since Postgres has true foreign key integrity enforcement and truly has a reputation for being hardened and robust, it got our attention. We are pretty close to choosing PostgreSQL 8.x. Since we know and use only Windows, there's still some learning curve and pain we are going through. Fortunately, there is a simple installer for windows. The PGAdmin tool that comes with PG looks decent and a company named EMS makes a decent looking tool for about $195. Trouble is, we are not DB admins. We're programmers who love and know java, JDBC and a few other languages. So, our problem in installing is we don't know a cluster or SSL from a hole in the ground. Things get confusing about contexts- are we talking about a user of the system or the database? Yikes, do I need to write down the 30+ character autogenerated password? We just want to use JDBC, code SQL queries and essentially not care what database is under us. We would love to find a good tool that runs as an Eclipse plug-in that lets us define our database, generate a script file to create it and perhaps also help us concoct queries. Our experience is that the many UNIX-ish thing about postgres are there and we don't know UNIX. This makes you realize how much you take for granted about the OS you do know. Of course, we'll learn, but postgres people, if you're listening: good job, now take us a little farther and we will be your most ardent supporters. ==Bill== -- Bill Ewing ------------------------------------------------------------------------ Posted via http://www.codecomments.com ------------------------------------------------------------------------ From pgsql-performance-owner@postgresql.org Fri Jun 3 19:03: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 7C9FB5284D for ; Fri, 3 Jun 2005 19:03:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41367-08 for ; Fri, 3 Jun 2005 22:03:16 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id B9F9952838 for ; Fri, 3 Jun 2005 19:03:15 -0300 (ADT) Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j53Lrna3005122; Fri, 3 Jun 2005 14:53:50 -0700 Message-ID: <42A0D3A5.1020509@commandprompt.com> Date: Fri, 03 Jun 2005 15:03:17 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Steve Poe Cc: pgsql-performance@postgresql.org Subject: Re: Postgresql and Software RAID/LVM References: <42A0A549.6070501@sfnet.cc> In-Reply-To: <42A0A549.6070501@sfnet.cc> 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.018 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/78 X-Sequence-Number: 12716 Steve Poe wrote: > I have a small business client that cannot afford high-end/high quality > RAID cards for their next server. That's a seperate argument/issue right > there for me, but what the client wants is what the client wants. > > Has anyone ran Postgres with software RAID or LVM on a production box? > What have been your experience? I would not run RAID + LVM in a software scenario. Software RAID is fine however. Sincerely, Joshua D. Drake > > I don't forsee more 10-15 concurrent sessions running for an their OLTP > application. > > Thanks. > > Steve Poe > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org -- Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 PostgreSQL Replication, Consulting, Custom Programming, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ From pgsql-performance-owner@postgresql.org Fri Jun 3 20:13: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 0A6CF52820 for ; Fri, 3 Jun 2005 20:13:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86153-10 for ; Fri, 3 Jun 2005 23:13:23 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id E9EF852816 for ; Fri, 3 Jun 2005 20:13:22 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id E4B9230952; Sat, 4 Jun 2005 01:09:49 +0200 (MET DST) From: "Morgan" X-Newsgroups: pgsql.performance Subject: Insert slow down on empty database Date: Fri, 3 Jun 2005 16:13:21 -0700 Organization: Hub.Org Networking Services Lines: 31 Message-ID: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4942.400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4942.400 To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.185 tagged_above=0 required=5 tests=PRIORITY_NO_NAME X-Spam-Level: * X-Archive-Number: 200506/79 X-Sequence-Number: 12717 Hi, I am having a problem with inserting a large amount of data with my libpqxx program into an initially empty database. It appears to be the EXACT same problem discussed here: http://archives.postgresql.org/pgsql-bugs/2005-03/msg00183.php In fact my situation is nearly identical, with roughly 5 major tables, with foreign keys between each other. All the tables are being loaded into similtaneously with about 2-3 million rows each. It seems that the problem is caused by the fact that I am using prepared statments, that cause the query planner to choose sequential scans for the foreign key checks due to the table being initially empty. As with the post above, if I dump my connection after about 4000 inserts, and restablish it the inserts speed up by a couple of orders of magnitude and remain realtively constant through the whole insertion. At first I was using straight insert statments, and although they were a bit slower than the prepared statments(after the restablished connection) they never ran into this problem with the database being initially empty. I only changed to the prepared statements because it was suggested in the documentation for advice on bulk data loads =). I can work around this problem, and I am sure somebody is working on fixing this, but I thought it might be good to reaffirm the problem. Thanks, Morgan Kita From pgsql-performance-owner@postgresql.org Fri Jun 3 20:22: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 AB5CE5284D for ; Fri, 3 Jun 2005 20:22:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01958-03 for ; Fri, 3 Jun 2005 23:22:54 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id B44F552816 for ; Fri, 3 Jun 2005 20:22:53 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 865F330952; Sat, 4 Jun 2005 01:19:22 +0200 (MET DST) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Forcing use of specific index Date: Fri, 03 Jun 2005 16:22:49 -0700 Organization: Hub.Org Networking Services Lines: 23 Message-ID: References: <20050602020528.GL26100@tobias.exoweb.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040803 X-Accept-Language: en-us, en In-Reply-To: <20050602020528.GL26100@tobias.exoweb.net> 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: 200506/80 X-Sequence-Number: 12718 A pretty awful way is to mangle the sql statement so the other field logical statements are like so: select * from mytable where 0+field = 100 Tobias Brox wrote: > Is it any way to attempt to force the planner to use some specific index > while creating the plan? Other than eventually dropping all the other > indices (which is obiously not a solution in production setting anyway)? > > I have one case where I have added 16 indices to a table, many of them > beeing partial indices. The table itself has only 50k of rows, but are > frequently used in heavy joins. I imagine there can be exponential order on > the number of alternative paths the planner must examinate as function of > the number of indices? > > It seems to me that the planner is quite often not choosing the "best" > index, so I wonder if there is any easy way for me to check out what the > planner think about a specific index :-) > From pgsql-performance-owner@postgresql.org Fri Jun 3 20: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 55299528BB for ; Fri, 3 Jun 2005 20:28:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97787-08 for ; Fri, 3 Jun 2005 23:28:31 +0000 (GMT) Received: from cmailm4.svr.pol.co.uk (cmailm4.svr.pol.co.uk [195.92.193.211]) by svr1.postgresql.org (Postfix) with ESMTP id 8D63F52816 for ; Fri, 3 Jun 2005 20:28:31 -0300 (ADT) Received: from modem-2569.leopard.dialup.pol.co.uk ([217.135.154.9] helo=192.168.0.102) by cmailm4.svr.pol.co.uk with esmtp (Exim 4.41) id 1DeLab-0000tq-Bc; Sat, 04 Jun 2005 00:28:33 +0100 Subject: Re: Query plan for very large number of joins From: Simon Riggs To: philb@vodafone.ie Cc: pgsql-performance@postgresql.org In-Reply-To: <189960.1117801361979.JavaMail.tomcat@iecsai19> References: <189960.1117801361979.JavaMail.tomcat@iecsai19> Content-Type: text/plain Organization: 2nd Quadrant Date: Sat, 04 Jun 2005 00:23:57 +0100 Message-Id: <1117841037.3844.1250.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.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/81 X-Sequence-Number: 12719 On Fri, 2005-06-03 at 13:22 +0100, philb@vodafone.ie wrote: > > >>> I am using PostgreSQL (7.4) with a schema that was generated > >>> automatically (using hibernate). The schema consists of about 650 > >>> relations. One particular query (also generated automatically) > >>> consists of left joining approximately 350 tables. > Despite being fairly restricted in scope, > the schema is highly denormalized hence the large number of tables. Do you mean normalized? Or do you mean you've pushed the superclass details down onto each of the leaf classes? I guess I'm interested in what type of modelling led you to have so many tables in the first place? Gotta say, never seen 350 table join before in a real app. Wouldn't it be possible to smooth out the model and end up with less tables? Or simply break things up somewhere slightly down from the root of the class hierarchy? Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Fri Jun 3 22:50: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 4BBCC5281D for ; Fri, 3 Jun 2005 22:50:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52966-01 for ; Sat, 4 Jun 2005 01:50:04 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 58098528C7 for ; Fri, 3 Jun 2005 22:50:02 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 67F7030952; Sat, 4 Jun 2005 03:46:31 +0200 (MET DST) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Insert slow down on empty database Date: Fri, 03 Jun 2005 21:20:08 -0400 Organization: cbbrowne Computing Inc Lines: 17 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 (Jumbo Shrimp, linux) Cancel-Lock: sha1:0ubWAGQGI9Q0NDt3tchbLJ7xRlU= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.386 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200506/82 X-Sequence-Number: 12720 In an attempt to throw the authorities off his trail, "Morgan" transmitted: > At first I was using straight insert statments, and although they > were a bit slower than the prepared statments(after the restablished > connection) they never ran into this problem with the database being > initially empty. I only changed to the prepared statements because > it was suggested in the documentation for advice on bulk data loads > =). I remember encountering this with Oracle, and the answer being "do some loading 'til it slows down, then update statistics and restart." I don't know that there's an obvious alternative outside of perhaps some variation on pg_autovacuum... -- If this was helpful, rate me http://linuxdatabases.info/info/spreadsheets.html So long and thanks for all the fish. From pgsql-performance-owner@postgresql.org Fri Jun 3 22:52: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 8FD1C5281A for ; Fri, 3 Jun 2005 22:52:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39652-09 for ; Sat, 4 Jun 2005 01:52:25 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.201]) by svr1.postgresql.org (Postfix) with ESMTP id ACFDE5280B for ; Fri, 3 Jun 2005 22:52:23 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id 40so1438101nzk for ; Fri, 03 Jun 2005 18:52:28 -0700 (PDT) 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:content-disposition:references; b=dQtBs4/qSGaHlPH7qBpoLAHU3TMAmBOevdqR7aWgdVWGpWu8OFVo2cBKS91e3Z2oqRPpAM8nDgldr9qsLXB+3auZz1PuYwOUIHzjNeM7vbFUSKLMIlp4hokXuwi4kTwWyCj+ZNOG6ETByA7FLw/ivE5OJo1dbZoBtPJ3WAY0cHs= Received: by 10.36.34.12 with SMTP id h12mr1334850nzh; Fri, 03 Jun 2005 18:52:27 -0700 (PDT) Received: by 10.36.47.20 with HTTP; Fri, 3 Jun 2005 18:52:27 -0700 (PDT) Message-ID: <8d04ce9905060318523d368995@mail.gmail.com> Date: Fri, 3 Jun 2005 18:52:27 -0700 From: Junaili Lie Reply-To: Junaili Lie To: pgsql-performance@postgresql.org Subject: Re: Forcing use of specific index In-Reply-To: <20050602020528.GL26100@tobias.exoweb.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050602020528.GL26100@tobias.exoweb.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.099 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/83 X-Sequence-Number: 12721 HI all, I also would like to know if there is a way to force a use of a specific index for a specific query. I am currently using Postgresql 7.4.6 In my case I have a relatively big table (several millions of records) that are frequently used to join with other tables (explicit join or through view). The table has several indices, some are single column and some are multi co= lumn. Some queries are faster if using single colum index while other are faster using multi column indexes. I have play around with SET STATISTICS, but it doesn't seem to make any differences (I tried to set it to 1000 one time, but still the same). I did analyze and vacuum after SET STATISTICS. Any pointer on how to do this is greatly appreciated. Thank you in advance, J On 6/1/05, Tobias Brox wrote: > Is it any way to attempt to force the planner to use some specific index > while creating the plan? Other than eventually dropping all the other > indices (which is obiously not a solution in production setting anyway)? >=20 > I have one case where I have added 16 indices to a table, many of them > beeing partial indices. The table itself has only 50k of rows, but are > frequently used in heavy joins. I imagine there can be exponential order= on > the number of alternative paths the planner must examinate as function of > the number of indices? >=20 > It seems to me that the planner is quite often not choosing the "best" > index, so I wonder if there is any easy way for me to check out what the > planner think about a specific index :-) >=20 > -- > Tobias Brox, Beijing >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From pgsql-performance-owner@postgresql.org Sat Jun 4 05: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 4C3ED5284D for ; Sat, 4 Jun 2005 05:17:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75112-08 for ; Sat, 4 Jun 2005 08:17:49 +0000 (GMT) Received: from viper.eo.pl (viper.eo.pl [217.17.46.133]) by svr1.postgresql.org (Postfix) with ESMTP id CC88A52841 for ; Sat, 4 Jun 2005 05:17:47 -0300 (ADT) Received: from xxx.hq.eo.pl ([192.168.20.129] helo=localhost.localdomain) by viper with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1DeTqh-0007AE-9g for pgsql-performance@postgresql.org; Sat, 04 Jun 2005 10:17:47 +0200 Received: from depesz by localhost.localdomain with local (Exim 4.50) id 1DeTqg-0001GR-AN for pgsql-performance@postgresql.org; Sat, 04 Jun 2005 10:17:42 +0200 Date: Sat, 4 Jun 2005 10:17:42 +0200 From: hubert lubaczewski To: pgsql-performance@postgresql.org Subject: strategies for optimizing read on rather large tables Message-ID: <20050604081742.GA29123@eo.pl> Reply-To: hubert.lubaczewski@eo.pl Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YZ5djTAD1cGYuMQK" Content-Disposition: inline X-info-en-1: this message *may* reflect my personal opinion. it is *not* X-info-en-2: intended to reflect those of my employer, or anyone else. X-info-pl-1: wszelkie opinie =?iso-8859-2?Q?wyra=BFone_?= =?iso-8859-2?Q?w_tym_li=B6cie_prezentuj=B1_wy=B3=B1cznie_pogl=B1dy?= X-info-pl-2: autora listu. opinie =?iso-8859-2?Q?te_?= =?iso-8859-2?Q?w_=BFadnym__razie_nie__wyra=BFaj=B1__pogl=B1d=F3w?= X-info-pl-3: pracodawcy autora =?iso-8859-2?Q?listu_?= =?iso-8859-2?Q?_ani__innych__zwi=B1zanych__z__nim__os=F3b=2E?= User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/84 X-Sequence-Number: 12722 --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable hi first let me draw the outline. we have a database which stores "adverts". each advert is in one category, and one or more "region". regions and categories form (each) tree structure. assume category tree: a / \ b c / \ d e if any given advert is in category "e". it means it is also in "b" and "a". same goes for regions. as for now we have approx. 400 categories, 1300 regions, and 1000000 adverts. since checking always over the tress of categories and regions we created acr_cache table (advert/category/region) which stores information on all adverts and all categories and regions this particular region is in. plus some more information for sorting purposes. this table is ~ 11 milion records. now. we query this in more or less this manner: select advert_id from acr_cache where category_id =3D ? and region_id =3D ? order by XXX {asc|desc} limit 20; where XXX is one of 5 possible fields, timestamp, timestamp, text, text, numeric we created index on acr_cache (category_id, region_id)=20 and it works rather well. usually. if a given "crossing" (category + region) has small amount of ads (less then 10000) - the query is good enough (up to 300 miliseconds). but when we enter the crossings which result in 50000 ads - the query takes up to 10 seconds. which is almost "forever". we thought about creating indices like this: index on acr_cache (effective_date); where effective_dateis on of the timestamp fields. it worked well for the crossings with lots of ads, but when we asked for small crossing (like 1000 ads) it took > 120 seconds! it appears that postgresql was favorizing this new advert instead of using much better index on category_id and region_id. actually - i'm not sure what to do next. i am even thinkinh about createing special indices (partial) for big crossings, but that's just weird. plus the fact that already the acr_cache vacuum time exceeds 3 hours!. any suggestions? hardware is dual xeon 3 ghz, 4G ram, hardware scsi raid put into raid 1. settings in postgresql.conf: listen_addresses =3D '*' port =3D 5800 max_connections =3D 300 superuser_reserved_connections =3D 50 shared_buffers =3D 131072 work_mem =3D 4096 maintenance_work_mem =3D 65536 fsync =3D false commit_delay =3D 100 commit_siblings =3D 5 checkpoint_segments =3D 10 effective_cache_size =3D 10000 random_page_cost =3D 1.1 log_destination =3D 'stderr' redirect_stderr =3D true log_directory =3D '/home/pgdba/logs' log_filename =3D 'postgresql-%Y-%m-%d_%H%M%S.log' log_truncate_on_rotation =3D false log_rotation_age =3D 1440 log_rotation_size =3D 502400 log_min_duration_statement =3D -1 log_connections =3D true log_duration =3D true log_line_prefix =3D '[%t] [%p] <%u@%d> ' log_statement =3D 'all' stats_start_collector =3D true stats_command_string =3D true stats_block_level =3D true stats_row_level =3D true stats_reset_on_server_start =3D true lc_messages =3D 'en_US.UTF-8' lc_monetary =3D 'en_US.UTF-8' lc_numeric =3D 'en_US.UTF-8' lc_time =3D 'en_US.UTF-8' actual max numer of connection is 120 plus some administrative connections = (psql sessions). postgresql version 8.0.2 on linux debian sarge. best regards, depesz --=20 hubert lubaczewski Network Operations Center eo Networks Sp. z o.o. --YZ5djTAD1cGYuMQK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCoWOm5ZmPxbV4/n4RAsiAAKCQFWTLn8KbECWm+Ql6mvEiD5kx+QCcDnXa AL2ZiTuu43Pl9uajFjy8/9E= =t8ci -----END PGP SIGNATURE----- --YZ5djTAD1cGYuMQK-- From pgsql-performance-owner@postgresql.org Sat Jun 4 07:04: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 E619A52802 for ; Sat, 4 Jun 2005 07:04:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97696-10 for ; Sat, 4 Jun 2005 10:04:12 +0000 (GMT) Received: from mail3.vodafone.ie (lughnasa.vodafone.ie [213.233.128.5]) by svr1.postgresql.org (Postfix) with ESMTP id CF66B52896 for ; Sat, 4 Jun 2005 07:04:10 -0300 (ADT) Received: from iecsai19 (10.163.136.100) by mail3.vodafone.ie (7.2.033.1) id 428A1D120006E098; Sat, 4 Jun 2005 11:04:10 +0100 Message-ID: <774541.1117879450594.JavaMail.tomcat@iecsai19> Date: Sat, 4 Jun 2005 11:04:10 +0100 (IST) From: Reply-To: To: pgsql-performance@postgresql.org Subject: Re: Query plan for very large number of joins Cc: simon@2ndquadrant.com Mime-Version: 1.0 Content-Type: text/plain;charset="UTF-8" Content-Transfer-Encoding: 7bit X-CP-Disclaimer: 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: 200506/85 X-Sequence-Number: 12723 >> Despite being fairly restricted in scope, >> the schema is highly denormalized hence the large number of tables. > >Do you mean normalized? Or do you mean you've pushed the superclass >details down onto each of the leaf classes? Sorry, I meant normalized, typing faster than I'm thinking here:) The schema was generated by hyperjaxb, a combination of Hibernate and JAXB. This allows one to go from XSD -> Object model -> Persistance in a single step. I'm just getting the hang of Hibernate so I don't know how flexible its' strategy is. Obviously though, the emphasis is on correctness first so while the same result could possibly be achieved more quickly with many smaller queries, it probably considers that it's up to the DBMS to handle optimisation (not unreasonably either I guess) Since the entire process from the XSD onwards is automated, there's no scope for tweaking either the OR mapping code or the DB schema itself except for isolated troubleshooting purposes. The XSD set in question is the UBL schema published by OASIS which has about 650 relations, I thought it would be nice to have this as a standard component in future development. Regards, -phil > >I guess I'm interested in what type of modelling led you to have so many >tables in the first place? > >Gotta say, never seen 350 table join before in a real app. > >Wouldn't it be possible to smooth out the model and end up with less >tables? Or simply break things up somewhere slightly down from the root >of the class hierarchy? > >Best Regards, Simon Riggs I'm using Vodafone Mail - to get your free mobile email account go to http://www.vodafone.ie Use of Vodafone Mail is subject to Terms and Conditions http://www.vodafone.ie/terms/website From pgsql-performance-owner@postgresql.org Sat Jun 4 08:17: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 015B0528C5 for ; Sat, 4 Jun 2005 08:17:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19476-03 for ; Sat, 4 Jun 2005 11:17:17 +0000 (GMT) Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) by svr1.postgresql.org (Postfix) with ESMTP id 20EC952851 for ; Sat, 4 Jun 2005 08:17:15 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id E45DF1188E3; Sat, 4 Jun 2005 19:17:14 +0800 (WST) Received: from vscan02.westnet.com.au ([127.0.0.1]) by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03393-13; Sat, 4 Jun 2005 19:17:14 +0800 (WST) Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au [202.72.133.22]) by vscan02.westnet.com.au (Postfix) with ESMTP id 0073B1188DC; Sat, 4 Jun 2005 19:17:13 +0800 (WST) Message-ID: <42A18DBD.5090904@familyhealth.com.au> Date: Sat, 04 Jun 2005 19:17:17 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: hubert.lubaczewski@eo.pl Cc: pgsql-performance@postgresql.org Subject: Re: strategies for optimizing read on rather large tables References: <20050604081742.GA29123@eo.pl> In-Reply-To: <20050604081742.GA29123@eo.pl> 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.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/86 X-Sequence-Number: 12724 Without reading too hard, I suggest having a quick look at contrib/ltree module in the PostgreSQL distribution. It may or may not help you. Chris hubert lubaczewski wrote: > hi > first let me draw the outline. > we have a database which stores "adverts". > each advert is in one category, and one or more "region". > regions and categories form (each) tree structure. > assume category tree: > > a > / \ > b c > / \ > d e > > if any given advert is in category "e". it means it is also in "b" and > "a". > same goes for regions. > > as for now we have approx. 400 categories, 1300 regions, and 1000000 > adverts. > > since checking always over the tress of categories and regions we > created acr_cache table (advert/category/region) > which stores information on all adverts and all categories and regions > this particular region is in. > plus some more information for sorting purposes. > > this table is ~ 11 milion records. > > now. > we query this in more or less this manner: > > select advert_id from acr_cache where category_id = ? and region_id = ? > order by XXX {asc|desc} limit 20; > > where XXX is one of 5 possible fields, > timestamp, > timestamp, > text, > text, > numeric > > we created index on acr_cache (category_id, region_id) > and it works rather well. > usually. > if a given "crossing" (category + region) has small amount of ads (less > then 10000) - the query is good enough (up to 300 miliseconds). > but when we enter the crossings which result in 50000 ads - the query > takes up to 10 seconds. > which is almost "forever". > > we thought about creating indices like this: > index on acr_cache (effective_date); > where effective_dateis on of the timestamp fields. > it worked well for the crossings with lots of ads, but when we asked for > small crossing (like 1000 ads) it took > 120 seconds! > it appears that postgresql was favorizing this new advert instead of > using much better index on category_id and region_id. > > actually - i'm not sure what to do next. > i am even thinkinh about createing special indices (partial) for big > crossings, but that's just weird. plus the fact that already the > acr_cache vacuum time exceeds 3 hours!. > > > any suggestions? > hardware is dual xeon 3 ghz, 4G ram, hardware scsi raid put into raid 1. > settings in postgresql.conf: > listen_addresses = '*' > port = 5800 > max_connections = 300 > superuser_reserved_connections = 50 > shared_buffers = 131072 > work_mem = 4096 > maintenance_work_mem = 65536 > fsync = false > commit_delay = 100 > commit_siblings = 5 > checkpoint_segments = 10 > effective_cache_size = 10000 > random_page_cost = 1.1 > log_destination = 'stderr' > redirect_stderr = true > log_directory = '/home/pgdba/logs' > log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' > log_truncate_on_rotation = false > log_rotation_age = 1440 > log_rotation_size = 502400 > log_min_duration_statement = -1 > log_connections = true > log_duration = true > log_line_prefix = '[%t] [%p] <%u@%d> ' > log_statement = 'all' > stats_start_collector = true > stats_command_string = true > stats_block_level = true > stats_row_level = true > stats_reset_on_server_start = true > lc_messages = 'en_US.UTF-8' > lc_monetary = 'en_US.UTF-8' > lc_numeric = 'en_US.UTF-8' > lc_time = 'en_US.UTF-8' > > actual max numer of connection is 120 plus some administrative connections (psql sessions). > postgresql version 8.0.2 on linux debian sarge. > > best regards, > > depesz > From pgsql-performance-owner@postgresql.org Sat Jun 4 08:18: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 8DC4952838 for ; Sat, 4 Jun 2005 08:18:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18492-04 for ; Sat, 4 Jun 2005 11:18:04 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 2ADED52805 for ; Sat, 4 Jun 2005 08:18:03 -0300 (ADT) Received: (qmail 4610 invoked from network); 4 Jun 2005 13:18:09 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 4 Jun 2005 13:18:09 +0200 Date: Sat, 04 Jun 2005 13:18:04 +0200 To: hubert.lubaczewski@eo.pl, pgsql-performance@postgresql.org Subject: Re: strategies for optimizing read on rather large tables References: <20050604081742.GA29123@eo.pl> 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: <20050604081742.GA29123@eo.pl> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/87 X-Sequence-Number: 12725 > select advert_id from acr_cache where category_id = ? and region_id = ? > order by XXX {asc|desc} limit 20; > > where XXX is one of 5 possible fields, > timestamp, > timestamp, > text, > text, > numeric Create 5 indexes on ( category_id, region_id, a field ) where "a field" is one of your 5 fields. Then write your query as : select advert_id from acr_cache where category_id = ? and region_id = ? order by category_id, region_id, XXX limit 20; select advert_id from acr_cache where category_id = ? and region_id = ? order by category_id desc, region_id desc, XXX desc limit 20; This should put your query down to a millisecond. It will use the index for the lookup, the sort and the limit, and hence only retrieve 20 rows for the table. Downside is you have 5 indexes, but that's not so bad. If your categories and regions form a tree, you should definitely use a ltree datatype, which enables indexed operators like "is contained in" which would probably allow you to reduce the size of your cache table a lot. > > we created index on acr_cache (category_id, region_id) > and it works rather well. > usually. > if a given "crossing" (category + region) has small amount of ads (less > then 10000) - the query is good enough (up to 300 miliseconds). > but when we enter the crossings which result in 50000 ads - the query > takes up to 10 seconds. > which is almost "forever". > > we thought about creating indices like this: > index on acr_cache (effective_date); > where effective_dateis on of the timestamp fields. > it worked well for the crossings with lots of ads, but when we asked for > small crossing (like 1000 ads) it took > 120 seconds! > it appears that postgresql was favorizing this new advert instead of > using much better index on category_id and region_id. > > actually - i'm not sure what to do next. > i am even thinkinh about createing special indices (partial) for big > crossings, but that's just weird. plus the fact that already the > acr_cache vacuum time exceeds 3 hours!. > > > any suggestions? > hardware is dual xeon 3 ghz, 4G ram, hardware scsi raid put into raid 1. > settings in postgresql.conf: > listen_addresses = '*' > port = 5800 > max_connections = 300 > superuser_reserved_connections = 50 > shared_buffers = 131072 > work_mem = 4096 > maintenance_work_mem = 65536 > fsync = false > commit_delay = 100 > commit_siblings = 5 > checkpoint_segments = 10 > effective_cache_size = 10000 > random_page_cost = 1.1 > log_destination = 'stderr' > redirect_stderr = true > log_directory = '/home/pgdba/logs' > log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' > log_truncate_on_rotation = false > log_rotation_age = 1440 > log_rotation_size = 502400 > log_min_duration_statement = -1 > log_connections = true > log_duration = true > log_line_prefix = '[%t] [%p] <%u@%d> ' > log_statement = 'all' > stats_start_collector = true > stats_command_string = true > stats_block_level = true > stats_row_level = true > stats_reset_on_server_start = true > lc_messages = 'en_US.UTF-8' > lc_monetary = 'en_US.UTF-8' > lc_numeric = 'en_US.UTF-8' > lc_time = 'en_US.UTF-8' > > actual max numer of connection is 120 plus some administrative > connections (psql sessions). > postgresql version 8.0.2 on linux debian sarge. > > best regards, > > depesz > From pgsql-performance-owner@postgresql.org Sat Jun 4 08:40: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 1080B5280B for ; Sat, 4 Jun 2005 08:40:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19745-09 for ; Sat, 4 Jun 2005 11:40:28 +0000 (GMT) Received: from viper.eo.pl (viper.eo.pl [217.17.46.133]) by svr1.postgresql.org (Postfix) with ESMTP id 350C35284B for ; Sat, 4 Jun 2005 08:40:27 -0300 (ADT) Received: from xxx.hq.eo.pl ([192.168.20.129] helo=localhost.localdomain) by viper with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1DeX0r-0000Am-7j; Sat, 04 Jun 2005 13:40:29 +0200 Received: from depesz by localhost.localdomain with local (Exim 4.50) id 1DeX0p-0005Xw-A5; Sat, 04 Jun 2005 13:40:23 +0200 Date: Sat, 4 Jun 2005 13:40:23 +0200 From: hubert lubaczewski To: Christopher Kings-Lynne Cc: pgsql-performance@postgresql.org Subject: Re: strategies for optimizing read on rather large tables Message-ID: <20050604114023.GA21031@eo.pl> Reply-To: hubert.lubaczewski@eo.pl References: <20050604081742.GA29123@eo.pl> <42A18DBD.5090904@familyhealth.com.au> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8t9RHnE3ZwKMSgU+" Content-Disposition: inline In-Reply-To: <42A18DBD.5090904@familyhealth.com.au> X-info-en-1: this message *may* reflect my personal opinion. it is *not* X-info-en-2: intended to reflect those of my employer, or anyone else. X-info-pl-1: wszelkie opinie =?iso-8859-2?Q?wyra=BFone_?= =?iso-8859-2?Q?w_tym_li=B6cie_prezentuj=B1_wy=B3=B1cznie_pogl=B1dy?= X-info-pl-2: autora listu. opinie =?iso-8859-2?Q?te_?= =?iso-8859-2?Q?w_=BFadnym__razie_nie__wyra=BFaj=B1__pogl=B1d=F3w?= X-info-pl-3: pracodawcy autora =?iso-8859-2?Q?listu_?= =?iso-8859-2?Q?_ani__innych__zwi=B1zanych__z__nim__os=F3b=2E?= User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/88 X-Sequence-Number: 12726 --8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 04, 2005 at 07:17:17PM +0800, Christopher Kings-Lynne wrote: > Without reading too hard, I suggest having a quick look at contrib/ltree= =20 > module in the PostgreSQL distribution. It may or may not help you. acr_cache doesn't care about trees. and - since i have acr_cache - i dont have to worry about trees when selecting from acr_cache. ltree - is known to me. yet i decided not to use it to have the ability to move to another database engines without rewriting something that is havily used. depesz --8t9RHnE3ZwKMSgU+ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCoZMn5ZmPxbV4/n4RAqV5AJ417egSNTB1V4Mvi2z/XH0CEJjR+wCghJUA OzXPY/OE8JAswORgoM5BAWo= =J9cq -----END PGP SIGNATURE----- --8t9RHnE3ZwKMSgU+-- From pgsql-performance-owner@postgresql.org Sat Jun 4 08:41: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 59B655284B for ; Sat, 4 Jun 2005 08:41:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20816-08 for ; Sat, 4 Jun 2005 11:41:35 +0000 (GMT) Received: from viper.eo.pl (viper.eo.pl [217.17.46.133]) by svr1.postgresql.org (Postfix) with ESMTP id 0AEF95283D for ; Sat, 4 Jun 2005 08:41:34 -0300 (ADT) Received: from xxx.hq.eo.pl ([192.168.20.129] helo=localhost.localdomain) by viper with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1DeX1x-0000Dn-T7; Sat, 04 Jun 2005 13:41:37 +0200 Received: from depesz by localhost.localdomain with local (Exim 4.50) id 1DeX1w-0005a4-7D; Sat, 04 Jun 2005 13:41:32 +0200 Date: Sat, 4 Jun 2005 13:41:32 +0200 From: hubert lubaczewski To: PFC Cc: pgsql-performance@postgresql.org Subject: Re: strategies for optimizing read on rather large tables Message-ID: <20050604114132.GB21031@eo.pl> Reply-To: hubert.lubaczewski@eo.pl References: <20050604081742.GA29123@eo.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yNb1oOkm5a9FJOVX" Content-Disposition: inline In-Reply-To: X-info-en-1: this message *may* reflect my personal opinion. it is *not* X-info-en-2: intended to reflect those of my employer, or anyone else. X-info-pl-1: wszelkie opinie =?iso-8859-2?Q?wyra=BFone_?= =?iso-8859-2?Q?w_tym_li=B6cie_prezentuj=B1_wy=B3=B1cznie_pogl=B1dy?= X-info-pl-2: autora listu. opinie =?iso-8859-2?Q?te_?= =?iso-8859-2?Q?w_=BFadnym__razie_nie__wyra=BFaj=B1__pogl=B1d=F3w?= X-info-pl-3: pracodawcy autora =?iso-8859-2?Q?listu_?= =?iso-8859-2?Q?_ani__innych__zwi=B1zanych__z__nim__os=F3b=2E?= User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/89 X-Sequence-Number: 12727 --yNb1oOkm5a9FJOVX Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline On Sat, Jun 04, 2005 at 01:18:04PM +0200, PFC wrote: > Then write your query as : > select advert_id from acr_cache where category_id = ? and region_id = ? > order by category_id, region_id, XXX limit 20; this is great idea - i'll check it out definitelly. depesz --yNb1oOkm5a9FJOVX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCoZNs5ZmPxbV4/n4RArrRAJsFUOzzlfGbNc9Zz/ZoqhYnEo6hlACeOJly G0tkKk/bSLEfuh8wOxUc6X0= =2swm -----END PGP SIGNATURE----- --yNb1oOkm5a9FJOVX-- From pgsql-performance-owner@postgresql.org Sat Jun 4 09: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 E42FD52838 for ; Sat, 4 Jun 2005 09:08:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29074-02 for ; Sat, 4 Jun 2005 12:07:52 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id CB0225280B for ; Sat, 4 Jun 2005 09:07:50 -0300 (ADT) Received: (qmail 6988 invoked from network); 4 Jun 2005 14:07:58 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 4 Jun 2005 14:07:58 +0200 To: hubert.lubaczewski@eo.pl Cc: pgsql-performance@postgresql.org Subject: Re: strategies for optimizing read on rather large tables References: <20050604081742.GA29123@eo.pl> <20050604114132.GB21031@eo.pl> 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: Sat, 04 Jun 2005 14:07:52 +0200 In-Reply-To: User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/90 X-Sequence-Number: 12728 >> select advert_id from acr_cache where category_id = ? and region_id = ? >> order by category_id, region_id, XXX limit 20; don't forget to mention all the index columns in the order by, or the planner won't use it. From pgsql-performance-owner@postgresql.org Sat Jun 4 09:13: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 B27225284B for ; Sat, 4 Jun 2005 09:13:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32751-04 for ; Sat, 4 Jun 2005 12:13:28 +0000 (GMT) Received: from viper.eo.pl (viper.eo.pl [217.17.46.133]) by svr1.postgresql.org (Postfix) with ESMTP id 3F2D15283B for ; Sat, 4 Jun 2005 09:13:27 -0300 (ADT) Received: from xxx.hq.eo.pl ([192.168.20.129] helo=localhost.localdomain) by viper with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1DeXWn-00029O-SI; Sat, 04 Jun 2005 14:13:30 +0200 Received: from depesz by localhost.localdomain with local (Exim 4.50) id 1DeXWh-0006cE-TT; Sat, 04 Jun 2005 14:13:19 +0200 Date: Sat, 4 Jun 2005 14:13:19 +0200 From: hubert lubaczewski To: PFC Cc: pgsql-performance@postgresql.org Subject: Re: strategies for optimizing read on rather large tables Message-ID: <20050604121319.GA25309@eo.pl> Reply-To: hubert.lubaczewski@eo.pl References: <20050604081742.GA29123@eo.pl> <20050604114132.GB21031@eo.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mP3DRpeJDSE+ciuQ" Content-Disposition: inline In-Reply-To: X-info-en-1: this message *may* reflect my personal opinion. it is *not* X-info-en-2: intended to reflect those of my employer, or anyone else. X-info-pl-1: wszelkie opinie =?iso-8859-2?Q?wyra=BFone_?= =?iso-8859-2?Q?w_tym_li=B6cie_prezentuj=B1_wy=B3=B1cznie_pogl=B1dy?= X-info-pl-2: autora listu. opinie =?iso-8859-2?Q?te_?= =?iso-8859-2?Q?w_=BFadnym__razie_nie__wyra=BFaj=B1__pogl=B1d=F3w?= X-info-pl-3: pracodawcy autora =?iso-8859-2?Q?listu_?= =?iso-8859-2?Q?_ani__innych__zwi=B1zanych__z__nim__os=F3b=2E?= User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/91 X-Sequence-Number: 12729 --mP3DRpeJDSE+ciuQ Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 04, 2005 at 02:07:52PM +0200, PFC wrote: > don't forget to mention all the index columns in the order by, or=20 > the planner won't use it. of course. i understand the concept. actually i find kind of ashamed i did not try it before.=20 anyway - thanks for great tip. depesz --mP3DRpeJDSE+ciuQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCoZrf5ZmPxbV4/n4RAvY1AJsFTqKsvN45qU63IsD+VhlgFMicSQCdEA+d Zfnny8+5u2ZbX7hSRCSuPIE= =FRkC -----END PGP SIGNATURE----- --mP3DRpeJDSE+ciuQ-- From pgsql-performance-owner@postgresql.org Sat Jun 4 10:30: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 6209952908 for ; Sat, 4 Jun 2005 10:30:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45135-04 for ; Sat, 4 Jun 2005 13:30:55 +0000 (GMT) Received: from serrano.cc.columbia.edu (serrano.cc.columbia.edu [128.59.29.6]) by svr1.postgresql.org (Postfix) with ESMTP id 6807352906 for ; Sat, 4 Jun 2005 10:30:54 -0300 (ADT) Received: from JAGLABLAPTOP (user-0cdfa9u.cable.mindspring.com [24.215.169.62]) (user=baj2107 mech=LOGIN bits=0) by serrano.cc.columbia.edu (8.13.0/8.13.0) with ESMTP id j54DUtUE005586 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Sat, 4 Jun 2005 09:30:57 -0400 (EDT) From: "Bernd Jagla" To: "'Pgsql performance'" Subject: Best hardware Date: Sat, 4 Jun 2005 09:30:57 -0400 Message-ID: <002701c56909$a5491720$0300a8c0@JAGLABLAPTOP> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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.2527 Importance: Normal X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.48 on 128.59.29.6 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.516 tagged_above=0 required=5 tests=FROM_ENDS_IN_NUMS X-Spam-Level: X-Archive-Number: 200506/92 X-Sequence-Number: 12730 Hi there, And sorry for bringing this up again, but I couldn't find any recent discussion on the best hardware, and I know it actually depends on what = you are doing... So this is what I had in mind: Our database is going to consist of about 100 tables or so of which only = a hand full will be really big, say in the 100 of million rows, fully = indexed and we are going to add a lot of entries (n* 100 000, n<100) on a daily bases (24/5). So from my experience with MySql I know that it is = somewhat hard on the I/O, and that the speed of the head of the HD is actually limitiing. Also, I only experimented with RAID5, and heard that RAID10 = will be good for reading but not writing. So I wanted to go whith RAIDKing. They have a 16 bay Raid box that they = fill with Raptors (10krpm,73 GB, SATA), connected via FC. Now I am not sure = what server would be good or if I should go with redundant servers. Are Quad = CPUs any good? I heard that the IBM quad system is supposed to be 40% faster = than HP or Dell???. And how much RAM should go for: are 8GB enough? Oh, of = course I wanted to run it under RedHat... I would appreciate any sugestions and comments or if you are too bored = with this topic, just send me a link where I can read up on this.... Thanks a lot for your kind replies. Bernd Bernd Jagla, PhD Associate Research Scientist Columbia University =20 From pgsql-performance-owner@postgresql.org Sun Jun 5 22:25: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 A0DDE5282B for ; Sat, 4 Jun 2005 11:16:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55145-10 for ; Sat, 4 Jun 2005 14:16:31 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 97C2E52805 for ; Sat, 4 Jun 2005 11:16:30 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 97EE430952; Sat, 4 Jun 2005 16:12:58 +0200 (MET DST) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: Forcing use of specific index Date: Sat, 4 Jun 2005 22:14:26 +0800 Organization: Hub.Org Networking Services Lines: 12 Message-ID: References: <20050602020528.GL26100@tobias.exoweb.net> Reply-To: "Qingqing Zhou" X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.195 tagged_above=0 required=5 tests=AWL, PRIORITY_NO_NAME X-Spam-Level: * X-Archive-Number: 200506/94 X-Sequence-Number: 12732 "Tobias Brox" writes > Is it any way to attempt to force the planner to use some specific index > while creating the plan? Other than eventually dropping all the other > indices (which is obiously not a solution in production setting anyway)? > I don't think currently PG supports this but "SQL hints" is planned ... Regards, Qingqing From pgsql-performance-owner@postgresql.org Sat Jun 4 20:23: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 B6D5D52805 for ; Sat, 4 Jun 2005 20:23:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70214-01 for ; Sat, 4 Jun 2005 23:23:36 +0000 (GMT) Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net [199.185.220.223]) by svr1.postgresql.org (Postfix) with ESMTP id C10C1528D0 for ; Sat, 4 Jun 2005 20:23:34 -0300 (ADT) Received: from localhost ([199.185.220.240]) by priv-edtnes51.telusplanet.net (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP id <20050604232337.ZGJH21662.priv-edtnes51.telusplanet.net@localhost>; Sat, 4 Jun 2005 17:23:37 -0600 Received: from 64.180.5.127 ( [64.180.5.127]) as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; Sat, 4 Jun 2005 16:23:37 -0700 Message-ID: <1117927417.42a237f92b0f7@webmail.telus.net> Date: Sat, 4 Jun 2005 16:23:37 -0700 From: Mischa Sandberg To: Bernd Jagla Cc: 'Pgsql performance' Subject: Re: Best hardware References: <002701c56909$a5491720$0300a8c0@JAGLABLAPTOP> In-Reply-To: <002701c56909$a5491720$0300a8c0@JAGLABLAPTOP> 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: 64.180.5.127 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.057 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/93 X-Sequence-Number: 12731 Quoting Bernd Jagla : > ... the speed of the head of the HD is actually > limitiing. Also, I only experimented with RAID5, and heard that > RAID10 will be good for reading but not writing. Au contraire. RAID5 is worse than RAID10 for writing, because it has the extra implicit read (parity stripe) for every write. I've switched all my perftest boxes over from RAID5 to RAID10, and the smallest performance increase was x1.6 . This is in an update-intensive system; the WAL log's disk write rate was the controlling factor. > Are Quad CPUs any good? I heard that the IBM quad system is supposed to be 40% > faster than HP or Dell???. Check out the other threads for negative experiences with Xeon 2x2 and perhaps quad CPU's. Me, I'm looking forward to my first Opteron box arriving next week. > And how much RAM should go for: are 8GB enough? Oh, of course I wanted to run it under RedHat... First off, you need enough RAM to hold all your connections. Run your app, watch the RSS column of "ps". For my own simpler apps (that pump data into the db) I allow 20MB/connection. Next, if you are heavy on inserts, your tables will never fit in RAM, and you really just need enough to hold the top levels of the indexes. Look at the disk space used in your $PGDATA/base// files, and you can work out whether holding ALL your indexes in memory is feasible. If you are heavy on updates, the above holds, but ymmv depending on locality of reference, you have to run your own tests. If you have concurrent big queries, all bets are off --- ask not how much RAM you need, but how much you can afford :-) From pgsql-performance-owner@postgresql.org Sun Jun 5 22:57: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 38B7A5284D for ; Sun, 5 Jun 2005 22:57:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35292-05 for ; Mon, 6 Jun 2005 01:57:33 +0000 (GMT) Received: from vscan03.westnet.com.au (vscan03.westnet.com.au [203.10.1.142]) by svr1.postgresql.org (Postfix) with ESMTP id EC46F5283D for ; Sun, 5 Jun 2005 22:57:31 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 69E6AB60430; Mon, 6 Jun 2005 09:57:34 +0800 (WST) Received: from vscan03.westnet.com.au ([127.0.0.1]) by localhost (vscan03.westnet.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18856-01-3; Mon, 6 Jun 2005 09:57:34 +0800 (WST) Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au [202.72.133.22]) by vscan03.westnet.com.au (Postfix) with ESMTP id DF441B6020E; Mon, 6 Jun 2005 09:57:33 +0800 (WST) Message-ID: <42A3AD92.20206@familyhealth.com.au> Date: Mon, 06 Jun 2005 09:57:38 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bill Ewing Cc: pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres 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.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/102 X-Sequence-Number: 12739 > So, our problem in installing is we don't know a cluster or SSL from a > hole in the ground. Things get confusing about contexts- are we > talking about a user of the system or the database? Yikes, do I need > to write down the 30+ character autogenerated password? No you don't need to write it down :) > We just want to use JDBC, code SQL queries and essentially not care > what database is under us. We would love to find a good tool that runs > as an Eclipse plug-in that lets us define our database, generate a > script file to create it and perhaps also help us concoct queries. Dunno if such a thing exists? > Our experience is that the many UNIX-ish thing about postgres are there > and we don't know UNIX. This makes you realize how much you take for > granted about the OS you do know. Of course, we'll learn, but postgres > people, if you're listening: good job, now take us a little farther and > we will be your most ardent supporters. Just ask questions on the lists, or get instant answers on #postgresql on irc.freenode.org. Cheers, Chris From pgsql-performance-owner@postgresql.org Sun Jun 5 23:04: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 8F6355280B for ; Sun, 5 Jun 2005 23:04:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35903-10 for ; Mon, 6 Jun 2005 02:04:35 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id 2D9985282A for ; Sun, 5 Jun 2005 23:04:34 -0300 (ADT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id C9F1D18CC05; Sun, 5 Jun 2005 22:04:38 -0400 (EDT) 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 25459-01-5; Sun, 5 Jun 2005 22:04:36 -0400 (EDT) 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 3595C18D055; Sun, 5 Jun 2005 22:04:35 -0400 (EDT) Message-ID: <42A3AF2D.4000802@samurai.com> Date: Mon, 06 Jun 2005 12:04:29 +1000 From: Neil Conway User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mark Stosberg Cc: pgsql-performance@postgresql.org Subject: Re: Most effective tuning choices for busy website? 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 mailbox.samurai.com 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: 200506/103 X-Sequence-Number: 12740 Mark Stosberg wrote: > I've used PQA to analyze my queries and happy overall with how they are > running. About 55% of the query time is going to variations of the pet > searching query, which seems like where it should be going. The query is > frequent and complex. It has already been combed over for appropriate > indexing. It might be worth posting the EXPLAIN ANALYZE and relevant schema definitions for this query, in case there is additional room for optimization. > Our hardware: Dual 3 Ghz processors 3 GB RAM, running on FreeBSD. Disk? You are presumably using Xeon processors, right? If so, check the list archives for information on the infamous "context switching storm" that causes performance problems for some people using SMP Xeons. -Neil From pgsql-performance-owner@postgresql.org Mon Jun 6 03:49: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 3662252812 for ; Mon, 6 Jun 2005 03:49:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98639-10 for ; Mon, 6 Jun 2005 06:49:20 +0000 (GMT) Received: from mail1.catalyst.net.nz (godel.catalyst.net.nz [202.49.159.12]) by svr1.postgresql.org (Postfix) with ESMTP id 7A453528C5 for ; Mon, 6 Jun 2005 03:49:19 -0300 (ADT) Received: from 210-86-100-240.jetstream.xtra.co.nz ([210.86.100.240] helo=lamb.mcmillan.net.nz) by mail1.catalyst.net.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1DfBQD-00050c-Jj; Mon, 06 Jun 2005 18:49:17 +1200 Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) by lamb.mcmillan.net.nz (Postfix) with ESMTP id E9A7BAD98581; Mon, 6 Jun 2005 18:48:45 +1200 (NZST) Subject: Re: Postgresql and Software RAID/LVM From: Andrew McMillan To: Steve Poe Cc: pgsql-performance@postgresql.org In-Reply-To: <42A0A549.6070501@sfnet.cc> References: <42A0A549.6070501@sfnet.cc> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-zbyYWFS88+HT4GKoECjK" Date: Mon, 06 Jun 2005 18:48:45 +1200 Message-Id: <1118040525.10586.172.camel@lamb.mcmillan.net.nz> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 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: 200506/104 X-Sequence-Number: 12741 --=-zbyYWFS88+HT4GKoECjK Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 2005-06-03 at 11:45 -0700, Steve Poe wrote: > I have a small business client that cannot afford high-end/high quality > RAID cards for their next server. That's a seperate argument/issue right > there for me, but what the client wants is what the client wants. >=20 > Has anyone ran Postgres with software RAID or LVM on a production box? > What have been your experience? Hi, We regularly run LVM on top of software raid for our PostgreSQL servers (and our other servers, for that matter). As far as I can see these systems have not had issues related to either software RAID or LVM - that's around 30 systems all up, maybe 8 running PostgreSQL, in production. The database servers are a variety of dual-Xeon (older) and dual-Opteron (newer) systems. The Xeons are all running Debian "Woody" with 2.4.xx kernels and the Opterons are all running "Sarge" with 2.6.x kernels. Regards, Andrew. ------------------------------------------------------------------------- Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 The secret of being a bore is to say everything -- Voltaire ------------------------------------------------------------------------- --=-zbyYWFS88+HT4GKoECjK Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBCo/HNjJA0f48GgBIRAsC6AJ9Y7MW+vuxrw0RFN8b1x0X7N3ZSoACeOop8 1ZasWH+1/ixtHBmd6t1i+fY= =7Z5P -----END PGP SIGNATURE----- --=-zbyYWFS88+HT4GKoECjK-- From pgsql-performance-owner@postgresql.org Mon Jun 6 08:45: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 C62D552834 for ; Mon, 6 Jun 2005 08:45:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54576-02 for ; Mon, 6 Jun 2005 11:45:39 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 8D0285283B for ; Mon, 6 Jun 2005 08:45:37 -0300 (ADT) Received: (qmail 30505 invoked from network); 6 Jun 2005 13:45:45 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 6 Jun 2005 13:45:45 +0200 To: "K C Lau" , pgsql-performance@postgresql.org Subject: Re: SELECT DISTINCT Performance Issue References: <6.2.1.2.0.20050602190756.05ab2c70@localhost> 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: Mon, 06 Jun 2005 13:45:39 +0200 In-Reply-To: <6.2.1.2.0.20050602190756.05ab2c70@localhost> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/105 X-Sequence-Number: 12742 > Previously, we have also tried to use LIMIT 1 instead of DISTINCT, but > the performance was no better: > select PlayerID,AtDate from Player where PlayerID='22220' order by > PlayerID desc, AtDate desc LIMIT 1 The DISTINCT query will pull out all the rows and keep only one, so the one with LIMIT should be faster. Can you post explain analyze of the LIMIT query ? From pgsql-performance-owner@postgresql.org Mon Jun 6 08:54: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 DAA2052841 for ; Mon, 6 Jun 2005 08:54:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53198-06 for ; Mon, 6 Jun 2005 11:54:03 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id A4F995283B for ; Mon, 6 Jun 2005 08:54:02 -0300 (ADT) Received: (qmail 30876 invoked from network); 6 Jun 2005 13:54:11 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 6 Jun 2005 13:54:11 +0200 Date: Mon, 06 Jun 2005 13:54:03 +0200 To: "Bill Ewing" , pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres References: 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(BETA2)/8.0 (Linux, build 987) 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: 200506/106 X-Sequence-Number: 12743 If you want something more "embedded" in your application, you could consider : http://firebird.sourceforge.net/ http://hsqldb.sourceforge.net/ http://sqlite.org/ From pgsql-performance-owner@postgresql.org Mon Jun 6 12:15: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 03CE85289B for ; Mon, 6 Jun 2005 12:15:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07526-03 for ; Mon, 6 Jun 2005 15:15:31 +0000 (GMT) Received: from imsm058dat.netvigator.com (imsm058.netvigator.com [218.102.48.211]) by svr1.postgresql.org (Postfix) with ESMTP id 4643152862 for ; Mon, 6 Jun 2005 12:15:25 -0300 (ADT) Received: from n2.netvigator.com ([218.102.224.145]) by imsm058dat.netvigator.com (InterMail vM.6.01.04.01 201-2131-118-101-20041129) with ESMTP id <20050606151522.POOY3558.imsm058dat.netvigator.com@n2.netvigator.com>; Mon, 6 Jun 2005 23:15:22 +0800 Message-Id: <6.2.1.2.0.20050606224010.05df3578@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.1.2 Date: Mon, 06 Jun 2005 22:54:44 +0800 To: PFC , pgsql-performance@postgresql.org From: K C Lau Subject: Re: SELECT DISTINCT Performance Issue In-Reply-To: References: <6.2.1.2.0.20050602190756.05ab2c70@localhost> 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=1.499 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST, FROM_ENDS_IN_NUMS X-Spam-Level: * X-Archive-Number: 200506/111 X-Sequence-Number: 12748 At 19:45 05/06/06, PFC wrote: >>Previously, we have also tried to use LIMIT 1 instead of DISTINCT, but >>the performance was no better: >>select PlayerID,AtDate from Player where PlayerID='22220' order by >>PlayerID desc, AtDate desc LIMIT 1 > > The DISTINCT query will pull out all the rows and keep only one, > so the >one with LIMIT should be faster. Can you post explain analyze of the LIMIT >query ? Actually the problem with LIMIT 1 query is when we use views with the LIMIT 1 construct. The direct SQL is ok: esdt=> explain analyze select PlayerID,AtDate from Player where PlayerID='22220' order by PlayerID desc, AtDate desc LIMIT 1; Limit (cost=0.00..1.37 rows=1 width=23) (actual time=0.000..0.000 rows=1 loops =1) -> Index Scan Backward using pk_player on player (cost=0.00..16074.23 rows= 11770 width=23) (actual time=0.000..0.000 rows=1 loops=1) Index Cond: ((playerid)::text = '22220'::text) Total runtime: 0.000 ms esdt=> create or replace view VCurPlayer3 as select * from Player a where AtDate = (select b.AtDate from Player b where a.PlayerID = b.PlayerID order by b.PlayerID desc, b.AtDate desc LIMIT 1); esdt=> explain analyze select PlayerID,AtDate,version from VCurPlayer3 where Pla yerID='22220'; Index Scan using pk_player on player a (cost=0.00..33072.78 rows=59 width=27) (actual time=235.000..235.000 rows=1 loops=1) Index Cond: ((playerid)::text = '22220'::text) Filter: ((atdate)::text = ((subplan))::text) SubPlan -> Limit (cost=0.00..1.44 rows=1 width=23) (actual time=0.117..0.117 rows =1 loops=1743) -> Index Scan Backward using pk_player on player b (cost=0.00..1402 3.67 rows=9727 width=23) (actual time=0.108..0.108 rows=1 loops=1743) Index Cond: (($0)::text = (playerid)::text) Total runtime: 235.000 ms The problem appears to be in the loops=1743 scanning all 1743 data records for that player. Regards, KC. From pgsql-performance-owner@postgresql.org Mon Jun 6 11:54: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 E5034528CA for ; Mon, 6 Jun 2005 11:54:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00795-08 for ; Mon, 6 Jun 2005 14:54:45 +0000 (GMT) Received: from spieden.seattleserver.com (spieden.seattleserver.com [216.57.201.54]) by svr1.postgresql.org (Postfix) with ESMTP id 335FB52896 for ; Mon, 6 Jun 2005 11:54:44 -0300 (ADT) Received: (qmail 32242 invoked from network); 6 Jun 2005 14:52:02 +0000 Received: from pool-71-113-2-184.sttlwa.dsl-w.verizon.net (HELO ?192.168.2.5?) (cshobe@seattleserver.com@71.113.2.184) by spieden.seattleserver.com with RC4-MD5 encrypted SMTP; 6 Jun 2005 14:52:02 +0000 From: Casey Allen Shobe Organization: SeattleServer.com, Inc. To: Postgresql Performance Subject: Re: Performance nightmare with dspam (urgent) (resolved) Date: Mon, 6 Jun 2005 14:54:47 +0000 User-Agent: KMail/1.8 References: <200506012019.13218.cshobe@seattleserver.com> In-Reply-To: <200506012019.13218.cshobe@seattleserver.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506061454.48018.lists@seattleserver.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.481 tagged_above=0 required=5 tests=INFO_TLD X-Spam-Level: X-Archive-Number: 200506/107 X-Sequence-Number: 12744 On Wednesday 01 June 2005 20:19, Casey Allen Shobe wrote: > We've seen PostgreSQL performance as a dspam database be simply stellar on > some machines with absolutely no tuning to the postgres.conf, and no > statistics target altering. Wow. That took a phenomenally long time to post. I asked on IRC, and they said it is "normal" for the PG lists to bee so horribly slow. What gives? I think you guys really need to stop using majordomo, but I'll avoid blaming that for the time being. Maybe a good time for the performance crew to look at the mailing list software instead of just PG. > We had set up about 200 domains on a SuperMicro P4 2.4GHz server, and it was > working great too (without the above tweak!), but then the motherboard > started having issues and the machine would lock up every few weeks. So we > moved everything to a brand new SuperMicro P4 3.0GHz server last week, and > now performance is simply appalling. Well, we actually added about 10 more domains right around the time of the move, not thinking anything of it. Turns out that simply set the disk usage over the threshhold of what the drive could handle. At least, that's the best guess of the situation - I don't really know whether to believe that because the old machine had a 3-disk RAID5 so it should have been half the speed of the new machine. However, analyzing the statements showed that they were all using index scans as they should, and no amount of tuning managed to reduce the I/O to an acceptable level. After lots of tuning, we moved pg_xlog onto a separate disk, and switched dspam from TEFT to TOE mode (which reduces the number of inserts). By doing this, the immediate problem was alleviated. Indeed the suggestion in link in my previous email to add an extra index was a BAD idea, since it increased the amount of work that had to be done per write, and didn't help anything. Long-term, whenever we hit the I/O limit again, it looks like we really don't have much of a solution except to throw more hardware (mainly lots of disks in RAID0's) at the problem. :( Fortunately, with the above two changes I/O usage on the PG data disk is a quarter of what it was, so theoretically we should be able to quadruple the number of users on current hardware. Our plan forward is to increase the number of disks in the two redundant mail servers, so that each has a single ultra320 disk for O/S and pg_xlog, and a 3-disk RAID0 for the data. This should triple our current capacity. The general opinion of the way dspam uses the database among people I've talked to on #postgresql is not very good, but of course the dspam folk blame PostgreSQL and say to use MySQL if you want reasonable performance. Makes it real fun to be a DSpam+PostgreSQL user when limits are reached, since everyone denies responsibility. Fortunately, PostgreSQL people are pretty helpful even if they think the client software sucks. :) Cheers, -- Casey Allen Shobe | http://casey.shobe.info cshobe@seattleserver.com | cell 425-443-4653 AIM & Yahoo: SomeLinuxGuy | ICQ: 1494523 SeattleServer.com, Inc. | http://www.seattleserver.com From pgsql-performance-owner@postgresql.org Mon Jun 6 11:58: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 99BCD52921 for ; Mon, 6 Jun 2005 11:58:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03894-02 for ; Mon, 6 Jun 2005 14:58:10 +0000 (GMT) Received: from ns1.bi.lt (ns.bi.lt [213.226.131.131]) by svr1.postgresql.org (Postfix) with ESMTP id AF8E252930 for ; Mon, 6 Jun 2005 11:58:07 -0300 (ADT) Received: from B027543 (inet.bee.lt [213.226.131.30]) by ns1.bi.lt (8.12.11/8.12.11) with SMTP id j56EwBAW016215; Mon, 6 Jun 2005 17:58:11 +0300 Message-ID: <03f801c56aa8$2867abe0$f20214ac@bite.lt> From: "Mindaugas Riauba" To: "Matthew T. O'Connor" Cc: "Tom Lane" , References: <00d501c5667d$8cc12320$f20214ac@bite.lt> <13878.1117636799@sss.pgh.pa.us> <018601c56744$9d5aae50$f20214ac@bite.lt> <13178.1117719939@sss.pgh.pa.us> <02db01c5677e$d43d3b10$f20214ac@bite.lt> <429F2F73.8050406@zeut.net> <010701c56817$fd543d20$f20214ac@bite.lt> <42A0889A.2050200@zeut.net> Subject: Re: How to avoid database bloat Date: Mon, 6 Jun 2005 17:58:10 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1257" Content-Transfer-Encoding: 7bit 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.121 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/108 X-Sequence-Number: 12745 > Looked like pg_autovacuum is operating as expected. One of the annoying > limitations of pg_autovacuum in current releases is that you can't set > thresholds on a per table basis. It looks like this table might require > an even more aggressive vacuum threshold. Couple of thoughts, are you > sure it's the table that is growing and not the indexes? (assuming this > table has indexes on it). Yes I am sure (oid2name :) ). > > And one more question - anyway why table keeps growing? It is shown that > >it occupies > ><10000 pages and max_fsm_pages = 200000 so vacuum should keep up with the > >changes? > >Or is it too low according to pg_class system table? What should be the > >reasonable value? > > > > > > Does the table keep growing? Or does it grow to a point an then stop > growing? It's normal for a table to operate at a steady state size that > is bigger that it's fresly "vacuum full"'d size. And with -V set at 0.5 > it should be at a minimum 50% larger than it's minimum size. Your email > before said that this table went from 20M to 70M but does it keep > going? Perhaps it would start leveling off at this point, or some point > shortly there-after. Yes it keeps growing. And the main problem is that performance starts to suffer from that. Do not forget that we are talking about 100+ insert/ update/select/delete cycles per second. > Anyway, I'm not sure if there is something else going on here, but from > the log it looks as though pg_autovacuum is working as advertised. Something is out there :). But how to fix that bloat? More aggressive autovacuum settings? Even larger FSM? Do not know if that matters but database has very many connections to it (400-600) and clients are doing mostly asynchronous operations. How to find out where this extra space gone? Thanks, Mindaugas From pgsql-performance-owner@postgresql.org Mon Jun 6 12:08: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 71A1052834 for ; Mon, 6 Jun 2005 12:08:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03417-08 for ; Mon, 6 Jun 2005 15:08:30 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id AB6845289B for ; Mon, 6 Jun 2005 12:08:28 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j56F8Q7j015584; (envelope-from ) Mon, 6 Jun 2005 10:08:26 -0500 (CDT) Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com [12.215.118.172]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j56F8OPG020849 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Mon, 6 Jun 2005 10:08:25 -0500 (CDT) Message-ID: <42A466E7.4080808@arbash-meinel.com> Date: Mon, 06 Jun 2005 10:08:23 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Casey Allen Shobe Cc: Postgresql Performance Subject: Re: Performance nightmare with dspam (urgent) (resolved) References: <200506012019.13218.cshobe@seattleserver.com> <200506061454.48018.lists@seattleserver.com> In-Reply-To: <200506061454.48018.lists@seattleserver.com> X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig6181E67B355E7A6657F58D55" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean 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: 200506/109 X-Sequence-Number: 12746 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig6181E67B355E7A6657F58D55 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Casey Allen Shobe wrote: > On Wednesday 01 June 2005 20:19, Casey Allen Shobe wrote: > ... > Long-term, whenever we hit the I/O limit again, it looks like we really don't > have much of a solution except to throw more hardware (mainly lots of disks > in RAID0's) at the problem. :( Fortunately, with the above two changes I/O > usage on the PG data disk is a quarter of what it was, so theoretically we > should be able to quadruple the number of users on current hardware. > Be very careful in this situation. If any disks in a RAID0 fails, the entire raid is lost. You *really* want a RAID10. It takes more drives, but then if anything dies you don't lose everything. If you are running RAID0 and you *really* want performance, and aren't concerned about safety (at all), you could also set fsync=false. That should also speed things up. But you are really risking corruption/data loss on your system. > Our plan forward is to increase the number of disks in the two redundant mail > servers, so that each has a single ultra320 disk for O/S and pg_xlog, and a > 3-disk RAID0 for the data. This should triple our current capacity. I don't know if you can do it, but it would be nice to see this be 1 RAID1 for OS, 1 RAID10 for pg_xlog, and another RAID10 for data. That is the recommended performance layout. It takes quite a few drives (minimum of 10). But it means your data is safe, and your performance should be very good. > > The general opinion of the way dspam uses the database among people I've > talked to on #postgresql is not very good, but of course the dspam folk blame > PostgreSQL and say to use MySQL if you want reasonable performance. Makes it > real fun to be a DSpam+PostgreSQL user when limits are reached, since > everyone denies responsibility. Fortunately, PostgreSQL people are pretty > helpful even if they think the client software sucks. :) > I can't say how dspam uses the database. But they certainly could make assumptions about how certain actions are done by the db, which are not quite true with postgres. (For instance MySQL can use an index to return information, because Postgres supports transactions, it cannot, because even though a row is in the index, it may not be visible to the current transaction.) They also might be doing stuff like "select max(row)" instead of "select row ORDER BY row DESC LIMIT 1". In postgres the former will be a sequential scan, the latter will be an index scan. Though I wonder about "select max(row) ORDER BY row DESC LIMIT 1". to me, that should still return the right answer, but I'm not sure. > Cheers, Good luck, John =:-> --------------enig6181E67B355E7A6657F58D55 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.1 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFCpGbnJdeBCYSNAAMRAhGUAJwKCyIKAZKFRt5jci9MwqTotfynygCgym7j 047uL9GNdhNZqVg9RhkZRlA= =7/mu -----END PGP SIGNATURE----- --------------enig6181E67B355E7A6657F58D55-- From pgsql-performance-owner@postgresql.org Mon Jun 6 12:11: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 0A3EB5289B for ; Mon, 6 Jun 2005 12:11:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06009-10 for ; Mon, 6 Jun 2005 15:11:37 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 2AD1B52834 for ; Mon, 6 Jun 2005 12:11:33 -0300 (ADT) Received: (qmail 9813 invoked from network); 6 Jun 2005 17:11:37 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 6 Jun 2005 17:11:37 +0200 Date: Mon, 06 Jun 2005 17:11:31 +0200 To: "Casey Allen Shobe" , "Postgresql Performance" Subject: Re: Performance nightmare with dspam (urgent) (resolved) References: <200506012019.13218.cshobe@seattleserver.com> <200506061454.48018.lists@seattleserver.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: <200506061454.48018.lists@seattleserver.com> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/110 X-Sequence-Number: 12747 > PostgreSQL and say to use MySQL if you want reasonable performance. If you want MySQL performance and reliability with postgres, simply run it with fsync deactivated ;) I'd suggest a controller with battery backed up cache to get rid of the 1 commit = 1 seek boundary. > Makes it > real fun to be a DSpam+PostgreSQL user when limits are reached, since > everyone denies responsibility. Fortunately, PostgreSQL people are > pretty > helpful even if they think the client software sucks. :) > > Cheers, From pgsql-performance-owner@postgresql.org Mon Jun 6 12:19: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 A00C452862 for ; Mon, 6 Jun 2005 12:19:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07686-05 for ; Mon, 6 Jun 2005 15:19:16 +0000 (GMT) Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by svr1.postgresql.org (Postfix) with ESMTP id 0FAAD528E0 for ; Mon, 6 Jun 2005 12:19:14 -0300 (ADT) Received: from osgiliath.mathom.us ([70.108.94.185]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IHO009DQ580LLI6@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Mon, 06 Jun 2005 10:19:13 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 1DA076000B2 for ; Mon, 06 Jun 2005 11:19:12 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 25210-01-9 for ; Mon, 06 Jun 2005 11:19:12 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 05A116000A8; Mon, 06 Jun 2005 11:19:12 -0400 (EDT) Date: Mon, 06 Jun 2005 11:19:11 -0400 From: Michael Stone Subject: Re: Performance nightmare with dspam (urgent) (resolved) In-reply-to: <42A466E7.4080808@arbash-meinel.com> To: Postgresql Performance Mail-Followup-To: Postgresql Performance Message-id: <20050606151911.GB19670@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <200506012019.13218.cshobe@seattleserver.com> <200506061454.48018.lists@seattleserver.com> <42A466E7.4080808@arbash-meinel.com> User-Agent: Mutt/1.5.9i 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: 200506/112 X-Sequence-Number: 12749 On Mon, Jun 06, 2005 at 10:08:23AM -0500, John A Meinel wrote: >I don't know if you can do it, but it would be nice to see this be 1 >RAID1 for OS, 1 RAID10 for pg_xlog, That's probably overkill--it's a relatively small sequential-write partition with really small writes; I don't see how pg_xlog would benefit from raid10 as opposed to raid1. Mike Stone From pgsql-performance-owner@postgresql.org Mon Jun 6 12:51: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 81C6152885 for ; Mon, 6 Jun 2005 12:51:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17299-03 for ; Mon, 6 Jun 2005 15:51:26 +0000 (GMT) Received: from sccrmhc14.comcast.net (sccrmhc14.comcast.net [204.127.202.59]) by svr1.postgresql.org (Postfix) with ESMTP id A0C58528A7 for ; Mon, 6 Jun 2005 12:51:24 -0300 (ADT) Received: from [192.168.1.52] (c-24-60-119-214.hsd1.ma.comcast.net[24.60.119.214]) by comcast.net (sccrmhc14) with ESMTP id <2005060615512301400dl439e>; Mon, 6 Jun 2005 15:51:23 +0000 Message-ID: <42A470FA.1080001@comcast.net> Date: Mon, 06 Jun 2005 11:51:22 -0400 From: Jeffrey Tenny User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres 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=1.285 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200506/113 X-Sequence-Number: 12750 Re: your JDBC wishes: Consider IBM Cloudscape (now Apache Derby) too, which has an apache license. It's all pure java and it's easy to get going. As to MySql vs Postgres: license issues aside, if you have transactionally complex needs (multi-table updates, etc), PostgreSQL wins hands down in my experience. There are a bunch of things about MySQL that just suck for high end SQL needs. (I like my subqueries, and I absolutely demand transactional integrity). There are some pitfalls to pgsql though, especially for existing SQL code using MAX and some other things which can really be blindsided (performance-wise) by pgsql if you don't use the workarounds. MySQL is nice for what I call "raw read speed" applications. But that license is an issue for me, as it is for you apparently. Some cloudscape info: http://www-306.ibm.com/software/data/cloudscape/ Some info on pitfalls of MySQL and PostgreSQL, an interesting contrast: http://sql-info.de/postgresql/postgres-gotchas.html http://sql-info.de/mysql/gotchas.html From pgsql-performance-owner@postgresql.org Mon Jun 6 13:08: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 7B8675282B for ; Mon, 6 Jun 2005 13:08:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21141-05 for ; Mon, 6 Jun 2005 16:08:10 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id C8D3C52902 for ; Mon, 6 Jun 2005 13:08:08 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j56G82GD018262; (envelope-from ) Mon, 6 Jun 2005 11:08:08 -0500 (CDT) Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com [12.215.118.172]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j56FqBx2001770 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Mon, 6 Jun 2005 10:52:11 -0500 (CDT) Message-ID: <42A47129.30309@arbash-meinel.com> Date: Mon, 06 Jun 2005 10:52:09 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Stone Cc: Postgresql Performance Subject: Re: Performance nightmare with dspam (urgent) (resolved) References: <200506012019.13218.cshobe@seattleserver.com> <200506061454.48018.lists@seattleserver.com> <42A466E7.4080808@arbash-meinel.com> <20050606151911.GB19670@mathom.us> In-Reply-To: <20050606151911.GB19670@mathom.us> X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig2B39D38647B3D6086103D3CD" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean 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: 200506/116 X-Sequence-Number: 12753 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig2B39D38647B3D6086103D3CD Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Michael Stone wrote: > On Mon, Jun 06, 2005 at 10:08:23AM -0500, John A Meinel wrote: > >> I don't know if you can do it, but it would be nice to see this be 1 >> RAID1 for OS, 1 RAID10 for pg_xlog, > > > That's probably overkill--it's a relatively small sequential-write > partition with really small writes; I don't see how pg_xlog would > benefit from raid10 as opposed to raid1. > Mike Stone > pg_xlog benefits from being super fast. Because it has to be fully synced before the rest of the data can be committed. Yes they are small, but if you can make it fast, you eliminate that overhead. It also benefits from having it's own spindle, because you eliminate the seek time. (Since it is always appending) Anyway, my point is that pg_xlog isn't necessarily tiny. Many people seem to set it as high as 100-200, and each one is 16MB. But one other thing to consider is to make pg_xlog on a battery backed ramdisk. Because it really *can* use the extra speed. I can't say that a ramdisk is more cost effective than faster db disks. But if you aren't using many checkpoint_segments, it seems like you could get a 1GB ramdisk, and probably have a pretty good performance boost. (I have not tested this personally, though). Since he is using the default settings (mostly) for dspam, he could probably get away with something like a 256MB ramdisk. The only prices I could find with a few minutes of googleing was: http://www.cenatek.com/store/category.cfm?Category=15 Which is $1.6k for 2GB. But there is also a product that is being developed, which claims $60 for the PCI card, you supply the memory. It has 4 DDR slots http://www.engadget.com/entry/1234000227045399/ And you can get a 128MB SDRAM ECC module for around $22 http://www.newegg.com/Product/Product.asp?Item=N82E16820998004 So that would put the total cost of a 512MB battery backed ramdisk at $60 + 4*22 = $150. That certainly seems less than what you would pay for the same speed in hard-drives. Unfortunately the Giga-byte iRam seems to just be in the demo stage. But if they aren't lying in the press releases, it would certainly be something to keep an eye on. John =:-> --------------enig2B39D38647B3D6086103D3CD 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.1 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFCpHEpJdeBCYSNAAMRApS7AJ9Z+wtADL6qBTQFxRm28mL4PdixGACeOA4v VIkicec9kApKEVZjaxPc6yc= =K+QL -----END PGP SIGNATURE----- --------------enig2B39D38647B3D6086103D3CD-- From pgsql-performance-owner@postgresql.org Mon Jun 6 13:00: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 D362D528A9 for ; Mon, 6 Jun 2005 13:00:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18849-06 for ; Mon, 6 Jun 2005 16:00:12 +0000 (GMT) Received: from mail-relay1.tagaudit.com (unknown [69.64.214.4]) by svr1.postgresql.org (Postfix) with ESMTP id E9C1252812 for ; Mon, 6 Jun 2005 13:00:10 -0300 (ADT) Received: from mail-hub.tagaudit.com (dns2.tagaudit.com [192.168.3.32]) by mail-relay1.tagaudit.com (Postfix) with ESMTP id F0711200000B8 for ; Mon, 6 Jun 2005 12:00:09 -0400 (EDT) Received: by mail-hub.tagaudit.com (Postfix, from userid 8) id DF0D2208A6; Mon, 6 Jun 2005 12:00:09 -0400 (EDT) Received: from xeon400.tagaudit.com (xeon400.tagaudit.com [192.168.3.17]) by mail-hub.tagaudit.com (Postfix) with ESMTP id AC04C208A6; Mon, 6 Jun 2005 12:00:09 -0400 (EDT) Received: by xeon400.tagaudit.com with Internet Mail Service (5.5.2656.59) id <2C4CR4A1>; Mon, 6 Jun 2005 12:00:09 -0400 Message-ID: <0C072E7CC947D511AC9600A0CC7341200256CF36@xeon400.tagaudit.com> From: Amit V Shah To: 'Jeffrey Tenny' , pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres Date: Mon, 6 Jun 2005 12:00:08 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.35 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/114 X-Sequence-Number: 12751 Hi all, Thanks for your replies. I ran a very prelimnary test, and found following results. I feel they are wierd and I dont know what I am doing wrong !!! I made a schema with 5 tables. I have a master data table with foreign keys pointing to other 4 tables. Master data table has around 4 million records. When I run a select joining it with the baby tables, postgres -> returns results in 2.8 seconds mysql -> takes around 16 seconds !!!! (This is with myisam ... with innodb it takes 220 seconds) I am all for postgres at this point, however just want to know why I am getting opposite results !!! Both DBs are on the same machine Thanks, Amit -----Original Message----- From: Jeffrey Tenny [mailto:jeffrey.tenny@comcast.net] Sent: Monday, June 06, 2005 11:51 AM To: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Need help to decide Mysql vs Postgres Re: your JDBC wishes: Consider IBM Cloudscape (now Apache Derby) too, which has an apache license. It's all pure java and it's easy to get going. As to MySql vs Postgres: license issues aside, if you have transactionally complex needs (multi-table updates, etc), PostgreSQL wins hands down in my experience. There are a bunch of things about MySQL that just suck for high end SQL needs. (I like my subqueries, and I absolutely demand transactional integrity). There are some pitfalls to pgsql though, especially for existing SQL code using MAX and some other things which can really be blindsided (performance-wise) by pgsql if you don't use the workarounds. MySQL is nice for what I call "raw read speed" applications. But that license is an issue for me, as it is for you apparently. Some cloudscape info: http://www-306.ibm.com/software/data/cloudscape/ Some info on pitfalls of MySQL and PostgreSQL, an interesting contrast: http://sql-info.de/postgresql/postgres-gotchas.html http://sql-info.de/mysql/gotchas.html ---------------------------(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 Jun 6 13:04: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 3399752891 for ; Mon, 6 Jun 2005 13:04:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21725-03 for ; Mon, 6 Jun 2005 16:04:44 +0000 (GMT) Received: from spieden.seattleserver.com (spieden.seattleserver.com [216.57.201.54]) by svr1.postgresql.org (Postfix) with ESMTP id 5D73852812 for ; Mon, 6 Jun 2005 13:04:41 -0300 (ADT) Received: (qmail 3980 invoked from network); 6 Jun 2005 16:01:54 +0000 Received: from pool-71-113-2-184.sttlwa.dsl-w.verizon.net (HELO ?192.168.2.5?) (cshobe@seattleserver.com@71.113.2.184) by spieden.seattleserver.com with RC4-MD5 encrypted SMTP; 6 Jun 2005 16:01:54 +0000 From: Casey Allen Shobe Organization: SeattleServer.com, Inc. To: John A Meinel Subject: Re: Performance nightmare with dspam (urgent) (resolved) Date: Mon, 6 Jun 2005 16:04:39 +0000 User-Agent: KMail/1.8 Cc: Postgresql Performance References: <200506012019.13218.cshobe@seattleserver.com> <200506061454.48018.lists@seattleserver.com> <42A466E7.4080808@arbash-meinel.com> In-Reply-To: <42A466E7.4080808@arbash-meinel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506061604.39122.lists@seattleserver.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.481 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200506/115 X-Sequence-Number: 12752 On Monday 06 June 2005 15:08, John A Meinel wrote: > Be very careful in this situation. If any disks in a RAID0 fails, the > entire raid is lost. You *really* want a RAID10. It takes more drives, > but then if anything dies you don't lose everything. We have redundancy at the machine level using DRBD, so this is not a concern. > I don't know if you can do it, but it would be nice to see this be 1 > RAID1 for OS, 1 RAID10 for pg_xlog, and another RAID10 for data. That is > the recommended performance layout. It takes quite a few drives (minimum > of 10). But it means your data is safe, and your performance should be > very good. The current servers have 4 drive bays, and we can't even afford to fill them all right now...we just invested what amounts to "quite a lot" on our budget for these 2 servers, so replacing them is not an option at all right now. I think the most cost-effective road forward is to add 2 more drives to each of the existing servers (which currently have 2 each). Cheers, -- Casey Allen Shobe | http://casey.shobe.info cshobe@seattleserver.com | cell 425-443-4653 AIM & Yahoo: SomeLinuxGuy | ICQ: 1494523 SeattleServer.com, Inc. | http://www.seattleserver.com From pgsql-performance-owner@postgresql.org Mon Jun 6 13:15: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 BA8CB528A8 for ; Mon, 6 Jun 2005 13:15:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22551-09 for ; Mon, 6 Jun 2005 16:15:18 +0000 (GMT) Received: from mr1.surnet.cl (smtp1.surnet.cl [216.155.73.162]) by svr1.postgresql.org (Postfix) with ESMTP id 005385283A for ; Mon, 6 Jun 2005 13:15:17 -0300 (ADT) Received: from smtp1.surnet.cl (216.155.73.168) by mr1.surnet.cl (7.0.031.3) id 42587EDE00C283F9; Mon, 6 Jun 2005 12:14:44 -0400 Received: from smtp2.surnet.cl (smtp2.surnet.cl []) by mr1.surnet.cl ([216.155.73.168]); Mon, 06 Jun 2005 16:14:44 +0000 Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl (7.0.031.3) id 4259ADE3007670B6; Mon, 6 Jun 2005 12:15:32 -0400 Received: from localhost (200.85.216.119) by cluster.surnet.cl (7.0.024) id 4276578F004C7BDA; Mon, 6 Jun 2005 12:15:15 -0400 Received: by localhost (Postfix, from userid 1000) id B9F72C20F80; Mon, 6 Jun 2005 12:15:37 -0400 (CLT) Date: Mon, 6 Jun 2005 12:15:37 -0400 From: Alvaro Herrera To: Amit V Shah Cc: 'Jeffrey Tenny' , pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres Message-ID: <20050606161537.GB9595@surnet.cl> References: <0C072E7CC947D511AC9600A0CC7341200256CF36@xeon400.tagaudit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0C072E7CC947D511AC9600A0CC7341200256CF36@xeon400.tagaudit.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.637 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/117 X-Sequence-Number: 12754 On Mon, Jun 06, 2005 at 12:00:08PM -0400, Amit V Shah wrote: > I made a schema with 5 tables. I have a master data table with foreign keys > pointing to other 4 tables. Master data table has around 4 million records. > When I run a select joining it with the baby tables, > > postgres -> returns results in 2.8 seconds > mysql -> takes around 16 seconds !!!! (This is with myisam ... with innodb > it takes 220 seconds) PostgreSQL has an excellent query optimizer, so if you get a much better execution time than MySQL in complex queries this isn't at all unexpected. I assume the MySQL guys would tell you to rewrite the queries in certain ways to make it go faster (just like the Postgres guys tell people to rewrite certain things when they hit Postgres limitations.) -- Alvaro Herrera () "I would rather have GNU than GNOT." (ccchips, lwn.net/Articles/37595/) From pgsql-performance-owner@postgresql.org Mon Jun 6 13:24: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 0143852805 for ; Mon, 6 Jun 2005 13:24:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26758-06 for ; Mon, 6 Jun 2005 16:24:23 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7C83D52814 for ; Mon, 6 Jun 2005 13:24:22 -0300 (ADT) Received: from 209-161-193-7.dsl.look.ca (209-161-193-7.dsl.look.ca [209.161.193.7]) by tht.net (Postfix) with ESMTP id EE7D576A23; Mon, 6 Jun 2005 12:24:23 -0400 (EDT) Subject: Re: Need help to decide Mysql vs Postgres From: Rod Taylor To: Amit V Shah Cc: pgsql-performance@postgresql.org, 'Jeffrey Tenny' In-Reply-To: <0C072E7CC947D511AC9600A0CC7341200256CF36@xeon400.tagaudit.com> References: <0C072E7CC947D511AC9600A0CC7341200256CF36@xeon400.tagaudit.com> Content-Type: text/plain Date: Mon, 06 Jun 2005 12:22:29 -0400 Message-Id: <1118074949.709.18.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 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: 200506/118 X-Sequence-Number: 12755 On Mon, 2005-06-06 at 12:00 -0400, Amit V Shah wrote: > Hi all, > > Thanks for your replies. > > I ran a very prelimnary test, and found following results. I feel they are > wierd and I dont know what I am doing wrong !!! > > I made a schema with 5 tables. I have a master data table with foreign keys > pointing to other 4 tables. Master data table has around 4 million records. > When I run a select joining it with the baby tables, > > postgres -> returns results in 2.8 seconds > mysql -> takes around 16 seconds !!!! (This is with myisam ... with innodb > it takes 220 seconds) We said MySQL was faster for simple selects and non-transaction inserts on a limited number of connections. Assuming you rebuilt statistics in MySQL (myisamchk -a), I would presume that PostgreSQLs more mature optimizer has come into play in the above 5 table join test by finding a better (faster) way of executing the query. If you post EXPLAIN ANALYZE output for the queries, we might be able to tell you what they did differently. > I am all for postgres at this point, however just want to know why I am > getting opposite results !!! Both DBs are on the same machine If possible, it would be wise to run a performance test with the expected load you will receive. If you expect to have 10 clients perform operation X at a time, then benchmark that specific scenario. Both PostgreSQL and MySQL will perform differently in a typical real load situation than with a single user, single query situation. > -----Original Message----- > From: Jeffrey Tenny [mailto:jeffrey.tenny@comcast.net] > Sent: Monday, June 06, 2005 11:51 AM > To: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Need help to decide Mysql vs Postgres > > > Re: your JDBC wishes: Consider IBM Cloudscape (now Apache Derby) too, > which has an apache license. It's all pure java and it's easy to get going. > > > As to MySql vs Postgres: license issues aside, if you have > transactionally complex needs (multi-table updates, etc), PostgreSQL > wins hands down in my experience. There are a bunch of things about > MySQL that just suck for high end SQL needs. (I like my subqueries, > and I absolutely demand transactional integrity). > > There are some pitfalls to pgsql though, especially for existing SQL > code using MAX and some other things which can really be blindsided > (performance-wise) by pgsql if you don't use the workarounds. > > > MySQL is nice for what I call "raw read speed" applications. But that > license is an issue for me, as it is for you apparently. > > > Some cloudscape info: > http://www-306.ibm.com/software/data/cloudscape/ > > Some info on pitfalls of MySQL and PostgreSQL, an interesting contrast: > http://sql-info.de/postgresql/postgres-gotchas.html > http://sql-info.de/mysql/gotchas.html > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > > ---------------------------(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 > -- From pgsql-performance-owner@postgresql.org Mon Jun 6 13:41: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 C979052814 for ; Mon, 6 Jun 2005 13:41:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30848-05 for ; Mon, 6 Jun 2005 16:41:15 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 577AB52806 for ; Mon, 6 Jun 2005 13:41:14 -0300 (ADT) Received: (qmail 16289 invoked from network); 6 Jun 2005 18:41:19 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 6 Jun 2005 18:41:19 +0200 To: "Amit V Shah" , "'Jeffrey Tenny'" , pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres References: <0C072E7CC947D511AC9600A0CC7341200256CF36@xeon400.tagaudit.com> Message-ID: Date: Mon, 06 Jun 2005 18:41:13 +0200 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: <0C072E7CC947D511AC9600A0CC7341200256CF36@xeon400.tagaudit.com> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/119 X-Sequence-Number: 12756 > postgres -> returns results in 2.8 seconds What kind of plan does it do ? seq scan on the big tables and hash join on the small tables ? > mysql -> takes around 16 seconds !!!! (This is with myisam ... with > innodb it takes 220 seconds) I'm not surprised at all. Try the same Join query but with a indexed where + order by / limit on the big table and you should get even worse for MySQL. I found 3 tables in a join was the maximum the MySQL planner was able to cope with before blowing up just like you experienced. > I am all for postgres at this point, however just want to know why I am > getting opposite results !!! Both DBs are on the same machine Why do you say "opposite results" ? From pgsql-performance-owner@postgresql.org Mon Jun 6 13:46: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 43C9A52814 for ; Mon, 6 Jun 2005 13:45:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32254-05 for ; Mon, 6 Jun 2005 16:45:56 +0000 (GMT) Received: from mail-relay1.tagaudit.com (unknown [69.64.214.4]) by svr1.postgresql.org (Postfix) with ESMTP id 5274052926 for ; Mon, 6 Jun 2005 13:45:53 -0300 (ADT) Received: from mail-hub.tagaudit.com (dns2.tagaudit.com [192.168.3.32]) by mail-relay1.tagaudit.com (Postfix) with ESMTP id 76FB2200000B7 for ; Mon, 6 Jun 2005 12:45:53 -0400 (EDT) Received: by mail-hub.tagaudit.com (Postfix, from userid 8) id 617CF20F76; Mon, 6 Jun 2005 12:45:53 -0400 (EDT) Received: from xeon400.tagaudit.com (xeon400.tagaudit.com [192.168.3.17]) by mail-hub.tagaudit.com (Postfix) with ESMTP id 41975208A6 for ; Mon, 6 Jun 2005 12:45:53 -0400 (EDT) Received: by xeon400.tagaudit.com with Internet Mail Service (5.5.2656.59) id <2C4CR4FK>; Mon, 6 Jun 2005 12:45:53 -0400 Message-ID: <0C072E7CC947D511AC9600A0CC7341200256CF37@xeon400.tagaudit.com> From: Amit V Shah To: pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres Date: Mon, 6 Jun 2005 12:45:51 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="ISO-8859-15" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.35 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/120 X-Sequence-Number: 12757 > I am all for postgres at this point, however just want to know why I am > getting opposite results !!! Both DBs are on the same machine > Why do you say "opposite results" ? Please pardon my ignorance, but from whatever I had heard, mysql was supposedly always faster than postgres !!!! Thats why I was so surprised !! I will definately post the "analyze query" thing by end of today ... Thanks for all your helps !! Amit From pgsql-performance-owner@postgresql.org Mon Jun 6 13:49: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 CD20652908 for ; Mon, 6 Jun 2005 13:49:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32642-07 for ; Mon, 6 Jun 2005 16:48:59 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id F002D528BB for ; Mon, 6 Jun 2005 13:48:57 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so1982086wra for ; Mon, 06 Jun 2005 09:48:58 -0700 (PDT) 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:content-disposition; b=oOflRU974/BiHi6s3tbn7EaC4mv1U2R+HHZNetHjiHW5CHv6RGhEL+dYLyPsEeItDeCjOBpuquVMd1kGBnFPzwbk0tmyYP26jRlO8HRFwRe8lB2HWdDW3uW/IXTTaZrhDBaGC2DJqSkspVwE8SBdHIeIGANf9JDN08wH7MFROYk= Received: by 10.54.3.68 with SMTP id 68mr3366676wrc; Mon, 06 Jun 2005 09:48:27 -0700 (PDT) Received: by 10.54.46.46 with HTTP; Mon, 6 Jun 2005 09:48:26 -0700 (PDT) Message-ID: <6556952605060609485c622403@mail.gmail.com> Date: Mon, 6 Jun 2005 09:48:26 -0700 From: Jone C Reply-To: Jone C To: pgsql-performance@postgresql.org Subject: slow growing table Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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: 200506/121 X-Sequence-Number: 12758 HI! I have a table that I use for about a month. As the month progresses, COPYs performed to this table get much much slower than they were at the beginning, for the same number of rows (about 100,000 and growing). I'm essentially doing a delete for a given day, then a COPY as a big transaction. This is done about 12 times a day. When the table is new it's very fast, towards the end of the month it's taking almost 10 times longer, yet I'm deleting and COPYing in the same amount of data. Other operations on this table slow down, too, that were fast before using the same criteria. I do a VACUUM ANALYZE after each delete / COPY process, I tried experimenting with CLUSTER but saw no real difference. this is psql 7.45 on Linux server, dedicated for this purpose. About 5 indexes, no FKs on this table. happy to provide any other info might need, suggestions appreciated all my best, Jone From pgsql-performance-owner@postgresql.org Mon Jun 6 14:00: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 D9DE052902 for ; Mon, 6 Jun 2005 14:00:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39364-04 for ; Mon, 6 Jun 2005 17:00:45 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id DF4E1528A7 for ; Mon, 6 Jun 2005 14:00:41 -0300 (ADT) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1DfKxp-0002bX-TF for pgsql-performance@postgresql.org; Mon, 06 Jun 2005 19:00:40 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1DfKxp-0000NH-00 for ; Mon, 06 Jun 2005 19:00:37 +0200 Date: Mon, 6 Jun 2005 19:00:37 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: slow growing table Message-ID: <20050606170037.GA1177@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <6556952605060609485c622403@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <6556952605060609485c622403@mail.gmail.com> X-Operating-System: Linux 2.6.11.8 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.021 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/122 X-Sequence-Number: 12759 On Mon, Jun 06, 2005 at 09:48:26AM -0700, Jone C wrote: > When the table is new it's very fast, towards the end of the month > it's taking almost 10 times longer, yet I'm deleting and COPYing in > the same amount of data. Other operations on this table slow down, > too, that were fast before using the same criteria. You might have a problem with index bloat. Could you try REINDEXing the indexes on the table and see if that makes a difference? /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Mon Jun 6 14: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 1F8335292F for ; Mon, 6 Jun 2005 14:50:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57921-05 for ; Mon, 6 Jun 2005 17:50:06 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7631D52805 for ; Mon, 6 Jun 2005 14:50:04 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 2FD9130952; Mon, 6 Jun 2005 19:46:21 +0200 (MET DST) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Need help to decide Mysql vs Postgres Date: Mon, 06 Jun 2005 13:01:23 -0400 Organization: cbbrowne Computing Inc Lines: 24 Message-ID: References: <0C072E7CC947D511AC9600A0CC7341200256CF37@xeon400.tagaudit.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:0VG4wbdDXjrRhR7Dn5mLh9oZdik= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.386 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200506/127 X-Sequence-Number: 12764 In the last exciting episode, ashah@tagaudit.com (Amit V Shah) wrote: >> I am all for postgres at this point, however just want to know why I am >> getting opposite results !!! Both DBs are on the same machine > >> Why do you say "opposite results" ? > > Please pardon my ignorance, but from whatever I had heard, mysql was > supposedly always faster than postgres !!!! Thats why I was so > surprised !! I will definately post the "analyze query" thing by > end of today ... There is a common "use case" where MySQL(tm) using the "MyISAM" storage manager tends to be quicker than PostgreSQL, namely where you are submitting a lot of more-or-less serial requests of the form: select * from some_table where id='some primary key value'; If your usage patterns differ from that, then "what you heard" won't necessarily apply to your usage. -- output = ("cbbrowne" "@" "acm.org") http://linuxdatabases.info/info/rdbms.html The difference between a child and a hacker is the amount he flames about his toys. -- Ed Schwalenberg From pgsql-performance-owner@postgresql.org Mon Jun 6 14:13: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 D62E15292B for ; Mon, 6 Jun 2005 14:13:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45307-04 for ; Mon, 6 Jun 2005 17:12:54 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 7FAB35282B for ; Mon, 6 Jun 2005 14:12:54 -0300 (ADT) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1DfL9h-0003FI-OQ for pgsql-performance@postgresql.org; Mon, 06 Jun 2005 19:12:54 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1DfL9h-0000mA-00 for ; Mon, 06 Jun 2005 19:12:53 +0200 Date: Mon, 6 Jun 2005 19:12:53 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: slow growing table Message-ID: <20050606171253.GA1655@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <6556952605060609485c622403@mail.gmail.com> <20050606170037.GA1177@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20050606170037.GA1177@uio.no> X-Operating-System: Linux 2.6.11.8 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.9i 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: 200506/123 X-Sequence-Number: 12760 On Mon, Jun 06, 2005 at 07:00:37PM +0200, Steinar H. Gunderson wrote: > You might have a problem with index bloat. Could you try REINDEXing the > indexes on the table and see if that makes a difference? On second thought... Does a VACUUM FULL help? If so, you might want to increase your FSM settings. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Mon Jun 6 14: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 CE49A528A7 for ; Mon, 6 Jun 2005 14:25:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47370-06 for ; Mon, 6 Jun 2005 17:25:25 +0000 (GMT) Received: from mail.nordicbet.com (mail.nordicbet.com [193.69.167.130]) by svr1.postgresql.org (Postfix) with ESMTP id D2C7152805 for ; Mon, 6 Jun 2005 14:25:19 -0300 (ADT) Received: from estneti-gw.online.ee ([62.65.34.222] helo=tobias.nordicbet.invalid) (Authenticated Sender=tobias@nordicbet.com) by mail.nordicbet.com with esmtpa (Exim 4.50 #1 (Debian)) id 1DfLLK-0004n5-BO; Mon, 06 Jun 2005 19:25:03 +0200 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id 3E6636F771; Mon, 6 Jun 2005 20:25:08 +0300 (EEST) Date: Mon, 6 Jun 2005 20:25:08 +0300 From: Tobias Brox To: Jeffrey Tenny Cc: pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres Message-ID: <20050606172508.GB8451@tobias.nordicbet.com> References: <42A470FA.1080001@comcast.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42A470FA.1080001@comcast.net> Organization: Group Nordicbet User-Agent: Mutt/1.5.6i 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: 200506/124 X-Sequence-Number: 12761 [Jeffrey Tenny - Mon at 11:51:22AM -0400] > There are some pitfalls to pgsql though, especially for existing SQL > code using MAX and some other things which can really be blindsided > (performance-wise) by pgsql if you don't use the workarounds. Yes, I discovered that - "select max(num_attr)" does a full table scan even if the figure can be found easily through an index. There exists a workaround: select num_attr from my_table order by num_attr desc limit 1; will find the number through the index. -- Tobias Brox, Tallinn From pgsql-performance-owner@postgresql.org Mon Jun 6 14:27: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 F0D3552814 for ; Mon, 6 Jun 2005 14:27:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45137-10 for ; Mon, 6 Jun 2005 17:27:49 +0000 (GMT) Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by svr1.postgresql.org (Postfix) with ESMTP id EC18952806 for ; Mon, 6 Jun 2005 14:27:43 -0300 (ADT) Received: from osgiliath.mathom.us ([70.108.94.185]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IHO007DFB65GH92@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Mon, 06 Jun 2005 12:27:41 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 01FC56000AB for ; Mon, 06 Jun 2005 13:27:41 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 27113-01 for ; Mon, 06 Jun 2005 13:27:40 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id CCC2D6000A8; Mon, 06 Jun 2005 13:27:40 -0400 (EDT) Date: Mon, 06 Jun 2005 13:27:40 -0400 From: Michael Stone Subject: Re: Performance nightmare with dspam (urgent) (resolved) In-reply-to: <42A47129.30309@arbash-meinel.com> To: Postgresql Performance Mail-Followup-To: Postgresql Performance Message-id: <20050606172740.GC19670@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <200506012019.13218.cshobe@seattleserver.com> <200506061454.48018.lists@seattleserver.com> <42A466E7.4080808@arbash-meinel.com> <20050606151911.GB19670@mathom.us> <42A47129.30309@arbash-meinel.com> User-Agent: Mutt/1.5.9i 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: 200506/125 X-Sequence-Number: 12762 On Mon, Jun 06, 2005 at 10:52:09AM -0500, John A Meinel wrote: >pg_xlog benefits from being super fast. Because it has to be fully >synced before the rest of the data can be committed. Yes they are small, >but if you can make it fast, you eliminate that overhead. It also >benefits from having it's own spindle, because you eliminate the seek >time. (Since it is always appending) Eliminating the seeks is definately a win. >Anyway, my point is that pg_xlog isn't necessarily tiny. Many people >seem to set it as high as 100-200, and each one is 16MB. It's not the size of the xlog, it's the size of the write. Unless you're writing out a stripe size of data at once you're only effectively writing to one disk pair at a time anyway. (Things change if you have a big NVRAM cache to aggregate the writes, but you'd need a *lot* of transaction activity to exceed the 50MB/s or so you could get from the single raid1 pair in that scenario.) Mike Stone From pgsql-performance-owner@postgresql.org Mon Jun 6 14:47: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 5236D52934 for ; Mon, 6 Jun 2005 14:47:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57088-04 for ; Mon, 6 Jun 2005 17:47:22 +0000 (GMT) Received: from www.bowmansystems.com (ns1.bowmansystems.com [65.166.193.2]) by svr1.postgresql.org (Postfix) with ESMTP id 32ED652926 for ; Mon, 6 Jun 2005 14:47:21 -0300 (ADT) Received: from localhost.localdomain (unknown [65.166.193.10]) by www.bowmansystems.com (Postfix) with ESMTP id 40896C130; Mon, 6 Jun 2005 12:43:26 -0500 (CDT) Subject: Postgresql on an AMD64 machine From: Mark Rinaudo To: pgsql-performance@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.5 Date: 06 Jun 2005 12:53:40 -0500 Message-Id: <1118080420.1644.23.camel@penguin1> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.8 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/126 X-Sequence-Number: 12763 I'm not sure if this is the appropriate list to post this question to but i'm starting with this one because it is related to the performance of Postgresql server. I have a Penguin Computing dual AMD 64 bit opteron machine with 8 Gigs of memory. In my attempt to increase the number of shared_buffers from the default to 65000 i was running into a semget error when trying to start Postgresql. After reading the documentation I adjusted the semaphore settings in the kernel to allow Postgresql to start successfully. With this configuration running if I do a ipcs -u i get the following. ------ Shared Memory Status -------- segments allocated 1 pages allocated 30728 pages resident 30626 pages swapped 0 Swap performance: 0 attempts 0 successes ------ Semaphore Status -------- used arrays = 1880 allocated semaphores = 31928 ------ Messages: Status -------- allocated queues = 0 used headers = 0 used space = 0 bytes I'm questioning the number of semaphores being used. In order for postgresql to start I had to set the maximum number of semaphores system wide to 6000000. This seems to be an abnormal amount of semaphores. I'm curious if this is a bug in the amd64 postgresql port. Is anyone else using postgresql on an AMD64 machine without similar issues? TIA Mark From pgsql-performance-owner@postgresql.org Mon Jun 6 15:12: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 65308528AA for ; Mon, 6 Jun 2005 15:12:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59975-10 for ; Mon, 6 Jun 2005 18:12:13 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 6C46552805 for ; Mon, 6 Jun 2005 15:12:11 -0300 (ADT) Received: (qmail 20423 invoked from network); 6 Jun 2005 20:12:17 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 6 Jun 2005 20:12:17 +0200 Date: Mon, 06 Jun 2005 20:12:11 +0200 To: "Amit V Shah" , pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres References: <0C072E7CC947D511AC9600A0CC7341200256CF37@xeon400.tagaudit.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: <0C072E7CC947D511AC9600A0CC7341200256CF37@xeon400.tagaudit.com> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/128 X-Sequence-Number: 12765 > Please pardon my ignorance, but from whatever I had heard, mysql was > supposedly always faster than postgres !!!! Thats why I was so surprised > !! I heard a lot of this too, so much it seems common wisdom that postgres is slow... well maybe some old version was, but it's getting better at every release, and the 8.0 really delivers... I get the feeling that the PG team is really working and delivering improvements every few months, compare this to MySQL 5 which has been in beta for as long as I can remember. Also, yes, definitely mysql is faster when doing simple selects like SELECT * FROM table WHERE id=constant, or on updates with few users, but once you start digging... it can get a thousand times slower on some joins just because the optimizer is dumb... and then suddenly 0.2 ms for MySQL versus 0.3 ms for postgres on a simple query doesn't seem that attractive when it's 2 ms on postgres versus 2 seconds on mysql for a not so complicated one like pulling the first N rows from a join ordered by... PG is considered slower than mysql also because many people don't use persistent connections, and connecting postgres is a lot slower than connecting MySQL... But well, persistent connections are easy to use and mandatory for performance on any database anyway so I don't understand why the fuss. > I will definately post the "analyze query" thing by end of today ... > > Thanks for all your helps !! > Amit > > > ---------------------------(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 > From pgsql-performance-owner@postgresql.org Mon Jun 6 15:32: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 0A482528A7 for ; Mon, 6 Jun 2005 15:32:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67025-10 for ; Mon, 6 Jun 2005 18:32:20 +0000 (GMT) Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by svr1.postgresql.org (Postfix) with ESMTP id 5D4FF5289B for ; Mon, 6 Jun 2005 15:32:15 -0300 (ADT) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id 4C963B85A for ; Mon, 6 Jun 2005 14:32:15 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v730) In-Reply-To: <1118080420.1644.23.camel@penguin1> References: <1118080420.1644.23.camel@penguin1> Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-6-189097658; protocol="application/pkcs7-signature" Message-Id: From: Vivek Khera Subject: Re: Postgresql on an AMD64 machine Date: Mon, 6 Jun 2005 14:32:14 -0400 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/129 X-Sequence-Number: 12766 --Apple-Mail-6-189097658 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Jun 6, 2005, at 1:53 PM, Mark Rinaudo wrote: > I'm questioning the number of semaphores being used. In order for > postgresql to start I had to set the maximum number of semaphores > system > wide to 6000000. This seems to be an abnormal amount of > semaphores. I'm > curious if this is a bug in the amd64 postgresql port. Is anyone else > using postgresql on an AMD64 machine without similar issues? > No such nonsense required for me under FreeBSD 5.4/amd64. I used the same settings I had under i386 OS. Postgres uses very few semaphores, from what I recall. My system shows 13 active semaphores. Vivek Khera, Ph.D. +1-301-869-4449 x806 --Apple-Mail-6-189097658 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA xKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B1OVQCjDXAmNaLIkVcI7d yfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk16emu59l0cUqVIUPSAR/ p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/AgEAMEMGA1UdHwQ8MDow OKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLm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trVpQ++4BTt+Y37uAI2Lnmv2SuXKgFoPTqgG +o4lfClRB2hKJXTByfYf69+wZf7+uCclbvVEvuwV9MlzeSUNHEVl4fH7y91o+Paw2zGBneRyEw2G Us7PU9y+xV5BJ1ONDrJYjJXBEKcnqJjUo/NU2Rc15ZBSAwfpSMWdnC0zi1hQ6Wr5aqwA48ryBiNU fNNyL5FaAQWT4P2vPg9x/8NynOT2HAh8CFgkTFKkfW/x9KDOMdlPdrKWYEt5uBe+WujRwx2LVXDx 7BdcSnhgNes6Q7VG+bRPcHDplQAAAAAAAA== --Apple-Mail-6-189097658-- From pgsql-performance-owner@postgresql.org Mon Jun 6 15:34: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 8B226528BE for ; Mon, 6 Jun 2005 15:34:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68969-02 for ; Mon, 6 Jun 2005 18:34:07 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 49C6B52864 for ; Mon, 6 Jun 2005 15:34:04 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j56IXeXY054916 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 Jun 2005 12:33:43 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j56IXeWF038958; Mon, 6 Jun 2005 12:33:40 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j56IXe5L038957; Mon, 6 Jun 2005 12:33:40 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 6 Jun 2005 12:33:40 -0600 From: Michael Fuhr To: Tobias Brox Cc: Jeffrey Tenny , pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres Message-ID: <20050606183340.GA38889@winnie.fuhr.org> References: <42A470FA.1080001@comcast.net> <20050606172508.GB8451@tobias.nordicbet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050606172508.GB8451@tobias.nordicbet.com> 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: 200506/130 X-Sequence-Number: 12767 On Mon, Jun 06, 2005 at 08:25:08PM +0300, Tobias Brox wrote: > [Jeffrey Tenny - Mon at 11:51:22AM -0400] > > There are some pitfalls to pgsql though, especially for existing SQL > > code using MAX and some other things which can really be blindsided > > (performance-wise) by pgsql if you don't use the workarounds. > > Yes, I discovered that - "select max(num_attr)" does a full table scan even > if the figure can be found easily through an index. PostgreSQL 8.1 will be able to use indexes for MIN and MAX. http://archives.postgresql.org/pgsql-committers/2005-04/msg00163.php http://archives.postgresql.org/pgsql-committers/2005-04/msg00168.php -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Mon Jun 6 15:55: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 E4EC552872 for ; Mon, 6 Jun 2005 15:55:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72369-05 for ; Mon, 6 Jun 2005 18:55:13 +0000 (GMT) Received: from smtp102.mail.sc5.yahoo.com (smtp102.mail.sc5.yahoo.com [216.136.174.140]) by svr1.postgresql.org (Postfix) with SMTP id 75F38528A7 for ; Mon, 6 Jun 2005 15:55:12 -0300 (ADT) Received: (qmail 22011 invoked from network); 6 Jun 2005 18:55:12 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=Yahoo.com; h=Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Kex2C0+6Bq/3FerOhWn9DT2DqXWum9ZgTSA5qu0YqG6VcTj9hkIqfplwdZn6P1fmFntJqojtg3n+1xdU/3CcGv6Gs9263OAwsWClPrbrHVNhCQ1WwpJPYKdAX1LdiRGf2ZW6uCpupfL8ZjaCseSZ9aMg2r5Aj+vHziRKwlYLZGw= ; Received: from unknown (HELO jupiter.black-lion.info) (janwieck@68.80.245.191 with login) by smtp102.mail.sc5.yahoo.com with SMTP; 6 Jun 2005 18:55:12 -0000 Received: from [172.21.8.23] (ismtp.afilias.com [216.217.55.254]) (authenticated bits=0) by jupiter.black-lion.info (8.12.10/8.12.9) with ESMTP id j56ItAwC014456; Mon, 6 Jun 2005 14:55:10 -0400 (EDT) (envelope-from JanWieck@Yahoo.com) Message-ID: <42A49C1B.4010701@Yahoo.com> Date: Mon, 06 Jun 2005 14:55:23 -0400 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: PFC Cc: Amit V Shah , pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres References: <0C072E7CC947D511AC9600A0CC7341200256CF37@xeon400.tagaudit.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=2.838 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: ** X-Archive-Number: 200506/132 X-Sequence-Number: 12769 On 6/6/2005 2:12 PM, PFC wrote: > >> Please pardon my ignorance, but from whatever I had heard, mysql was >> supposedly always faster than postgres !!!! Thats why I was so surprised >> !! > > I heard a lot of this too, so much it seems common wisdom that postgres > is slow... well maybe some old version was, but it's getting better at > every release, and the 8.0 really delivers... The harder it is to evaluate software, the less often people reevaluate it and the more often people just "copy" opinions instead of doing an evaluation at all. Today there are a gazillion people out there who "know" that MySQL is faster than PostgreSQL. They don't know under what circumstances it is, or what the word "circumstances" means in this context anyway. When you ask them when was the last time they actually tested this you get in about 99% of the cases an answer anywhere between 3 years and infinity (for all those who never did). The remaining 1% can then be reduced to an insignificant minority by asking how many concurrent users their test simulated. 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 Jun 6 15:55: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 3FEAF5289B for ; Mon, 6 Jun 2005 15:55:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71570-04 for ; Mon, 6 Jun 2005 18:54:55 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id E933152864 for ; Mon, 6 Jun 2005 15:54:54 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9029230952; Mon, 6 Jun 2005 20:51:11 +0200 (MET DST) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: Need help to decide Mysql vs Postgres Date: Mon, 06 Jun 2005 12:02:27 -0700 Organization: Hub.Org Networking Services Lines: 20 Message-ID: <42A49DC3.1030800@cheapcomplexdevices.com> References: <0C072E7CC947D511AC9600A0CC7341200256CF37@xeon400.tagaudit.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: Christopher Browne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/131 X-Sequence-Number: 12768 Christopher Browne wrote: > > There is a common "use case" where MySQL(tm) ... > > select * from some_table where id='some primary key value'; > > If your usage patterns differ from that... However this is a quite common use-case; and I wonder what the best practices for postgresql is for applications like that. I'm guessing the answer is PGMemcache? (http://people.freebsd.org/~seanc/pgmemcache/pgmemcache.pdf) ... with triggers and listen/notify to manage deletes&updates and tweaks to the application code to look to memcached for those primary_key=constant queries? If that is the answer, I'm curious if anyone's benchmarked or even has qualitative "yeah, feels very fast" results for such an application for the common mysql use case. From pgsql-performance-owner@postgresql.org Mon Jun 6 16:13: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 643F55287E for ; Mon, 6 Jun 2005 16:12:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76105-05 for ; Mon, 6 Jun 2005 19:12:44 +0000 (GMT) Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) by svr1.postgresql.org (Postfix) with ESMTP id D711752879 for ; Mon, 6 Jun 2005 16:12:41 -0300 (ADT) Received: from jfradkin ([63.162.100.127]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IHO0000UG13JCV2@vms040.mailsrvcs.net> for pgsql-performance@postgresql.org; Mon, 06 Jun 2005 14:12:42 -0500 (CDT) Date: Mon, 06 Jun 2005 15:12:50 -0400 From: "Joel Fradkin" Subject: Re: Need help to decide Mysql vs Postgres In-reply-to: <42A49C1B.4010701@Yahoo.com> To: "'Jan Wieck'" , "'PFC'" Cc: "'Amit V Shah'" , Message-id: <001c01c56acb$bc9ba730$797ba8c0@jfradkin> 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=2.09 tagged_above=0 required=5 tests=AWL, MSGID_DOLLARS X-Spam-Level: ** X-Archive-Number: 200506/133 X-Sequence-Number: 12770 I did my own evaluation a few months back, because postgres was not cutting it for me. I found that postgres 8.0 (was what I was using at the time, now on 8.0.2) out performed mysql on a optiplex with 2gig meg of memory. I had postgres and mysql loaded and would run one server at a time doing testing. My tests included using aqua studios connection to both databases and .asp page using odbc connections. There was not a huge difference, but I had significant time in postgres and it was a little faster, so I just took new approaches (flattened views,eliminated outer joins etc) to fixing the issues. Joel Fradkin Wazagua, Inc. 2520 Trailmate Dr Sarasota, Florida 34243 Tel. 941-753-7111 ext 305 jfradkin@wazagua.com www.wazagua.com Powered by Wazagua Providing you with the latest Web-based technology & advanced tools. C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc This email message is for the use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and delete and destroy all copies of the original message, including attachments. -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Jan Wieck Sent: Monday, June 06, 2005 1:55 PM To: PFC Cc: Amit V Shah; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Need help to decide Mysql vs Postgres On 6/6/2005 2:12 PM, PFC wrote: > >> Please pardon my ignorance, but from whatever I had heard, mysql was >> supposedly always faster than postgres !!!! Thats why I was so surprised >> !! > > I heard a lot of this too, so much it seems common wisdom that postgres > is slow... well maybe some old version was, but it's getting better at > every release, and the 8.0 really delivers... The harder it is to evaluate software, the less often people reevaluate it and the more often people just "copy" opinions instead of doing an evaluation at all. Today there are a gazillion people out there who "know" that MySQL is faster than PostgreSQL. They don't know under what circumstances it is, or what the word "circumstances" means in this context anyway. When you ask them when was the last time they actually tested this you get in about 99% of the cases an answer anywhere between 3 years and infinity (for all those who never did). The remaining 1% can then be reduced to an insignificant minority by asking how many concurrent users their test simulated. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From pgsql-performance-owner@postgresql.org Mon Jun 6 16:14: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 C4BAE5287E for ; Mon, 6 Jun 2005 16:13:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78760-03 for ; Mon, 6 Jun 2005 19:13:50 +0000 (GMT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id 918ED5285B for ; Mon, 6 Jun 2005 16:13:48 -0300 (ADT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.10.2+Sun/8.11.3) with ESMTP id j56JDpN07184; Mon, 6 Jun 2005 13:13:51 -0600 (MDT) Message-ID: <42A4A06F.9040008@outputservices.com> Date: Mon, 06 Jun 2005 13:13:51 -0600 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Postgresql and Software RAID/LVM 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.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/134 X-Sequence-Number: 12771 > Has anyone ran Postgres with software RAID or LVM on a production box? > What have been your experience? Yes, we have run for a couple years Pg with software LVM (mirroring) against two hardware RAID5 arrays. We host a production Sun box that runs 24/7. My experience: * Software RAID (other than mirroring) is a disaster waiting to happen. If the metadata for the RAID set gives out for any reason (CMOS scrambles, card dies, power spike, etc.) then you are hosed beyond belief. In most cases it is almost impossible to recover. With mirroring, however, you can always boot and operate on a single mirror, pretending that no LVM/RAID is underway. In other words, each mirror is a fully functional copy of the data which will operate your server. * Hardware RAID5 is a terrific way to boost performance via write caching and spreading I/O across multiple spindles. Each of our external arrays operates 14 drives (12 data, 1 parity and 1 hot spare). While RAID5 protects against single spindle failure, it will not hedge against multiple failures in a short time period, SCSI contoller failure, SCSI cable problems or even wholesale failure of the RAID controller. All of these things happen in a 24/7 operation. Using software RAID1 against the hardware RAID5 arrays hedges against any single failure. * Software mirroring gives you tremendous ability to change the system while it is running, by taking offline the mirror you wish to change and then synchronizing it after the change. On a fully operational production server, we have: * restriped the RAID5 array * replaced all RAID5 media with higher capacity drives * upgraded RAID5 controller * moved all data from an old RAID5 array to a newer one * replaced host SCSI controller * uncabled and physically moved storage to a different part of data center Again, all of this has taken place (over the years) while our machine was fully operational. From pgsql-performance-owner@postgresql.org Mon Jun 6 18:00: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 D08D452851 for ; Mon, 6 Jun 2005 18:00:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00251-05 for ; Mon, 6 Jun 2005 20:59:52 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id 695785287E for ; Mon, 6 Jun 2005 17:59:51 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so2260413wra for ; Mon, 06 Jun 2005 13:59:53 -0700 (PDT) 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:content-disposition:references; b=Y3cfX4bbjJaHRqBk1B1lAGLBJygWEsq+y6Tpjm2nxmELWfgwuT4RA5wzX6aK9/xdkv8CuLFW9Xw5levaOfnrN8YO4KgfhUkGrOB4Py2OuKcm8Xy0J3bGy4dnPkqDfSybgBGyq75FwuVMj7138rudiTbtXmgaX/dwV5KOBFl2HxE= Received: by 10.54.6.56 with SMTP id 56mr2251317wrf; Mon, 06 Jun 2005 13:59:21 -0700 (PDT) Received: by 10.54.150.16 with HTTP; Mon, 6 Jun 2005 13:59:21 -0700 (PDT) Message-ID: Date: Mon, 6 Jun 2005 16:59:21 -0400 From: Mike Rylander Reply-To: Mike Rylander To: Mark Rinaudo Subject: Re: Postgresql on an AMD64 machine Cc: pgsql-performance@postgresql.org In-Reply-To: <1118080420.1644.23.camel@penguin1> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1118080420.1644.23.camel@penguin1> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/135 X-Sequence-Number: 12772 On 06 Jun 2005 12:53:40 -0500, Mark Rinaudo wrote: > I'm not sure if this is the appropriate list to post this question to > but i'm starting with this one because it is related to the performance > of Postgresql server. I have a Penguin Computing dual AMD 64 bit > opteron machine with 8 Gigs of memory. In my attempt to increase the > number of shared_buffers from the default to 65000 i was running into a > semget error when trying to start Postgresql. After reading the > documentation I adjusted the semaphore settings in the kernel to allow > Postgresql to start successfully. With this configuration running if I > do a ipcs -u i get the following. On my HP-585, 4xOpteron, 16G RAM, Gentoo Linux (2.6.9): $ ipcs -u i ------ Shared Memory Status -------- segments allocated 1 pages allocated 34866 pages resident 31642 pages swapped 128 Swap performance: 0 attempts 0 successes ------ Semaphore Status -------- used arrays =3D 7 allocated semaphores =3D 119 ------ Messages: Status -------- allocated queues =3D 0 used headers =3D 0 used space =3D 0 bytes Did you perhaps disable spinlocks when compiling PG? --=20 Mike Rylander mrylander@gmail.com GPLS -- PINES Development Database Developer http://open-ils.org From pgsql-performance-owner@postgresql.org Mon Jun 6 18:15: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 3E9CE528A7 for ; Mon, 6 Jun 2005 18:15:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01828-07 for ; Mon, 6 Jun 2005 21:15: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 53D8B5289E for ; Mon, 6 Jun 2005 18:15:26 -0300 (ADT) 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 j56LFLKc022888; Mon, 6 Jun 2005 17:15:21 -0400 (EDT) To: Mike Rylander Cc: Mark Rinaudo , pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine In-reply-to: References: <1118080420.1644.23.camel@penguin1> Comments: In-reply-to Mike Rylander message dated "Mon, 06 Jun 2005 16:59:21 -0400" Date: Mon, 06 Jun 2005 17:15:21 -0400 Message-ID: <22887.1118092521@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: 200506/136 X-Sequence-Number: 12773 Mike Rylander writes: > On 06 Jun 2005 12:53:40 -0500, Mark Rinaudo wrote: >> I'm not sure if this is the appropriate list to post this question to >> but i'm starting with this one because it is related to the performance >> of Postgresql server. I have a Penguin Computing dual AMD 64 bit >> opteron machine with 8 Gigs of memory. In my attempt to increase the >> number of shared_buffers from the default to 65000 i was running into a >> semget error when trying to start Postgresql. > Did you perhaps disable spinlocks when compiling PG? That sure looks like it must be the issue --- in a normal build the number of semaphores needed does not vary with shared_buffers, but it will if Postgres is falling back to semaphore-based spinlocks. Which is a really bad idea from a performance standpoint, so you want to fix the build. Which PG version is this exactly, and what configure options did you use? What compiler was used? regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jun 6 19:22: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 C5E39528D0 for ; Mon, 6 Jun 2005 19:22:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19587-04 for ; Mon, 6 Jun 2005 22:21:58 +0000 (GMT) Received: from www.bowmansystems.com (ns1.bowmansystems.com [65.166.193.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1687A5289A for ; Mon, 6 Jun 2005 19:21:57 -0300 (ADT) Received: from localhost.localdomain (unknown [65.166.193.10]) by www.bowmansystems.com (Postfix) with ESMTP id 400C7C130; Mon, 6 Jun 2005 17:18:04 -0500 (CDT) Subject: Re: Postgresql on an AMD64 machine From: Mark Rinaudo To: postgres performance Cc: tgl@sss.pgh.pa.us In-Reply-To: <22887.1118092521@sss.pgh.pa.us> References: <1118080420.1644.23.camel@penguin1> <22887.1118092521@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.5 Date: 06 Jun 2005 17:28:20 -0500 Message-Id: <1118096900.1893.58.camel@penguin1> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.35 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/137 X-Sequence-Number: 12774 I'm running the Redhat Version of Postgresql which came pre-installed with Redhat ES. It's version number is 7.3.10-1. I'm not sure what options it was compiled with. Is there a way for me to tell? Should i just compile my own postgresql for this platform? Thanks Mark On Mon, 2005-06-06 at 16:15, Tom Lane wrote: > Mike Rylander writes: > > On 06 Jun 2005 12:53:40 -0500, Mark Rinaudo wrote: > >> I'm not sure if this is the appropriate list to post this question to > >> but i'm starting with this one because it is related to the performance > >> of Postgresql server. I have a Penguin Computing dual AMD 64 bit > >> opteron machine with 8 Gigs of memory. In my attempt to increase the > >> number of shared_buffers from the default to 65000 i was running into a > >> semget error when trying to start Postgresql. > > > Did you perhaps disable spinlocks when compiling PG? > > That sure looks like it must be the issue --- in a normal build the > number of semaphores needed does not vary with shared_buffers, but > it will if Postgres is falling back to semaphore-based spinlocks. > Which is a really bad idea from a performance standpoint, so you > want to fix the build. > > Which PG version is this exactly, and what configure options did > you use? What compiler was used? > > regards, tom lane > -- Mark Rinaudo 318-213-8780 ext 111 Bowman Systems From pgsql-performance-owner@postgresql.org Mon Jun 6 20:49: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 48218528D0 for ; Mon, 6 Jun 2005 20:49:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38537-04 for ; Mon, 6 Jun 2005 23:48:55 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id 356A45289B for ; Mon, 6 Jun 2005 20:48:54 -0300 (ADT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id 8022A18CC33; Mon, 6 Jun 2005 19:48:57 -0400 (EDT) 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 65654-01-6; Mon, 6 Jun 2005 19:48:56 -0400 (EDT) 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 25B6418CC06; Mon, 6 Jun 2005 19:48:54 -0400 (EDT) Message-ID: <42A4E0E0.5010601@samurai.com> Date: Tue, 07 Jun 2005 09:48:48 +1000 From: Neil Conway User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mark Rinaudo Cc: postgres performance , tgl@sss.pgh.pa.us Subject: Re: Postgresql on an AMD64 machine References: <1118080420.1644.23.camel@penguin1> <22887.1118092521@sss.pgh.pa.us> <1118096900.1893.58.camel@penguin1> In-Reply-To: <1118096900.1893.58.camel@penguin1> 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.019 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/138 X-Sequence-Number: 12775 Mark Rinaudo wrote: > I'm running the Redhat Version of Postgresql which came pre-installed > with Redhat ES. It's version number is 7.3.10-1. I'm not sure what > options it was compiled with. Is there a way for me to tell? `pg_config --configure` in recent releases. > Should i just compile my own postgresql for this platform? Yes, I would. 7.4 was the first release to include support for proper spinlocks on AMD64. (From a Redhat POV, it would probably be a good idea to patch 7.3 to include the relatively trivial changes needed for decent AMD64 performance, assuming that shipping a more recent version of PG with ES isn't an option.) -Neil From pgsql-performance-owner@postgresql.org Tue Jun 7 01: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 EE56952921 for ; Tue, 7 Jun 2005 01:28:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13450-01 for ; Tue, 7 Jun 2005 04:28:47 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 99E7552926 for ; Tue, 7 Jun 2005 01:28:45 -0300 (ADT) 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 j574Sh2L025726; Tue, 7 Jun 2005 00:28:43 -0400 (EDT) To: Neil Conway Cc: Mark Rinaudo , postgres performance Subject: Re: Postgresql on an AMD64 machine In-reply-to: <42A4E0E0.5010601@samurai.com> References: <1118080420.1644.23.camel@penguin1> <22887.1118092521@sss.pgh.pa.us> <1118096900.1893.58.camel@penguin1> <42A4E0E0.5010601@samurai.com> Comments: In-reply-to Neil Conway message dated "Tue, 07 Jun 2005 09:48:48 +1000" Date: Tue, 07 Jun 2005 00:28:43 -0400 Message-ID: <25725.1118118523@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: 200506/139 X-Sequence-Number: 12776 Neil Conway writes: > (From a Redhat POV, it would probably be a good idea to patch 7.3 to > include the relatively trivial changes needed for decent AMD64 > performance, How embarrassing :-( Will see about fixing it. However, this certainly won't ship before the next RHEL3 quarterly update, so in the meantime if Mark feels like building locally, it wouldn't be a bad idea. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 7 01:37: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 517BF5289E for ; Tue, 7 Jun 2005 01:37:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13384-03 for ; Tue, 7 Jun 2005 04:37:09 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 919AC5280F for ; Tue, 7 Jun 2005 01:37:06 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j574b097010793; (envelope-from ) Mon, 6 Jun 2005 23:37:00 -0500 (CDT) Received: from [192.168.1.11] (12-215-118-172.client.mchsi.com [12.215.118.172]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j574awWv019400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Mon, 6 Jun 2005 23:36:59 -0500 (CDT) Message-ID: <42A52465.2000302@arbash-meinel.com> Date: Mon, 06 Jun 2005 23:36:53 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marty Scholes Cc: pgsql-performance@postgresql.org Subject: Re: Postgresql and Software RAID/LVM References: <42A4A06F.9040008@outputservices.com> In-Reply-To: <42A4A06F.9040008@outputservices.com> X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig54ABC4DF9717F1D20E62FBB1" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean 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: 200506/140 X-Sequence-Number: 12777 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig54ABC4DF9717F1D20E62FBB1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Marty Scholes wrote: >> Has anyone ran Postgres with software RAID or LVM on a production box? >> What have been your experience? > > Yes, we have run for a couple years Pg with software LVM (mirroring) > against two hardware RAID5 arrays. We host a production Sun box that > runs 24/7. > > My experience: > * Software RAID (other than mirroring) is a disaster waiting to happen. > If the metadata for the RAID set gives out for any reason (CMOS > scrambles, card dies, power spike, etc.) then you are hosed beyond > belief. In most cases it is almost impossible to recover. With > mirroring, however, you can always boot and operate on a single mirror, > pretending that no LVM/RAID is underway. In other words, each mirror is > a fully functional copy of the data which will operate your server. Isn't this actually more of a problem for the meta-data to give out in a hardware situation? I mean, if the card you are using dies, you can't just get another one. With software raid, because the meta-data is on the drives, you can pull it out of that machine, and put it into any machine that has a controller which can read the drives, and a similar kernel, and you are back up and running. > > * Hardware RAID5 is a terrific way to boost performance via write > caching and spreading I/O across multiple spindles. Each of our > external arrays operates 14 drives (12 data, 1 parity and 1 hot spare). > While RAID5 protects against single spindle failure, it will not hedge > against multiple failures in a short time period, SCSI contoller > failure, SCSI cable problems or even wholesale failure of the RAID > controller. All of these things happen in a 24/7 operation. Using > software RAID1 against the hardware RAID5 arrays hedges against any > single failure. No, it hedges against *more* than one failure. But you can also do a RAID1 over a RAID5 in software. But if you are honestly willing to create a full RAID1, just create a RAID1 over RAID0. The performance is much better. And since you have a full RAID1, as long as both drives of a pairing don't give out, you can lose half of your drives. If you want the space, but you feel that RAID5 isn't redundant enough, go to RAID6, which uses 2 parity locations, each with a different method of storing parity, so not only is it more redundant, you have a better chance of finding problems. > > * Software mirroring gives you tremendous ability to change the system > while it is running, by taking offline the mirror you wish to change and > then synchronizing it after the change. > That certainly is a nice ability. But remember that LVM also has the idea of "snapshot"ing a running system. I don't know the exact details, just that there is a way to have some processes see the filesystem as it existed at an exact point in time. Which is also a great way to handle backups. > On a fully operational production server, we have: > * restriped the RAID5 array > * replaced all RAID5 media with higher capacity drives > * upgraded RAID5 controller > * moved all data from an old RAID5 array to a newer one > * replaced host SCSI controller > * uncabled and physically moved storage to a different part of data center > > Again, all of this has taken place (over the years) while our machine > was fully operational. > So you are saying that you were able to replace the RAID controller without turning off the machine? I realize there does exist hot-swappable PCI cards, but I think you are overstating what you mean by "fully operational". For instance, it's not like you can access your data while it is being physically moved. I do think you had some nice hardware. But I know you can do all of this in software as well. It is usually a price/performance tradeoff. You spend quite a bit to get a hardware RAID card that can keep up with a modern CPU. I know we have an FC raid box at work which has a full 512MB of cache on it, but it wasn't that much cheaper than buying a dedicated server. John =:-> --------------enig54ABC4DF9717F1D20E62FBB1 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.1 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFCpSRoJdeBCYSNAAMRAtkpAKCD7UaLjU4Qwi6Ri0hMt3Sd5KHijwCgwXRZ DYJs+pvwHSY9gwoshySsG+Y= =dg/K -----END PGP SIGNATURE----- --------------enig54ABC4DF9717F1D20E62FBB1-- From pgsql-performance-owner@postgresql.org Tue Jun 7 01:54: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 30EBD52812 for ; Tue, 7 Jun 2005 01:54:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18928-02 for ; Tue, 7 Jun 2005 04:54: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 CE3355283A for ; Tue, 7 Jun 2005 01:54:39 -0300 (ADT) 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 j574sabC026013; Tue, 7 Jun 2005 00:54:36 -0400 (EDT) To: Ron Mayer Cc: Christopher Browne , pgsql-performance@postgresql.org Subject: Re: Need help to decide Mysql vs Postgres In-reply-to: <42A49DC3.1030800@cheapcomplexdevices.com> References: <0C072E7CC947D511AC9600A0CC7341200256CF37@xeon400.tagaudit.com> <42A49DC3.1030800@cheapcomplexdevices.com> Comments: In-reply-to Ron Mayer message dated "Mon, 06 Jun 2005 12:02:27 -0700" Date: Tue, 07 Jun 2005 00:54:36 -0400 Message-ID: <26012.1118120076@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: 200506/141 X-Sequence-Number: 12778 Ron Mayer writes: > Christopher Browne wrote: >> There is a common "use case" where MySQL(tm) ... >> select * from some_table where id='some primary key value'; > However this is a quite common use-case; and I wonder what the > best practices for postgresql is for applications like that. Setting up a prepared statement should be a noticeable win for that sort of thing. Also of course there are the usual tuning issues: have you picked an appropriate shared_buffers setting, etc. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 7 06:43: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 5C87252817 for ; Tue, 7 Jun 2005 06:43:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86887-02 for ; Tue, 7 Jun 2005 09:43:25 +0000 (GMT) Received: from pws.com.au (mail.pws.com.au [210.23.138.139]) by svr1.postgresql.org (Postfix) with SMTP id 4E402528AA for ; Tue, 7 Jun 2005 06:43:20 -0300 (ADT) Received: (qmail 13695 invoked from network); 7 Jun 2005 09:43:18 -0000 Received: from unknown (HELO wizzard.pws.com.au) (russell@pws.com.au@138.217.54.70) by mail.pws.com.au with SMTP; 7 Jun 2005 09:43:18 -0000 From: Russell Smith To: Casey Allen Shobe Subject: Re: Performance nightmare with dspam (urgent) Date: Tue, 7 Jun 2005 19:43:16 +1000 User-Agent: KMail/1.7.2 Cc: Postgresql Performance References: <200506012019.13218.cshobe@seattleserver.com> In-Reply-To: <200506012019.13218.cshobe@seattleserver.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506071943.16238.mr-russ@pws.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/142 X-Sequence-Number: 12779 On Thu, 2 Jun 2005 06:19 am, Casey Allen Shobe wrote: > I found this response to my original post, and tried every single suggestion > in it, which has not helped: > > http://archives.postgresql.org/pgsql-performance/2004-11/msg00416.php > > I'm sorry to come begging for help, but this is a MAJOR problem with no > logical explanation, and is almost certainly the fault of PostgreSQL, because > the database and contents have been identical across all the hosts, and some > work beautifully with no tuning whatsoever; so I don't feel I'm wrong in > placing blame... I would personally strongly suggest turing on logging on the PG server for about an hour, sifting through the runtimes for the queries and finding which ones are taking all the time. I'd then run explain analyze and see what is happening. I have heard you could get much better performance by rewriting some of the dspam queries to use PG features. But I've never used dspam, so I can't verify that. But a quick look through the dspam pg driver source... /* Declare Cursor */ #ifdef VIRTUAL_USERS strcpy (query, "DECLARE dscursor CURSOR FOR SELECT DISTINCT username FROM dspam_virtual_uids"); #else strcpy (query, "DECLARE dscursor CURSOR FOR SELECT DISTINCT uid FROM dspam_stats"); #endif If that's run often, it probably won't give the best performance, but that's a guess. Again I'd suggest turning up the logging. > > All machines run Gentoo Linux. All have the same package versions. Disk I/O > doesn't seem to be related - the 733MHz server had a 33MB/s IDE drive, the > 2.4GHz server had a RAID 5 with 3 ultra320 drives: neither of those required > any tuning. The new 3.0GHz has a mirror raid with 2 ultra320 drives, and the > 3000+ that tuning fixed had an ultra160 disk not in a RAID. > > I really like PostgreSQL, and really don't want to use MySQL for dspam, but if > I can't get this worked out ASAP I'm going to have to change for the sake of > our customers. Any help is GREATLY appreciated! Again I'd suggest turning up the logging. > > I'm online on instant messengers (contact IDs shown below), monitoring my > email, and will be on #postgresql on Freenode. > > Cheers, From pgsql-performance-owner@postgresql.org Tue Jun 7 09:54: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 A8C0F528A7 for ; Tue, 7 Jun 2005 09:54:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48835-02 for ; Tue, 7 Jun 2005 12:53:58 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 1DAEA528D9 for ; Tue, 7 Jun 2005 09:53:56 -0300 (ADT) Received: (qmail 19758 invoked from network); 7 Jun 2005 14:54:03 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 7 Jun 2005 14:54:03 +0200 Date: Tue, 07 Jun 2005 14:53:54 +0200 To: "Joel Fradkin" , "'Jan Wieck'" Subject: Re: Need help to decide Mysql vs Postgres Cc: "'Amit V Shah'" , pgsql-performance@postgresql.org References: <001c01c56acb$bc9ba730$797ba8c0@jfradkin> From: PFC Organization: =?utf-8?Q?La_Boutique_Num=C3=A9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: <001c01c56acb$bc9ba730$797ba8c0@jfradkin> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/143 X-Sequence-Number: 12780 > My tests included using aqua studios connection to both databases and > .asp > page using odbc connections. Performance also depends a lot on the driver. For instance, the PHP driver for MySQL is very very fast. It is also very dumb, as it returns everything as a string and doesn't know about quoting. For Python it's the reverse : the MySQL driver is slow and dumb, and the postgres driver (psycopg 2) is super fast, handles all quoting, and knows about type conversions, it will automatically convert a Python List into a postgres Array and do the right thing with quoting, and it works both ways (ie you select a TEXT[] you get a list of strings all parsed for you). It knows about all the postgres types (yes even numeric <=> python Decimal) and you can even add your own types. That's really cool, plus the developer is a friendly guy. ------------------ in psql : test=> CREATE TABLE typetests ( id SERIAL PRIMARY KEY, iarray INTEGER[] NULL, narray NUMERIC[] NULL, tarray TEXT[] NULL,vnum NUMERIC NULL, vint INTEGER NULL, vtext TEXT NULL) WITHOUT OIDS; NOTICE: CREATE TABLE will create implicit sequence "typetests_id_seq" for serial column "typetests.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "typetests_pkey" for table "typetests" CREATE TABLE ------------------- in Python : data = { 'myiarray' : [1,5,8,6], 'mytarray' : ['hello','world'], 'mynarray' : [Decimal("1.23"),Decimal("6.58")], 'mynum' : Decimal("66.66"), 'myint' : 555, 'mytext' :u "This is an Unicode String Портал по изучению иностранных" } cursor.execute( """INSERT INTO typetests (iarray,narray,tarray,vnum,vint,vtext) VALUES (%(myiarray)s,%(mynarray)s,%(mytarray)s,%(mynum)s,%(myint)s,%(mytext)s)""", data ); ------------------ in psql : test=> SELECT * FROM typetests; id | iarray | narray | tarray | vnum | vint | vtext ----+-----------+-------------+---------------+-------+------+----------- 4 | {1,5,8,6} | {1.23,6.58} | {hello,world} | 66.66 | 555 | This is an Unicode String Портал по изучению иностранных (1 ligne) ------------------- in Python : cursor.execute( "SELECT * FROM typetests" ) for row in cursor.fetchall(): for elem in row: print type(elem), elem ------------------- output : 4 [1, 5, 8, 6] [Decimal("1.23"), Decimal("6.58")] ['hello', 'world'] 66.66 555 This is an Unicode String Портал по изучению иностранных ------------------- in Python : cursor = db.cursor(cursor_factory = psycopg.extras.DictCursor) cursor.execute( "SELECT * FROM typetests" ) for row in cursor.fetchall(): for key, value in row.items(): print key, ":", type(value), value ------------------- output : iarray : [1, 5, 8, 6] tarray : ['hello', 'world'] vtext : This is an Unicode String Портал по изучению иностранных id : 4 vnum : 66.66 vint : 555 narray : [Decimal("1.23"), Decimal("6.58")] ------------------- Timings : Time to execute SELECT * FROM typetests and fetch the results, including type conversions : Plain query : 0.279 ms / request Prepared query : 0.252 ms / request (not that bad ! Pentium-M 1600 MHz laptop with local postgres). Just doing SELECT id FROM typetests gives 0.1 ms for executing query and fetching the result. Who said Postgres was slow on small queries ? From pgsql-performance-owner@postgresql.org Tue Jun 7 12:30: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 F02A652913 for ; Tue, 7 Jun 2005 12:30:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86619-03 for ; Tue, 7 Jun 2005 15:30:17 +0000 (GMT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id D340B528BE for ; Tue, 7 Jun 2005 12:30:16 -0300 (ADT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.10.2+Sun/8.11.3) with ESMTP id j57FUDN24663; Tue, 7 Jun 2005 09:30:13 -0600 (MDT) Message-ID: <42A5BD85.3060309@outputservices.com> Date: Tue, 07 Jun 2005 09:30:13 -0600 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: John A Meinel Cc: pgsql-performance@postgresql.org Subject: Re: Postgresql and Software RAID/LVM References: <42A4A06F.9040008@outputservices.com> <42A52465.2000302@arbash-meinel.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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/144 X-Sequence-Number: 12781 John A Meinel wrote: > > Isn't this actually more of a problem for the meta-data to give out in a > hardware situation? I mean, if the card you are using dies, you can't > just get another one. > With software raid, because the meta-data is on the drives, you can pull > it out of that machine, and put it into any machine that has a > controller which can read the drives, and a similar kernel, and you are > back up and running. Probably true. If you have a similar kernel and hardware and if you can recover the state information, knowing where the state information is stored. Those are some very big "ifs" during a hectic disaster. > No, it hedges against *more* than one failure. But you can also do a > RAID1 over a RAID5 in software. But if you are honestly willing to > create a full RAID1, just create a RAID1 over RAID0. The performance is > much better. And since you have a full RAID1, as long as both drives of > a pairing don't give out, you can lose half of your drives. True as well. The problem with RAID1 over RAID0 is that, during a drive failure, you are one bad sector from disaster. Further, RAID5 does automatic rebuild, whereas most RAID1 setups do not. RAID5 reduces the amount of time that things are degraded, reducing the time that your data is in danger. > If you want the space, but you feel that RAID5 isn't redundant enough, > go to RAID6, which uses 2 parity locations, each with a different method > of storing parity, so not only is it more redundant, you have a better > chance of finding problems. Agreed, RAID6 is the future, but still won't keep the server running when the RAID controller dies, or the SCSI/FC host adapter goes, or you want to upgrade controller firmware, or you want to replace the media, or... > So you are saying that you were able to replace the RAID controller > without turning off the machine? I realize there does exist > hot-swappable PCI cards, but I think you are overstating what you mean > by "fully operational". For instance, it's not like you can access your > data while it is being physically moved. Detach mirror 1, uncable and move, recable and resync. Detach mirror 2, uncable and move, recable and resync. > > I do think you had some nice hardware. But I know you can do all of this > in software as well. It is usually a price/performance tradeoff. You > spend quite a bit to get a hardware RAID card that can keep up with a > modern CPU. I know we have an FC raid box at work which has a full 512MB > of cache on it, but it wasn't that much cheaper than buying a dedicated > server. We run two Nexsan ATABoy2 arrays. These can be found in 1 TB configurations for about $3,000 each, putting mirrored RAID5 storage at $6 per GB. Is that a lot of money for storage? Maybe. In our case, that's dirt cheap protection against storage-related downtime. Marty From pgsql-general-owner@postgresql.org Tue Jun 7 12:51:50 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E569D52953 for ; Tue, 7 Jun 2005 12:51:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91043-05 for ; Tue, 7 Jun 2005 15:51:38 +0000 (GMT) Received: from themode.com (themode.com [161.58.169.198]) by svr1.postgresql.org (Postfix) with ESMTP id 777B15294A for ; Tue, 7 Jun 2005 12:51:37 -0300 (ADT) Received: from localhost (bde@localhost) by themode.com (8.12.11/8.12.11) with ESMTP id j57FpXrj013787 for ; Tue, 7 Jun 2005 11:51:34 -0400 (EDT) Date: Tue, 7 Jun 2005 11:51:32 -0400 (EDT) From: brew@theMode.com X-X-Sender: mode@themode.com To: pgsql-general@postgresql.org Subject: Debian Stable goes from Woody to Sarge!! In-Reply-To: <42A5BD85.3060309@outputservices.com> Message-ID: References: <42A4A06F.9040008@outputservices.com> <42A52465.2000302@arbash-meinel.com> <42A5BD85.3060309@outputservices.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.178 tagged_above=0 required=5 tests=AWL, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200506/314 X-Sequence-Number: 79022 Debian Stable has gone from Woody to Sarge. Hooray! That means the normal package installed goes from 7.2.1 to 7.4.7. Thanks to the folks who told me about backports.org, but I didn't follow through and load it, though. Maybe when backports has 8.x I'll go that route. Thanks Oliver for the work you did (I'm assuming) on getting the Sarge postgreSQL package ready over the various incarnations of Testing. Now I'm off to upgrade the rest of my machines, prudently saving my production server for last. brew ========================================================================== Strange Brew (brew@theMode.com) Check out my Stock Option Covered Call website http://www.callpix.com and my Musician's Online Database Exchange http://www.TheMode.com ========================================================================== From pgsql-general-owner@postgresql.org Tue Jun 7 13:15:28 2005 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 444B4528E0 for ; Tue, 7 Jun 2005 13:15:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97737-03 for ; Tue, 7 Jun 2005 16:15:25 +0000 (GMT) Received: from mail.gmx.net (pop.gmx.de [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id 10EBE52942 for ; Tue, 7 Jun 2005 13:15:24 -0300 (ADT) Received: (qmail invoked by alias); 07 Jun 2005 16:15:23 -0000 Received: from dsl-082-083-249-182.arcor-ip.net (EHLO colt.pezone.net) [82.83.249.182] by mail.gmx.net (mp006) with SMTP; 07 Jun 2005 18:15:23 +0200 X-Authenticated: #495269 From: Peter Eisentraut To: brew@themode.com Subject: Re: Debian Stable goes from Woody to Sarge!! Date: Tue, 7 Jun 2005 18:15:21 +0200 User-Agent: KMail/1.7.2 Cc: pgsql-general@postgresql.org References: <42A4A06F.9040008@outputservices.com> <42A5BD85.3060309@outputservices.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506071815.21904.peter_e@gmx.net> X-Y-GMX-Trusted: 0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/317 X-Sequence-Number: 79025 brew@theMode.com wrote: > Thanks Oliver for the work you did (I'm assuming) on getting the > Sarge postgreSQL package ready over the various incarnations of > Testing. Martin Pitt maintains the Debian packages of PostgreSQL these days. -- Peter Eisentraut http://developer.postgresql.org/~petere/ From pgsql-performance-owner@postgresql.org Tue Jun 7 16:40: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 59F43528D9 for ; Tue, 7 Jun 2005 16:40:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48784-04 for ; Tue, 7 Jun 2005 19:40:40 +0000 (GMT) Received: from brmea-mail-4.sun.com (brmea-mail-4.Sun.COM [192.18.98.36]) by svr1.postgresql.org (Postfix) with ESMTP id 546755283C for ; Tue, 7 Jun 2005 16:40:36 -0300 (ADT) Received: from phys-bur-1 ([129.148.9.72]) by brmea-mail-4.sun.com (8.12.10/8.12.9) with ESMTP id j57Jebau001283 for ; Tue, 7 Jun 2005 13:40:38 -0600 (MDT) Received: from conversion-daemon.bur-mail1.east.sun.com by bur-mail1.east.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IHQ00201BUEM7@bur-mail1.east.sun.com> (original mail from Donald.Courtney@Sun.COM) for pgsql-performance@postgresql.org; Tue, 07 Jun 2005 15:40:37 -0400 (EDT) Received: from [129.148.184.34] (gyama.East.Sun.COM [129.148.184.34]) by bur-mail1.east.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTPA id <0IHQ003CIBZO18@bur-mail1.east.sun.com> for pgsql-performance@postgresql.org; Tue, 07 Jun 2005 15:40:37 -0400 (EDT) Date: Tue, 07 Jun 2005 15:38:30 -0400 From: Donald Courtney Subject: Re: Postgresql on an AMD64 machine In-reply-to: Cc: pgsql-performance@postgresql.org Message-id: <42A5F7B6.20502@sun.com> Organization: Sun Microsystems MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7) Gecko/20041221 References: <1118080420.1644.23.camel@penguin1> 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: 200506/145 X-Sequence-Number: 12782 Get FATAL when starting up (64 bit) with large shared_buffers setting I built a 64 bit for Sparc/Solaris easily but I found that the startup of postmaster generates a FATAL diagnostic due to going over the 2GB limit (3.7 GB). When building for 64 bit is there some other things that must change in order to size UP the shared_buffers? Thanks. Don C. P.S. A severe checkpoint problem I was having was fixed with "checkpoint_segments=200". Message: FATAL: 460000 is outside the valid range for parameter "shared_buffers" (16 .. 262143) LOG: database system was shut down at 2005-06-07 15:20:28 EDT Mike Rylander wrote: >On 06 Jun 2005 12:53:40 -0500, Mark Rinaudo wrote: > > >>I'm not sure if this is the appropriate list to post this question to >>but i'm starting with this one because it is related to the performance >>of Postgresql server. I have a Penguin Computing dual AMD 64 bit >>opteron machine with 8 Gigs of memory. In my attempt to increase the >>number of shared_buffers from the default to 65000 i was running into a >>semget error when trying to start Postgresql. After reading the >>documentation I adjusted the semaphore settings in the kernel to allow >>Postgresql to start successfully. With this configuration running if I >>do a ipcs -u i get the following. >> >> > > >On my HP-585, 4xOpteron, 16G RAM, Gentoo Linux (2.6.9): > >$ ipcs -u i > >------ Shared Memory Status -------- >segments allocated 1 >pages allocated 34866 >pages resident 31642 >pages swapped 128 >Swap performance: 0 attempts 0 successes > >------ Semaphore Status -------- >used arrays = 7 >allocated semaphores = 119 > >------ Messages: Status -------- >allocated queues = 0 >used headers = 0 >used space = 0 bytes > > >Did you perhaps disable spinlocks when compiling PG? > > > From pgsql-performance-owner@postgresql.org Tue Jun 7 16:54: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 D406B5280F for ; Tue, 7 Jun 2005 16:54:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43920-10 for ; Tue, 7 Jun 2005 19:54:33 +0000 (GMT) Received: from mail.jobflash.com (mail.jobflash.com [64.62.211.41]) by svr1.postgresql.org (Postfix) with ESMTP id E4615528AA for ; Tue, 7 Jun 2005 16:54:32 -0300 (ADT) Received: from [192.168.2.22] (user-2ivfiht.dialup.mindspring.com [165.247.202.61]) by mail.jobflash.com (Postfix) with ESMTP id 1059442002; Tue, 7 Jun 2005 12:54:31 -0700 (PDT) Message-ID: <42A5FB70.8090807@jobflash.com> Date: Tue, 07 Jun 2005 12:54:24 -0700 From: Tom Arthurs User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Donald Courtney Cc: pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> In-Reply-To: <42A5F7B6.20502@sun.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: 200506/146 X-Sequence-Number: 12783 According to my research, you only need a 64 bit image if you are going to be doing intensive floating point operations (which most db servers don't do). Some benchmarking results I've found on the internet indicate that 64 bit executables can be slower than 32 bit versions. I've been running 32 bit compiles on solaris for several years. How much memory do you have on that sparc box? Allocating more than about 7-12% to shared buffers has proven counter productive for us (it slows down). Kernel buffers are another animal. :) Donald Courtney wrote: > Get FATAL when starting up (64 bit) with large shared_buffers setting > > I built a 64 bit for Sparc/Solaris easily but I found that the > startup of postmaster generates a FATAL diagnostic due to going > over the 2GB limit (3.7 GB). > > When building for 64 bit is there some other > things that must change in order to size UP the shared_buffers? > > Thanks. > > Don C. > > P.S. A severe checkpoint problem I was having was fixed with > "checkpoint_segments=200". > > > Message: > > FATAL: 460000 is outside the valid range for parameter "shared_buffers" > (16 .. 262143) > LOG: database system was shut down at 2005-06-07 15:20:28 EDT > > Mike Rylander wrote: > >> On 06 Jun 2005 12:53:40 -0500, Mark Rinaudo >> wrote: >> >> >>> I'm not sure if this is the appropriate list to post this question to >>> but i'm starting with this one because it is related to the performance >>> of Postgresql server. I have a Penguin Computing dual AMD 64 bit >>> opteron machine with 8 Gigs of memory. In my attempt to increase the >>> number of shared_buffers from the default to 65000 i was running into a >>> semget error when trying to start Postgresql. After reading the >>> documentation I adjusted the semaphore settings in the kernel to allow >>> Postgresql to start successfully. With this configuration running if I >>> do a ipcs -u i get the following. >>> >> >> >> >> On my HP-585, 4xOpteron, 16G RAM, Gentoo Linux (2.6.9): >> >> $ ipcs -u i >> >> ------ Shared Memory Status -------- >> segments allocated 1 >> pages allocated 34866 >> pages resident 31642 >> pages swapped 128 >> Swap performance: 0 attempts 0 successes >> >> ------ Semaphore Status -------- >> used arrays = 7 >> allocated semaphores = 119 >> >> ------ Messages: Status -------- >> allocated queues = 0 >> used headers = 0 >> used space = 0 bytes >> >> >> Did you perhaps disable spinlocks when compiling PG? >> >> >> > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > > > From pgsql-performance-owner@postgresql.org Tue Jun 7 17:21: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 39DE55289A for ; Tue, 7 Jun 2005 17:21:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52725-10 for ; Tue, 7 Jun 2005 20:21:33 +0000 (GMT) Received: from nwkea-mail-2.sun.com (nwkea-mail-2.sun.com [192.18.42.14]) by svr1.postgresql.org (Postfix) with ESMTP id 1DFFD5289E for ; Tue, 7 Jun 2005 17:21:30 -0300 (ADT) Received: from phys-bur-1 ([129.148.9.72]) by nwkea-mail-2.sun.com (8.12.10/8.12.9) with ESMTP id j57KLVFH004457 for ; Tue, 7 Jun 2005 13:21:31 -0700 (PDT) Received: from conversion-daemon.bur-mail1.east.sun.com by bur-mail1.east.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IHQ00K01DPCQ4@bur-mail1.east.sun.com> (original mail from Donald.Courtney@Sun.COM) for pgsql-performance@postgresql.org; Tue, 07 Jun 2005 16:21:31 -0400 (EDT) Received: from [129.148.184.34] (gyama.East.Sun.COM [129.148.184.34]) by bur-mail1.east.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTPA id <0IHQ003LODVV18@bur-mail1.east.sun.com>; Tue, 07 Jun 2005 16:21:31 -0400 (EDT) Date: Tue, 07 Jun 2005 16:19:24 -0400 From: Donald Courtney Subject: Re: Postgresql on an AMD64 machine In-reply-to: <42A5FB70.8090807@jobflash.com> To: Tom Arthurs Cc: pgsql-performance@postgresql.org Message-id: <42A6014C.30108@sun.com> Organization: Sun Microsystems MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7) Gecko/20041221 References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.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: 200506/147 X-Sequence-Number: 12784 Tom Arthurs wrote: > According to my research, you only need a 64 bit image if you are > going to be doing intensive floating point operations (which most db > servers don't do). Some benchmarking results I've found on the > internet indicate that 64 bit executables can be slower than 32 bit > versions. I've been running 32 bit compiles on solaris for several years. > > How much memory do you have on that sparc box? Allocating more than > about 7-12% to shared buffers has proven counter productive for us (it > slows down). > The system has 8 CPUs w/ 32 GB - I'm hoping to see some benefit to large caches - Am I missing something key with postgreSQL? Yes - we have seen with oracle 64 bit that there can be as much as a 10% hit moving from 32 - but we make it up big time with large db-buffer sizes that drastically reduce I/O and allow for other things (like more connections). Maybe the expectation of less I/O is not correct? Don P.S. built with the Snapshot from two weeks ago. > Kernel buffers are another animal. :) > > Donald Courtney wrote: > >> Get FATAL when starting up (64 bit) with large shared_buffers setting >> >> I built a 64 bit for Sparc/Solaris easily but I found that the >> startup of postmaster generates a FATAL diagnostic due to going >> over the 2GB limit (3.7 GB). >> >> When building for 64 bit is there some other >> things that must change in order to size UP the shared_buffers? >> >> Thanks. >> >> Don C. >> >> P.S. A severe checkpoint problem I was having was fixed with >> "checkpoint_segments=200". >> >> >> Message: >> >> FATAL: 460000 is outside the valid range for parameter >> "shared_buffers" (16 .. 262143) >> LOG: database system was shut down at 2005-06-07 15:20:28 EDT >> >> Mike Rylander wrote: >> >>> On 06 Jun 2005 12:53:40 -0500, Mark Rinaudo >>> wrote: >>> >>> >>>> I'm not sure if this is the appropriate list to post this question to >>>> but i'm starting with this one because it is related to the >>>> performance >>>> of Postgresql server. I have a Penguin Computing dual AMD 64 bit >>>> opteron machine with 8 Gigs of memory. In my attempt to increase the >>>> number of shared_buffers from the default to 65000 i was running >>>> into a >>>> semget error when trying to start Postgresql. After reading the >>>> documentation I adjusted the semaphore settings in the kernel to allow >>>> Postgresql to start successfully. With this configuration running >>>> if I >>>> do a ipcs -u i get the following. >>>> >>> >>> >>> >>> >>> On my HP-585, 4xOpteron, 16G RAM, Gentoo Linux (2.6.9): >>> >>> $ ipcs -u i >>> >>> ------ Shared Memory Status -------- >>> segments allocated 1 >>> pages allocated 34866 >>> pages resident 31642 >>> pages swapped 128 >>> Swap performance: 0 attempts 0 successes >>> >>> ------ Semaphore Status -------- >>> used arrays = 7 >>> allocated semaphores = 119 >>> >>> ------ Messages: Status -------- >>> allocated queues = 0 >>> used headers = 0 >>> used space = 0 bytes >>> >>> >>> Did you perhaps disable spinlocks when compiling PG? >>> >>> >>> >> >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 5: Have you checked our extensive FAQ? >> >> http://www.postgresql.org/docs/faq >> >> >> From pgsql-performance-owner@postgresql.org Tue Jun 7 17:28: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 2D40B528D9 for ; Tue, 7 Jun 2005 17:27:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58487-07 for ; Tue, 7 Jun 2005 20:27:53 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 711A8528D0 for ; Tue, 7 Jun 2005 17:27:53 -0300 (ADT) Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j57KI5a3008791; Tue, 7 Jun 2005 13:18:05 -0700 Message-ID: <42A6034A.90405@commandprompt.com> Date: Tue, 07 Jun 2005 13:27:54 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Donald Courtney Cc: Tom Arthurs , pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> In-Reply-To: <42A6014C.30108@sun.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.017 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/148 X-Sequence-Number: 12785 >> > The system has 8 CPUs w/ 32 GB - I'm hoping to see some benefit to large > caches - > Am I missing something key with postgreSQL? > Yes - we have seen with oracle 64 bit that there can be as much as a 10% > hit moving > from 32 - but we make it up big time with large db-buffer sizes that > drastically Well for Opteron you should also gain from the very high memory bandwidth and the fact that it has I believe "3" FP units per CPU. Sincerely, Joshua D. Drake -- Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 PostgreSQL Replication, Consulting, Custom Programming, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ From pgsql-performance-owner@postgresql.org Tue Jun 7 17:47: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 BA5EC5292B for ; Tue, 7 Jun 2005 17:47:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64573-06 for ; Tue, 7 Jun 2005 20:47:51 +0000 (GMT) Received: from mr1.surnet.cl (smtp1.surnet.cl [216.155.73.162]) by svr1.postgresql.org (Postfix) with ESMTP id C3EA25292D for ; Tue, 7 Jun 2005 17:47:49 -0300 (ADT) Received: from smtp1.surnet.cl (216.155.73.168) by mr1.surnet.cl (7.0.031.3) id 42587EDE00C77A8C; Tue, 7 Jun 2005 16:47:18 -0400 Received: from smtp1.surnet.cl (mr1.surnet.cl []) by mr1.surnet.cl ([216.155.73.168]); Tue, 07 Jun 2005 20:47:18 +0000 Received: from cluster.surnet.cl (216.155.73.164) by smtp1.surnet.cl (7.0.031.3) id 42587C6E00A279E8; Tue, 7 Jun 2005 16:47:17 -0400 Received: from localhost (200.85.216.119) by cluster.surnet.cl (7.0.024) id 4276578F004FAB94; Tue, 7 Jun 2005 16:27:29 -0400 Received: by localhost (Postfix, from userid 1000) id E3897C2DC08; Tue, 7 Jun 2005 16:27:55 -0400 (CLT) Date: Tue, 7 Jun 2005 16:27:55 -0400 From: Alvaro Herrera To: Donald Courtney Cc: Tom Arthurs , pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine Message-ID: <20050607202755.GA28361@surnet.cl> References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42A6014C.30108@sun.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.604 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/150 X-Sequence-Number: 12787 On Tue, Jun 07, 2005 at 04:19:24PM -0400, Donald Courtney wrote: > The system has 8 CPUs w/ 32 GB - I'm hoping to see some benefit to large > caches - > Am I missing something key with postgreSQL? Yeah. Postgres makes extensive use of the kernel's cache (or, more precisely, assumes that the kernel is doing some caching on its own). So the bulk of the memory should be left to the kernel to handle, and shared_buffers be set relatively slow. This was the standard wisdom with releases previous to 8.0; I'm not sure if anyone confirmed to still hold after the buffer manager changes in 8.0 and later in 8.1 -- we saw extensive redesign of the bufmgr on both, so the behavior may have changed. If you wanna test, I'm sure lots of people here will be interested in the results. -- Alvaro Herrera () "This is a foot just waiting to be shot" (Andrew Dunstan) From pgsql-performance-owner@postgresql.org Tue Jun 7 17:39: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 BF1AE528D9 for ; Tue, 7 Jun 2005 17:39:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64070-01 for ; Tue, 7 Jun 2005 20:39:11 +0000 (GMT) Received: from mail.jobflash.com (mail.jobflash.com [64.62.211.41]) by svr1.postgresql.org (Postfix) with ESMTP id 6700A528BB for ; Tue, 7 Jun 2005 17:39:10 -0300 (ADT) Received: from [192.168.2.22] (user-2ivfiht.dialup.mindspring.com [165.247.202.61]) by mail.jobflash.com (Postfix) with ESMTP id 5A5C242002; Tue, 7 Jun 2005 13:39:11 -0700 (PDT) Message-ID: <42A605E8.8040607@jobflash.com> Date: Tue, 07 Jun 2005 13:39:04 -0700 From: Tom Arthurs User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Donald Courtney Cc: pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> In-Reply-To: <42A6014C.30108@sun.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: 200506/149 X-Sequence-Number: 12786 Yes, shared buffers in postgres are not used for caching -- unlike Oracle. Every time we hire an Oracle dba, I have to break them of the notion (which I shared when I started with postgres -- Josh Berkus and Josh Drake helped burst that bubble for me) :) You should gain i/o reduction through increasing kernel buffers -- Postgresql counts on read/write caching through that, so increasing that should get your performance improvemnets -- though I haven't found the sweet spot there yet, for solaris. My biggest challenge with solaris/sparc is trying to reduce context switching. Donald Courtney wrote: > Tom Arthurs wrote: > >> According to my research, you only need a 64 bit image if you are >> going to be doing intensive floating point operations (which most db >> servers don't do). Some benchmarking results I've found on the >> internet indicate that 64 bit executables can be slower than 32 bit >> versions. I've been running 32 bit compiles on solaris for several years. >> >> How much memory do you have on that sparc box? Allocating more than >> about 7-12% to shared buffers has proven counter productive for us (it >> slows down). >> > The system has 8 CPUs w/ 32 GB - I'm hoping to see some benefit to large > caches - > Am I missing something key with postgreSQL? > Yes - we have seen with oracle 64 bit that there can be as much as a 10% > hit moving > from 32 - but we make it up big time with large db-buffer sizes that > drastically > reduce I/O and allow for other things (like more connections). Maybe > the expectation of less I/O is not correct? > > Don > > P.S. built with the Snapshot from two weeks ago. > >> Kernel buffers are another animal. :) >> >> Donald Courtney wrote: >> >>> Get FATAL when starting up (64 bit) with large shared_buffers setting >>> >>> I built a 64 bit for Sparc/Solaris easily but I found that the >>> startup of postmaster generates a FATAL diagnostic due to going >>> over the 2GB limit (3.7 GB). >>> >>> When building for 64 bit is there some other >>> things that must change in order to size UP the shared_buffers? >>> >>> Thanks. >>> >>> Don C. >>> >>> P.S. A severe checkpoint problem I was having was fixed with >>> "checkpoint_segments=200". >>> >>> >>> Message: >>> >>> FATAL: 460000 is outside the valid range for parameter >>> "shared_buffers" (16 .. 262143) >>> LOG: database system was shut down at 2005-06-07 15:20:28 EDT >>> >>> Mike Rylander wrote: >>> >>>> On 06 Jun 2005 12:53:40 -0500, Mark Rinaudo >>>> wrote: >>>> >>>> >>>>> I'm not sure if this is the appropriate list to post this question to >>>>> but i'm starting with this one because it is related to the >>>>> performance >>>>> of Postgresql server. I have a Penguin Computing dual AMD 64 bit >>>>> opteron machine with 8 Gigs of memory. In my attempt to increase the >>>>> number of shared_buffers from the default to 65000 i was running >>>>> into a >>>>> semget error when trying to start Postgresql. After reading the >>>>> documentation I adjusted the semaphore settings in the kernel to allow >>>>> Postgresql to start successfully. With this configuration running >>>>> if I >>>>> do a ipcs -u i get the following. >>>>> >>>> >>>> >>>> >>>> >>>> >>>> On my HP-585, 4xOpteron, 16G RAM, Gentoo Linux (2.6.9): >>>> >>>> $ ipcs -u i >>>> >>>> ------ Shared Memory Status -------- >>>> segments allocated 1 >>>> pages allocated 34866 >>>> pages resident 31642 >>>> pages swapped 128 >>>> Swap performance: 0 attempts 0 successes >>>> >>>> ------ Semaphore Status -------- >>>> used arrays = 7 >>>> allocated semaphores = 119 >>>> >>>> ------ Messages: Status -------- >>>> allocated queues = 0 >>>> used headers = 0 >>>> used space = 0 bytes >>>> >>>> >>>> Did you perhaps disable spinlocks when compiling PG? >>>> >>>> >>>> >>> >>> >>> ---------------------------(end of broadcast)--------------------------- >>> TIP 5: Have you checked our extensive FAQ? >>> >>> http://www.postgresql.org/docs/faq >>> >>> >>> > > > > From pgsql-performance-owner@postgresql.org Tue Jun 7 18:04: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 53E4C52934 for ; Tue, 7 Jun 2005 18:04:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68030-06 for ; Tue, 7 Jun 2005 21:04:46 +0000 (GMT) Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by svr1.postgresql.org (Postfix) with ESMTP id 50F9F52937 for ; Tue, 7 Jun 2005 18:04:44 -0300 (ADT) Received: from osgiliath.mathom.us ([70.108.94.185]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IHQ00KZSFVRG2T4@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 07 Jun 2005 16:04:40 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 2D58F61BC7E for ; Tue, 07 Jun 2005 17:04:39 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 18652-03 for ; Tue, 07 Jun 2005 17:04:39 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 0C4006000AB; Tue, 07 Jun 2005 17:04:39 -0400 (EDT) Date: Tue, 07 Jun 2005 17:04:39 -0400 From: Michael Stone Subject: Re: Postgresql on an AMD64 machine In-reply-to: <42A605E8.8040607@jobflash.com> To: pgsql-performance@postgresql.org Mail-Followup-To: pgsql-performance@postgresql.org Message-id: <20050607210438.GF19670@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> <42A605E8.8040607@jobflash.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/151 X-Sequence-Number: 12788 On Tue, Jun 07, 2005 at 01:39:04PM -0700, Tom Arthurs wrote: >Yes, shared buffers in postgres are not used for caching That begs the question of what they are used for. :) Mike Stone From pgsql-performance-owner@postgresql.org Tue Jun 7 18:11: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 D1D0D5289A for ; Tue, 7 Jun 2005 18:11:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68847-06 for ; Tue, 7 Jun 2005 21:11:28 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 07B5C52899 for ; Tue, 7 Jun 2005 18:11:27 -0300 (ADT) 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 j57LBTwi018286; Tue, 7 Jun 2005 17:11:29 -0400 (EDT) To: Alvaro Herrera Cc: Donald Courtney , Tom Arthurs , pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine In-reply-to: <20050607202755.GA28361@surnet.cl> References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> <20050607202755.GA28361@surnet.cl> Comments: In-reply-to Alvaro Herrera message dated "Tue, 07 Jun 2005 16:27:55 -0400" Date: Tue, 07 Jun 2005 17:11:29 -0400 Message-ID: <18285.1118178689@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: 200506/152 X-Sequence-Number: 12789 Alvaro Herrera writes: > This was the standard wisdom with releases previous to 8.0; I'm not sure > if anyone confirmed to still hold after the buffer manager changes in > 8.0 and later in 8.1 -- we saw extensive redesign of the bufmgr on both, > so the behavior may have changed. If you wanna test, I'm sure lots of > people here will be interested in the results. Quite. The story at the moment is that we haven't bothered to create support for shared memory exceeding 2Gb, because there's never been any evidence that pushing shared_buffers up even close to that, much less above it, was a good idea. Most people have found the "sweet spot" to be in the range of 10K to 50K shared buffers, with performance dropping off above that. Obviously we'd be willing to do this work if there were convincing evidence it'd be worth the time. A benchmark showing performance continuing to climb with increasing shared_buffers right up to the 2Gb limit would be reasonably convincing. I think there is 0 chance of drawing such a graph with a pre-8.1 server, because of internal inefficiencies in the buffer manager ... but with CVS tip the story might be different. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 7 19:21: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 30B3A52851 for ; Tue, 7 Jun 2005 19:21:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 85798-04 for ; Tue, 7 Jun 2005 22:21:46 +0000 (GMT) Received: from cmailg3.svr.pol.co.uk (cmailg3.svr.pol.co.uk [195.92.195.173]) by svr1.postgresql.org (Postfix) with ESMTP id 8E8B852800 for ; Tue, 7 Jun 2005 19:21:46 -0300 (ADT) Received: from modem-2650.leopard.dialup.pol.co.uk ([217.135.154.90] helo=192.168.0.102) by cmailg3.svr.pol.co.uk with esmtp (Exim 4.41) id 1DfmSC-000806-IR; Tue, 07 Jun 2005 23:21:48 +0100 Subject: Re: slow growing table From: Simon Riggs To: Jone C Cc: pgsql-performance@postgresql.org In-Reply-To: <6556952605060609485c622403@mail.gmail.com> References: <6556952605060609485c622403@mail.gmail.com> Content-Type: text/plain Organization: 2nd Quadrant Date: Tue, 07 Jun 2005 23:21:48 +0100 Message-Id: <1118182908.3844.1605.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.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/153 X-Sequence-Number: 12790 On Mon, 2005-06-06 at 09:48 -0700, Jone C wrote: > HI! > > I have a table that I use for about a month. As the month progresses, > COPYs performed to this table get much much slower than they were at > the beginning, for the same number of rows (about 100,000 and > growing). > > I'm essentially doing a delete for a given day, then a COPY as a big > transaction. This is done about 12 times a day. > > When the table is new it's very fast, towards the end of the month > it's taking almost 10 times longer, yet I'm deleting and COPYing in > the same amount of data. Other operations on this table slow down, > too, that were fast before using the same criteria. > > I do a VACUUM ANALYZE after each delete / COPY process, I tried > experimenting with CLUSTER but saw no real difference. > > this is psql 7.45 on Linux server, dedicated for this purpose. About 5 > indexes, no FKs on this table. > > happy to provide any other info might need, suggestions appreciated > Search the archives for details within 4 months of a similar issue. The consensus was that this was because the indexes had become too big to fit in memory, hence the leap in response times. The workaround is to split the table into smaller pieces. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Tue Jun 7 21:20: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 B1D4752849 for ; Tue, 7 Jun 2005 21:20:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09595-10 for ; Wed, 8 Jun 2005 00:20:26 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id 1D67452816 for ; Tue, 7 Jun 2005 21:20:25 -0300 (ADT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id 6275218CF41; Tue, 7 Jun 2005 20:20:29 -0400 (EDT) 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 79640-01-7; Tue, 7 Jun 2005 20:20:27 -0400 (EDT) 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 C813918CF53; Tue, 7 Jun 2005 20:20:26 -0400 (EDT) Message-ID: <42A639C3.40606@samurai.com> Date: Wed, 08 Jun 2005 10:20:19 +1000 From: Neil Conway User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Arthurs Cc: Donald Courtney , pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> <42A605E8.8040607@jobflash.com> In-Reply-To: <42A605E8.8040607@jobflash.com> 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.019 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/154 X-Sequence-Number: 12791 Tom Arthurs wrote: > Yes, shared buffers in postgres are not used for caching Shared buffers in Postgres _are_ used for caching, they just form a secondary cache on top of the kernel's IO cache. Postgres does IO through the filesystem, which is then cached by the kernel. Increasing shared_buffers means that less memory is available for the kernel to cache IO -- increasing shared_buffers has been shown to be a net performance loss beyond a certain point. Still, there is value in shared_buffers as it means we can avoid a read() system call for hot pages. We can also do better buffer replacement in the PG shared buffer than the kernel can do (e.g. treating IO caused by VACUUM specially). > My biggest challenge with solaris/sparc is trying to reduce context > switching. It would be interesting to see if this is improved with current sources, as Tom's bufmgr rewrite should have hopefully have reduced this problem. -Neil From pgsql-performance-owner@postgresql.org Tue Jun 7 21:44: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 87BC952934 for ; Tue, 7 Jun 2005 21:44:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17562-01 for ; Wed, 8 Jun 2005 00:44:24 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 718435294D for ; Tue, 7 Jun 2005 21:44:22 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j580iNXA022415; (envelope-from ) Tue, 7 Jun 2005 19:44:24 -0500 (CDT) Received: from [192.168.1.11] ([12.215.118.172]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j580iMpD015073 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Tue, 7 Jun 2005 19:44:23 -0500 (CDT) Message-ID: <42A63F62.40007@arbash-meinel.com> Date: Tue, 07 Jun 2005 19:44:18 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Neil Conway Cc: Tom Arthurs , Donald Courtney , pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> <42A605E8.8040607@jobflash.com> <42A639C3.40606@samurai.com> In-Reply-To: <42A639C3.40606@samurai.com> X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig0B10D113C2C726FE382298D2" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean 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: 200506/155 X-Sequence-Number: 12792 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0B10D113C2C726FE382298D2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Neil Conway wrote: > Tom Arthurs wrote: > >> Yes, shared buffers in postgres are not used for caching > > > Shared buffers in Postgres _are_ used for caching, they just form a > secondary cache on top of the kernel's IO cache. Postgres does IO > through the filesystem, which is then cached by the kernel. Increasing > shared_buffers means that less memory is available for the kernel to > cache IO -- increasing shared_buffers has been shown to be a net > performance loss beyond a certain point. Still, there is value in > shared_buffers as it means we can avoid a read() system call for hot > pages. We can also do better buffer replacement in the PG shared buffer > than the kernel can do (e.g. treating IO caused by VACUUM specially). > As I recall, one of the performance problems with a large shared_buffers is that there are some commands which require looking at *all* of the shared buffer space. So the larger it gets, the longer those functions take. >> My biggest challenge with solaris/sparc is trying to reduce context >> switching. > > > It would be interesting to see if this is improved with current sources, > as Tom's bufmgr rewrite should have hopefully have reduced this problem. > These might be what was fixed with Tom's rewrite. I don't really know. John =:-> > -Neil > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster --------------enig0B10D113C2C726FE382298D2 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.1 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFCpj9kJdeBCYSNAAMRAqRAAKCN3lh88n5FfN1Dy3fjxFNcH1iHzQCeMiX5 A0FKVRf/Vz5BxaumMUPE4fY= =Zo6E -----END PGP SIGNATURE----- --------------enig0B10D113C2C726FE382298D2-- From pgsql-performance-owner@postgresql.org Wed Jun 8 00:08: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 AA80B52974 for ; Wed, 8 Jun 2005 00:05:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51307-06 for ; Wed, 8 Jun 2005 03:05:41 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 331CE52958 for ; Wed, 8 Jun 2005 00:05:40 -0300 (ADT) 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 7456137 for pgsql-performance@postgresql.org; Tue, 07 Jun 2005 20:07:43 -0700 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine Date: Tue, 7 Jun 2005 20:05:47 -0700 User-Agent: KMail/1.8 References: <1118080420.1644.23.camel@penguin1> <20050607202755.GA28361@surnet.cl> <18285.1118178689@sss.pgh.pa.us> In-Reply-To: <18285.1118178689@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506072005.47418.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: 200506/156 X-Sequence-Number: 12793 Tom, > Obviously we'd be willing to do this work if there were convincing > evidence it'd be worth the time. A benchmark showing performance > continuing to climb with increasing shared_buffers right up to the 2Gb > limit would be reasonably convincing. I think there is 0 chance of > drawing such a graph with a pre-8.1 server, because of internal > inefficiencies in the buffer manager ... but with CVS tip the story > might be different. Not that I've seen in testing so far. Your improvements have, fortunately, eliminated the penalty for allocating too much shared buffers as far as I can tell (at least, allocating 70,000 when gains stopped at 15,000 doesn't seem to carry a penalty), but I don't see any progressive gain with increased buffers above the initial ideal. In fact, with clock-sweep the shared_buffer curve is refreshingly flat once it reaches the required level, which will take a lot of the guesswork out of allocating buffers. Regarding 2GB memory allocation, though, we *could* really use support for work_mem and maintenance_mem of > 2GB. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jun 8 00:50: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 1D1545293D for ; Wed, 8 Jun 2005 00:50:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62210-02 for ; Wed, 8 Jun 2005 03:50: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 2BEC25294C for ; Wed, 8 Jun 2005 00:50:35 -0300 (ADT) 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 j583oYbl026814; Tue, 7 Jun 2005 23:50:34 -0400 (EDT) To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine In-reply-to: <200506072005.47418.josh@agliodbs.com> References: <1118080420.1644.23.camel@penguin1> <20050607202755.GA28361@surnet.cl> <18285.1118178689@sss.pgh.pa.us> <200506072005.47418.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Tue, 07 Jun 2005 20:05:47 -0700" Date: Tue, 07 Jun 2005 23:50:33 -0400 Message-ID: <26813.1118202633@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: 200506/157 X-Sequence-Number: 12794 Josh Berkus writes: > Not that I've seen in testing so far. Your improvements have, fortunately, > eliminated the penalty for allocating too much shared buffers as far as I can > tell (at least, allocating 70,000 when gains stopped at 15,000 doesn't seem > to carry a penalty), Cool, that's definitely a step forward ;-) > Regarding 2GB memory allocation, though, we *could* really use support for > work_mem and maintenance_mem of > 2GB. Again, let's see some evidence that it's worth putting effort into that. (Offhand it seems this is probably an easier fix than changing the shared-memory allocation code; but conventional wisdom is that really large values of work_mem are a bad idea, and I'm not sure I see the case for maintenance_work_mem above 2Gb either.) regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 8 03:16: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 757AA528BB for ; Wed, 8 Jun 2005 03:16:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96775-04 for ; Wed, 8 Jun 2005 06:16:23 +0000 (GMT) Received: from cmailg2.svr.pol.co.uk (cmailg2.svr.pol.co.uk [195.92.195.172]) by svr1.postgresql.org (Postfix) with ESMTP id C39075289B for ; Wed, 8 Jun 2005 03:16:22 -0300 (ADT) Received: from modem-2893.leopard.dialup.pol.co.uk ([217.135.155.77] helo=192.168.0.102) by cmailg2.svr.pol.co.uk with esmtp (Exim 4.41) id 1DftrM-0001wM-3q; Wed, 08 Jun 2005 07:16:16 +0100 Subject: Re: Postgresql on an AMD64 machine From: Simon Riggs To: Tom Lane Cc: Josh Berkus , pgsql-performance@postgresql.org In-Reply-To: <26813.1118202633@sss.pgh.pa.us> References: <1118080420.1644.23.camel@penguin1> <20050607202755.GA28361@surnet.cl> <18285.1118178689@sss.pgh.pa.us> <200506072005.47418.josh@agliodbs.com> <26813.1118202633@sss.pgh.pa.us> Content-Type: text/plain Organization: 2nd Quadrant Date: Wed, 08 Jun 2005 07:16:14 +0100 Message-Id: <1118211374.3844.1617.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.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/158 X-Sequence-Number: 12795 On Tue, 2005-06-07 at 23:50 -0400, Tom Lane wrote: > > Regarding 2GB memory allocation, though, we *could* really use support for > > work_mem and maintenance_mem of > 2GB. > > Again, let's see some evidence that it's worth putting effort into that. > (Offhand it seems this is probably an easier fix than changing the > shared-memory allocation code; but conventional wisdom is that really > large values of work_mem are a bad idea, and I'm not sure I see the case > for maintenance_work_mem above 2Gb either.) We have strong evidence that an in-memory sort is better than an external sort. And strong evidence that a hash-join/aggregate is faster than a sort-merge or sort-aggregate. What other evidence do you need? The idea that work_mem is bad is a workload dependent thing. It assumes that using the memory for other things is useful. That isn't the case for apps with large tables, which just churn through memory with zero gain. In 8.2, I imagine a workload management feature that would limit the allocation of work_mem and maintenance_work_mem, so that they can be more safely allocated to very high values in production. That would open the door to the use of very high work_mem values. Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Jun 8 04:37: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 9ECAC52954 for ; Wed, 8 Jun 2005 04:37:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25397-03 for ; Wed, 8 Jun 2005 07:37:33 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id D4EF05292F for ; Wed, 8 Jun 2005 04:37:29 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j587bQ0A009165; Wed, 8 Jun 2005 09:37:26 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j587bQKE009164; Wed, 8 Jun 2005 09:37:26 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Wed, 08 Jun 2005 09:37:24 +0200 (CEST) Date: Wed, 8 Jun 2005 09:36:31 +0200 From: "Martin Fandel" To: "J. Andrew Rogers" Cc: pgsql-performance@postgresql.org Message-ID: <1118216192.14965.24.camel@fandelm.ecommit.de> In-Reply-To: References: <1117782401.4380.37.camel@fandelm.ecommit.de> References: Subject: Re: Filesystem x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/159 X-Sequence-Number: 12796 Hi, I've installed the same installation of my reiser-fs-postgres-8.0.1 with xfs. Now my pgbench shows the following results: postgres@ramses:~> pgbench -h 127.0.0.1 -p 5432 -c150 -t5 pgbench starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 1 number of clients: 150 number of transactions per client: 5 number of transactions actually processed: 750/750 tps = 133.719348 (including connections establishing) tps = 151.670315 (excluding connections establishing) With reiserfs my pgbench results are between 230-280 (excluding connections establishing) and 199-230 (including connections establishing). I'm using Suse Linux 9.3. I can't see better performance with xfs. :/ Must I enable special fstab-settings? Best regards, Martin Am Freitag, den 03.06.2005, 10:18 -0700 schrieb J. Andrew Rogers: > On Fri, 3 Jun 2005 09:06:41 +0200 > "Martin Fandel" wrote: > > i have only a little question. Which filesystem is > >preferred for postgresql? I'm plan to use xfs > >(before i used reiserfs). The reason > > is the xfs_freeze Tool to make filesystem-snapshots. > > > XFS has worked great for us, and has been both reliable > and fast. Zero problems and currently our standard server > filesystem. Reiser, on the other hand, has on rare > occasion eaten itself on the few systems where someone was > running a Reiser partition, though none were running > Postgres at the time. We have deprecated the use of > Reiser on all systems where it is not already running. > > In terms of performance for Postgres, the rumor is that > XFS and JFS are at the top of the heap, definitely better > than ext3 and somewhat better than Reiser. I've never > used JFS, but I've seen a few benchmarks that suggest it > is at least as fast as XFS for Postgres. > > Since XFS is more mature than JFS on Linux, I go with XFS > by default. If some tragically bad problems develop with > XFS I may reconsider that position, but we've been very > happy with it so far. YMMV. > > cheers, > > J. Andrew Rogers From pgsql-performance-owner@postgresql.org Wed Jun 8 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 0CFCB52899 for ; Wed, 8 Jun 2005 06:09:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62156-04 for ; Wed, 8 Jun 2005 09:09:11 +0000 (GMT) Received: from exchange.hostworks.com.au (exchange.hostworks.com.au [202.58.32.39]) by svr1.postgresql.org (Postfix) with ESMTP id A22D052883 for ; Wed, 8 Jun 2005 06:09:09 -0300 (ADT) Received: from EXCHANGEHW.au.corp.hostworks.com.au ([10.5.0.93]) by exchange.hostworks.com.au with Microsoft SMTPSVC(6.0.3790.211); Wed, 8 Jun 2005 18:39:09 +0930 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: Importing from pg_dump slow, low Disk IO Date: Wed, 8 Jun 2005 18:39:09 +0930 Message-ID: <13F3036A953F6A41BC91040310BD692A01FD3B@EXCHANGEHW.au.corp.hostworks.com.au> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Importing from pg_dump slow, low Disk IO Thread-Index: AcVsCbqVuSQ3UPyzQeCqjH+47jIeXQ== From: "Steve Pollard" To: X-OriginalArrivalTime: 08 Jun 2005 09:09:09.0408 (UTC) FILETIME=[BAC7AA00:01C56C09] 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: 200506/160 X-Sequence-Number: 12797 Hi Everyone, Im having a performance issue with version 7.3.4 which i first thought = was Disk IO related, however now it seems like the problem is caused by really slow = commits, this is running on Redhat 8. Basically im taking a .sql file with insert of about 15,000 lines and = <'ing straight into psql DATABASENAME, the Disk writes never gets over about 2000 on = this machine with a RAID5 SCSI setup, this happens in my PROD and DEV environment. Ive installed the latest version on RedHat ES3 and copied the configs = across however the inserts are really really fast.. Was there a performce change from 7.3.4 to current to turn of = autocommits by default or is buffering handled differently ? I have ruled out Disk IO issues as a siple 'cp' exceeds Disk writes to = 60000 (using vmstat) If i do this with a BEGIN; and COMMIT; its really fast, however not = practical as im setting up a cold-standby server for automation. Have been trying to debug for a few days now and see nothing.. here is = some info : :::::::::::::: /proc/sys/kernel/shmall :::::::::::::: 2097152 :::::::::::::: /proc/sys/kernel/shmmax :::::::::::::: 134217728 :::::::::::::: /proc/sys/kernel/shmmni :::::::::::::: 4096 shared_buffers =3D 51200 max_fsm_relations =3D 1000 max_fsm_pages =3D 10000 max_locks_per_transaction =3D 64 wal_buffers =3D 64 effective_cache_size =3D 65536 MemTotal: 1547608 kB MemFree: 47076 kB MemShared: 0 kB Buffers: 134084 kB Cached: 1186596 kB SwapCached: 544 kB Active: 357048 kB ActiveAnon: 105832 kB ActiveCache: 251216 kB Inact_dirty: 321020 kB Inact_laundry: 719492 kB Inact_clean: 28956 kB Inact_target: 285300 kB HighTotal: 655336 kB HighFree: 1024 kB LowTotal: 892272 kB LowFree: 46052 kB SwapTotal: 1534056 kB SwapFree: 1526460 kB This is a real doosey for me, please provide any advise possible. Steve From pgsql-performance-owner@postgresql.org Wed Jun 8 06:37: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 3314052899 for ; Wed, 8 Jun 2005 06:37:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62997-09 for ; Wed, 8 Jun 2005 09:37:47 +0000 (GMT) Received: from mailgw.dmi.dk (mailgw.dmi.dk [130.226.71.185]) by svr1.postgresql.org (Postfix) with ESMTP id A88C95289E for ; Wed, 8 Jun 2005 06:37:45 -0300 (ADT) Received: from localhost (localhost.dmi.dk [127.0.0.1]) by mailgw.dmi.dk (8.12.11/8.12.11/Debian-1) with ESMTP id j589bhBi020998 for ; Wed, 8 Jun 2005 09:37:43 GMT Received: from mailgw.dmi.dk ([127.0.0.1]) by localhost (mailgw.dmi.dk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20982-01 for ; Wed, 8 Jun 2005 09:37:41 +0000 (GMT) Received: from postoffice.dmi.dk (postoffice.dmi.dk [130.226.64.60]) by mailgw.dmi.dk (8.12.11/8.12.11/Debian-1) with ESMTP id j589beNl020991 for ; Wed, 8 Jun 2005 09:37:40 GMT Received: from localhost (localhost.dmi.dk [127.0.0.1]) by postoffice.dmi.dk (Postfix) with ESMTP id 9DEE31803F for ; Wed, 8 Jun 2005 09:37:40 +0000 (GMT) Received: from postoffice.dmi.dk ([127.0.0.1]) by localhost (postoffice.dmi.dk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30276-01-89 for ; Wed, 8 Jun 2005 09:37:40 +0000 (GMT) Received: from [130.226.66.16] (anders [130.226.66.16]) by postoffice.dmi.dk (Postfix) with ESMTP id 5685618050 for ; Wed, 8 Jun 2005 09:37:40 +0000 (GMT) Message-ID: <42A6BC64.4010001@dmi.dk> Date: Wed, 08 Jun 2005 11:37:40 +0200 From: Kim Bisgaard User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: full outer performance problem Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at dmi.dk X-Virus-Scanned: by amavisd-maia-1.0.0-rc5 (Debian) at dmi.dk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.081 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/161 X-Sequence-Number: 12798 Hi, I'm having problems with the query optimizer and FULL OUTER JOIN on PostgreSQL 7.4. I cannot get it to use my indexes with full outer joins. I might be naive, but I think that it should be possible? I have two BIG tables (virtually identical) with 3 NOT NULL columns Station_id, TimeObs, Temp_XXXX, with unique indexes on (Station_id, TimeObs) and valid ANALYSE (set statistics=100). I want to join the two tables with a FULL OUTER JOIN. When I specify the query as: SELECT station_id, timeobs,temp_grass, temp_dry_at_2m FROM temp_dry_at_2m a FULL OUTER JOIN temp_grass b USING (station_id, timeobs) WHERE station_id = 52981 AND timeobs = '2004-1-1 0:0:0' I get the correct results station_id | timeobs | temp_grass | temp_dry_at_2m ------------+---------------------+------------+---------------- 52944 | 2004-01-01 00:10:00 | | -1.1 (1 row) BUT LOUSY performance, and the following EXPLAIN: QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Merge Full Join (cost=1542369.83..1618958.58 rows=6956994 width=32) (actual time=187176.408..201436.264 rows=1 loops=1) Merge Cond: (("outer".station_id = "inner".station_id) AND ("outer".timeobs = "inner".timeobs)) Filter: ((COALESCE("outer".station_id, "inner".station_id) = 52981) AND (COALESCE("outer".timeobs, "inner".timeobs) = '2004-01-01 00:00:00'::timestamp without time zone)) -> Sort (cost=1207913.44..1225305.93 rows=6956994 width=16) (actual time=145748.253..153851.607 rows=6956994 loops=1) Sort Key: a.station_id, a.timeobs -> Seq Scan on temp_dry_at_2m a (cost=0.00..117549.94 rows=6956994 width=16) (actual time=0.049..54226.770 rows=6956994 loops=1) -> Sort (cost=334456.38..340472.11 rows=2406292 width=16) (actual time=31668.876..34491.123 rows=2406292 loops=1) Sort Key: b.station_id, b.timeobs -> Seq Scan on temp_grass b (cost=0.00..40658.92 rows=2406292 width=16) (actual time=0.052..5484.489 rows=2406292 loops=1) Total runtime: 201795.989 ms (10 rows) If I change the query (note the "b."s) explain analyse SELECT b.station_id, b.timeobs,temp_grass, temp_dry_at_2m FROM temp_dry_at_2m a FULL OUTER JOIN temp_grass b USING (station_id, timeobs) WHERE b.station_id = 52981 AND b.timeobs = '2004-1-1 0:0:0' I seem to destroy the FULL OUTER JOIN and get wrong results (nothing) If I had happend to use "a.", and not "b.", I would have gotten correct results (by accident). The "a." variant gives this EXPLAIN: QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop Left Join (cost=0.00..11.97 rows=1 width=20) (actual time=0.060..0.067 rows=1 loops=1) -> Index Scan using temp_dry_at_2m_idx on temp_dry_at_2m a (cost=0.00..5.99 rows=1 width=16) (actual time=0.033..0.036 rows=1 loops=1) Index Cond: ((station_id = 52981) AND (timeobs = '2004-01-01 00:00:00'::timestamp without time zone)) -> Index Scan using temp_grass_idx on temp_grass b (cost=0.00..5.96 rows=1 width=16) (actual time=0.018..0.021 rows=1 loops=1) Index Cond: (("outer".station_id = b.station_id) AND ("outer".timeobs = b.timeobs)) Total runtime: 0.140 ms (6 rows) Why will PostgreSQL not use the same plan for both these queries - they are virtually identical?? I have tried to formulate the problem with left joins, but this demands from me that I know which table has all the values (and thus has to go first), and in practice no such table excists. TIA, Kim Bisgaard. From pgsql-performance-owner@postgresql.org Wed Jun 8 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 783B85292F for ; Wed, 8 Jun 2005 06:52:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68299-10 for ; Wed, 8 Jun 2005 09:51:52 +0000 (GMT) Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) by svr1.postgresql.org (Postfix) with ESMTP id 904315292D for ; Wed, 8 Jun 2005 06:51:51 -0300 (ADT) Received: from osgiliath.mathom.us ([70.108.120.78]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IHR00GXLFEELW07@vms040.mailsrvcs.net> for pgsql-performance@postgresql.org; Wed, 08 Jun 2005 04:51:50 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 22A3F60E032 for ; Wed, 08 Jun 2005 05:51:50 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 31404-03-6 for ; Wed, 08 Jun 2005 05:51:50 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 0B29460E031; Wed, 08 Jun 2005 05:51:50 -0400 (EDT) Date: Wed, 08 Jun 2005 05:51:50 -0400 From: Michael Stone Subject: Re: Postgresql on an AMD64 machine In-reply-to: <26813.1118202633@sss.pgh.pa.us> To: pgsql-performance@postgresql.org Mail-Followup-To: pgsql-performance@postgresql.org Message-id: <20050608095149.GB19513@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <1118080420.1644.23.camel@penguin1> <20050607202755.GA28361@surnet.cl> <18285.1118178689@sss.pgh.pa.us> <200506072005.47418.josh@agliodbs.com> <26813.1118202633@sss.pgh.pa.us> User-Agent: Mutt/1.5.9i 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: 200506/162 X-Sequence-Number: 12799 On Tue, Jun 07, 2005 at 11:50:33PM -0400, Tom Lane wrote: >Again, let's see some evidence that it's worth putting effort into that. >(Offhand it seems this is probably an easier fix than changing the >shared-memory allocation code; but conventional wisdom is that really >large values of work_mem are a bad idea, and I'm not sure I see the case >for maintenance_work_mem above 2Gb either.) Hmm. That would be a fairly hard thing to test, no? I wouldn't expect to see a smooth curve as the value is increased--I'd expect it to remain fairly flat until you hit the sweet spot where you can fit the whole working set into RAM. When you say "2Gb", does that imply that the memory allocation limit in 8.1 has been increased from 1G-1? Mike Stone From pgsql-performance-owner@postgresql.org Wed Jun 8 09:10: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 4B6325294D for ; Wed, 8 Jun 2005 09:10:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06384-06 for ; Wed, 8 Jun 2005 12:10:10 +0000 (GMT) Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by svr1.postgresql.org (Postfix) with ESMTP id 22EA85294C for ; Wed, 8 Jun 2005 09:10:09 -0300 (ADT) Received: from osgiliath.mathom.us ([70.108.120.78]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IHR003C4LSZPZV0@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Wed, 08 Jun 2005 07:10:11 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id C9EA360E032 for ; Wed, 08 Jun 2005 08:10:10 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03007-04-5 for ; Wed, 08 Jun 2005 08:10:10 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id B2304600344; Wed, 08 Jun 2005 08:10:10 -0400 (EDT) Date: Wed, 08 Jun 2005 08:10:10 -0400 From: Michael Stone Subject: Re: Filesystem In-reply-to: <1118216192.14965.24.camel@fandelm.ecommit.de> To: pgsql-performance@postgresql.org Mail-Followup-To: pgsql-performance@postgresql.org Message-id: <20050608121010.GC19513@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <1118216192.14965.24.camel@fandelm.ecommit.de> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.035 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/163 X-Sequence-Number: 12800 On Wed, Jun 08, 2005 at 09:36:31AM +0200, Martin Fandel wrote: >I've installed the same installation of my reiser-fs-postgres-8.0.1 >with xfs. Do you have pg_xlog on a seperate partition? I've noticed that ext2 seems to have better performance than xfs for the pg_xlog workload (with all the syncs). Mike Stone From pgsql-performance-owner@postgresql.org Wed Jun 8 09:18: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 301DB528E0 for ; Wed, 8 Jun 2005 09:18:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08082-02 for ; Wed, 8 Jun 2005 12:18:39 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 975D8528BE for ; Wed, 8 Jun 2005 09:18:37 -0300 (ADT) Received: (qmail 13962 invoked by uid 500); 8 Jun 2005 12:17:56 -0000 Date: Wed, 8 Jun 2005 07:17:55 -0500 From: Bruno Wolff III To: Kim Bisgaard Cc: pgsql-performance@postgresql.org Subject: Re: full outer performance problem Message-ID: <20050608121755.GB11464@wolff.to> Mail-Followup-To: Bruno Wolff III , Kim Bisgaard , pgsql-performance@postgresql.org References: <42A6BC64.4010001@dmi.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42A6BC64.4010001@dmi.dk> 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: 200506/164 X-Sequence-Number: 12801 On Wed, Jun 08, 2005 at 11:37:40 +0200, Kim Bisgaard wrote: > Hi, > > I'm having problems with the query optimizer and FULL OUTER JOIN on > PostgreSQL 7.4. I cannot get it to use my indexes with full outer joins. > I might be naive, but I think that it should be possible? > > I have two BIG tables (virtually identical) with 3 NOT NULL columns > Station_id, TimeObs, Temp_XXXX, with unique indexes on (Station_id, > TimeObs) and valid ANALYSE (set statistics=100). I want to join the two > tables with a FULL OUTER JOIN. > > When I specify the query as: > > SELECT station_id, timeobs,temp_grass, temp_dry_at_2m > FROM temp_dry_at_2m a > FULL OUTER JOIN temp_grass b > USING (station_id, timeobs) > WHERE station_id = 52981 > AND timeobs = '2004-1-1 0:0:0' > > I get the correct results > > station_id | timeobs | temp_grass | temp_dry_at_2m > ------------+---------------------+------------+---------------- > 52944 | 2004-01-01 00:10:00 | | -1.1 > (1 row) > > BUT LOUSY performance, and the following EXPLAIN: > > QUERY PLAN > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ > Merge Full Join (cost=1542369.83..1618958.58 rows=6956994 width=32) > (actual time=187176.408..201436.264 rows=1 loops=1) > Merge Cond: (("outer".station_id = "inner".station_id) AND > ("outer".timeobs = "inner".timeobs)) > Filter: ((COALESCE("outer".station_id, "inner".station_id) = 52981) AND > (COALESCE("outer".timeobs, "inner".timeobs) = '2004-01-01 > 00:00:00'::timestamp without time zone)) > -> Sort (cost=1207913.44..1225305.93 rows=6956994 width=16) (actual > time=145748.253..153851.607 rows=6956994 loops=1) > Sort Key: a.station_id, a.timeobs > -> Seq Scan on temp_dry_at_2m a (cost=0.00..117549.94 > rows=6956994 width=16) (actual time=0.049..54226.770 rows=6956994 > loops=1) > -> Sort (cost=334456.38..340472.11 rows=2406292 width=16) (actual > time=31668.876..34491.123 rows=2406292 loops=1) > Sort Key: b.station_id, b.timeobs > -> Seq Scan on temp_grass b (cost=0.00..40658.92 rows=2406292 > width=16) (actual time=0.052..5484.489 rows=2406292 loops=1) > Total runtime: 201795.989 ms > (10 rows) Someone else will need to comment on why Postgres can't use a more efficient plan. What I think will work for you is to restrict the station_id and timeobs on each side and then do a full join. You can try something like the sample query below (which hasn't been tested): SELECT station_id, timeobs, temp_grass, temp_dry_at_2m FROM (SELECT station_id, timeobs, temp_dry_at_2m FROM temp_dry_at_2m WHERE station_id = 52981 AND timeobs = '2004-1-1 0:0:0') a FULL OUTER JOIN (SELECT station_id, timeobs, temp_grass FROM temp_grass WHERE station_id = 52981 AND timeobs = '2004-1-1 0:0:0') b USING (station_id, timeobs) From pgsql-performance-owner@postgresql.org Wed Jun 8 09:26: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 6A725528CA for ; Wed, 8 Jun 2005 09:26:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10821-02 for ; Wed, 8 Jun 2005 12:26:48 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id 999005289A for ; Wed, 8 Jun 2005 09:26:44 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j58CQk0A009707; Wed, 8 Jun 2005 14:26:46 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j58CQkAT009706; Wed, 8 Jun 2005 14:26:46 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Wed, 08 Jun 2005 14:26:45 +0200 (CEST) Date: Wed, 8 Jun 2005 14:25:52 +0200 From: "Martin Fandel" To: Michael Stone Cc: pgsql-performance@postgresql.org Message-ID: <1118233552.14965.74.camel@fandelm.ecommit.de> In-Reply-To: <20050608121010.GC19513@mathom.us> References: References: <1118216192.14965.24.camel@fandelm.ecommit.de> References: <20050608121010.GC19513@mathom.us> Subject: Re: Filesystem x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline 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: 200506/165 X-Sequence-Number: 12802 Hi, ah you're right. :) I forgot to symlink the pg_xlog-dir to another partition. Now it's a bit faster than before. But not faster than the same installation with reiserfs: postgres@ramses:~> pgbench -h 127.0.0.1 -p 5432 -c150 -t5 pgbench starting vacuum...end. transaction type: TPC-B (sort of) scaling factor: 1 number of clients: 150 number of transactions per client: 5 number of transactions actually processed: 750/750 tps = 178.831543 (including connections establishing) tps = 213.931383 (excluding connections establishing) I've tested dump's and copy's with the xfs-installation. It's faster than before. But the transactions-query's are still slower than the reiserfs-installation. Are any fstab-/mount-options recommended for xfs? best regards, Martin Am Mittwoch, den 08.06.2005, 08:10 -0400 schrieb Michael Stone: > pgsql-performance@postgresql.org From pgsql-performance-owner@postgresql.org Wed Jun 8 09:32: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 34CD552879 for ; Wed, 8 Jun 2005 09:32:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11316-06 for ; Wed, 8 Jun 2005 12:32:36 +0000 (GMT) Received: from mailgw.dmi.dk (mailgw.dmi.dk [130.226.71.185]) by svr1.postgresql.org (Postfix) with ESMTP id D0B515283B for ; Wed, 8 Jun 2005 09:32:32 -0300 (ADT) Received: from localhost (localhost.dmi.dk [127.0.0.1]) by mailgw.dmi.dk (8.12.11/8.12.11/Debian-1) with ESMTP id j58CWZ5E030577 for ; Wed, 8 Jun 2005 12:32:35 GMT Received: from mailgw.dmi.dk ([127.0.0.1]) by localhost (mailgw.dmi.dk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30499-04 for ; Wed, 8 Jun 2005 12:32:33 +0000 (GMT) Received: from postoffice.dmi.dk (postoffice.dmi.dk [130.226.64.60]) by mailgw.dmi.dk (8.12.11/8.12.11/Debian-1) with ESMTP id j58CWTKl030564 for ; Wed, 8 Jun 2005 12:32:29 GMT Received: from localhost (localhost.dmi.dk [127.0.0.1]) by postoffice.dmi.dk (Postfix) with ESMTP id 4950418056; Wed, 8 Jun 2005 12:32:29 +0000 (GMT) Received: from postoffice.dmi.dk ([127.0.0.1]) by localhost (postoffice.dmi.dk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17241-01-8; Wed, 8 Jun 2005 12:32:29 +0000 (GMT) Received: from [130.226.66.16] (anders [130.226.66.16]) by postoffice.dmi.dk (Postfix) with ESMTP id CCC9E18050; Wed, 8 Jun 2005 12:32:28 +0000 (GMT) Message-ID: <42A6E55C.4030203@dmi.dk> Date: Wed, 08 Jun 2005 14:32:28 +0200 From: Kim Bisgaard User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Kim Bisgaard Subject: Re: full outer performance problem References: <42A6BC64.4010001@dmi.dk> <20050608121755.GB11464@wolff.to> In-Reply-To: <20050608121755.GB11464@wolff.to> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at dmi.dk X-Virus-Scanned: by amavisd-maia-1.0.0-rc5 (Debian) at dmi.dk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.058 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/166 X-Sequence-Number: 12803 Hi Bruno, Thanks for the moral support! I feel so too - but I am confident it will show up soon. W.r.t. your rewrite of the query, I get this "ERROR: could not devise a query plan for the given query" but no further details - I will try google Regards, Kim. Bruno Wolff III wrote: >On Wed, Jun 08, 2005 at 11:37:40 +0200, > Kim Bisgaard wrote: > > >>Hi, >> >>I'm having problems with the query optimizer and FULL OUTER JOIN on >>PostgreSQL 7.4. I cannot get it to use my indexes with full outer joins. >>I might be naive, but I think that it should be possible? >> >>I have two BIG tables (virtually identical) with 3 NOT NULL columns >>Station_id, TimeObs, Temp_XXXX, with unique indexes on (Station_id, >>TimeObs) and valid ANALYSE (set statistics=100). I want to join the two >>tables with a FULL OUTER JOIN. >> >>When I specify the query as: >> >>SELECT station_id, timeobs,temp_grass, temp_dry_at_2m >> FROM temp_dry_at_2m a >> FULL OUTER JOIN temp_grass b >> USING (station_id, timeobs) >> WHERE station_id = 52981 >> AND timeobs = '2004-1-1 0:0:0' >> >>I get the correct results >> >>station_id | timeobs | temp_grass | temp_dry_at_2m >>------------+---------------------+------------+---------------- >> 52944 | 2004-01-01 00:10:00 | | -1.1 >>(1 row) >> >>BUT LOUSY performance, and the following EXPLAIN: >> >> QUERY PLAN >>------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ >>Merge Full Join (cost=1542369.83..1618958.58 rows=6956994 width=32) >>(actual time=187176.408..201436.264 rows=1 loops=1) >> Merge Cond: (("outer".station_id = "inner".station_id) AND >> ("outer".timeobs = "inner".timeobs)) >> Filter: ((COALESCE("outer".station_id, "inner".station_id) = 52981) AND >> (COALESCE("outer".timeobs, "inner".timeobs) = '2004-01-01 >> 00:00:00'::timestamp without time zone)) >> -> Sort (cost=1207913.44..1225305.93 rows=6956994 width=16) (actual >> time=145748.253..153851.607 rows=6956994 loops=1) >> Sort Key: a.station_id, a.timeobs >> -> Seq Scan on temp_dry_at_2m a (cost=0.00..117549.94 >> rows=6956994 width=16) (actual time=0.049..54226.770 rows=6956994 >> loops=1) >> -> Sort (cost=334456.38..340472.11 rows=2406292 width=16) (actual >> time=31668.876..34491.123 rows=2406292 loops=1) >> Sort Key: b.station_id, b.timeobs >> -> Seq Scan on temp_grass b (cost=0.00..40658.92 rows=2406292 >> width=16) (actual time=0.052..5484.489 rows=2406292 loops=1) >>Total runtime: 201795.989 ms >>(10 rows) >> >> > >Someone else will need to comment on why Postgres can't use a more >efficient plan. What I think will work for you is to restrict >the station_id and timeobs on each side and then do a full join. >You can try something like the sample query below (which hasn't been tested): >SELECT station_id, timeobs, temp_grass, temp_dry_at_2m > FROM > (SELECT station_id, timeobs, temp_dry_at_2m > FROM temp_dry_at_2m > WHERE > station_id = 52981 > AND > timeobs = '2004-1-1 0:0:0') a > FULL OUTER JOIN > (SELECT station_id, timeobs, temp_grass > FROM temp_grass > WHERE > station_id = 52981 > AND > timeobs = '2004-1-1 0:0:0') b > USING (station_id, timeobs) > >---------------------------(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 Wed Jun 8 10:34: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 D181E5298D for ; Wed, 8 Jun 2005 10:34:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28146-03 for ; Wed, 8 Jun 2005 13:34:25 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by svr1.postgresql.org (Postfix) with ESMTP id 45DB152987 for ; Wed, 8 Jun 2005 10:34:24 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so250375wra for ; Wed, 08 Jun 2005 06:34:29 -0700 (PDT) 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:content-disposition:references; b=CHXg3AITMPuQEH0UWe2mMZp7Es1iDBJxqnuzmHqlNcn9KJreJFJ/5wdSIwt4iDdU1+RfkpB5T+H9StpYiuGCX6DNdfvSuUCCKcGp7AmajaMe+HoVWJiAxd1ew+9E7RtrHApR39++aMbeGzVXkIEcZ4tKir0xlSL1c0IpnlcNbNQ= Received: by 10.54.13.66 with SMTP id 66mr4534536wrm; Wed, 08 Jun 2005 06:34:29 -0700 (PDT) Received: by 10.54.96.18 with HTTP; Wed, 8 Jun 2005 06:34:29 -0700 (PDT) Message-ID: <6744b38505060806342e6a07d@mail.gmail.com> Date: Wed, 8 Jun 2005 08:34:29 -0500 From: George Essig Reply-To: George Essig To: K C Lau Subject: Re: SELECT DISTINCT Performance Issue Cc: pgsql-performance@postgresql.org In-Reply-To: <6.2.1.2.0.20050602190756.05ab2c70@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6.2.1.2.0.20050602190756.05ab2c70@localhost> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.097 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/167 X-Sequence-Number: 12804 On 6/2/05, K C Lau wrote: ... >=20 > select DISTINCT ON (PlayerID) PlayerID,AtDate from Player where > PlayerID=3D'22220' order by PlayerID desc, AtDate desc; > The Player table has primary key (PlayerID, AtDate) representing data ove= r > time and the query gets the latest data for a player. >=20 > ...=20 > esdt=3D> explain analyze select DISTINCT ON (PlayerID) PlayerID,AtDate fr= om > Player > where PlayerID=3D'22220' order by PlayerID desc, AtDate desc; > Unique (cost=3D0.00..2507.66 rows=3D1 width=3D23) (actual time=3D0.000= ..187.000 > rows=3D1 loops=3D1) > -> Index Scan Backward using pk_player on player (cost=3D0.00..2505= .55 > rows=3D8 > 43 width=3D23) (actual time=3D0.000..187.000 rows=3D1227 loops=3D1) > Index Cond: ((playerid)::text =3D '22220'::text) > Total runtime: 187.000 ms >=20 Is PlayerID an integer datatype or a text datatype. It seems like PlayerID should be an integer data type, but postgres treats PlayerID as a text data type. This is because the value '22220' is quoted in your query. Also, the explain analyze output shows "Index Cond: ((playerid)::text =3D '22220'::text". George Essig From pgsql-performance-owner@postgresql.org Wed Jun 8 10:49: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 1ECCE5289A for ; Wed, 8 Jun 2005 10:49:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30975-04 for ; Wed, 8 Jun 2005 13:49:28 +0000 (GMT) Received: from p0f.net (p0f.net [193.77.154.190]) by svr1.postgresql.org (Postfix) with ESMTP id A402D5281C for ; Wed, 8 Jun 2005 10:49:26 -0300 (ADT) Received: from [10.10.105.30] ([193.77.165.58]) (authenticated bits=0) by p0f.net (8.13.3/8.13.3) with ESMTP id j58Ddj8a009445 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Jun 2005 15:39:47 +0200 Message-ID: <42A6F75C.50100@p0f.net> Date: Wed, 08 Jun 2005 15:49:16 +0200 From: Grega Bremec Organization: P0F User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Martin Fandel Cc: pgsql-performance@postgresql.org Subject: Re: Filesystem References: <1118233552.14965.74.camel@fandelm.ecommit.de> In-Reply-To: <1118233552.14965.74.camel@fandelm.ecommit.de> X-Enigmail-Version: 0.91.0.0 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=1.376 tagged_above=0 required=5 tests=AWL, RCVD_IN_NJABL_DUL X-Spam-Level: * X-Archive-Number: 200506/168 X-Sequence-Number: 12805 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Martin Fandel wrote: | | I've tested dump's and copy's with the xfs-installation. It's | faster than before. But the transactions-query's are still slower | than the reiserfs-installation. | | Are any fstab-/mount-options recommended for xfs? | Hello, Martin. I'm afraid that, unless you planned for your typical workload and database cluster configuration at filesystem creation time, there is not much you can do solely by using different mount options. As you don't mention how you configured the filesystem though, here's some thoughts on that (everybody is more than welcome to comment on this, of course). Depending on the underlying array, the block size should be set as high as possible (page size) to get as close as possible to single stripe unit size, provided that the stripe unit is a multiple of block size. For now, x86 unfortunately doesn't allow blocks of multiple pages (yet). If possible, try to stick as close to the PostgreSQL page size as well, which is 8kB, if I recall correctly. 4k blocks may hence be a good choice here. Higher allocation group count (agcount/agsize) allows for better parallelism when allocating blocks and inodes. From your perspective, this may not necessarily be needed (or desired), as allocation and block reorganization may be "implicitly forced" to being performed internally as often as possible (depending on how frequently you run VACUUM FULL; if you can afford it, try running it as seldomly as possible). What you do want here though, is a good enough an allocation group count to prevent one group from occupying too much of one single disk in the array, thus smothering other applicants trying to obtain an extent (this would imply $agsize = ($desired_agsize - ($sunit * n)), where n < ($swidth / $sunit). If stripe unit for the underlying RAID device is x kB, the "sunit" setting is (2 * x), as it is in 512-byte blocks (do not be mislead by the rather confusing manpage). If you have RAID10/RAID01 in place, "swidth" may be four times the size of "sunit", depending on how your RAID controller (or software driver) understands it (I'm not 100% sure on this, comments, anyone?). "unwritten" (for unwritten extent markings) can be set to 0 if all of the files are predominantly preallocated - again, if you VACUUM FULL extremely seldomly, and delete/update a lot, this may be useful as it saves I/O and CPU time. YMMV. Inode size can be set using "size" parameter set to maximum, which is currently 2048 bytes on x86, if you're using page-sized blocks. As the filesystem will probably be rather big, as well as the files that live on it, you probably won't be using much of it for inodes, so you can set "maxpct" to a safe minimum of 1%, which would yield apprx. 200.000 file slots in a 40GB filesystem (with inode size of 2kB). Log can, of course, be either "internal", with a "sunit" that fits the logical configuration of the array, or any other option, if you want to move the book-keeping overhead away from your data. Do mind that typical journal size is usually rather small though, so you probably want to be using one partitioned disk drive for a number of journals, especially since there usually isn't much journalism to be done on a typical database cluster filesystem (compared to, for example, a mail server). Naming (a.k.a. directory) area of the filesystem is also rather poorly utilized, as there are few directories, and they only contain small numbers of files, so you can try optimizing in this area too: "size" may be set to maximum, 64k, although this probably doesn't buy you much besides a couple of kilobytes' worth of space. Now finally, the most common options you could play with at mount time. They would most probably include "noatime", as it is of course rather undesirable to update inodes upon each and every read access, attribute or directory lookup, etc. I would be surprised if you were running the filesystem both without noatime and a good reason to do that. :) Do mind that this is a generic option available for all filesystems that support the atime attribute and is not xfs-specific in any way. As for XFS, biosize=n can be used, where n = log2(${swidth} * ${sunit}), ~ or a multiple thereof. This is, _if_ you planned for your workload by using an array configuration and stripe sizes befitting of biosize, as well as configuring filesystem appropriately, the setting where you can gain by making operating system cache in a slightly readahead manner. Another useful option might be osyncisosync, which implements a true O_SYNC on files opened with that option, instead of the default Linux behaviour where O_SYNC, O_DSYNC and O_RSYNC are synonymous. It may hurt your performance though, so beware. If you decided to externalize log journal to another disk drive, and you have several contendants to that storage unit, you may also want to release contention a bit by using larger logbufs and logbsize settings, to provide for more slack in others when a particular needs to spill buffers to disk. All of these ideas share one common thought: you can tune a filesystem so it helps in reducing the amount of iowait. The filesystem itself can help preventing unnecessary work performed by the disk and eliminating contention for the bandwidth of the transport subsystem. This can be achieved by improving internal organization of the filesystem to better suite the requirements of a typical database workload, and eliminating the (undesired part of the) book-keeping work in a your filesystem. Hope to have helped. Kind regards, - -- Grega Bremec gregab at p0f dot net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFCpvdcfu4IwuB3+XoRAiQQAJ4rnnFYGW42U/SnYz4LGmgEsF0s1gCfXikL HT6EHWeTvQfd+s+9DkvOQpI= =V+E2 -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Wed Jun 8 11: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 91D8C52800 for ; Wed, 8 Jun 2005 11:39:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43322-09 for ; Wed, 8 Jun 2005 14:39: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 93A0552997 for ; Wed, 8 Jun 2005 11:39:23 -0300 (ADT) 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 j58E3ZxB001276; Wed, 8 Jun 2005 10:03:35 -0400 (EDT) To: Kim Bisgaard Cc: pgsql-performance@postgresql.org Subject: Re: full outer performance problem In-reply-to: <42A6BC64.4010001@dmi.dk> References: <42A6BC64.4010001@dmi.dk> Comments: In-reply-to Kim Bisgaard message dated "Wed, 08 Jun 2005 11:37:40 +0200" Date: Wed, 08 Jun 2005 10:03:35 -0400 Message-ID: <1275.1118239415@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: 200506/170 X-Sequence-Number: 12807 Kim Bisgaard writes: > SELECT station_id, timeobs,temp_grass, temp_dry_at_2m > FROM temp_dry_at_2m a > FULL OUTER JOIN temp_grass b > USING (station_id, timeobs) > WHERE station_id = 52981 > AND timeobs = '2004-1-1 0:0:0' > explain analyse SELECT b.station_id, b.timeobs,temp_grass, temp_dry_at_2m > FROM temp_dry_at_2m a > FULL OUTER JOIN temp_grass b > USING (station_id, timeobs) > WHERE b.station_id = 52981 > AND b.timeobs = '2004-1-1 0:0:0' > Why will PostgreSQL not use the same plan for both these queries - they > are virtually identical?? Because they're semantically completely different. The second query is effectively a RIGHT JOIN, because join rows in which b is all-null will be thrown away by the WHERE. The optimizer sees this (note your second plan doesn't use a Full Join step anywhere) and is able to produce a much better plan. Full outer join is difficult to optimize, in part because we have no choice but to use a merge join for it --- the other join types don't support full join. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 8 11:38: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 D9D0252991 for ; Wed, 8 Jun 2005 11:38:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44377-06 for ; Wed, 8 Jun 2005 14:38:38 +0000 (GMT) Received: from imsm058dat.netvigator.com (imsm058.netvigator.com [218.102.48.211]) by svr1.postgresql.org (Postfix) with ESMTP id D862852881 for ; Wed, 8 Jun 2005 11:38:35 -0300 (ADT) Received: from n2.netvigator.com ([218.102.224.145]) by imsm058dat.netvigator.com (InterMail vM.6.01.04.01 201-2131-118-101-20041129) with ESMTP id <20050608143839.QSJP3558.imsm058dat.netvigator.com@n2.netvigator.com>; Wed, 8 Jun 2005 22:38:39 +0800 Message-Id: <6.2.1.2.0.20050608221510.02c4e368@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.1.2 Date: Wed, 08 Jun 2005 22:25:16 +0800 To: George Essig From: K C Lau Subject: Re: SELECT DISTINCT Performance Issue Cc: pgsql-performance@postgresql.org In-Reply-To: <6744b38505060806342e6a07d@mail.gmail.com> References: <6.2.1.2.0.20050602190756.05ab2c70@localhost> <6744b38505060806342e6a07d@mail.gmail.com> 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=1.51 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST, FROM_ENDS_IN_NUMS X-Spam-Level: * X-Archive-Number: 200506/169 X-Sequence-Number: 12806 Both keys are text fields. Does it make any difference if PlayerID were integer? BTW, I think the real performance problem is when we use SELECT ... ORDER BY PlayerID DESC, AtDate DESC LIMIT 1 in a VIEW. Please see my subsequent email http://archives.postgresql.org/pgsql-performance/2005-06/msg00110.php on this show-stopper problem for which I still have no clue how to get around. Suggestions are much appreciated. Thanks and regards, KC. At 21:34 05/06/08, George Essig wrote: >On 6/2/05, K C Lau wrote: >... > > > > select DISTINCT ON (PlayerID) PlayerID,AtDate from Player where > > PlayerID='22220' order by PlayerID desc, AtDate desc; > > The Player table has primary key (PlayerID, AtDate) representing data over > > time and the query gets the latest data for a player. > > > > >... > > esdt=> explain analyze select DISTINCT ON (PlayerID) PlayerID,AtDate from > > Player > > where PlayerID='22220' order by PlayerID desc, AtDate desc; > > Unique (cost=0.00..2507.66 rows=1 width=23) (actual time=0.000..187.000 > > rows=1 loops=1) > > -> Index Scan Backward using pk_player on player (cost=0.00..2505.55 > > rows=8 > > 43 width=23) (actual time=0.000..187.000 rows=1227 loops=1) > > Index Cond: ((playerid)::text = '22220'::text) > > Total runtime: 187.000 ms > > > >Is PlayerID an integer datatype or a text datatype. It seems like >PlayerID should be an integer data type, but postgres treats PlayerID >as a text data type. This is because the value '22220' is quoted in >your query. Also, the explain analyze output shows "Index Cond: >((playerid)::text = '22220'::text". > >George Essig > >---------------------------(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 From pgsql-performance-owner@postgresql.org Wed Jun 8 11:55: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 6850B52997 for ; Wed, 8 Jun 2005 11:51:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49010-05 for ; Wed, 8 Jun 2005 14:51:12 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) by svr1.postgresql.org (Postfix) with ESMTP id C90BB529A3 for ; Wed, 8 Jun 2005 11:51:06 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so280489wra for ; Wed, 08 Jun 2005 07:51:12 -0700 (PDT) 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:content-disposition:references; b=T3W2jIQduPq3Sk/YlRNNR8913JNat3wCzltXcwQU9UhDRRv58f7nzfd0g/KOLUk7TggYBv95uOMLpwrlvQxmPqSKhe+Umn9IGHGemPzC5IfBNZpT5SuG3+tMOadZBUfe5jOJ+O1dqoKPqulL6S7q1w1rWCOXPeDSx7qe0TmSEJo= Received: by 10.54.15.75 with SMTP id 75mr3392739wro; Wed, 08 Jun 2005 07:51:11 -0700 (PDT) Received: by 10.54.96.18 with HTTP; Wed, 8 Jun 2005 07:51:11 -0700 (PDT) Message-ID: <6744b385050608075132eeb8a6@mail.gmail.com> Date: Wed, 8 Jun 2005 09:51:11 -0500 From: George Essig Reply-To: George Essig To: K C Lau Subject: Re: SELECT DISTINCT Performance Issue Cc: pgsql-performance@postgresql.org In-Reply-To: <6.2.1.2.0.20050608221510.02c4e368@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6.2.1.2.0.20050602190756.05ab2c70@localhost> <6744b38505060806342e6a07d@mail.gmail.com> <6.2.1.2.0.20050608221510.02c4e368@localhost> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.086 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/171 X-Sequence-Number: 12808 On 6/8/05, K C Lau wrote: > Both keys are text fields. Does it make any difference if PlayerID were > integer? >=20 It can make a difference in speed and integrity. If the column is an integer, the storage on disk could be smaller for the column and the related indexes. If the the column is an integer, it would not be possible to have a value like 'arbitrary value that looks nothing like an integer'. George Essig From pgsql-performance-owner@postgresql.org Wed Jun 8 12: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 85BEE52879 for ; Wed, 8 Jun 2005 12:04:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54638-05 for ; Wed, 8 Jun 2005 15:04:07 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.203]) by svr1.postgresql.org (Postfix) with ESMTP id 8DA8852997 for ; Wed, 8 Jun 2005 12:04:06 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id 40so362218nzk for ; Wed, 08 Jun 2005 08:04:05 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:subject:from:reply-to:to:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=uj+mna21sF2EXlVsQ7ODhQDMqrHYFKlQITrMlE7m8lnGIk+sA1h81Poe4zIMgSDlIZn0YpadfACHNtHu5a4gAZWsbHLbcc/JbQoC8cWipfN81cWNw0rWO8/2k254gMTu3b6KOqtbzPUHXli6Aq84td620u5BLhc1zX4mbefgKEA= Received: by 10.36.47.15 with SMTP id u15mr1443582nzu; Wed, 08 Jun 2005 08:04:05 -0700 (PDT) Received: from ?192.168.1.103? ([69.244.64.133]) by mx.gmail.com with ESMTP id 38sm109392nza.2005.06.08.08.04.05; Wed, 08 Jun 2005 08:04:05 -0700 (PDT) Subject: Performance problems, bad estimates and plan From: Allan Wang Reply-To: allanvv@gmail.com To: pgsql-performance@postgresql.org Content-Type: text/plain Date: Wed, 08 Jun 2005 11:04:04 -0400 Message-Id: <1118243044.3454.3.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: 7bit 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: 200506/172 X-Sequence-Number: 12809 It seems that Postgres is estimating that all rows in a 50k row table will be returned, but only one should match. The query runs slow because of the seqscan. When I set enable_seqscan to off, then it does an index scan and it runs quickly. I've set the statistics target on the index to 100 and 1000, and they don't make a difference in the plan. I've also ran VACUUM ANALYZE right before the query. Here is my query, output of EXPLAIN ANALYZE, and my tables: I'm not sure how wrapping will make this look, so I've put it into a pastebin also, if it makes it easier to read: http://rafb.net/paste/results/RqeyX523.nln.html talluria=# explain analyze SELECT t.*, p.name AS owner, c.name FROM tiles AS t LEFT JOIN cities AS c USING (cityid) LEFT JOIN players p USING (playerid) WHERE box(t.coord, t.coord) ~= box(point (4,3), point (4,3)); QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------- Merge Right Join (cost=119.07..122.13 rows=52 width=55) (actual time=232.777..232.780 rows=1 loops=1) Merge Cond: ("outer".playerid = "inner".playerid) -> Index Scan using users_pkey on players p (cost=0.00..4138.82 rows=56200 width=8) (actual time=0.017..122.409 rows=56200 loops=1) -> Sort (cost=119.07..119.20 rows=52 width=55) (actual time=0.070..0.072 rows=1 loops=1) Sort Key: c.playerid -> Hash Left Join (cost=1.03..117.59 rows=52 width=55) (actual time=0.045..0.059 rows=1 loops=1) Hash Cond: ("outer".cityid = "inner".cityid) -> Index Scan using tiles_coord_key on tiles t (cost=0.00..116.29 rows=52 width=37) (actual time=0.014..0.026 rows=1 loops=1) Index Cond: (box(coord, coord) ~= '(4,3),(4,3)'::box) -> Hash (cost=1.02..1.02 rows=2 width=22) (actual time=0.017..0.017 rows=0 loops=1) -> Seq Scan on cities c (cost=0.00..1.02 rows=2 width=22) (actual time=0.008..0.012 rows=2 loops=1) Total runtime: 232.893 ms (12 rows) talluria=# set enable_seqscan = false; SET talluria=# explain analyze SELECT t.*, p.name AS owner, c.name FROM tiles AS t LEFT JOIN cities AS c USING (cityid) LEFT JOIN players p USING (playerid) WHERE box(t.coord, t.coord) ~= box(point (4,3), point (4,3)); QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------- Merge Left Join (cost=121.07..124.14 rows=52 width=55) (actual time=0.102..0.105 rows=1 loops=1) Merge Cond: ("outer".playerid = "inner".playerid) -> Sort (cost=121.07..121.20 rows=52 width=55) (actual time=0.076..0.077 rows=1 loops=1) Sort Key: c.playerid -> Hash Left Join (cost=3.03..119.59 rows=52 width=55) (actual time=0.053..0.066 rows=1 loops=1) Hash Cond: ("outer".cityid = "inner".cityid) -> Index Scan using tiles_coord_key on tiles t (cost=0.00..116.29 rows=52 width=37) (actual time=0.014..0.026 rows=1 loops=1) Index Cond: (box(coord, coord) ~= '(4,3),(4,3)'::box) -> Hash (cost=3.02..3.02 rows=2 width=22) (actual time=0.026..0.026 rows=0 loops=1) -> Index Scan using cities_userid_key on cities c (cost=0.00..3.02 rows=2 width=22) (actual time=0.016..0.021 rows=2 loops=1) -> Index Scan using users_pkey on players p (cost=0.00..4138.82 rows=56200 width=8) (actual time=0.012..0.012 rows=1 loops=1) Total runtime: 0.200 ms (12 rows) talluria=# \d tiles Table "public.tiles" Column | Type | Modifiers --------+-------------------+---------------------------------------------------------------------- tileid | integer | not null default nextval('tiles_tileid_seq'::text) mapid | integer | not null default 1 tile | character varying | not null default 'field'::character varying coord | point | not null default point((0)::double precision, (0)::double precision) cityid | integer | Indexes: "times_pkey" PRIMARY KEY, btree (tileid) CLUSTER "tiles_cityid_key" btree (cityid) "tiles_coord_key" rtree (box(coord, coord)) Foreign-key constraints: "tiles_cityid_fkey" FOREIGN KEY (cityid) REFERENCES cities(cityid) ON UPDATE CASCADE ON DELETE SET NULL talluria=# \d cities Table "public.cities" Column | Type | Modifiers -------------+-----------------------+----------------------------------------------------- cityid | integer | not null default nextval('cities_cityid_seq'::text) playerid | integer | not null default 0 bordercolor | character(6) | not null default '0000ff'::bpchar citystatus | smallint | not null default 0 name | character varying(30) | not null Indexes: "cities_pkey" PRIMARY KEY, btree (cityid) "cities_cityname_uikey" UNIQUE, btree (lower(name::text)) "cities_userid_key" btree (playerid) Foreign-key constraints: "cities_userid_fkey" FOREIGN KEY (playerid) REFERENCES players(playerid) ON UPDATE CASCADE ON DELETE CASCADE talluria=# \d players Table "public.players" Column | Type | Modifiers -----------------+------------------------+---------------------------------------------------------------------- playerid | integer | not null default nextval('players_playerid_seq'::text) username | character varying(30) | not null default ''::character varying md5password | character(32) | not null default (''::bpchar)::character(1) name | character varying(100) | not null default ''::character varying email | character varying(50) | not null default ''::character varying (snipped a few irrelavent columns) Indexes: "users_pkey" PRIMARY KEY, btree (playerid) "players_username_key" UNIQUE, btree (username, md5password) "users_username_lkey" UNIQUE, btree (lower(username::text)) "users_coord_key" rtree (box(coord, coord)) Foreign-key constraints: "players_stylesheet_fkey" FOREIGN KEY (stylesheet) REFERENCES stylesheets(stylesheetid) ON UPDATE CASCADE ON DELETE SET DEFAULT "users_arm" FOREIGN KEY (arm) REFERENCES items(itemid) ON UPDATE CASCADE ON DELETE SET NULL "users_activefight_pkey" FOREIGN KEY (activefight) REFERENCES monsters(monsterid) ON UPDATE CASCADE ON DELETE SET NULL "players_map_fkey" FOREIGN KEY (map) REFERENCES maps(mapid) ON UPDATE CASCADE ON DELETE SET DEFAULT "users_belt" FOREIGN KEY (belt) REFERENCES items(itemid) ON UPDATE CASCADE ON DELETE SET NULL "users_body" FOREIGN KEY (body) REFERENCES items(itemid) ON UPDATE CASCADE ON DELETE SET NULL "users_head" FOREIGN KEY (head) REFERENCES items(itemid) ON UPDATE CASCADE ON DELETE SET NULL "users_lefthand" FOREIGN KEY (lefthand) REFERENCES items(itemid) ON UPDATE CASCADE ON DELETE SET NULL "users_leg" FOREIGN KEY (leg) REFERENCES items(itemid) ON UPDATE CASCADE ON DELETE SET NULL "users_righthand" FOREIGN KEY (righthand) REFERENCES items(itemid) ON UPDATE CASCADE ON DELETE SET NULL Thanks in advance for any help, Allan Wang From pgsql-performance-owner@postgresql.org Wed Jun 8 13:23: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 80A885289A for ; Wed, 8 Jun 2005 13:23:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77183-03 for ; Wed, 8 Jun 2005 16:23:03 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6AC2352814 for ; Wed, 8 Jun 2005 13:23:02 -0300 (ADT) 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 j58GN1wf003910; Wed, 8 Jun 2005 12:23:01 -0400 (EDT) To: Kim Bisgaard Cc: pgsql-performance@postgresql.org Subject: Re: full outer performance problem In-reply-to: <42A6E55C.4030203@dmi.dk> References: <42A6BC64.4010001@dmi.dk> <20050608121755.GB11464@wolff.to> <42A6E55C.4030203@dmi.dk> Comments: In-reply-to Kim Bisgaard message dated "Wed, 08 Jun 2005 14:32:28 +0200" Date: Wed, 08 Jun 2005 12:23:01 -0400 Message-ID: <3909.1118247781@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: 200506/173 X-Sequence-Number: 12810 Kim Bisgaard writes: > W.r.t. your rewrite of the query, I get this "ERROR: could not devise a > query plan for the given query" but no further details - I will try google Which PG version are you using again? That should be fixed in 7.4.3 and later. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 8 13:32: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 8BD2B5280B for ; Wed, 8 Jun 2005 13:32:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78461-10 for ; Wed, 8 Jun 2005 16:32:15 +0000 (GMT) Received: from campbell-lange.net (campbell-lange.net [217.147.82.41]) by svr1.postgresql.org (Postfix) with ESMTP id 472BC5289E for ; Wed, 8 Jun 2005 13:32:14 -0300 (ADT) Received: from host-83-146-33-145.bulldogdsl.com ([83.146.33.145] helo=localhost.localdomain) by localhost.localdomain with esmtpa (Exim 4.50) id 1Dg3Th-0001sk-Dt for pgsql-performance@postgresql.org; Wed, 08 Jun 2005 17:32:29 +0100 Received: from rory by localhost.localdomain with local (Exim 4.50) id 1Dg3VS-0000rx-Oa for pgsql-performance@postgresql.org; Wed, 08 Jun 2005 17:34:18 +0100 Date: Wed, 8 Jun 2005 17:34:18 +0100 From: Rory Campbell-Lange To: pgsql-performance@postgresql.org Subject: Help specifying new web server/database machine Message-ID: <20050608163418.GA3327@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i 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: 200506/174 X-Sequence-Number: 12811 I'm tasked with specifying a new machine to run a web application prototype. The machine will be serving web pages with a Postgresql backend; we will be making extensive use of plpgsql functions. No database tables are likely to go over a million rows during the prototype period. We are considering two RAID1 system disks, and two RAID1 data disks. We've avoided buying Xeons. The machine we are looking at looks like this: Rackmount Chassis - 500W PSU / 4 x SATA Disk Drive Bays S2882-D - Dual Opteron / AMD 8111 Chipset / 5 x PCI Slots 2x - (Dual) AMD Opteron 246 Processors (2.0GHz) - 1MB L2 Cache/core (single core) 2GB (2x 1024MB) DDR-400 (PC3200) ECC Registered SDRAM (single rank) 4 Port AMCC/3Ware 9500-4LP PCI SATA RAID Controller 80GB SATA-150 7200RPM Hard Disk / 8MB Cache 80GB SATA-150 7200RPM Hard Disk / 8MB Cache 250GB SATA-150 7200RPM Hard Disk / 8MB Cache 250GB SATA-150 7200RPM Hard Disk / 8MB Cache Slimline 8x DVD / 24x CD-ROM Drive Standard 3yr (UK) Next Business Day On-site Warranty I would be grateful for any comments about this config. Kind regards, Rory -- Rory Campbell-Lange From pgsql-performance-owner@postgresql.org Wed Jun 8 13:41: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 AC1C952851 for ; Wed, 8 Jun 2005 13:41:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82350-04 for ; Wed, 8 Jun 2005 16:41:06 +0000 (GMT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id 37D285281C for ; Wed, 8 Jun 2005 13:41:04 -0300 (ADT) Received: from 173-172-20-212.dsl.globvill.de ([212.20.172.173] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1Dg3bx-0004fD-00; Wed, 08 Jun 2005 18:41:02 +0200 Received: from [212.6.194.238] (helo=[212.6.194.238]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1Dg3bx-0007ZM-00; Wed, 08 Jun 2005 18:41:01 +0200 Message-ID: <42A71F9D.6040604@turtle-entertainment.de> Date: Wed, 08 Jun 2005 18:41:01 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rory Campbell-Lange Cc: pgsql-performance@postgresql.org Subject: Re: Help specifying new web server/database machine References: <20050608163418.GA3327@campbell-lange.net> In-Reply-To: <20050608163418.GA3327@campbell-lange.net> 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.946 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/175 X-Sequence-Number: 12812 Hi, Rory Campbell-Lange wrote: > We are considering two RAID1 system disks, and two RAID1 data disks. > We've avoided buying Xeons. The machine we are looking at looks like > this: > > Rackmount Chassis - 500W PSU / 4 x SATA Disk Drive Bays > S2882-D - Dual Opteron / AMD 8111 Chipset / 5 x PCI Slots > 2x - (Dual) AMD Opteron 246 Processors (2.0GHz) - 1MB L2 Cache/core (single core) > 2GB (2x 1024MB) DDR-400 (PC3200) ECC Registered SDRAM (single rank) Make that 4 or 8 GB total. We have seen a huge boost in performance when we upgraded from 4 to 8 GB. Make sure to use a decent 64bit Linux. > 4 Port AMCC/3Ware 9500-4LP PCI SATA RAID Controller > 80GB SATA-150 7200RPM Hard Disk / 8MB Cache > 80GB SATA-150 7200RPM Hard Disk / 8MB Cache > 250GB SATA-150 7200RPM Hard Disk / 8MB Cache > 250GB SATA-150 7200RPM Hard Disk / 8MB Cache Three options: 9500-4LP with Raptor drives 10k rpm, raid 1 + raid 1 9500-8LP with Raptor drives 10k rpm, raid 10 + raid 1 Go for SCSI (LSI Megaraid or ICP Vortex) and take 10k drives BBU option is always nice. Regards, Bjoern From pgsql-performance-owner@postgresql.org Wed Jun 8 13:44: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 8AFCA52814 for ; Wed, 8 Jun 2005 13:44:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80544-09 for ; Wed, 8 Jun 2005 16:44:03 +0000 (GMT) Received: from mail.jobflash.com (oncallweb2.jobflash.com [64.62.211.41]) by svr1.postgresql.org (Postfix) with ESMTP id 3D60552883 for ; Wed, 8 Jun 2005 13:44:00 -0300 (ADT) Received: from [192.168.2.22] (user-2ivfinj.dialup.mindspring.com [165.247.202.243]) by mail.jobflash.com (Postfix) with ESMTP id EAF5442002; Wed, 8 Jun 2005 09:43:58 -0700 (PDT) Message-ID: <42A72047.6030304@jobflash.com> Date: Wed, 08 Jun 2005 09:43:51 -0700 From: Tom Arthurs User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Neil Conway Cc: Donald Courtney , pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> <42A605E8.8040607@jobflash.com> <42A639C3.40606@samurai.com> In-Reply-To: <42A639C3.40606@samurai.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: 200506/176 X-Sequence-Number: 12813 I just puhsd 8.0.3 to production on Sunday, and haven't had a time to really monitor it under load, so I can't tell if it's helped the context switch problem yet or not. Neil Conway wrote: > Tom Arthurs wrote: > >> Yes, shared buffers in postgres are not used for caching > > > Shared buffers in Postgres _are_ used for caching, they just form a > secondary cache on top of the kernel's IO cache. Postgres does IO > through the filesystem, which is then cached by the kernel. Increasing > shared_buffers means that less memory is available for the kernel to > cache IO -- increasing shared_buffers has been shown to be a net > performance loss beyond a certain point. Still, there is value in > shared_buffers as it means we can avoid a read() system call for hot > pages. We can also do better buffer replacement in the PG shared buffer > than the kernel can do (e.g. treating IO caused by VACUUM specially). > >> My biggest challenge with solaris/sparc is trying to reduce context >> switching. > > > It would be interesting to see if this is improved with current sources, > as Tom's bufmgr rewrite should have hopefully have reduced this problem. > > -Neil > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > > From pgsql-performance-owner@postgresql.org Wed Jun 8 13:48: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 CE7A35280A for ; Wed, 8 Jun 2005 13:48:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82282-06 for ; Wed, 8 Jun 2005 16:48:45 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 9344C52851 for ; Wed, 8 Jun 2005 13:48:45 -0300 (ADT) Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j58GcIa3009422; Wed, 8 Jun 2005 09:38:18 -0700 Message-ID: <42A7214C.7080002@commandprompt.com> Date: Wed, 08 Jun 2005 09:48:12 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bjoern Metzdorf Cc: Rory Campbell-Lange , pgsql-performance@postgresql.org Subject: Re: Help specifying new web server/database machine References: <20050608163418.GA3327@campbell-lange.net> <42A71F9D.6040604@turtle-entertainment.de> In-Reply-To: <42A71F9D.6040604@turtle-entertainment.de> 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.017 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/177 X-Sequence-Number: 12814 > Three options: > > 9500-4LP with Raptor drives 10k rpm, raid 1 + raid 1 > 9500-8LP with Raptor drives 10k rpm, raid 10 + raid 1 > Go for SCSI (LSI Megaraid or ICP Vortex) and take 10k drives If you are going with Raptor drives use the LSI 150-6 SATA RAID with the BBU. Sincerely, Joshua D. Drake > > BBU option is always nice. > > Regards, > Bjoern > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 PostgreSQL Replication, Consulting, Custom Programming, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ From pgsql-performance-owner@postgresql.org Wed Jun 8 13:54: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 699065281C for ; Wed, 8 Jun 2005 13:54:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86787-02 for ; Wed, 8 Jun 2005 16:54:11 +0000 (GMT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id 211A652814 for ; Wed, 8 Jun 2005 13:54:10 -0300 (ADT) Received: from 173-172-20-212.dsl.globvill.de ([212.20.172.173] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1Dg3oT-0005z2-00; Wed, 08 Jun 2005 18:53:57 +0200 Received: from [212.6.194.238] (helo=[212.6.194.238]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1Dg3oS-0007vQ-00; Wed, 08 Jun 2005 18:53:56 +0200 Message-ID: <42A722A5.6000708@turtle-entertainment.de> Date: Wed, 08 Jun 2005 18:53:57 +0200 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Arthurs Cc: Neil Conway , Donald Courtney , pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> <42A605E8.8040607@jobflash.com> <42A639C3.40606@samurai.com> <42A72047.6030304@jobflash.com> In-Reply-To: <42A72047.6030304@jobflash.com> Content-Type: multipart/mixed; boundary="------------070808000601050006090507" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.647 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/178 X-Sequence-Number: 12815 This is a multi-part message in MIME format. --------------070808000601050006090507 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, > I just puhsd 8.0.3 to production on Sunday, and haven't had a time to > really monitor it under load, so I can't tell if it's helped the context > switch problem yet or not. Attached is a "vmstat 5" output from one of our machines. This is a dual Xeon 3,2 Ghz with EM64T and 8 GB RAM, running postgresql 8.0.3 on Debian Sarge 64bit. Connection count is about 350. Largest amount of cs per second is nearly 10000 which is high, yes, but not too high. Regards, Bjoern --------------070808000601050006090507 Content-Type: text/plain; name="vmstat.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="vmstat.txt" # vmstat 5 procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 1 0 0 332004 52 6508160 0 0 28 55 5 9 5 1 94 0 0 0 0 335268 52 6509452 0 0 162 2195 2210 13633 34 7 57 2 2 0 0 303996 52 6510200 0 0 89 151 1909 26634 39 8 52 1 3 0 0 305772 52 6510676 0 0 41 40 1934 45525 54 12 34 0 4 0 0 283700 52 6511900 0 0 122 115 2175 36937 59 13 28 0 2 0 0 283132 52 6512444 0 0 88 137 1965 41128 57 12 31 0 1 0 0 277940 52 6513056 0 0 24 88 1899 47906 47 10 43 0 2 0 0 282404 52 6513668 0 0 54 51 1901 37858 47 9 44 0 3 0 0 283996 52 6514212 0 0 59 1675 2028 33609 49 10 40 1 4 0 0 282372 52 6514892 0 0 86 81 2046 31513 57 9 33 1 3 0 0 279228 52 6515300 0 0 18 88 1876 14465 41 5 54 0 3 0 0 288156 52 6516048 0 0 130 632 1944 25456 45 7 47 1 3 0 0 284884 52 6516592 0 0 66 60 1907 27620 56 8 35 0 3 0 0 279356 52 6516932 0 0 38 97 1950 45386 57 10 33 0 3 0 0 294764 52 6517476 0 0 45 52 1823 27900 40 7 53 0 4 0 0 295348 52 6518020 0 0 78 1352 1938 6048 16 4 79 1 2 0 0 282260 52 6518496 0 0 45 100 1954 14304 47 10 42 0 1 0 0 282708 52 6520196 0 0 288 62 2007 8705 29 6 64 1 4 0 0 292868 52 6520468 0 0 29 983 1829 6634 28 4 68 0 0 1 0 284380 52 6521148 0 0 114 163 2035 7017 23 4 72 1 1 0 0 281572 52 6522032 0 0 102 180 1861 7577 19 4 76 1 2 0 0 286668 52 6522440 0 0 75 150 1870 11185 30 5 65 1 0 0 0 293964 52 6523188 0 0 58 1533 2122 8174 23 5 71 1 1 0 0 287940 52 6523732 0 0 93 127 2001 11732 28 5 66 1 1 0 0 283428 52 6523936 0 0 40 89 1941 6360 20 4 75 0 1 0 0 280492 52 6524752 0 0 110 78 1912 5732 19 3 76 1 0 0 0 275684 52 6525160 0 0 67 55 2025 15541 25 6 69 1 --------------070808000601050006090507-- From pgsql-performance-owner@postgresql.org Wed Jun 8 14:05: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 D520652823 for ; Wed, 8 Jun 2005 14:02:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87743-03 for ; Wed, 8 Jun 2005 17:02: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 D1B8C5283B for ; Wed, 8 Jun 2005 14:02:37 -0300 (ADT) 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 j58H2aL1004363; Wed, 8 Jun 2005 13:02:36 -0400 (EDT) To: allanvv@gmail.com Cc: pgsql-performance@postgresql.org Subject: Re: Performance problems, bad estimates and plan In-reply-to: <1118243044.3454.3.camel@localhost> References: <1118243044.3454.3.camel@localhost> Comments: In-reply-to Allan Wang message dated "Wed, 08 Jun 2005 11:04:04 -0400" Date: Wed, 08 Jun 2005 13:02:35 -0400 Message-ID: <4362.1118250155@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: 200506/179 X-Sequence-Number: 12816 Allan Wang writes: > It seems that Postgres is estimating that all rows in a 50k row table > will be returned, but only one should match. I think this is the same issue fixed here: 2005-04-03 21:43 tgl * src/backend/optimizer/path/: costsize.c (REL7_4_STABLE), costsize.c (REL8_0_STABLE), costsize.c: In cost_mergejoin, the early-exit effect should not apply to the outer side of an outer join. Per andrew@supernews. Are you running 7.4.8 or 8.0.2 or later? regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 8 14:39: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 BDA315280B for ; Wed, 8 Jun 2005 14:39:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95818-10 for ; Wed, 8 Jun 2005 17:39: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 3130152816 for ; Wed, 8 Jun 2005 14:39:16 -0300 (ADT) 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 j58HdGP0009066; Wed, 8 Jun 2005 13:39:16 -0400 (EDT) To: allanvv@gmail.com Cc: pgsql-performance@postgreSQL.org Subject: Re: Performance problems, bad estimates and plan In-reply-to: <1118250631.3454.6.camel@localhost> References: <1118243044.3454.3.camel@localhost> <4362.1118250155@sss.pgh.pa.us> <1118250631.3454.6.camel@localhost> Comments: In-reply-to Allan Wang message dated "Wed, 08 Jun 2005 13:10:31 -0400" Date: Wed, 08 Jun 2005 13:39:16 -0400 Message-ID: <9065.1118252356@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: 200506/180 X-Sequence-Number: 12817 Allan Wang writes: > On Wed, 2005-06-08 at 13:02 -0400, Tom Lane wrote: >> Are you running 7.4.8 or 8.0.2 or later? > I'm running 8.0.2 on Gentoo. Oh, OK [ looks again ... ] I read the join backward, the issue I was concerned about would've applied to a right join there not left. The seqscan vs indexscan difference is a red herring: if you look at the explain output, the only thing that changes to an indexscan is the scan on cities, which is only two rows and is not taking any time anyway. The thing that is taking a long time (or not) is the indexscan over players. The planner is expecting that to stop short of completion (presumably based on comparing the maximum values of playerid in the two tables) --- and in one plan it does so, so the planner's logic is apparently correct. Are there any NULLs in c.playerid? We found an executor issue recently that it would not figure out it could stop the scan if there was a NULL involved. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 8 14:57: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 45AB152814 for ; Wed, 8 Jun 2005 14:57:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00476-09 for ; Wed, 8 Jun 2005 17:57: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 D261B5283B for ; Wed, 8 Jun 2005 14:57:20 -0300 (ADT) 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 j58HvJ2h009167; Wed, 8 Jun 2005 13:57:19 -0400 (EDT) To: allanvv@gmail.com Cc: pgsql-performance@postgreSQL.org Subject: Re: Performance problems, bad estimates and plan In-reply-to: <1118252779.4579.1.camel@localhost> References: <1118243044.3454.3.camel@localhost> <4362.1118250155@sss.pgh.pa.us> <1118250631.3454.6.camel@localhost> <9065.1118252356@sss.pgh.pa.us> <1118252779.4579.1.camel@localhost> Comments: In-reply-to Allan Wang message dated "Wed, 08 Jun 2005 13:46:19 -0400" Date: Wed, 08 Jun 2005 13:57:19 -0400 Message-ID: <9166.1118253439@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: 200506/181 X-Sequence-Number: 12818 [ Please cc your responses to the list; other people may be interested in the same problem ] Allan Wang writes: > On Wed, 2005-06-08 at 13:39 -0400, Tom Lane wrote: >> Are there any NULLs in c.playerid? > Here is the contents of cities: I'm sorry, what I should've said is "are there any NULLs in c.playerid in the output of the first LEFT JOIN?" In practice that means "does the selected row of tiles actually join to cities?" regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 8 15:06: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 4F4E152816 for ; Wed, 8 Jun 2005 15:06:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05510-04 for ; Wed, 8 Jun 2005 18:06:54 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id C9C4E5280A for ; Wed, 8 Jun 2005 15:06:53 -0300 (ADT) 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 j58I6rJo009262; Wed, 8 Jun 2005 14:06:53 -0400 (EDT) To: allanvv@gmail.com Cc: pgsql-performance@postgreSQL.org Subject: Re: Performance problems, bad estimates and plan In-reply-to: <1118253770.4579.3.camel@localhost> References: <1118243044.3454.3.camel@localhost> <4362.1118250155@sss.pgh.pa.us> <1118250631.3454.6.camel@localhost> <9065.1118252356@sss.pgh.pa.us> <1118252779.4579.1.camel@localhost> <9166.1118253439@sss.pgh.pa.us> <1118253770.4579.3.camel@localhost> Comments: In-reply-to Allan Wang message dated "Wed, 08 Jun 2005 14:02:50 -0400" Date: Wed, 08 Jun 2005 14:06:53 -0400 Message-ID: <9261.1118254013@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: 200506/182 X-Sequence-Number: 12819 Allan Wang writes: > No, the tiles row doesn't join with cities: Uh-huh, so it's the same issue described here: http://archives.postgresql.org/pgsql-performance/2005-05/msg00219.php This is fixed in CVS tip but the change was large enough that I'm disinclined to try to back-port it ... regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 8 15:47: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 52C0A52849 for ; Wed, 8 Jun 2005 15:46:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17036-02 for ; Wed, 8 Jun 2005 18:46:53 +0000 (GMT) Received: from mailgw.dmi.dk (mailgw.dmi.dk [130.226.71.185]) by svr1.postgresql.org (Postfix) with ESMTP id EF88F52834 for ; Wed, 8 Jun 2005 15:46:51 -0300 (ADT) Received: from localhost (localhost.dmi.dk [127.0.0.1]) by mailgw.dmi.dk (8.12.11/8.12.11/Debian-1) with ESMTP id j58IkpWZ015206; Wed, 8 Jun 2005 18:46:51 GMT Received: from mailgw.dmi.dk ([127.0.0.1]) by localhost (mailgw.dmi.dk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15130-04; Wed, 8 Jun 2005 18:46:40 +0000 (GMT) Received: from postoffice.dmi.dk (postoffice.dmi.dk [130.226.64.60]) by mailgw.dmi.dk (8.12.11/8.12.11/Debian-1) with ESMTP id j58IkaJu015183; Wed, 8 Jun 2005 18:46:36 GMT Received: from localhost (localhost.dmi.dk [127.0.0.1]) by postoffice.dmi.dk (Postfix) with ESMTP id 3B77218055; Wed, 8 Jun 2005 18:46:36 +0000 (GMT) Received: from postoffice.dmi.dk ([127.0.0.1]) by localhost (postoffice.dmi.dk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17243-01-4; Wed, 8 Jun 2005 18:46:36 +0000 (GMT) Received: from localhost (webmail [130.226.71.186]) by postoffice.dmi.dk (Postfix) with ESMTP id DC5D118052; Wed, 8 Jun 2005 18:46:35 +0000 (GMT) Received: from port161.ds1-aroe.adsl.cybercity.dk (port161.ds1-aroe.adsl.cybercity.dk [217.157.138.230]) by webmail.dmi.dk (IMP) with HTTP for ; Wed, 8 Jun 2005 20:46:35 +0200 Message-ID: <1118256395.42a73d0bca492@webmail.dmi.dk> Date: Wed, 8 Jun 2005 20:46:35 +0200 From: Kim Bisgaard To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: full outer performance problem References: <42A6BC64.4010001@dmi.dk> <1275.1118239415@sss.pgh.pa.us> In-Reply-To: <1275.1118239415@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.2.6 X-Originating-IP: 217.157.138.230 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at dmi.dk X-Virus-Scanned: by amavisd-maia-1.0.0-rc5 (Debian) at dmi.dk 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: 200506/183 X-Sequence-Number: 12820 Quoting Tom Lane : > Kim Bisgaard writes: > > SELECT station_id, timeobs,temp_grass, temp_dry_at_2m > > FROM temp_dry_at_2m a > > FULL OUTER JOIN temp_grass b > > USING (station_id, timeobs) > > WHERE station_id = 52981 > > AND timeobs = '2004-1-1 0:0:0' > > > explain analyse SELECT b.station_id, b.timeobs,temp_grass, temp_dry_at_2m > > FROM temp_dry_at_2m a > > FULL OUTER JOIN temp_grass b > > USING (station_id, timeobs) > > WHERE b.station_id = 52981 > > AND b.timeobs = '2004-1-1 0:0:0' > > > Why will PostgreSQL not use the same plan for both these queries - they > > are virtually identical?? > > Because they're semantically completely different. The second query is > effectively a RIGHT JOIN, because join rows in which b is all-null will > be thrown away by the WHERE. The optimizer sees this (note your second > plan doesn't use a Full Join step anywhere) and is able to produce a > much better plan. Full outer join is difficult to optimize, in part > because we have no choice but to use a merge join for it --- the other > join types don't support full join. > > regards, tom lane > Yes I am aware that they are not "identical", they also give different results, but the data nessesary to compute the results is (0-2 rows, 0-1 row from each table), and thus ideally have the potential to have similar performance - to my head anyway, but I may not have grasped the complete picture yet :-) Regards, Kim. From pgsql-performance-owner@postgresql.org Wed Jun 8 15:54: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 B209E5283B for ; Wed, 8 Jun 2005 15:54:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18363-07 for ; Wed, 8 Jun 2005 18:53:59 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by svr1.postgresql.org (Postfix) with ESMTP id 81CC7528B7 for ; Wed, 8 Jun 2005 15:53:58 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so920054wri for ; Wed, 08 Jun 2005 11:53:59 -0700 (PDT) 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:content-disposition:references; b=KO4tpkGSJk56gEJ3I4LTY/3mE7eo80cXAYMRYZTPXNXRNsCvQoyg7YTr1Z07MiD/oxxfRIErWWzyqYism9NXKbMl4ni1u/wzhN1JCHgBdGvIgtXRMjsbj1bN/8XOVhNLNDVOurHypeFVdV3yH8RGgTKjUzd0RtFr5WIuUZOnBKQ= Received: by 10.54.126.16 with SMTP id y16mr4721520wrc; Wed, 08 Jun 2005 11:53:30 -0700 (PDT) Received: by 10.54.22.15 with HTTP; Wed, 8 Jun 2005 11:53:30 -0700 (PDT) Message-ID: Date: Wed, 8 Jun 2005 13:53:30 -0500 From: Matthew Nuzum Reply-To: newz@bearfruit.org To: Rory Campbell-Lange Subject: Re: Help specifying new web server/database machine Cc: pgsql-performance@postgresql.org In-Reply-To: <20050608163418.GA3327@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050608163418.GA3327@campbell-lange.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.128 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/185 X-Sequence-Number: 12822 On 6/8/05, Rory Campbell-Lange wrote: > I'm tasked with specifying a new machine to run a web application > prototype. The machine will be serving web pages with a Postgresql > backend; we will be making extensive use of plpgsql functions. No > database tables are likely to go over a million rows during the > prototype period. ... > 2GB (2x 1024MB) DDR-400 (PC3200) ECC Registered SDRAM (single rank) > 4 Port AMCC/3Ware 9500-4LP PCI SATA RAID Controller > 80GB SATA-150 7200RPM Hard Disk / 8MB Cache > 80GB SATA-150 7200RPM Hard Disk / 8MB Cache > 250GB SATA-150 7200RPM Hard Disk / 8MB Cache > 250GB SATA-150 7200RPM Hard Disk / 8MB Cache If your app is select heavy, especially the types of things that do sequential scans, you will enjoy having enough ram to easily load all of your tables and indexes in ram. If your database will exceed 1GB on disk consider more ram than 2GB. If your database will be write heavy choosing good controllers and disks is essential. Reading through the archives you will see that there are some important disk configurations you can choose for optimizing disk writes such as using the outer portions of the disks exclusively. If data integrity is not an issue, choose a controller that allows caching of writes (usually IDE and cheaper SATA systems cache writes regardless of what you want). If it were my application, and if I had room in the budget, I'd double the RAM. I don't know anything about your application though so use the guidlines above. --=20 Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Wed Jun 8 15: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 4D4C952838 for ; Wed, 8 Jun 2005 15:54:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20213-04 for ; Wed, 8 Jun 2005 18:54:05 +0000 (GMT) Received: from mailgw.dmi.dk (mailgw.dmi.dk [130.226.71.185]) by svr1.postgresql.org (Postfix) with ESMTP id D9989528C1 for ; Wed, 8 Jun 2005 15:54:04 -0300 (ADT) Received: from localhost (localhost.dmi.dk [127.0.0.1]) by mailgw.dmi.dk (8.12.11/8.12.11/Debian-1) with ESMTP id j58Is5fL015615; Wed, 8 Jun 2005 18:54:05 GMT Received: from mailgw.dmi.dk ([127.0.0.1]) by localhost (mailgw.dmi.dk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 15487-06; Wed, 8 Jun 2005 18:53:56 +0000 (GMT) Received: from postoffice.dmi.dk (postoffice.dmi.dk [130.226.64.60]) by mailgw.dmi.dk (8.12.11/8.12.11/Debian-1) with ESMTP id j58Irq4c015608; Wed, 8 Jun 2005 18:53:52 GMT Received: from localhost (localhost.dmi.dk [127.0.0.1]) by postoffice.dmi.dk (Postfix) with ESMTP id BAEC018048; Wed, 8 Jun 2005 18:53:52 +0000 (GMT) Received: from postoffice.dmi.dk ([127.0.0.1]) by localhost (postoffice.dmi.dk [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17243-01-22; Wed, 8 Jun 2005 18:53:52 +0000 (GMT) Received: from localhost (webmail [130.226.71.186]) by postoffice.dmi.dk (Postfix) with ESMTP id 7FD581803F; Wed, 8 Jun 2005 18:53:52 +0000 (GMT) Received: from port161.ds1-aroe.adsl.cybercity.dk (port161.ds1-aroe.adsl.cybercity.dk [217.157.138.230]) by webmail.dmi.dk (IMP) with HTTP for ; Wed, 8 Jun 2005 20:53:52 +0200 Message-ID: <1118256832.42a73ec06b75c@webmail.dmi.dk> Date: Wed, 8 Jun 2005 20:53:52 +0200 From: Kim Bisgaard To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: full outer performance problem References: <42A6BC64.4010001@dmi.dk> <20050608121755.GB11464@wolff.to> <42A6E55C.4030203@dmi.dk> <3909.1118247781@sss.pgh.pa.us> In-Reply-To: <3909.1118247781@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.2.6 X-Originating-IP: 217.157.138.230 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at dmi.dk X-Virus-Scanned: by amavisd-maia-1.0.0-rc5 (Debian) at dmi.dk 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: 200506/184 X-Sequence-Number: 12821 Quoting Tom Lane : > Kim Bisgaard writes: > > W.r.t. your rewrite of the query, I get this "ERROR: could not devise a > > query plan for the given query" but no further details - I will try google > > Which PG version are you using again? That should be fixed in 7.4.3 > and later. > > regards, tom lane > Its 7.4.1. I am in the process (may take a while yet) of installing 8.0.3 on the same hardware in order to have a parallel system. Time is a finite meassure :-) I must admit I would rather have the first query perform, that have this workaround function ;-) Regards, Kim. From pgsql-performance-owner@postgresql.org Wed Jun 8 16:34: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 36B8552862 for ; Wed, 8 Jun 2005 16:34:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29391-03 for ; Wed, 8 Jun 2005 19:34:31 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198]) by svr1.postgresql.org (Postfix) with ESMTP id 9DA2B52851 for ; Wed, 8 Jun 2005 16:34:31 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id 16so644288nzp for ; Wed, 08 Jun 2005 12:34:32 -0700 (PDT) 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:content-disposition; b=r3yyb/VT9FQ9OD+Sn2x3b/6veC8JKuYyzUxlXsIzuzRQd0MGvxlNIP/GZ0h9r3XO1ozLtI2/mRHFpU25rT+e6ZmEE7GNixwfRhJFsqLObk2QdAOnZOkNJYpDUuJWlvEhsY+9l9Ub1xh/9HJEw6Q/3FvDqj9NZ5mB+YpoTLTHVFI= Received: by 10.36.224.21 with SMTP id w21mr2297645nzg; Wed, 08 Jun 2005 12:34:32 -0700 (PDT) Received: by 10.36.47.20 with HTTP; Wed, 8 Jun 2005 12:34:32 -0700 (PDT) Message-ID: <8d04ce990506081234121995f9@mail.gmail.com> Date: Wed, 8 Jun 2005 12:34:32 -0700 From: Junaili Lie Reply-To: Junaili Lie To: pgsql-performance@postgresql.org Subject: Help with rewriting query Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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: 200506/186 X-Sequence-Number: 12823 Hi, I have the following table: person - primary key id, and some attributes food - primary key id, foreign key p_id reference to table person. table food store all the food that a person is eating. The more recent food is indicated by the higher food.id. I need to find what is the most recent food a person ate for every person. The query: select f.p_id, max(f.id) from person p, food f where p.id=3Df.p_id group by f.p_id will work. But I understand this is not the most efficient way. Is there another way to rewrite this query? (maybe one that involves order by desc limit 1) Thank you in advance. From pgsql-performance-owner@postgresql.org Wed Jun 8 16:56: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 1D8FC52838 for ; Wed, 8 Jun 2005 16:56:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34349-02 for ; Wed, 8 Jun 2005 19:56:43 +0000 (GMT) Received: from mail.nordicbet.com (mail.nordicbet.com [193.69.167.130]) by svr1.postgresql.org (Postfix) with ESMTP id 463A952824 for ; Wed, 8 Jun 2005 16:56:37 -0300 (ADT) Received: from estneti-gw.online.ee ([62.65.34.222] helo=tobias.nordicbet.invalid) (Authenticated Sender=tobias@nordicbet.com) by mail.nordicbet.com with esmtpa (Exim 4.50 #1 (Debian)) id 1Dg6em-0007lV-6G; Wed, 08 Jun 2005 21:56:17 +0200 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id B3D06E0C51; Wed, 8 Jun 2005 22:56:25 +0300 (EEST) Date: Wed, 8 Jun 2005 22:56:25 +0300 From: Tobias Brox To: Junaili Lie Cc: pgsql-performance@postgresql.org Subject: Re: Help with rewriting query Message-ID: <20050608195625.GM8451@tobias.nordicbet.com> References: <8d04ce990506081234121995f9@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d04ce990506081234121995f9@mail.gmail.com> Organization: Group Nordicbet User-Agent: Mutt/1.5.6i 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: 200506/187 X-Sequence-Number: 12824 [Junaili Lie - Wed at 12:34:32PM -0700] > select f.p_id, max(f.id) from person p, food f where p.id=f.p_id group > by f.p_id will work. > But I understand this is not the most efficient way. Is there another > way to rewrite this query? (maybe one that involves order by desc > limit 1) eventually, try something like select p.id,(select f.id from food f where f.p_id=p.id order by f.id desc limit 1) from person p not tested, no warranties. Since subqueries can be inefficient, use "explain analyze" to see which one is actually better. This issue will be solved in future versions of postgresql. -- Tobias Brox, +47-91700050 Tallinn From pgsql-performance-owner@postgresql.org Wed Jun 8 22:47: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 3724F5288D for ; Wed, 8 Jun 2005 22:47:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08190-09 for ; Thu, 9 Jun 2005 01:47:06 +0000 (GMT) Received: from smtp.gvtc.com (smtp3.gvtc.com [216.177.160.85]) by svr1.postgresql.org (Postfix) with SMTP id D724D52869 for ; Wed, 8 Jun 2005 22:47:04 -0300 (ADT) Received: (qmail 23088 invoked from network); 9 Jun 2005 01:47:05 -0000 Received: from ip-12-181-68-5.dsl0-blvrtx.gvtc.com (HELO ?192.168.0.100?) (12.181.68.5) by smtp.gvtc.com with SMTP; 9 Jun 2005 01:47:05 -0000 Message-ID: <42A75985.8090709@gvtc.com> Date: Wed, 08 Jun 2005 20:48:05 +0000 From: Jim Johannsen User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: pgsql-performance@postgresql.org Subject: Re: Help with rewriting query References: <8d04ce990506081234121995f9@mail.gmail.com> <20050608195625.GM8451@tobias.nordicbet.com> <8d04ce990506081548355991bb@mail.gmail.com> In-Reply-To: <8d04ce990506081548355991bb@mail.gmail.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.053 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/193 X-Sequence-Number: 12830 How about SELECT p_id, f_id FROM person as p LEFT JOIN (SELECT f.p_id, max(f.id), f_item FROM food) as f ON p.p_id = f.p_id Create an index on Food (p_id, seq #) This may not gain any performance, but worth a try. I don't have any data similar to this to test it on. Let us know. I assume that the food id is a sequential number across all people. Have you thought of a date field and a number representing what meal was last eaten, i.e. 1= breakfast, 2 = mid morning snack etc. Or a date field and the food id code? Junaili Lie wrote: >Hi, >The suggested query below took forever when I tried it. >In addition, as suggested by Tobias, I also tried to create index on >food(p_id, id), but still no goal (same query plan). >Here is the explain: >TEST1=# explain select f.p_id, max(f.id) from Food f, Person p where >(f.p_id = p.id) group by p.id; > QUERY PLAN >---------------------------------------------------------------------------------------------------------------- > GroupAggregate (cost=0.00..214585.51 rows=569 width=16) > -> Merge Join (cost=0.00..200163.50 rows=2884117 width=16) > Merge Cond: ("outer".id = "inner".p_id) > -> Index Scan using person_pkey on person p >(cost=0.00..25.17 rows=569 width=8) > -> Index Scan using person_id_food_index on food f >(cost=0.00..164085.54 rows=2884117 width=16) >(5 rows) > > > > >TEST1=# explain select p.id, (Select f.id from food f where >f.p_id=p.id order by f.id desc limit 1) from person p; > QUERY PLAN >----------------------------------------------------------------------------------------------------------- > Seq Scan on Person p (cost=100000000.00..100007015.24 rows=569 width=8) > SubPlan > -> Limit (cost=0.00..12.31 rows=1 width=8) > -> Index Scan Backward using food_pkey on food f >(cost=0.00..111261.90 rows=9042 width=8) > Filter: (p_id = $0) >(5 rows) > >any ideas or suggestions is appreciate. > > >On 6/8/05, Tobias Brox wrote: > > >>[Junaili Lie - Wed at 12:34:32PM -0700] >> >> >>>select f.p_id, max(f.id) from person p, food f where p.id=f.p_id group >>>by f.p_id will work. >>>But I understand this is not the most efficient way. Is there another >>>way to rewrite this query? (maybe one that involves order by desc >>>limit 1) >>> >>> >>eventually, try something like >> >> select p.id,(select f.id from food f where f.p_id=p.id order by f.id desc limit 1) >> from person p >> >>not tested, no warranties. >> >>Since subqueries can be inefficient, use "explain analyze" to see which one >>is actually better. >> >>This issue will be solved in future versions of postgresql. >> >>-- >>Tobias Brox, +47-91700050 >>Tallinn >> >> >> > >---------------------------(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 > > > > From pgsql-performance-owner@postgresql.org Wed Jun 8 18:04: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 9DC8B52838 for ; Wed, 8 Jun 2005 18:04:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50653-04 for ; Wed, 8 Jun 2005 21:04:50 +0000 (GMT) Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) by svr1.postgresql.org (Postfix) with ESMTP id C213A52824 for ; Wed, 8 Jun 2005 18:04:48 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 08 Jun 2005 16:04:50 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Date: Wed, 08 Jun 2005 16:04:36 -0500 From: "Kevin Grittner" To: Subject: Recommendations for configuring a 200 GB database Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__PartA4874C74.0__=" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.276 tagged_above=0 required=5 tests=AWL, HTML_20_30, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200506/188 X-Sequence-Number: 12825 --=__PartA4874C74.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit We have had four databases serving our web site, but due to licensing issues, we have had to take two out of production, and we are looking to bring those two onto PostgreSQL very quickly, with an eye toward moving everything in the longer term. The central web DBs are all copies of the same data, drawn from 72 servers at remote locations. We replicate modifications made at these 72 remote sites real-time to all central servers. On each central server, there are 352 tables and 412 indexes holding about 700 million rows, taking almost 200 GB of disk space. The largest table has about 125 million of those rows, with several indexes. There are about 3 million database transactions modifying each central database every day, with each transaction typically containing many inserts and/or updates -- deletes are sparse. During idle time the replication process compares tables in the source databases to the central databases to log any differences and correct the central copies. To support the 2 million browser and SOAP hits per day, the web sites spread about 6 million SELECT statements across available central servers, using load balancing. Many of these queries involve a 10 or more tables with many subqueries; some involve unions. The manager of the DBA team is reluctant to change both the OS and the DBMS at the same time, so unless I can make a strong case for why it is important to run postgresql under Linux, we will be running this on Windows. Currently, there are two Java-based middle tier processes running on each central database server, one for the replication and one for the web. We expect to keep it that way, so the database needs to play well with these processes. I've been reading everything I can find on postgresql configuration, but would welcome any specific suggestions for this environment. I'd also be really happy to hear that we're not the first to use postgresql with this much data and load. Thanks for any info you can provide. -Kevin --=__PartA4874C74.0__= Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable =20
We have had four databases serving our web site, but due to = licensing issues, we have had to take two out of production, and = we are looking to bring those two onto PostgreSQL very quickly, with = an eye toward moving everything in the longer term.  The central web = DBs are all copies of the same data, drawn from 72 servers at remote = locations.  We replicate modifications made at these 72 remote sites = real-time to all central servers.
 
On each central server, there are 352 tables and 412 indexes = holding about 700 million rows, taking almost 200 GB of disk space. =  The largest table has about 125 million of those rows, with = several indexes.  There are about 3 million database transactions = modifying each central database every day, with each transaction = typically containing many inserts and/or updates -- deletes are sparse. =  During idle time the replication process compares tables in the = source databases to the central databases to log any differences and = correct the central copies.  To support the 2 million browser and = SOAP hits per day, the web sites spread about 6 million SELECT = statements across available central servers, using load balancing. =  Many of these queries involve a 10 or more tables with many = subqueries; some involve unions.
 
The manager of the DBA team is reluctant to change both the OS and = the DBMS at the same time, so unless I can make a strong case for why = it is important to run postgresql under Linux, we will be running this = on Windows.  Currently, there are two Java-based middle tier = processes running on each central database server, one for the = replication and one for the web.  We expect to keep it that way, = so the database needs to play well with these processes.
 
I've been reading everything I can find on postgresql configurati= on, but would welcome any specific suggestions for this environment. =  I'd also be really happy to hear that we're not the first to = use postgresql with this much data and load.
 
Thanks for any info you can provide.
 
-Kevin
 
 
--=__PartA4874C74.0__=-- From pgsql-performance-owner@postgresql.org Wed Jun 8 18: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 9604952824 for ; Wed, 8 Jun 2005 18:14:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50942-03 for ; Wed, 8 Jun 2005 21:14:07 +0000 (GMT) Received: from mail.utsl.gen.nz (210-54-92-184.ipnets.xtra.co.nz [210.54.92.184]) by svr1.postgresql.org (Postfix) with ESMTP id 9044C52838 for ; Wed, 8 Jun 2005 18:14:06 -0300 (ADT) Received: by mail.utsl.gen.nz (Postfix, from userid 65534) id 712E711004; Thu, 9 Jun 2005 09:14:08 +1200 (NZST) Received: from [127.0.0.1] (longdrop.clunker.utsl.gen.nz [192.168.255.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.utsl.gen.nz (Postfix) with ESMTP id BFA5711002; Thu, 9 Jun 2005 09:14:04 +1200 (NZST) Message-ID: <42A75F9A.3070500@vilain.net> Date: Thu, 09 Jun 2005 09:14:02 +1200 From: Sam Vilain User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Joshua D. Drake" Cc: pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> <42A6034A.90405@commandprompt.com> In-Reply-To: <42A6034A.90405@commandprompt.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.207 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/189 X-Sequence-Number: 12826 Joshua D. Drake wrote: >> Yes - we have seen with oracle 64 bit that there can be as much as a >> 10% hit moving >> from 32 - but we make it up big time with large db-buffer sizes that >> drastically > Well for Opteron you should also gain from the very high memory > bandwidth and the fact that it has I believe "3" FP units per CPU. Sure. But you get those benefits in 32 or 64-bit mode. Sam. From pgsql-performance-owner@postgresql.org Wed Jun 8 19:48: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 1F785528BE for ; Wed, 8 Jun 2005 19:48:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73360-02 for ; Wed, 8 Jun 2005 22:48:26 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.200]) by svr1.postgresql.org (Postfix) with ESMTP id D76685288D for ; Wed, 8 Jun 2005 19:48:24 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id 16so734947nzp for ; Wed, 08 Jun 2005 15:48:27 -0700 (PDT) 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:content-disposition:references; b=NaZIfKmNJOSeQRj98KHx9unov6VQh3UsxJ8MdZdtsr0vo9WO1npD8oXg0HSZu5yWdEAUh7548GHgtUt6dQ3r6T6OvwJyRklps1KFRqhKCsClcD3MpKkjuj3jJAeXGBjawofUE5/9HuGMFJmgI+NiZe8xT42Gt1qpAn50Zf/6FMQ= Received: by 10.36.113.17 with SMTP id l17mr2260606nzc; Wed, 08 Jun 2005 15:48:27 -0700 (PDT) Received: by 10.36.47.20 with HTTP; Wed, 8 Jun 2005 15:48:27 -0700 (PDT) Message-ID: <8d04ce990506081548355991bb@mail.gmail.com> Date: Wed, 8 Jun 2005 15:48:27 -0700 From: Junaili Lie Reply-To: Junaili Lie To: pgsql-performance@postgresql.org Subject: Re: Help with rewriting query In-Reply-To: <20050608195625.GM8451@tobias.nordicbet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <8d04ce990506081234121995f9@mail.gmail.com> <20050608195625.GM8451@tobias.nordicbet.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.083 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/190 X-Sequence-Number: 12827 Hi, The suggested query below took forever when I tried it. In addition, as suggested by Tobias, I also tried to create index on food(p_id, id), but still no goal (same query plan). Here is the explain: TEST1=3D# explain select f.p_id, max(f.id) from Food f, Person p where (f.p_id =3D p.id) group by p.id; QUERY PLAN ---------------------------------------------------------------------------= ------------------------------------- GroupAggregate (cost=3D0.00..214585.51 rows=3D569 width=3D16) -> Merge Join (cost=3D0.00..200163.50 rows=3D2884117 width=3D16) Merge Cond: ("outer".id =3D "inner".p_id) -> Index Scan using person_pkey on person p (cost=3D0.00..25.17 rows=3D569 width=3D8) -> Index Scan using person_id_food_index on food f (cost=3D0.00..164085.54 rows=3D2884117 width=3D16) (5 rows) TEST1=3D# explain select p.id, (Select f.id from food f where f.p_id=3Dp.id order by f.id desc limit 1) from person p; QUERY PLAN ---------------------------------------------------------------------------= -------------------------------- Seq Scan on Person p (cost=3D100000000.00..100007015.24 rows=3D569 width= =3D8) SubPlan -> Limit (cost=3D0.00..12.31 rows=3D1 width=3D8) -> Index Scan Backward using food_pkey on food f (cost=3D0.00..111261.90 rows=3D9042 width=3D8) Filter: (p_id =3D $0) (5 rows) any ideas or suggestions is appreciate. On 6/8/05, Tobias Brox wrote: > [Junaili Lie - Wed at 12:34:32PM -0700] > > select f.p_id, max(f.id) from person p, food f where p.id=3Df.p_id grou= p > > by f.p_id will work. > > But I understand this is not the most efficient way. Is there another > > way to rewrite this query? (maybe one that involves order by desc > > limit 1) >=20 > eventually, try something like >=20 > select p.id,(select f.id from food f where f.p_id=3Dp.id order by f.id d= esc limit 1) > from person p >=20 > not tested, no warranties. >=20 > Since subqueries can be inefficient, use "explain analyze" to see which o= ne > is actually better. >=20 > This issue will be solved in future versions of postgresql. >=20 > -- > Tobias Brox, +47-91700050 > Tallinn > From pgsql-performance-owner@postgresql.org Wed Jun 8 20:33: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 3F22D52814 for ; Wed, 8 Jun 2005 20:33:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79548-04 for ; Wed, 8 Jun 2005 23:33:27 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id DAEFA52869 for ; Wed, 8 Jun 2005 20:33:26 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 1246D30E99; Thu, 9 Jun 2005 01:33:29 +0200 (MET DST) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Help specifying new web server/database machine Date: Wed, 08 Jun 2005 16:33:21 -0700 Organization: Hub.Org Networking Services Lines: 42 Message-ID: References: <20050608163418.GA3327@campbell-lange.net> 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.2 (X11/20050317) X-Accept-Language: en-us, en In-Reply-To: <20050608163418.GA3327@campbell-lange.net> 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: 200506/191 X-Sequence-Number: 12828 > We are considering two RAID1 system disks, and two RAID1 data disks. > We've avoided buying Xeons. The machine we are looking at looks like > this: > > Rackmount Chassis - 500W PSU / 4 x SATA Disk Drive Bays > S2882-D - Dual Opteron / AMD 8111 Chipset / 5 x PCI Slots > 2x - (Dual) AMD Opteron 246 Processors (2.0GHz) - 1MB L2 Cache/core (single core) For about $1500 more, you could go 2x270 (dual core 2ghz) and get a 4X SMP system. (My DC 2x265 system just arrived -- can't wait to start testing it!!!) > 2GB (2x 1024MB) DDR-400 (PC3200) ECC Registered SDRAM (single rank) This is a wierd configuration. For a 2x Opteron server to operate at max performance, it needs 4 DIMMs minimum. Opterons use a 128-bit memory interface and hence requires 2 DIMMs per CPU to run at full speed. With only 2 DIMMS, you either have both CPUs run @ 64-bit (this may not even be possible) or populate only 1 CPU bank -- the other CPU must then request all memory access through the other CPU which is a significant penalty. If you went 4x512MB, you'd limit your future update options by having less slots available to add more memory. I'd definitely out of the chute get 4x1GB, > 4 Port AMCC/3Ware 9500-4LP PCI SATA RAID Controller > 80GB SATA-150 7200RPM Hard Disk / 8MB Cache > 80GB SATA-150 7200RPM Hard Disk / 8MB Cache > 250GB SATA-150 7200RPM Hard Disk / 8MB Cache > 250GB SATA-150 7200RPM Hard Disk / 8MB Cache Now this is comes to the interesting part. We've had huge, gigantic threads (check archives for the $7K server threads) about SCSI versus SATA in the past. 7200 SATAs just aren't fast/smart enough to cut it for most production uses in regular configs. If you are set on SATA, you will have to consider the following options: (1) use 10K Raptors for TCQ goodness, (2) put a huge amount of memory onto the SATA RAID card -- 1GB minimum, (3) use a ton of SATA drives to make a RAID10 array -- 8 drives minimum. Or you could go SCSI. SCSI is cost prohibitive though at the larger disk sizes -- this is why I'm considering option #3 for my data processing server. From pgsql-performance-owner@postgresql.org Wed Jun 8 21:20: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 20DBC528CA for ; Wed, 8 Jun 2005 21:20:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88975-06 for ; Thu, 9 Jun 2005 00:19:59 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id D288F52864 for ; Wed, 8 Jun 2005 21:19:57 -0300 (ADT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id 2E00E18CDC6; Wed, 8 Jun 2005 20:20:01 -0400 (EDT) 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 28182-01-4; Wed, 8 Jun 2005 20:19:59 -0400 (EDT) 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 C3F6618CD67; Wed, 8 Jun 2005 20:19:58 -0400 (EDT) Message-ID: <42A78B27.9070603@samurai.com> Date: Thu, 09 Jun 2005 10:19:51 +1000 From: Neil Conway User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Arthurs Cc: Donald Courtney , pgsql-performance@postgresql.org Subject: Re: Postgresql on an AMD64 machine References: <1118080420.1644.23.camel@penguin1> <42A5F7B6.20502@sun.com> <42A5FB70.8090807@jobflash.com> <42A6014C.30108@sun.com> <42A605E8.8040607@jobflash.com> <42A639C3.40606@samurai.com> <42A72047.6030304@jobflash.com> In-Reply-To: <42A72047.6030304@jobflash.com> 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.018 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/192 X-Sequence-Number: 12829 Tom Arthurs wrote: > I just puhsd 8.0.3 to production on Sunday, and haven't had a time to > really monitor it under load, so I can't tell if it's helped the context > switch problem yet or not. 8.0 is unlikely to make a significant difference -- by "current sources" I meant the current CVS HEAD sources (i.e. 8.1devel). -Neil From pgsql-performance-owner@postgresql.org Thu Jun 9 00:00: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 5E7745283C for ; Thu, 9 Jun 2005 00:00:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24409-06 for ; Thu, 9 Jun 2005 02:59:52 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 713CF528C1 for ; Wed, 8 Jun 2005 23:59:50 -0300 (ADT) Received: (qmail 7540 invoked by uid 500); 9 Jun 2005 02:59:07 -0000 Date: Wed, 8 Jun 2005 21:59:07 -0500 From: Bruno Wolff III To: Junaili Lie Cc: pgsql-performance@postgresql.org Subject: Re: Help with rewriting query Message-ID: <20050609025907.GB6139@wolff.to> Mail-Followup-To: Bruno Wolff III , Junaili Lie , pgsql-performance@postgresql.org References: <8d04ce990506081234121995f9@mail.gmail.com> <20050608195625.GM8451@tobias.nordicbet.com> <8d04ce990506081548355991bb@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d04ce990506081548355991bb@mail.gmail.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: 200506/194 X-Sequence-Number: 12831 On Wed, Jun 08, 2005 at 15:48:27 -0700, Junaili Lie wrote: > Hi, > The suggested query below took forever when I tried it. > In addition, as suggested by Tobias, I also tried to create index on > food(p_id, id), but still no goal (same query plan). > Here is the explain: > TEST1=# explain select f.p_id, max(f.id) from Food f, Person p where > (f.p_id = p.id) group by p.id; The above is going to require reading all the food table (assuming no orphaned records), so the plan below seems reasonable. > QUERY PLAN > ---------------------------------------------------------------------------------------------------------------- > GroupAggregate (cost=0.00..214585.51 rows=569 width=16) > -> Merge Join (cost=0.00..200163.50 rows=2884117 width=16) > Merge Cond: ("outer".id = "inner".p_id) > -> Index Scan using person_pkey on person p > (cost=0.00..25.17 rows=569 width=8) > -> Index Scan using person_id_food_index on food f > (cost=0.00..164085.54 rows=2884117 width=16) > (5 rows) > > > > > TEST1=# explain select p.id, (Select f.id from food f where > f.p_id=p.id order by f.id desc limit 1) from person p; Using a subselect seems to be the best hope of getting better performance. I think you almost got it right, but in order to use the index on (p_id, id) you need to order by f.p_id desc, f.id desc. Postgres won't deduce this index can be used because f.p_id is constant in the subselect, you need to give it some help. > QUERY PLAN > ----------------------------------------------------------------------------------------------------------- > Seq Scan on Person p (cost=100000000.00..100007015.24 rows=569 width=8) > SubPlan > -> Limit (cost=0.00..12.31 rows=1 width=8) > -> Index Scan Backward using food_pkey on food f > (cost=0.00..111261.90 rows=9042 width=8) > Filter: (p_id = $0) > (5 rows) > > any ideas or suggestions is appreciate. > > > On 6/8/05, Tobias Brox wrote: > > [Junaili Lie - Wed at 12:34:32PM -0700] > > > select f.p_id, max(f.id) from person p, food f where p.id=f.p_id group > > > by f.p_id will work. > > > But I understand this is not the most efficient way. Is there another > > > way to rewrite this query? (maybe one that involves order by desc > > > limit 1) > > > > eventually, try something like > > > > select p.id,(select f.id from food f where f.p_id=p.id order by f.id desc limit 1) > > from person p > > > > not tested, no warranties. > > > > Since subqueries can be inefficient, use "explain analyze" to see which one > > is actually better. > > > > This issue will be solved in future versions of postgresql. > > > > -- > > Tobias Brox, +47-91700050 > > Tallinn > > > > ---------------------------(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 From pgsql-performance-owner@postgresql.org Thu Jun 9 00:57: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 3FEAD52816 for ; Thu, 9 Jun 2005 00:57:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44802-01 for ; Thu, 9 Jun 2005 03:57:05 +0000 (GMT) Received: from exchange.hostworks.com.au (exchange.hostworks.com.au [202.58.32.39]) by svr1.postgresql.org (Postfix) with ESMTP id D76A052814 for ; Thu, 9 Jun 2005 00:57:03 -0300 (ADT) Received: from EXCHANGEHW.au.corp.hostworks.com.au ([10.5.0.93]) by exchange.hostworks.com.au with Microsoft SMTPSVC(6.0.3790.211); Thu, 9 Jun 2005 13:26:57 +0930 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: Importing from pg_dump slow, low Disk IO Date: Thu, 9 Jun 2005 13:26:57 +0930 Message-ID: <13F3036A953F6A41BC91040310BD692A03EF1B2C@EXCHANGEHW.au.corp.hostworks.com.au> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Importing from pg_dump slow, low Disk IO Thread-Index: AcVsCbqVuSQ3UPyzQeCqjH+47jIeXQAnStbg From: "Steve Pollard" To: "Steve Pollard" , X-OriginalArrivalTime: 09 Jun 2005 03:56:57.0657 (UTC) FILETIME=[48330A90:01C56CA7] 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: 200506/195 X-Sequence-Number: 12832 As a follow up to this ive installed on another test Rehat 8 machine with 7.3.4 and slow inserts are present, however on another machine with ES3 the same 15,000 inserts is about 20 times faster, anyone know of a change that would effect this, kernel or rehat release ? Steve -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Steve Pollard Sent: Wednesday, 8 June 2005 6:39 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] Importing from pg_dump slow, low Disk IO Hi Everyone, Im having a performance issue with version 7.3.4 which i first thought was Disk IO related, however now it seems like the problem is caused by really slow commits, this is running on Redhat 8. Basically im taking a .sql file with insert of about 15,000 lines and <'ing straight into psql DATABASENAME, the Disk writes never gets over about 2000 on this machine with a RAID5 SCSI setup, this happens in my PROD and DEV environment. Ive installed the latest version on RedHat ES3 and copied the configs across however the inserts are really really fast.. Was there a performce change from 7.3.4 to current to turn of autocommits by default or is buffering handled differently ? I have ruled out Disk IO issues as a siple 'cp' exceeds Disk writes to 60000 (using vmstat) If i do this with a BEGIN; and COMMIT; its really fast, however not practical as im setting up a cold-standby server for automation. Have been trying to debug for a few days now and see nothing.. here is some info : :::::::::::::: /proc/sys/kernel/shmall :::::::::::::: 2097152 :::::::::::::: /proc/sys/kernel/shmmax :::::::::::::: 134217728 :::::::::::::: /proc/sys/kernel/shmmni :::::::::::::: 4096 shared_buffers =3D 51200 max_fsm_relations =3D 1000 max_fsm_pages =3D 10000 max_locks_per_transaction =3D 64 wal_buffers =3D 64 effective_cache_size =3D 65536 MemTotal: 1547608 kB MemFree: 47076 kB MemShared: 0 kB Buffers: 134084 kB Cached: 1186596 kB SwapCached: 544 kB Active: 357048 kB ActiveAnon: 105832 kB ActiveCache: 251216 kB Inact_dirty: 321020 kB Inact_laundry: 719492 kB Inact_clean: 28956 kB Inact_target: 285300 kB HighTotal: 655336 kB HighFree: 1024 kB LowTotal: 892272 kB LowFree: 46052 kB SwapTotal: 1534056 kB SwapFree: 1526460 kB This is a real doosey for me, please provide any advise possible. Steve ---------------------------(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 Thu Jun 9 01:02: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 0ECA95290C for ; Thu, 9 Jun 2005 01:02:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46211-01 for ; Thu, 9 Jun 2005 04:01:57 +0000 (GMT) Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) by svr1.postgresql.org (Postfix) with ESMTP id AB2AA528C7 for ; Thu, 9 Jun 2005 01:01:55 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 08 Jun 2005 23:01:52 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Date: Wed, 08 Jun 2005 23:01:35 -0500 From: "Kevin Grittner" To: , Subject: Re: Help with rewriting query Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.115 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/196 X-Sequence-Number: 12833 This is a pattern which I've seen many of times. I call it a "best choice" query -- you can easily match a row from one table against any of a number of rows in another, the trick is to pick the one that matters most. I've generally found that I want the query results to show more than the columns used for making the choice (and there can be many), which rules out the min/max technique. What works in a pretty straitforward way, and generally optimizes at least as well as the alternatives, is to join to the set of candidate rows and add a "not exists" test to eliminate all but the best choice. For your example, I've taken some liberties and added hypothetical columns from both tables to the result set, to demonstrate how that works. Feel free to drop them or substitute actual columns as you see fit. This will work best if there is an index for the food table on p_id and id. Please let me know whether this works for you. select p.id as p_id, p.fullname, f.id, f.foodtype, f.ts from food f join person p on f.p_id = p.id and not exists (select * from food f2 where f2.p_id = f.p_id and f2.id > f.id) order by p_id Note that this construct works for inner or outer joins and works regardless of how complex the logic for picking the best choice is. I think one reason this tends to optimize well is that an EXISTS test can finish as soon as it finds one matching row. -Kevin >>> Junaili Lie 06/08/05 2:34 PM >>> Hi, I have the following table: person - primary key id, and some attributes food - primary key id, foreign key p_id reference to table person. table food store all the food that a person is eating. The more recent food is indicated by the higher food.id. I need to find what is the most recent food a person ate for every person. The query: select f.p_id, max(f.id) from person p, food f where p.id=f.p_id group by f.p_id will work. But I understand this is not the most efficient way. Is there another way to rewrite this query? (maybe one that involves order by desc limit 1) Thank you in advance. ---------------------------(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 From pgsql-performance-owner@postgresql.org Thu Jun 9 01:41: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 7ADC652881 for ; Thu, 9 Jun 2005 01:41:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52724-01 for ; Thu, 9 Jun 2005 04:40:59 +0000 (GMT) Received: from mail.ceedees.com (unknown [203.101.67.210]) by svr1.postgresql.org (Postfix) with ESMTP id ED37C5280B for ; Thu, 9 Jun 2005 01:40:58 -0300 (ADT) Received: from localhost (ceedees.com [127.0.0.1]) by mail.ceedees.com (Postfix) with ESMTP id 4936123AB8; Thu, 9 Jun 2005 10:22:05 +0530 (IST) Received: from mail.ceedees.com ([127.0.0.1]) by localhost (mail.ceedees.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08796-04; Thu, 9 Jun 2005 10:22:02 +0530 (IST) Received: from [192.168.0.61] (unknown [192.168.0.61]) by mail.ceedees.com (Postfix) with ESMTP id 4678B23A68 for ; Thu, 9 Jun 2005 10:22:02 +0530 (IST) Message-ID: <42A7C84A.4020303@ceedees.com> Date: Thu, 09 Jun 2005 10:10:42 +0530 From: Shanmugasundaram Doraisamy Organization: Venbro Polymers Software Division User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: How to find the size of a database - reg. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at ceedees.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: 200506/197 X-Sequence-Number: 12834 Dear Group! Thank you for all the support you all have been providing from time to time. I have a small question: How do I find the actual size of the Database? Awaiting you replies, Shan. From pgsql-performance-owner@postgresql.org Thu Jun 9 01:59: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 39DE752864 for ; Thu, 9 Jun 2005 01:59:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54435-05 for ; Thu, 9 Jun 2005 04:59:41 +0000 (GMT) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id B3DF65280B for ; Thu, 9 Jun 2005 01:59:39 -0300 (ADT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 1BBB524FDD; Thu, 9 Jun 2005 12:59:39 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 022C824FCE; Thu, 9 Jun 2005 12:59:39 +0800 (WST) Message-ID: <42A7CD2F.7030203@familyhealth.com.au> Date: Thu, 09 Jun 2005 13:01:35 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Shanmugasundaram Doraisamy Cc: pgsql-performance@postgresql.org Subject: Re: How to find the size of a database - reg. References: <42A7C84A.4020303@ceedees.com> In-Reply-To: <42A7C84A.4020303@ceedees.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.064 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/198 X-Sequence-Number: 12835 contrib/dbsize in the postgresql distribution. Shanmugasundaram Doraisamy wrote: > Dear Group! > Thank you for all the support you all have been > providing from time to time. I have a small question: How do I find the > actual size of the Database? Awaiting you replies, > > Shan. > > ---------------------------(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 From pgsql-performance-owner@postgresql.org Thu Jun 9 03:02: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 753D652867 for ; Thu, 9 Jun 2005 03:02:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68349-04 for ; Thu, 9 Jun 2005 06:02:02 +0000 (GMT) Received: from oismail.com (unknown [38.117.22.100]) by svr1.postgresql.org (Postfix) with ESMTP id 368A45285B for ; Thu, 9 Jun 2005 03:02:01 -0300 (ADT) Received: from oismail.com (localhost [127.0.0.1]) by oismail.com (8.12.11/8.12.11) with ESMTP id j596225X008574 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 9 Jun 2005 02:02:03 -0400 Received: from localhost (jonanews@localhost) by oismail.com (8.12.11/8.12.11/Submit) with ESMTP id j59622nG008570 for ; Thu, 9 Jun 2005 02:02:02 -0400 Date: Thu, 9 Jun 2005 02:02:02 -0400 (EDT) From: jonanews@oismail.com To: pgsql-performance@postgresql.org Subject: Query plan changes after pg_dump / pg_restore Message-ID: 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.308 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, NORMAL_HTTP_TO_IP, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200506/199 X-Sequence-Number: 12836 Greetings all, I am continously encountering an issue with query plans that changes after a pg_dump / pg_restore operation has been performed. On the production database, PostGre refuses to use the defined indexes in several queries however once the database has been dumped and restored either on another server or on the same database server it suddenly "magically" changes the query plan to utilize the indexes thereby cutting the query cost down to 10% of the original. Databases are running on the same PostGre v7.3.9 on RH Enterprise 3.1 server. A VACUUM FULL runs regularly once a day and VACUUM ANALYZE every other hour. The data in the tables affected by this query doesn't change very often Even doing a manual VACUUM FULL, VACUUM ANALYZE or REINDEX before the query is run on the production database changes nothing. Have tried to drop the indexes completely and re-create them as well, all to no avail. If the queries are run with SET ENABLE_SEQSCAN TO OFF, the live database uses the correct indexes as expected. Have placed an export of the query, query plan etc. online at: http://213.173.234.215:8080/plan.htm in order to ensure it's still readable. For the plans, the key tables are marked with bold. Any insight into why PostGre behaves this way as well as a possible solution (other than performing a pg_dump / pg_restore on the live database) would be very much appreciated? Cheers Jona From pgsql-performance-owner@postgresql.org Thu Jun 9 04:33: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 590E1528BE for ; Thu, 9 Jun 2005 04:33:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90304-02 for ; Thu, 9 Jun 2005 07:33:08 +0000 (GMT) Received: from zigo.dhs.org (c8233a.g-aen.bostream.se [194.236.34.191]) by svr1.postgresql.org (Postfix) with ESMTP id 3B38F528E7 for ; Thu, 9 Jun 2005 04:33:07 -0300 (ADT) Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) by zigo.dhs.org (Postfix) with ESMTP id 08FC68467; Thu, 9 Jun 2005 09:33:07 +0200 (CEST) Date: Thu, 9 Jun 2005 09:33:07 +0200 (CEST) From: Dennis Bjorklund To: jonanews@oismail.com Cc: pgsql-performance@postgresql.org Subject: Re: Query plan changes after pg_dump / pg_restore In-Reply-To: Message-ID: 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.368 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO, NORMAL_HTTP_TO_IP X-Spam-Level: X-Archive-Number: 200506/200 X-Sequence-Number: 12837 On Thu, 9 Jun 2005 jonanews@oismail.com wrote: > I am continously encountering an issue with query plans that changes after > a pg_dump / pg_restore operation has been performed. > > Have placed an export of the query, query plan etc. online at: > http://213.173.234.215:8080/plan.htm in order to ensure it's still > readable. There is not a major difference in time, so pg is at least not way off (225ms vs. 280ms). The estimated cost is however not very related to the runtime (117 vs 1389). What you have not showed is if the database is properly tuned. The output of SHOW ALL; could help explain a lot together with info of how much memory your computer have. The first thing that comes to mind to me is that you probably have not tuned shared_buffers and effective_cache_size properly (SHOW ALL would tell). -- /Dennis Bj�rklund From pgsql-performance-owner@postgresql.org Thu Jun 9 05:11: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 1F8C652896 for ; Thu, 9 Jun 2005 05:11:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98989-03 for ; Thu, 9 Jun 2005 08:11:19 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 586C7528AD for ; Thu, 9 Jun 2005 05:11:19 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 1766640DFAB; Thu, 9 Jun 2005 09:11:16 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 7786715ED5; Thu, 9 Jun 2005 09:07:51 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06600-01; Thu, 9 Jun 2005 09:07:46 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id D172515ED9; Thu, 9 Jun 2005 09:06:44 +0100 (BST) Message-ID: <42A7F894.40803@archonet.com> Date: Thu, 09 Jun 2005 09:06:44 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Grittner Cc: pgsql-performance@postgresql.org Subject: Re: Recommendations for configuring a 200 GB database 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.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/202 X-Sequence-Number: 12839 Kevin Grittner wrote: > > The manager of the DBA team is reluctant to change both the OS and the > DBMS at the same time, so unless I can make a strong case for why it is > important to run postgresql under Linux, we will be running this on > Windows. Currently, there are two Java-based middle tier processes > running on each central database server, one for the replication and one > for the web. We expect to keep it that way, so the database needs to > play well with these processes. Well, there's a lot more experience running PG on various *nix systems and a lot more help available. Also, I don't think performance on Windows is as good as on Linux/*BSD yet. Against switching OS is the fact that you presumably don't have the skills in-house for it, and the hardware was chosen for Windows compatibility/performance. Speaking of which, what sort of hardware are we talking about? -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jun 9 05:07: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 CFA61528AD for ; Thu, 9 Jun 2005 05:07:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98921-02 for ; Thu, 9 Jun 2005 08:07:38 +0000 (GMT) Received: from oismail.com (unknown [38.117.22.100]) by svr1.postgresql.org (Postfix) with ESMTP id A5C3152883 for ; Thu, 9 Jun 2005 05:07:36 -0300 (ADT) Received: from [192.168.8.103] ([213.173.234.215]) (authenticated bits=0) by oismail.com (8.12.11/8.12.11) with ESMTP id j5987c3M011241 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Jun 2005 04:07:39 -0400 Message-ID: <42A7F9D9.8000004@oismail.com> Date: Thu, 09 Jun 2005 10:12:09 +0200 From: Jona User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dennis Bjorklund Cc: pgsql-performance@postgresql.org Subject: Re: Query plan changes after pg_dump / pg_restore References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------000801000709030505000605" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.371 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_20_30, HTML_MESSAGE, NORMAL_HTTP_TO_IP X-Spam-Level: X-Archive-Number: 200506/201 X-Sequence-Number: 12838 This is a multi-part message in MIME format. --------------000801000709030505000605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Thank you for the swift reply, the following is the output of the SHOW ALL for shared_buffers and effective_cache_size. shared_buffers: 13384 effective_cache_size: 4000 server memory: 2GB Please note, the databases are on the same server, it's merely 2 instances of the same database in order to figure out why there's a difference in the query plan before and after a dump / restore. What worries me is that the plan is different, in the bad plan it makes a seq scan of a table with 6.5k recods in (fairly silly) and another of a table with 50k records in (plan stupid). In the good plan it uses the indexes available as expected. The estimated cost is obviously way off in the live database, even though statistics etc should be up to date. Any insight into this? Appreciate the help here... Cheers Jona Dennis Bjorklund wrote: >On Thu, 9 Jun 2005 jonanews@oismail.com wrote: > > > >>I am continously encountering an issue with query plans that changes after >>a pg_dump / pg_restore operation has been performed. >> >>Have placed an export of the query, query plan etc. online at: >>http://213.173.234.215:8080/plan.htm in order to ensure it's still >>readable. >> >> > >There is not a major difference in time, so pg is at least not way off >(225ms vs. 280ms). The estimated cost is however not very related to the >runtime (117 vs 1389). > >What you have not showed is if the database is properly tuned. The output >of SHOW ALL; could help explain a lot together with info of how much >memory your computer have. > >The first thing that comes to mind to me is that you probably have not >tuned shared_buffers and effective_cache_size properly (SHOW ALL would >tell). > > > --------------000801000709030505000605 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thank you for the swift reply, the following is the output of the SHOW ALL for shared_buffers and effective_cache_size.
shared_buffers:  13384
effective_cache_size: 4000
server memory: 2GB

Please note, the databases are on the same server, it's merely 2 instances of the same database in order to figure out why there's a difference in the query plan before and after a dump / restore.

What worries me is that the plan is different, in the bad plan it makes a seq scan of a table with 6.5k recods in (fairly silly) and another of a table with 50k records in (plan stupid).
In the good plan it uses the indexes available as expected.

The estimated cost is obviously way off in the live database, even though statistics etc should be up to date. Any insight into this?

Appreciate the help here...

Cheers
Jona

Dennis Bjorklund wrote:
On Thu, 9 Jun 2005 jonanews@oismail.com wrote:

  
I am continously encountering an issue with query plans that changes after 
a pg_dump / pg_restore operation has been performed.

Have placed an export of the query, query plan etc. online at: 
http://213.173.234.215:8080/plan.htm in order to ensure it's still 
readable.
    

There is not a major difference in time, so pg is at least not way off 
(225ms vs. 280ms). The estimated cost is however not very related to the 
runtime (117 vs 1389).

What you have not showed is if the database is properly tuned. The output
of SHOW ALL; could help explain a lot together with info of how much
memory your computer have.

The first thing that comes to mind to me is that you probably have not 
tuned shared_buffers and effective_cache_size properly (SHOW ALL would 
tell).

  

--------------000801000709030505000605-- From pgsql-performance-owner@postgresql.org Thu Jun 9 05: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 E6F615292D for ; Thu, 9 Jun 2005 05:23:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02644-03 for ; Thu, 9 Jun 2005 08:23:55 +0000 (GMT) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 390805292B for ; Thu, 9 Jun 2005 05:23:54 -0300 (ADT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 3F28C24FE0; Thu, 9 Jun 2005 16:23:53 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 24EAA24FDF; Thu, 9 Jun 2005 16:23:53 +0800 (WST) Message-ID: <42A7FD12.2080608@familyhealth.com.au> Date: Thu, 09 Jun 2005 16:25:54 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jona Cc: Dennis Bjorklund , pgsql-performance@postgresql.org Subject: Re: Query plan changes after pg_dump / pg_restore References: <42A7F9D9.8000004@oismail.com> In-Reply-To: <42A7F9D9.8000004@oismail.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.064 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/203 X-Sequence-Number: 12840 > Thank you for the swift reply, the following is the output of the SHOW > ALL for shared_buffers and effective_cache_size. > shared_buffers: 13384 > effective_cache_size: 4000 > server memory: 2GB effective_cache_size should be 10-100x larger perhaps... Chris From pgsql-performance-owner@postgresql.org Thu Jun 9 05:50: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 8E376528FF for ; Thu, 9 Jun 2005 05:50:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05225-10 for ; Thu, 9 Jun 2005 08:50:09 +0000 (GMT) Received: from oismail.com (unknown [38.117.22.100]) by svr1.postgresql.org (Postfix) with ESMTP id 94F7952867 for ; Thu, 9 Jun 2005 05:50:08 -0300 (ADT) Received: from [192.168.8.103] ([213.173.234.215]) (authenticated bits=0) by oismail.com (8.12.11/8.12.11) with ESMTP id j598o0f5012484 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Jun 2005 04:50:02 -0400 Message-ID: <42A803C8.6070507@oismail.com> Date: Thu, 09 Jun 2005 10:54:32 +0200 From: Jona User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Kings-Lynne Cc: Dennis Bjorklund , pgsql-performance@postgresql.org Subject: Re: Query plan changes after pg_dump / pg_restore References: <42A7F9D9.8000004@oismail.com> <42A7FD12.2080608@familyhealth.com.au> In-Reply-To: <42A7FD12.2080608@familyhealth.com.au> 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.112 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/204 X-Sequence-Number: 12841 Thanks... have notified our sys admin of that so he can make the correct changes. It still doesn't explain the difference in query plans though? I mean, it's the same database server the two instances of the same database is running on. One instance (the live) just insists on doing the seq scan of the 50k records in Price_Tbl and the 6.5k records in SCT2SubCatType_Tbl. Seems weird.... Cheers Jona Christopher Kings-Lynne wrote: >> Thank you for the swift reply, the following is the output of the >> SHOW ALL for shared_buffers and effective_cache_size. >> shared_buffers: 13384 >> effective_cache_size: 4000 >> server memory: 2GB > > > effective_cache_size should be 10-100x larger perhaps... > > Chris From pgsql-performance-owner@postgresql.org Thu Jun 9 05:53: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 526D152883 for ; Thu, 9 Jun 2005 05:53:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06971-06 for ; Thu, 9 Jun 2005 08:52:51 +0000 (GMT) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 440F152867 for ; Thu, 9 Jun 2005 05:52:50 -0300 (ADT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 741E324FDD; Thu, 9 Jun 2005 16:52:52 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 720E924FCE; Thu, 9 Jun 2005 16:52:52 +0800 (WST) Message-ID: <42A803E2.8000706@familyhealth.com.au> Date: Thu, 09 Jun 2005 16:54:58 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jona Cc: Dennis Bjorklund , pgsql-performance@postgresql.org Subject: Re: Query plan changes after pg_dump / pg_restore References: <42A7F9D9.8000004@oismail.com> <42A7FD12.2080608@familyhealth.com.au> <42A803C8.6070507@oismail.com> In-Reply-To: <42A803C8.6070507@oismail.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.064 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/205 X-Sequence-Number: 12842 Is effective_cache_size set the same on the test and live? Jona wrote: > Thanks... have notified our sys admin of that so he can make the correct > changes. > > It still doesn't explain the difference in query plans though? > > I mean, it's the same database server the two instances of the same > database is running on. > One instance (the live) just insists on doing the seq scan of the 50k > records in Price_Tbl and the 6.5k records in SCT2SubCatType_Tbl. > Seems weird.... > > Cheers > Jona > > Christopher Kings-Lynne wrote: > >>> Thank you for the swift reply, the following is the output of the >>> SHOW ALL for shared_buffers and effective_cache_size. >>> shared_buffers: 13384 >>> effective_cache_size: 4000 >>> server memory: 2GB >> >> >> >> effective_cache_size should be 10-100x larger perhaps... >> >> Chris > > From pgsql-performance-owner@postgresql.org Thu Jun 9 06:15: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 9E0D45289E for ; Thu, 9 Jun 2005 06:15:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11585-06 for ; Thu, 9 Jun 2005 09:15:15 +0000 (GMT) Received: from mail.census.gov.ph (mail.census.gov.ph [203.172.28.120]) by svr1.postgresql.org (Postfix) with ESMTP id 811A852838 for ; Thu, 9 Jun 2005 06:13:11 -0300 (ADT) Received: from notnot ([192.168.1.70]) by mail.census.gov.ph (8.13.1/8.13.1) with ESMTP id j5997NkU023367 for ; Thu, 9 Jun 2005 17:07:23 +0800 Message-Id: <200506090907.j5997NkU023367@mail.census.gov.ph> From: "Michael Ryan S. Puncia" To: Subject: pg_autovacuum settings Date: Thu, 9 Jun 2005 17:19:55 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C56D17.74A7B330" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcVs1GYZSVIPXdoLS/GMM8Ey+rps2g== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-NSO-MailScanner: Found to be clean by NSO MailScanner. X-MailScanner-From: mpuncia@census.gov.ph X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.092 tagged_above=0 required=5 tests=AWL, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200506/206 X-Sequence-Number: 12843 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C56D17.74A7B330 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, My Secenario : P4 with 1G of memory on Fedora Core about 100 inserts/update per hour about 100 query per minute 20 concurrent connections 1. What is the best parameter setting in the pg_autovacuum for my scenario ? 2. what will be my sleep setting if i want to execute pg_autovacuum only after 10 hrs after the last execution. Sorry for asking those stupid question but is this my first time to use pg_autovacuum and i can't understand the README.pg_autovacuum file :) The default parameters in pg_autovacuum.h makes my box suffer some resources problem. Thanks ------=_NextPart_000_0000_01C56D17.74A7B330 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

 

Hi,

 

My Secenario :

 

P4 with 1G of memory on Fedora = Core

about 100 inserts/update per = hour

about 100 query per = minute

20 concurrent = connections

 

 

1. What is the best parameter setting in the = pg_autovacuum for my scenario ?

 

2. what will be my sleep setting if i want to execute pg_autovacuum only after 10 hrs after the last = execution.

 

 

Sorry for asking those stupid question but is this my = first time to use pg_autovacuum and i can’t understand the =

README.pg_autovacuum file = :)

 

The default parameters in pg_autovacuum.h makes my = box suffer some resources problem.

 

Thanks

 

------=_NextPart_000_0000_01C56D17.74A7B330-- From pgsql-performance-owner@postgresql.org Thu Jun 9 06:18: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 1160452838 for ; Thu, 9 Jun 2005 06:18:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16265-01 for ; Thu, 9 Jun 2005 09:18:47 +0000 (GMT) Received: from oismail.com (unknown [38.117.22.100]) by svr1.postgresql.org (Postfix) with ESMTP id 7229D52834 for ; Thu, 9 Jun 2005 06:18:46 -0300 (ADT) Received: from [192.168.8.103] ([213.173.234.215]) (authenticated bits=0) by oismail.com (8.12.11/8.12.11) with ESMTP id j599Ihfp013244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Jun 2005 05:18:45 -0400 Message-ID: <42A80A82.3060900@oismail.com> Date: Thu, 09 Jun 2005 11:23:14 +0200 From: Jona User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Kings-Lynne Cc: Dennis Bjorklund , pgsql-performance@postgresql.org Subject: Re: Query plan changes after pg_dump / pg_restore References: <42A7F9D9.8000004@oismail.com> <42A7FD12.2080608@familyhealth.com.au> <42A803C8.6070507@oismail.com> <42A803E2.8000706@familyhealth.com.au> In-Reply-To: <42A803E2.8000706@familyhealth.com.au> 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.104 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/207 X-Sequence-Number: 12844 It's the same (physical) server as well as the same PostGreSQL daemon, so yes. The only difference is the actual database, the test database is made from a backup of the live database and restored onto the same PostGreSQL server. So if I run "show databases" in psql i get: - test - live Makes sense?? /Jona Christopher Kings-Lynne wrote: > Is effective_cache_size set the same on the test and live? > > Jona wrote: > >> Thanks... have notified our sys admin of that so he can make the >> correct changes. >> >> It still doesn't explain the difference in query plans though? >> >> I mean, it's the same database server the two instances of the same >> database is running on. >> One instance (the live) just insists on doing the seq scan of the 50k >> records in Price_Tbl and the 6.5k records in SCT2SubCatType_Tbl. >> Seems weird.... >> >> Cheers >> Jona >> >> Christopher Kings-Lynne wrote: >> >>>> Thank you for the swift reply, the following is the output of the >>>> SHOW ALL for shared_buffers and effective_cache_size. >>>> shared_buffers: 13384 >>>> effective_cache_size: 4000 >>>> server memory: 2GB >>> >>> >>> >>> >>> effective_cache_size should be 10-100x larger perhaps... >>> >>> Chris >> >> >> > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Thu Jun 9 07: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 C0872528BF for ; Thu, 9 Jun 2005 07:09:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22457-09 for ; Thu, 9 Jun 2005 10:08:54 +0000 (GMT) Received: from zoom.spline.inf.fu-berlin.de (zoom.spline.inf.fu-berlin.de [160.45.117.148]) by svr1.postgresql.org (Postfix) with ESMTP id 8581E528BB for ; Thu, 9 Jun 2005 07:08:50 -0300 (ADT) Received: by zoom.spline.inf.fu-berlin.de (Postfix, from userid 2091) id 06A418C749; Thu, 9 Jun 2005 12:08:52 +0200 (CEST) Date: Thu, 9 Jun 2005 12:08:52 +0200 From: Yann Michel To: pgsql-performance@postgresql.org Subject: postgresql.conf runtime statistics default Message-ID: <20050609100852.GA16538@zoom.spline.inf.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: 200506/208 X-Sequence-Number: 12845 Hi, after having migrated a 7.2 pg-database to 7.4 while upgrdaing from debian woody to debian sarge there are some more conf-Parameters to evaluate. We are running a small but continuously growing datawarehouse which has recently around 40 million fact entries. To my question: I found the parameter "stats_reset_on_server_start" which is set to true by default. Why did you choose this (and not false) and what are the impacts of changeing it to false? I mean, as long as I understood it, each query or statements generates some statistic data which is used by the optimizer (or anything equal) later on. So in my oppinion, wouldn't it be better so set this parameter to false and to enable a kind of a "startup reset_stats" option? Regards, Yann From pgsql-performance-owner@postgresql.org Thu Jun 9 07: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 D375852814 for ; Thu, 9 Jun 2005 07:48:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34529-01 for ; Thu, 9 Jun 2005 10:48:05 +0000 (GMT) Received: from zigo.dhs.org (c8233a.g-aen.bostream.se [194.236.34.191]) by svr1.postgresql.org (Postfix) with ESMTP id 6462752824 for ; Thu, 9 Jun 2005 07:48:04 -0300 (ADT) Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) by zigo.dhs.org (Postfix) with ESMTP id 14E2C8467; Thu, 9 Jun 2005 12:48:07 +0200 (CEST) Date: Thu, 9 Jun 2005 12:48:07 +0200 (CEST) From: Dennis Bjorklund To: Jona Cc: Christopher Kings-Lynne , Subject: Re: Query plan changes after pg_dump / pg_restore In-Reply-To: <42A80A82.3060900@oismail.com> Message-ID: 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.329 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/209 X-Sequence-Number: 12846 On Thu, 9 Jun 2005, Jona wrote: > It's the same (physical) server as well as the same PostGreSQL daemon, > so yes. The only thing that can differ then is the statistics collected and the amount of dead space in tables and indexes (but since you both reindex and run vacuum full that should not be it). So comparing the statistics in the system tables is the only thing I can think of that might bring some light on the issue. Maybe someone else have some ideas. And as KL said, the effective_cache_size looked like it was way to small. With that setting bigger then pg should select index scans more often. It doesn't explain why the databases behave like they do now, but it might make pg select the same plan nevertheless. -- /Dennis Bj�rklund From pgsql-performance-owner@postgresql.org Thu Jun 9 10:15: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 59F8052814 for ; Thu, 9 Jun 2005 10:15:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79118-02 for ; Thu, 9 Jun 2005 13:15:21 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 54831528A9 for ; Thu, 9 Jun 2005 10:15:19 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id D9F294146A4; Thu, 9 Jun 2005 14:15:13 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id A05D515ED7; Thu, 9 Jun 2005 14:11:25 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21794-05; Thu, 9 Jun 2005 14:11:23 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 5D75915ED5; Thu, 9 Jun 2005 14:11:23 +0100 (BST) Message-ID: <42A83FFA.3030209@archonet.com> Date: Thu, 09 Jun 2005 14:11:22 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yann Michel Cc: pgsql-performance@postgresql.org Subject: Re: postgresql.conf runtime statistics default References: <20050609100852.GA16538@zoom.spline.inf.fu-berlin.de> In-Reply-To: <20050609100852.GA16538@zoom.spline.inf.fu-berlin.de> 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.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/210 X-Sequence-Number: 12847 Yann Michel wrote: > > To my question: I found the parameter "stats_reset_on_server_start" > which is set to true by default. Why did you choose this (and not false) > and what are the impacts of changeing it to false? I mean, as long as I > understood it, each query or statements generates some statistic data > which is used by the optimizer (or anything equal) later on. So in my > oppinion, wouldn't it be better so set this parameter to false and to > enable a kind of a "startup reset_stats" option? This is administrator statistics (e.g. number of disk blocks read from this index) not planner statistics. You're right - it would be foolish to throw away planner stats. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jun 9 10:35: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 B8CBB52932 for ; Thu, 9 Jun 2005 10:35:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83182-05 for ; Thu, 9 Jun 2005 13:35:25 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 6C9625280A for ; Thu, 9 Jun 2005 10:35:24 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so130058wra for ; Thu, 09 Jun 2005 06:35:29 -0700 (PDT) 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:content-disposition:references; b=Bq7ILTxWk7HQbUEe+vRag5scmcqtUKfUk9ydO2EZg9OeeDsI7vT9EvpCfN5LDZ/AmVGFLaOVckndeoZa5dLAHv2+oUmbnrTYpOMGjTtOt0DrEs0djJmCnYMN0LysmM/0PMV0CkijqOuuq2fR83aeKx6nKLzDaHNKA84YYmZhUEU= Received: by 10.54.94.3 with SMTP id r3mr370931wrb; Thu, 09 Jun 2005 06:35:29 -0700 (PDT) Received: by 10.54.2.45 with HTTP; Thu, 9 Jun 2005 06:35:29 -0700 (PDT) Message-ID: <4a0cafe2050609063557b4dcce@mail.gmail.com> Date: Thu, 9 Jun 2005 08:35:29 -0500 From: Josh Close Reply-To: Josh Close To: POSTGRES-PERFORMANCE Subject: Re: [Npgsql-general] index out of range In-Reply-To: <20050608204401.18205.qmail@web60713.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4a0cafe20506080631124b3162@mail.gmail.com> <20050608204401.18205.qmail@web60713.mail.yahoo.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.117 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/211 X-Sequence-Number: 12848 On 6/8/05, Francisco Figueiredo Jr. wrote: >=20 > --- Josh Close escreveu: >=20 > > Well, that would make total sense. I was kinda curious how the data > > provider differentianted between :a and casting like now()::text. > > >=20 > Hi Josh! >=20 > Npgsql uses the info found in NpgsqlCommand.Parameters collection. We do = check > if a parameter in Parameters collection isn't found in query string. The = other > way around isn't done yet. So, you can safely put something like: :a::tex= t and > it will send the text 5::text for example. >=20 > I hope it helps. Yes, that does help. Thanks. -Josh From pgsql-performance-owner@postgresql.org Thu Jun 9 10:38: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 EB581528FE for ; Thu, 9 Jun 2005 10:38:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80226-09 for ; Thu, 9 Jun 2005 13:38:00 +0000 (GMT) Received: from oismail.com (unknown [38.117.22.100]) by svr1.postgresql.org (Postfix) with ESMTP id 5BEBD52899 for ; Thu, 9 Jun 2005 10:38:00 -0300 (ADT) Received: from [192.168.8.103] ([213.173.234.215]) (authenticated bits=0) by oismail.com (8.12.11/8.12.11) with ESMTP id j59DbuET019398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Jun 2005 09:37:58 -0400 Message-ID: <42A84740.4010003@oismail.com> Date: Thu, 09 Jun 2005 15:42:24 +0200 From: Jona User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dennis Bjorklund Cc: Christopher Kings-Lynne , pgsql-performance@postgresql.org Subject: Re: Query plan changes after pg_dump / pg_restore References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------020907020505030406000309" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.115 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_30_40, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200506/212 X-Sequence-Number: 12849 This is a multi-part message in MIME format. --------------020907020505030406000309 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Thank you for the insight, any suggestion as to what table / columns I should compare between the databases? Cheers Jona Dennis Bjorklund wrote: >On Thu, 9 Jun 2005, Jona wrote: > > > >>It's the same (physical) server as well as the same PostGreSQL daemon, >>so yes. >> >> > >The only thing that can differ then is the statistics collected and the >amount of dead space in tables and indexes (but since you both reindex and >run vacuum full that should not be it). > >So comparing the statistics in the system tables is the only thing I can >think of that might bring some light on the issue. Maybe someone else have >some ideas. > >And as KL said, the effective_cache_size looked like it was way to small. >With that setting bigger then pg should select index scans more often. It >doesn't explain why the databases behave like they do now, but it might >make pg select the same plan nevertheless. > > > --------------020907020505030406000309 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thank you for the insight, any suggestion as to what table / columns I should compare between the databases?

Cheers
Jona

Dennis Bjorklund wrote:
On Thu, 9 Jun 2005, Jona wrote:

  
It's the same (physical) server as well as the same PostGreSQL daemon, 
so yes.
    

The only thing that can differ then is the statistics collected and the
amount of dead space in tables and indexes (but since you both reindex and
run vacuum full that should not be it).

So comparing the statistics in the system tables is the only thing I can 
think of that might bring some light on the issue. Maybe someone else have 
some ideas.

And as KL said, the effective_cache_size looked like it was way to small. 
With that setting bigger then pg should select index scans more often. It 
doesn't explain why the databases behave like they do now, but it might 
make pg select the same plan nevertheless.

  

--------------020907020505030406000309-- From pgsql-performance-owner@postgresql.org Thu Jun 9 11:55: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 F3CEC528FF for ; Thu, 9 Jun 2005 11:55:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12430-06 for ; Thu, 9 Jun 2005 14:54:59 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id BC874528C7 for ; Thu, 9 Jun 2005 11:54:58 -0300 (ADT) 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 j59EswGV011771; Thu, 9 Jun 2005 10:54:58 -0400 (EDT) To: Jona Cc: Dennis Bjorklund , pgsql-performance@postgresql.org Subject: Re: Query plan changes after pg_dump / pg_restore In-reply-to: <42A7F9D9.8000004@oismail.com> References: <42A7F9D9.8000004@oismail.com> Comments: In-reply-to Jona message dated "Thu, 09 Jun 2005 10:12:09 +0200" Date: Thu, 09 Jun 2005 10:54:58 -0400 Message-ID: <11770.1118328898@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: 200506/213 X-Sequence-Number: 12850 Jona writes: > What worries me is that the plan is different, Given that the estimated costs are close to the same, this is probably just the result of small differences in the ANALYZE statistics leading to small differences in cost estimates and thus choice of different plans. I'll bet if you re-ANALYZE a few times on the source database you'll see it flipping between plan choices too. This is normal because ANALYZE takes a random sample of rows rather than being exhaustive. So the interesting question is not "why are the plan choices different" it is "how do I get the cost estimates closer to reality". That's the only way in the long run to ensure the planner makes the right choice. Increasing the statistics targets or fooling with planner cost parameters are the basic tools you have available here. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 9 11:56: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 4922C52937 for ; Thu, 9 Jun 2005 11:56:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12715-03 for ; Thu, 9 Jun 2005 14:55:52 +0000 (GMT) Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) by svr1.postgresql.org (Postfix) with ESMTP id A5CBC5289E for ; Thu, 9 Jun 2005 11:55:48 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Thu, 09 Jun 2005 09:55:52 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Date: Thu, 09 Jun 2005 09:55:35 -0500 From: "Kevin Grittner" To: Cc: Subject: Re: Recommendations for configuring a 200 GB Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.082 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/214 X-Sequence-Number: 12851 Thanks for your reply. Besides your post regarding *nix vs. Windows I got a few which didn't go to the group. Words like "bold move" and "disaster waiting to happen" tended to feature prominently in these messages (regarding putting something this big on PostgreSQL under Windows), and management is considering deploying one under Windows and one under Linux, or possibly even both under Linux -- so please pass along advice for either environment. The four web servers are not all identical -- we have two "large" and two "small". They are split between sites, and even one of the small ones is capable of keeping our apps running, although with significantly impaired performance. The initial PostgreSQL implementation will be on one large and one small, unless we decide to do one each of Windows and Linux; in that case we'd want identical hardware to better compare the OS issues, so it would probably be the two small servers. The small servers are IBM 8686-9RX servers with 4 xeon processors at 2 ghz, 6 gig of ram. The internal drives are set as a 67 gig raid 5 array with three drives. We have an external storage arry attached. This has a 490 gig raid 5 array on it. The drives are 15K drives. http://www-307.ibm.com/pc/support/site.wss/quickPath.do?quickPathEntry=86869rx for more info. The large servers are also IBM, although I don't have a model number handy. I know the xeons are 3 ghz and the bus is faster; otherwise they are similar. I know the large servers can go to 64 GB RAM, and management has said they are willing to add a lot more RAM if it will get used. (Our current, commercial database product can't use it under Windows.) There is also the possibility of adding additional CPUs. Like I said, with the current hardware and Sybase 12.5.1, one small machine can keep the applications limping along, although data replication falls behind during the day and catches up at night, and we get complaints from web users about slow response and some requests timing out. One large machine handles the load with little degradation, and using any two machines keeps everyone happy. We have four so that we can have two each at two different sites, and so we can take one out for maintenance and still tolerate a singe machine failure. We're hoping PostgreSQL can match or beat Sybase performance, and preliminary tests look good. We should be able to get some load testing going within a week, and we're shooting for slipping these machines into the mix around the end of this month. (We've gone to some lengths to keep our code portable.) -Kevin >>> Richard Huxton 06/09/05 3:06 AM >>> Kevin Grittner wrote: > > The manager of the DBA team is reluctant to change both the OS and the > DBMS at the same time, so unless I can make a strong case for why it is > important to run postgresql under Linux, we will be running this on > Windows. Currently, there are two Java-based middle tier processes > running on each central database server, one for the replication and one > for the web. We expect to keep it that way, so the database needs to > play well with these processes. Well, there's a lot more experience running PG on various *nix systems and a lot more help available. Also, I don't think performance on Windows is as good as on Linux/*BSD yet. Against switching OS is the fact that you presumably don't have the skills in-house for it, and the hardware was chosen for Windows compatibility/performance. Speaking of which, what sort of hardware are we talking about? -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jun 9 12:01: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 DCE5C528C7 for ; Thu, 9 Jun 2005 12:01:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13918-04 for ; Thu, 9 Jun 2005 15:01:38 +0000 (GMT) Received: from vscan01.westnet.com.au (vscan01.westnet.com.au [203.10.1.131]) by svr1.postgresql.org (Postfix) with ESMTP id B13E35289E for ; Thu, 9 Jun 2005 12:01:34 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id E16FA760232; Thu, 9 Jun 2005 23:01:32 +0800 (WST) Received: from vscan01.westnet.com.au ([127.0.0.1]) by localhost (vscan01.westnet.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 19426-20; Thu, 9 Jun 2005 23:01:32 +0800 (WST) Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au [202.72.133.22]) by vscan01.westnet.com.au (Postfix) with ESMTP id 85AE1760221; Thu, 9 Jun 2005 23:01:32 +0800 (WST) Message-ID: <42A859CD.4070203@familyhealth.com.au> Date: Thu, 09 Jun 2005 23:01:33 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Grittner Cc: dev@archonet.com, pgsql-performance@postgresql.org Subject: Re: Recommendations for configuring a 200 GB 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.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/215 X-Sequence-Number: 12852 > We're hoping PostgreSQL can match or beat Sybase performance, and > preliminary tests look good. We should be able to get some load testing > going within a week, and we're shooting for slipping these machines into > the mix around the end of this month. (We've gone to some lengths to > keep our code portable.) Just make sure to set up and run the contrib/pg_autovacuum daemon, or make sure you fully read 'regular database maintenance' in the manual. Chris From pgsql-performance-owner@postgresql.org Thu Jun 9 13:10: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 8CB9552921 for ; Thu, 9 Jun 2005 13:10:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53202-05 for ; Thu, 9 Jun 2005 16:10:34 +0000 (GMT) Received: from oismail.com (unknown [38.117.22.100]) by svr1.postgresql.org (Postfix) with ESMTP id 2812952947 for ; Thu, 9 Jun 2005 13:10:31 -0300 (ADT) Received: from [192.168.8.103] ([213.173.234.215]) (authenticated bits=0) by oismail.com (8.12.11/8.12.11) with ESMTP id j59GAcjM023948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Jun 2005 12:10:40 -0400 Message-ID: <42A86B08.4070005@oismail.com> Date: Thu, 09 Jun 2005 18:15:04 +0200 From: Jona User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Query plan changes after pg_dump / pg_restore References: <42A7F9D9.8000004@oismail.com> <11770.1118328898@sss.pgh.pa.us> In-Reply-To: <11770.1118328898@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------050202000205020403090805" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.245 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_40_50, HTML_MESSAGE, HTML_TAG_EXIST_TBODY X-Spam-Level: X-Archive-Number: 200506/216 X-Sequence-Number: 12853 This is a multi-part message in MIME format. --------------050202000205020403090805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Tom, Thank you for the input, you're absolutely right. Have just executed like 10 VACUUM ANALYZE on the Price_Tbl in both databases and now both queries use the same plan.... the bad one, GREAT! Who said ignorance is bliss?? ;-) Have just messed around with ALTER TABLE ... ALTER .... SET STATISTICS .... for both tables to no effect. Have tried setting both high number (100 and 200) and a low number (1) and run several VACUUM ANALYZE afterwards. It still insists on the bad plan... Furthermore I've played around with the RANDOM_PAGE_COST runtime parameter. Seems that when I set it to 2.2 it switch to using the aff_price_uq index on Price_Tbl, however it needs to be set to 0.7 before it uses the subcat_uq index on SCT2SubCatType_Tbl. Has no effect wether the statistics is set to 1 or a 100 for this behaviour. The overall plan remains the same though, and even when it uses both indexes the total cost is roughly 5.5 times higher than the good plan. New plan: Unique (cost=612.29..612.65 rows=3 width=75) (actual time=255.88..255.89 rows=3 loops=1) -> Hash Join (cost=158.26..596.22 rows=288 width=75) (actual time=60.91..99.69 rows=2477 loops=1) Hash Cond: ("outer".sctid = "inner".sctid) -> Index Scan using aff_price_uq on price_tbl (cost=0.00..409.24 rows=5025 width=4) (actual time=0.03..17.81 rows=5157 loops=1) Index Cond: (affid = 8) -> Hash (cost=157.37..157.37 rows=355 width=71) (actual time=60.77..60.77 rows=0 loops=1) -> Merge Join (cost=10.26..157.37 rows=355 width=71) (actual time=14.42..53.79 rows=2493 loops=1) Merge Cond: ("outer".subcattpid = "inner".id) -> Index Scan using subcat_uq on sct2subcattype_tbl (cost=0.00..126.28 rows=6536 width=8) (actual time=0.03..23.25 rows=6527 loops=1) -> Sort (cost=10.26..10.28 rows=9 width=63) (actual time=2.46..5.66 rows=2507 loops=1) "Total runtime: 257.49 msec" Old "good" plan: Unique (cost=117.18..117.20 rows=1 width=147) (actual time=224.62..224.63 rows=3 loops=1) -> Index Scan using subcat_uq on sct2subcattype_tbl (cost=0.00..100.47 rows=33 width=8) (actual time=0.01..0.20 rows=46 loops=54) Index Cond: ("outer".id = sct2subcattype_tbl.subcattpid) -> Index Scan using aff_price_uq on price_tbl (cost=0.00..7.11 rows=1 width=4) (actual time=0.01..0.01 rows=1 loops=2493) Index Cond: ((price_tbl.affid = 8) AND ("outer".sctid = price_tbl.sctid)) Total runtime: 225.14 msec It seems that the more it knows about Could you provide some input on how to make it realise that the plan it selects is not the optimal? Cheers Jona Tom Lane wrote: >Jona writes: > > >>What worries me is that the plan is different, >> >> > >Given that the estimated costs are close to the same, this is probably >just the result of small differences in the ANALYZE statistics leading >to small differences in cost estimates and thus choice of different >plans. I'll bet if you re-ANALYZE a few times on the source database >you'll see it flipping between plan choices too. This is normal because >ANALYZE takes a random sample of rows rather than being exhaustive. > >So the interesting question is not "why are the plan choices different" >it is "how do I get the cost estimates closer to reality". That's the >only way in the long run to ensure the planner makes the right choice. >Increasing the statistics targets or fooling with planner cost >parameters are the basic tools you have available here. > > regards, tom lane > > --------------050202000205020403090805 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi Tom,
Thank you for the input, you're absolutely right.
Have just executed like 10 VACUUM ANALYZE on the Price_Tbl in both databases and now both queries use the same plan.... the bad one, GREAT!
Who said ignorance is bliss?? ;-)

Have just messed around with ALTER TABLE ... ALTER .... SET STATISTICS .... for both tables to no effect.
Have tried setting both high number (100 and 200) and a low number (1) and run several VACUUM ANALYZE afterwards.
It still insists on the bad plan...

Furthermore I've played around with the RANDOM_PAGE_COST runtime parameter.
Seems that when I set it to 2.2 it switch to using the aff_price_uq index on Price_Tbl, however  it needs to be set to 0.7 before it uses the subcat_uq index on SCT2SubCatType_Tbl.
Has no effect wether the statistics is set to 1 or a 100 for this behaviour.
The overall plan remains the same though, and even when it uses both indexes the total cost is roughly 5.5 times higher than the good plan.

New plan:
Unique  (cost=612.29..612.65 rows=3 width=75) (actual time=255.88..255.89 rows=3 loops=1)
   ->  Hash Join  (cost=158.26..596.22 rows=288 width=75) (actual time=60.91..99.69 rows=2477 loops=1)
         Hash Cond: ("outer".sctid = "inner".sctid)
             ->  Index Scan using aff_price_uq on price_tbl  (cost=0.00..409.24 rows=5025 width=4) (actual time=0.03..17.81 rows=5157 loops=1)
                   Index Cond: (affid = 8)
                    ->  Hash  (cost=157.37..157.37 rows=355 width=71) (actual time=60.77..60.77 rows=0 loops=1)
                          ->  Merge Join  (cost=10.26..157.37 rows=355 width=71) (actual time=14.42..53.79 rows=2493 loops=1)
                                 Merge Cond: ("outer".subcattpid = "inner".id)
                                 ->  Index Scan using subcat_uq on sct2subcattype_tbl  (cost=0.00..126.28 rows=6536 width=8) (actual time=0.03..23.25 rows=6527 loops=1)
                                 ->  Sort  (cost=10.26..10.28 rows=9 width=63) (actual time=2.46..5.66 rows=2507 loops=1)

"Total runtime: 257.49 msec"

Old "good" plan:
Unique  (cost=117.18..117.20 rows=1 width=147) (actual time=224.62..224.63 rows=3 loops=1)
    ->  Index Scan using subcat_uq on sct2subcattype_tbl  (cost=0.00..100.47 rows=33 width=8) (actual time=0.01..0.20 rows=46 loops=54)
          Index Cond: ("outer".id = sct2subcattype_tbl.subcattpid)

          ->  Index Scan using aff_price_uq on price_tbl  (cost=0.00..7.11 rows=1 width=4) (actual time=0.01..0.01 rows=1 loops=2493)
                 Index Cond: ((price_tbl.affid = 8) AND ("outer".sctid = price_tbl.sctid))
Total runtime: 225.14 msec

It seems that the more it knows about

Could you provide some input on how to make it realise that the plan it selects is not the optimal?

Cheers
Jona

Tom Lane wrote:
Jona <jonanews@oismail.com> writes:
  
What worries me is that the plan is different,
    

Given that the estimated costs are close to the same, this is probably
just the result of small differences in the ANALYZE statistics leading
to small differences in cost estimates and thus choice of different
plans.  I'll bet if you re-ANALYZE a few times on the source database
you'll see it flipping between plan choices too.  This is normal because
ANALYZE takes a random sample of rows rather than being exhaustive.

So the interesting question is not "why are the plan choices different"
it is "how do I get the cost estimates closer to reality".  That's the
only way in the long run to ensure the planner makes the right choice.
Increasing the statistics targets or fooling with planner cost
parameters are the basic tools you have available here.

			regards, tom lane
  

--------------050202000205020403090805-- From pgsql-performance-owner@postgresql.org Thu Jun 9 13:37: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 089DC5292E for ; Thu, 9 Jun 2005 13:37:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58103-10 for ; Thu, 9 Jun 2005 16:37:31 +0000 (GMT) Received: from mail49.messagelabs.com (mail49.messagelabs.com [193.109.255.19]) by svr1.postgresql.org (Postfix) with SMTP id 3918952914 for ; Thu, 9 Jun 2005 13:37:29 -0300 (ADT) X-VirusChecked: Checked X-Env-Sender: alexs@advfn.com X-Msg-Ref: server-11.tower-49.messagelabs.com!1118335047!1987257!1 X-StarScan-Version: 5.4.15; banners=-,-,- X-Originating-IP: [212.161.99.149] Received: (qmail 5643 invoked from network); 9 Jun 2005 16:37:27 -0000 Received: from mail.advfn.com (212.161.99.149) by server-11.tower-49.messagelabs.com with SMTP; 9 Jun 2005 16:37:27 -0000 Received: from [213.86.19.101] (helo=[192.168.0.185]) by mail.advfn.com with esmtp (Exim 4.22) id 1DgQ22-0000Yq-HP for pgsql-performance@postgresql.org; Thu, 09 Jun 2005 17:37:26 +0100 Mime-Version: 1.0 (Apple Message framework v730) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-performance@postgresql.org From: Alex Stapleton Subject: random_page_cost = 1? Date: Thu, 9 Jun 2005 17:37:25 +0100 X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/217 X-Sequence-Number: 12854 Is this advisable? The disks are rather fast (15k iirc) but somehow I don't think they are covered in whatever magic fairy dust it would require for a sequential read to be as fast as a random one. However I could be wrong, are there any circumstances when this is actually going to help performance? From pgsql-performance-owner@postgresql.org Thu Jun 9 13:42: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 C2F4652825 for ; Thu, 9 Jun 2005 13:42:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58734-09 for ; Thu, 9 Jun 2005 16:42:19 +0000 (GMT) Received: from campbell-lange.net (campbell-lange.net [217.147.82.41]) by svr1.postgresql.org (Postfix) with ESMTP id C8DF552822 for ; Thu, 9 Jun 2005 13:42:18 -0300 (ADT) Received: from host-83-146-33-145.bulldogdsl.com ([83.146.33.145] helo=localhost.localdomain) by localhost.localdomain with esmtpa (Exim 4.50) id 1DgQ6z-0004dK-9W; Thu, 09 Jun 2005 17:42:33 +0100 Received: from rory by localhost.localdomain with local (Exim 4.50) id 1DgQ8j-0002py-0D; Thu, 09 Jun 2005 17:44:21 +0100 Date: Thu, 9 Jun 2005 17:44:20 +0100 From: Rory Campbell-Lange To: William Yu Cc: pgsql-performance@postgresql.org Subject: Re: Help specifying new web server/database machine Message-ID: <20050609164420.GA3649@campbell-lange.net> References: <20050608163418.GA3327@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i 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: 200506/218 X-Sequence-Number: 12855 Hi All. Thanks very much for Joshua, William, Bjoern and Matthew's replies. I've now looked at the famous "Server for 7K" thread. In my case we are looking for a server for around 3000 pounds (UK); the server is to be an all-purpose web and database server. Processor: First of all I noted that we were intending to use Opteron processors. I guess this isn't a straightforward choice because I believe Debian (our Linux of choice) doesn't have a stable AMD64 port. However some users on this list suggest that Opterons work very well even in a 32 bit environment. Some have suggested that a single dual core processor is the way to go. The RAM needs to fit the CPU arrangement too; William points out that one needs 2 DIMMS per CPU. Disks: I'm somewhat confused here. I've followed the various notes about SATA vs SCSI and it seems that SCSI is the way to go. On a four-slot 1U server, would one do a single RAID10 over 4 disks 10000rpm U320 disks? I would run the database in its own partition, separate from the rest of the OS, possible on LVM. An LSI-Megaraid-2 appears to be the card of choice. The following (without RAID card) breaks my budget by about 200 pounds: System : Armari Opteron AM-2138-A8 1U Base PCI-X (BEI) Case Accessories : IPMI 2.0 module for AM Series Opteron Servers CPU : AMD Opteron 265 - Dual Core 1.8GHz CPU (940pin) Memory : 2GB 400MHz DDR SDRAM (4 x 512MB (PC3200) ECC REG.s) Hard drive : Maxtor Atlas 10K V 147.1GB 10K U320/SCA - 8D147J0 Additional Drives : 3 x Maxtor Atlas 10K V 147.1GB 10K U320/SCA - 8D147J0 CD/DVD Drive : AM series Server 8x Slimline DVD-ROM Warranty : 3 Year Return to base Warranty (Opteron Server) Carriage : PC System Carriage (UK only) for 1U Server Thanks for any further comments, Rory -- Rory Campbell-Lange From pgsql-performance-owner@postgresql.org Thu Jun 9 13: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 AB0915292C for ; Thu, 9 Jun 2005 13:55:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60646-08 for ; Thu, 9 Jun 2005 16:55: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 91DBB5292E for ; Thu, 9 Jun 2005 13:55:23 -0300 (ADT) 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 j59GtMFh014200; Thu, 9 Jun 2005 12:55:22 -0400 (EDT) To: Alex Stapleton Cc: pgsql-performance@postgresql.org Subject: Re: random_page_cost = 1? In-reply-to: References: Comments: In-reply-to Alex Stapleton message dated "Thu, 09 Jun 2005 17:37:25 +0100" Date: Thu, 09 Jun 2005 12:55:22 -0400 Message-ID: <14199.1118336122@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: 200506/219 X-Sequence-Number: 12856 Alex Stapleton writes: > Is this advisable? Only if your database is small enough that you expect it to remain fully cached in RAM. In that case random_page_cost = 1 does in fact describe the performance you expect Postgres to see. People occasionally use values for random_page_cost that are much smaller than physical reality would suggest, but I think this is mainly a workaround for deficiencies elsewhere in the planner cost models. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 9 14:25: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 2883D528B2 for ; Thu, 9 Jun 2005 14:25:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69503-06 for ; Thu, 9 Jun 2005 17:24:58 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by svr1.postgresql.org (Postfix) with ESMTP id 95A91528AD for ; Thu, 9 Jun 2005 14:24:55 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so29642wri for ; Thu, 09 Jun 2005 10:24:56 -0700 (PDT) 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:content-disposition:references; b=Qp1sW4KK7GcxXKHgARD03d9Z/9kVpNA9IIszUlcFWzMUw6+FUVFzEgxygNzQiMOYVba4fRr1h7ZL7+wZHoWA+glVmGNouNngt8O5GYb68nCyor8dK9vAke3YdaCdtgnkYd1oy2gNp6RS1+az/x8rhV6xjR0/lp3gqcbAlicdwic= Received: by 10.54.71.7 with SMTP id t7mr471676wra; Thu, 09 Jun 2005 10:18:15 -0700 (PDT) Received: by 10.54.22.15 with HTTP; Thu, 9 Jun 2005 10:18:15 -0700 (PDT) Message-ID: Date: Thu, 9 Jun 2005 12:18:15 -0500 From: Matthew Nuzum Reply-To: newz@bearfruit.org To: Rory Campbell-Lange Subject: Re: Help specifying new web server/database machine Cc: pgsql-performance@postgresql.org In-Reply-To: <20050609164420.GA3649@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050608163418.GA3327@campbell-lange.net> <20050609164420.GA3649@campbell-lange.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.109 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/220 X-Sequence-Number: 12857 On 6/9/05, Rory Campbell-Lange wrote: > Disks: >=20 > I'm somewhat confused here. I've followed the various notes about SATA > vs SCSI and it seems that SCSI is the way to go. On a four-slot 1U > server, would one do a single RAID10 over 4 disks 10000rpm U320 disks? > I would run the database in its own partition, separate from the rest of > the OS, possible on LVM. An LSI-Megaraid-2 appears to be the card of > choice. >=20 Can you tell us about your application? How much data will you have, what is your ratio of reads to writes, how tollerant to data loss are you? (for example, some people load their data in batches and if they loose their data its no big deal, others would have heart failure if a few transactions were lost) If your application is 95% writes then people will suggest drastically different hardware than if your application is 95% selects. Here is an example of one of my servers: application is 95+% selects, has 15GB of data (counting indexes), low tollerance for data loss, runs on a 1 GHz P3 Compaq server with mirrored 35 GB IDE disks and 1.6GB of RAM. Application response time is aproximately .1 second to serve a request on a moderately loaded server. --=20 Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Thu Jun 9 15:00: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 D6E80528AD for ; Thu, 9 Jun 2005 15:00:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79115-04 for ; Thu, 9 Jun 2005 18:00:11 +0000 (GMT) Received: from cu-chulhainn.bray-healthcare.com (mailgate.bray-healthcare.com [80.177.250.202]) by svr1.postgresql.org (Postfix) with ESMTP id 95FA852825 for ; Thu, 9 Jun 2005 15:00:10 -0300 (ADT) Received: from braydb.bray-healthcare.com ([192.168.1.18]) by cu-chulhainn.bray-healthcare.com with esmtp (Exim 4.50) id 1DgRKG-0001Tj-1P; Thu, 09 Jun 2005 19:00:20 +0100 Subject: Re: Help specifying new web server/database machine From: Oliver Elphick Reply-To: olly@lfix.co.uk To: Rory Campbell-Lange Cc: William Yu , pgsql-performance@postgresql.org In-Reply-To: <20050609164420.GA3649@campbell-lange.net> References: <20050608163418.GA3327@campbell-lange.net> <20050609164420.GA3649@campbell-lange.net> Content-Type: text/plain Date: Thu, 09 Jun 2005 19:00:19 +0100 Message-Id: <1118340019.27924.19.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/221 X-Sequence-Number: 12858 On Thu, 2005-06-09 at 17:44 +0100, Rory Campbell-Lange wrote: > Hi All. Thanks very much for Joshua, William, Bjoern and Matthew's > replies. > > I've now looked at the famous "Server for 7K" thread. In my case we are > looking for a server for around 3000 pounds (UK); the server is to be an > all-purpose web and database server. > > Processor: > > First of all I noted that we were intending to use Opteron processors. I > guess this isn't a straightforward choice because I believe Debian (our > Linux of choice) doesn't have a stable AMD64 port. Yes it does. Now sarge has become the new stable release, the amd64 version has also become stable. It doesn't have as many packages as the i386 port, but those it has will be supported by the Debian security team. Look at the debian-amd64 mailing list for more information. It only has PostgreSQL 7.4. To run 8.0, download the source packages from unstable and build them yourself. You need postgresql-8.0 and postgresql-common; if you also have an existing database to upgrade you need postgresql and postgresql-7.4. > However some users on > this list suggest that Opterons work very well even in a 32 bit > environment. You can treat the machine as a 32bit machine and install the i386 version of Debian; it will run rather slower than with 64 bit software. Oliver Elphick From pgsql-performance-owner@postgresql.org Thu Jun 9 15:05: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 D7A425292C for ; Thu, 9 Jun 2005 15:05:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80034-08 for ; Thu, 9 Jun 2005 18:04:54 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id 897A152863 for ; Thu, 9 Jun 2005 15:04:53 -0300 (ADT) Received: by flake.decibel.org (Postfix, from userid 1001) id 283EB152BB; Thu, 9 Jun 2005 13:04:54 -0500 (CDT) Date: Thu, 9 Jun 2005 13:04:53 -0500 From: "Jim C. Nasby" To: Tobias Brox Cc: pgsql-performance@postgresql.org Subject: Re: timestamp indexing Message-ID: <20050609180453.GQ44623@decibel.org> References: <20050530091951.GO26100@tobias.exoweb.net> <20050530135429.GA78082@winnie.fuhr.org> <20050530170816.GA9222@oppetid.no> <24839.1117475874@sss.pgh.pa.us> <20050531020625.GA26100@tobias.exoweb.net> <20050531022011.GC26100@tobias.exoweb.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050531022011.GC26100@tobias.exoweb.net> X-Operating-System: FreeBSD 4.11-RELEASE i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.8i 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: 200506/222 X-Sequence-Number: 12859 What does SET enable_seqscan = false; EXPLAIN ANALYZE SELECT * FROM ... get you? Is it faster? BTW, I suspect this behavior is because the estimates for the cost of an index scan don't give an appropriate weight to the correlation of the index. The 'sort and index' thread on this list from a few months ago has more info. -- 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 Jun 9 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 DE5F652862 for ; Thu, 9 Jun 2005 16:44:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04513-05 for ; Thu, 9 Jun 2005 19:44:20 +0000 (GMT) Received: from mail.nordicbet.com (mail.nordicbet.com [193.69.167.130]) by svr1.postgresql.org (Postfix) with ESMTP id B488152834 for ; Thu, 9 Jun 2005 16:44:13 -0300 (ADT) Received: from estneti-gw.online.ee ([62.65.34.222] helo=tobias.nordicbet.invalid) (Authenticated Sender=tobias@nordicbet.com) by mail.nordicbet.com with esmtpa (Exim 4.50 #1 (Debian)) id 1DgSwD-0007y7-R7; Thu, 09 Jun 2005 21:43:49 +0200 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id D875B3D157; Thu, 9 Jun 2005 22:43:56 +0300 (EEST) Date: Thu, 9 Jun 2005 22:43:56 +0300 From: Tobias Brox To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org Subject: Re: timestamp indexing Message-ID: <20050609194356.GT8451@tobias.nordicbet.com> References: <20050530091951.GO26100@tobias.exoweb.net> <20050530135429.GA78082@winnie.fuhr.org> <20050530170816.GA9222@oppetid.no> <24839.1117475874@sss.pgh.pa.us> <20050531020625.GA26100@tobias.exoweb.net> <20050531022011.GC26100@tobias.exoweb.net> <20050609180453.GQ44623@decibel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050609180453.GQ44623@decibel.org> Organization: Group Nordicbet User-Agent: Mutt/1.5.6i 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: 200506/223 X-Sequence-Number: 12860 [Jim C. Nasby - Thu at 01:04:53PM -0500] > What does > > SET enable_seqscan = false; > EXPLAIN ANALYZE SELECT * FROM ... > > get you? Is it faster? I was experimenting with this some weeks ago, by now our database server has quite low load numbers and I haven't gotten any complaints about anything that is too slow, so I have temporary stopped working with this issue - so I will not contribute with any more gory details at the moment. :-) I concluded with that our "problem" is that we (for performance reasons) store aggregated statistics in the "wrong" tables, and since updating a row in pg effectively means creating a new physical row in the database, the rows in the table are not in chronological order. If "last months activity" presents like 7% of the rows from the table is to be fetched, the planner will usually think that a seq scan is better. As time pass by and the table grows, it will jump to index scans. The "old" stuff in the database eventually grow historical, so the aggregated statistics will not be updated for most of those rows. Hence a forced index scan will often be a bit faster than a suggested table scan. I experimented, and doing an index scan for the 3rd time would usually be faster than doing a full table scan for the 3rd time, but with things not beeing in cache, the planner was right to suggest that seq scan was faster due to less disk seeks. The long term solution for this problem is to build a separate data warehouse system. The short time solution is to not care at all (eventually, buy more memory). As long as the queries is on the form "give me everything since last monday", it is at least theoretically possible to serve this through partial indices, and have a cronjob dropping the old indices and creating new every week. Doing table clustering night time would probably also be a solution, but I haven't cared to test it out yet. I'm a bit concerned about performance/locking issues. -- Tobias Brox, +47-91700050 Tallinn, Europe From pgsql-performance-owner@postgresql.org Thu Jun 9 16:53: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 DD7D15285B for ; Thu, 9 Jun 2005 16:53:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02464-10 for ; Thu, 9 Jun 2005 19:53:45 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id C3C935284D for ; Thu, 9 Jun 2005 16:53:44 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id A4AFE30E99; Thu, 9 Jun 2005 21:53:44 +0200 (MET DST) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Help specifying new web server/database machine Date: Thu, 09 Jun 2005 12:53:38 -0700 Organization: Hub.Org Networking Services Lines: 29 Message-ID: References: <20050608163418.GA3327@campbell-lange.net> <20050609164420.GA3649@campbell-lange.net> 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.2 (X11/20050317) X-Accept-Language: en-us, en In-Reply-To: <20050609164420.GA3649@campbell-lange.net> 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: 200506/224 X-Sequence-Number: 12861 Rory Campbell-Lange wrote: > Processor: > > First of all I noted that we were intending to use Opteron processors. I > guess this isn't a straightforward choice because I believe Debian (our > Linux of choice) doesn't have a stable AMD64 port. However some users on > this list suggest that Opterons work very well even in a 32 bit > environment. Some have suggested that a single dual core processor is > the way to go. The RAM needs to fit the CPU arrangement too; William > points out that one needs 2 DIMMS per CPU. Your summary here just pointed out the obvious to me. Start with a 2P MB but only populate a single DC Opteron. That'll give you 2P system with room to expand to 4P in the future. Plus you only need to populate 1 memory bank so you can do 2x1GB. > Disks: > > I'm somewhat confused here. I've followed the various notes about SATA > vs SCSI and it seems that SCSI is the way to go. On a four-slot 1U > server, would one do a single RAID10 over 4 disks 10000rpm U320 disks? > I would run the database in its own partition, separate from the rest of > the OS, possible on LVM. An LSI-Megaraid-2 appears to be the card of > choice. With only 4 disks, a MegaRAID U320-1 is good enough. It's quite a premium to go to the 2x channel MegaRAID. With 4 drives, I'd still do 2 big drives mirrored for the DB partition and 2 small drives for OS+WAL. From pgsql-performance-owner@postgresql.org Thu Jun 9 17:59: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 023E552816 for ; Thu, 9 Jun 2005 17:59:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22863-04 for ; Thu, 9 Jun 2005 20:59:06 +0000 (GMT) Received: from campbell-lange.net (campbell-lange.net [217.147.82.41]) by svr1.postgresql.org (Postfix) with ESMTP id 01FC152838 for ; Thu, 9 Jun 2005 17:59:02 -0300 (ADT) Received: from host-83-146-33-145.bulldogdsl.com ([83.146.33.145] helo=localhost.localdomain) by localhost.localdomain with esmtpa (Exim 4.50) id 1DgU7X-00052J-2U; Thu, 09 Jun 2005 21:59:24 +0100 Received: from rory by localhost.localdomain with local (Exim 4.50) id 1DgU9D-0000lV-Aa; Thu, 09 Jun 2005 22:01:07 +0100 Date: Thu, 9 Jun 2005 22:01:07 +0100 From: Rory Campbell-Lange To: William Yu Cc: pgsql-performance@postgresql.org Subject: Re: Help specifying new web server/database machine Message-ID: <20050609210106.GB2778@campbell-lange.net> References: <20050608163418.GA3327@campbell-lange.net> <20050609164420.GA3649@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i 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: 200506/225 X-Sequence-Number: 12862 On 09/06/05, William Yu (wyu@talisys.com) wrote: > Rory Campbell-Lange wrote: > > ... Some have suggested that a single dual core processor is the way > > to go. The RAM needs to fit the CPU arrangement too; William points > > out that one needs 2 DIMMS per CPU. > Your summary here just pointed out the obvious to me. Start with a 2P MB > but only populate a single DC Opteron. That'll give you 2P system with > room to expand to 4P in the future. Plus you only need to populate 1 > memory bank so you can do 2x1GB. That makes sense. I should by a board with support for 2 Dual-core Opterons, but only use one Opteron for the moment. Then I should buy 2x1GB RAM sticks to service that processor. > > ... On a four-slot 1U server, would one do a single RAID10 over 4 > > disks 10000rpm U320 disks? I would run the database in its own > > partition, separate from the rest of the OS, possible on LVM. An > > LSI-Megaraid-2 appears to be the card of choice. > > With only 4 disks, a MegaRAID U320-1 is good enough. It's quite a > premium to go to the 2x channel MegaRAID. With 4 drives, I'd still do 2 > big drives mirrored for the DB partition and 2 small drives for OS+WAL. Should these all RAID1? I'm a bit worried about how to partition up my system if it is strictly divided between a system RAID1 disk entity and a DB disk entity, as the proportion of web server content (images, movies, sounds) to actual database data is an unknown quantity at the moment. I typically keep all the database stuff in a /var logical partition and for this project would expect to keep the web stuff under a /web logical partition. I was thinking of using LVM to be able to shift around space on a large (4 x 147GB RAID 1 or RAID10) raided volume. I appreciate that this may not be optimal for the WAL transaction log. Thanks for your comments; Rory -- Rory Campbell-Lange From pgsql-performance-owner@postgresql.org Thu Jun 9 18: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 0ECB652881 for ; Thu, 9 Jun 2005 18:25:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29396-06 for ; Thu, 9 Jun 2005 21:25:27 +0000 (GMT) Received: from campbell-lange.net (campbell-lange.net [217.147.82.41]) by svr1.postgresql.org (Postfix) with ESMTP id B5AF152851 for ; Thu, 9 Jun 2005 18:25:24 -0300 (ADT) Received: from host-83-146-33-145.bulldogdsl.com ([83.146.33.145] helo=localhost.localdomain) by localhost.localdomain with esmtpa (Exim 4.50) id 1DgUX3-00055g-Be; Thu, 09 Jun 2005 22:25:46 +0100 Received: from rory by localhost.localdomain with local (Exim 4.50) id 1DgUYj-0000mV-7J; Thu, 09 Jun 2005 22:27:29 +0100 Date: Thu, 9 Jun 2005 22:27:28 +0100 From: Rory Campbell-Lange To: newz@bearfruit.org Cc: pgsql-performance@postgresql.org Subject: Re: Help specifying new web server/database machine Message-ID: <20050609212728.GC2778@campbell-lange.net> References: <20050608163418.GA3327@campbell-lange.net> <20050609164420.GA3649@campbell-lange.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i 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: 200506/226 X-Sequence-Number: 12863 On 09/06/05, Matthew Nuzum (mattnuzum@gmail.com) wrote: > On 6/9/05, Rory Campbell-Lange wrote: > > Disks: > > > > I'm somewhat confused here. I've followed the various notes about SATA > > vs SCSI and it seems that SCSI is the way to go. On a four-slot 1U > > server, would one do a single RAID10 over 4 disks 10000rpm U320 disks? > > I would run the database in its own partition, separate from the rest of > > the OS, possible on LVM. An LSI-Megaraid-2 appears to be the card of > > choice. > Can you tell us about your application? How much data will you have, > what is your ratio of reads to writes, how tollerant to data loss are > you? (for example, some people load their data in batches and if they > loose their data its no big deal, others would have heart failure if a > few transactions were lost) The application is a web-based prototype system for kids to make their own galleries based on content found in museums and galleries. They will link to content provided by curators, and be able to add in their own material, including movies, sounds and pictures. All the content, however, will be restricted in size. I also do not intend to store the movies, sounds or pictures in the database (although I have happily done the latter in the past). Up to the data will be uploaded from 3G handsets. The rest will be done on a per-user, per-pc basis through the web interface. The service is expected to be used by about 50000 users over 18 months. Of these around half will be content creators, so will account for say half a million rows in the main content table and under 2 million rows in the commentary table. The most used table will probably be a 'history' function required by the contract, tracking use through the site. I imagine this will account for something like 20 million rows (with very little data in them). The main tables will have something like 80% read, 20% write (thumb suck). The history table will be read by an automated process at 3 in the morning, to pick up some stats on how people are using the system. It wouldn't be a problem to very occasionally (once a month) lose a tiny piece of data (i.e a record). Losing any significant amounts of data is entirely out of the question. > If your application is 95% writes then people will suggest drastically > different hardware than if your application is 95% selects. > > Here is an example of one of my servers: > application is 95+% selects, has 15GB of data (counting indexes), low > tollerance for data loss, runs on a 1 GHz P3 Compaq server with > mirrored 35 GB IDE disks and 1.6GB of RAM. Application response time > is aproximately .1 second to serve a request on a moderately loaded > server. Yeah. Maybe the machine I'm speccing up is total overkill for this project? I'm just worried that if it is a big success, or if we have 400 kids pounding the server at once over high-speed school lines, the thing will grind to a halt. Thanks very much for your comments. Regards, Rory -- Rory Campbell-Lange From pgsql-performance-owner@postgresql.org Thu Jun 9 22:26: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 1022A5289E for ; Thu, 9 Jun 2005 22:26:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17372-03 for ; Fri, 10 Jun 2005 01:26:07 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.198]) by svr1.postgresql.org (Postfix) with ESMTP id B089052814 for ; Thu, 9 Jun 2005 22:26:05 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id 40so487054nzk for ; Thu, 09 Jun 2005 18:26:09 -0700 (PDT) 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:content-disposition:references; b=NRKv5qFJ0zZ1zu8mLiKDj+lqbBMivrKAhcpTZX6+mgLmxKzUQlGbvxxhrB/jM1mqgY5y23H5P/rfYoVUuPJbdop6ZZoublPNzCqV9Es19abhiHlNKCDmi8J2TjVQTFmu1vDp3DZFhF/xwxCBMHHGRKOCN41eYRSM2ZyKxaSa+kw= Received: by 10.36.106.20 with SMTP id e20mr825427nzc; Thu, 09 Jun 2005 18:26:09 -0700 (PDT) Received: by 10.36.47.20 with HTTP; Thu, 9 Jun 2005 18:26:09 -0700 (PDT) Message-ID: <8d04ce9905060918264740a0da@mail.gmail.com> Date: Thu, 9 Jun 2005 18:26:09 -0700 From: Junaili Lie Reply-To: Junaili Lie To: Bruno Wolff III , pgsql-performance@postgresql.org Subject: Re: Help with rewriting query In-Reply-To: <20050609025907.GB6139@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <8d04ce990506081234121995f9@mail.gmail.com> <20050608195625.GM8451@tobias.nordicbet.com> <8d04ce990506081548355991bb@mail.gmail.com> <20050609025907.GB6139@wolff.to> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.077 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/227 X-Sequence-Number: 12864 Hi Bruno, I followed your suggestion. The query plan shows that it uses the index (id, person_id). However, the execution time is still slow. I have to do ctl-C to stop it. Maybe something is wrong with my postgresql config. It's running Solaris on dual Opteron, 4GB. I allocated around 128MB for sorting and more than 80% for effective_cache_size and shared_buffers =3D 32768. Any further ideas is much appreciated. On 6/8/05, Bruno Wolff III wrote: > On Wed, Jun 08, 2005 at 15:48:27 -0700, > Junaili Lie wrote: > > Hi, > > The suggested query below took forever when I tried it. > > In addition, as suggested by Tobias, I also tried to create index on > > food(p_id, id), but still no goal (same query plan). > > Here is the explain: > > TEST1=3D# explain select f.p_id, max(f.id) from Food f, Person p where > > (f.p_id =3D p.id) group by p.id; >=20 > The above is going to require reading all the food table (assuming no > orphaned records), so the plan below seems reasonable. >=20 > > QUERY PLAN > > -----------------------------------------------------------------------= ----------------------------------------- > > GroupAggregate (cost=3D0.00..214585.51 rows=3D569 width=3D16) > > -> Merge Join (cost=3D0.00..200163.50 rows=3D2884117 width=3D16) > > Merge Cond: ("outer".id =3D "inner".p_id) > > -> Index Scan using person_pkey on person p > > (cost=3D0.00..25.17 rows=3D569 width=3D8) > > -> Index Scan using person_id_food_index on food f > > (cost=3D0.00..164085.54 rows=3D2884117 width=3D16) > > (5 rows) > > > > > > > > > > TEST1=3D# explain select p.id, (Select f.id from food f where > > f.p_id=3Dp.id order by f.id desc limit 1) from person p; >=20 > Using a subselect seems to be the best hope of getting better performance= . > I think you almost got it right, but in order to use the index on > (p_id, id) you need to order by f.p_id desc, f.id desc. Postgres won't > deduce this index can be used because f.p_id is constant in the subselect= , > you need to give it some help. >=20 > > QUERY PLAN > > -----------------------------------------------------------------------= ------------------------------------ > > Seq Scan on Person p (cost=3D100000000.00..100007015.24 rows=3D569 wi= dth=3D8) > > SubPlan > > -> Limit (cost=3D0.00..12.31 rows=3D1 width=3D8) > > -> Index Scan Backward using food_pkey on food f > > (cost=3D0.00..111261.90 rows=3D9042 width=3D8) > > Filter: (p_id =3D $0) > > (5 rows) > > > > any ideas or suggestions is appreciate. > > > > > > On 6/8/05, Tobias Brox wrote: > > > [Junaili Lie - Wed at 12:34:32PM -0700] > > > > select f.p_id, max(f.id) from person p, food f where p.id=3Df.p_id = group > > > > by f.p_id will work. > > > > But I understand this is not the most efficient way. Is there anoth= er > > > > way to rewrite this query? (maybe one that involves order by desc > > > > limit 1) > > > > > > eventually, try something like > > > > > > select p.id,(select f.id from food f where f.p_id=3Dp.id order by f.= id desc limit 1) > > > from person p > > > > > > not tested, no warranties. > > > > > > Since subqueries can be inefficient, use "explain analyze" to see whi= ch one > > > is actually better. > > > > > > This issue will be solved in future versions of postgresql. > > > > > > -- > > > Tobias Brox, +47-91700050 > > > Tallinn > > > > > > > ---------------------------(end of broadcast)--------------------------= - > > TIP 9: the planner will ignore your desire to choose an index scan if y= our > > joining column's datatypes do not match > From pgsql-performance-owner@postgresql.org Thu Jun 9 22:30: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 1412252970 for ; Thu, 9 Jun 2005 22:30:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09340-06 for ; Fri, 10 Jun 2005 01:30:34 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.207]) by svr1.postgresql.org (Postfix) with ESMTP id C85F15295E for ; Thu, 9 Jun 2005 22:30:32 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id 9so441285nzo for ; Thu, 09 Jun 2005 18:30:37 -0700 (PDT) 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:content-disposition:references; b=DcK+lim1T8NMnnDh5HpUE7h8C+cWHB4ckuXWjv3FdGHQ7dnbR+QaeXMxZvY9WZoagpyXTtGjLCY7k3bagTum7yvqZgcbKw5IKx7DjbNDThohynpbuyD6OM1QPw4PW67K6BfS84hWemHZ0RcjdTYKp+qAtx/R7l9WoG1rCnYi+ac= Received: by 10.36.34.2 with SMTP id h2mr809663nzh; Thu, 09 Jun 2005 18:30:37 -0700 (PDT) Received: by 10.36.47.20 with HTTP; Thu, 9 Jun 2005 18:30:37 -0700 (PDT) Message-ID: <8d04ce9905060918306fc4afb8@mail.gmail.com> Date: Thu, 9 Jun 2005 18:30:37 -0700 From: Junaili Lie Reply-To: Junaili Lie To: Kevin Grittner Subject: Re: Help with rewriting query Cc: pgsql-performance@postgresql.org In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.073 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/228 X-Sequence-Number: 12865 Hi Kevin, Thanks for the reply. I tried that query. It definately faster, but not fast enough (took around 50 second to complete). I have around 2.5 million on food and 1000 on person. Here is the query plan: QUERY PLAN ---------------------------------------------------------------------------= ------------------------------------- Merge Join (cost=3D0.00..11662257.52 rows=3D1441579 width=3D16) Merge Cond: ("outer".id =3D "inner".p_id) -> Index Scan using person_pkey on person p (cost=3D0.00..25.17 rows=3D569 width=3D8) -> Index Scan using p_id_food_index on food f=20 (cost=3D0.00..11644211.28 rows=3D1441579 width=3D16) Filter: (NOT (subplan)) SubPlan -> Index Scan using p_id_food_index on food f2=20 (cost=3D0.00..11288.47 rows=3D2835 width=3D177) Index Cond: (p_id =3D $0) Filter: (id > $1) (9 rows) I appreciate if you have further ideas to troubleshoot this issue. Thank you! On 6/8/05, Kevin Grittner wrote: > This is a pattern which I've seen many of times. I call it a "best > choice" query -- you can easily match a row from one table against any > of a number of rows in another, the trick is to pick the one that > matters most. I've generally found that I want the query results to > show more than the columns used for making the choice (and there can be > many), which rules out the min/max technique. What works in a pretty > straitforward way, and generally optimizes at least as well as the > alternatives, is to join to the set of candidate rows and add a "not > exists" test to eliminate all but the best choice. >=20 > For your example, I've taken some liberties and added hypothetical > columns from both tables to the result set, to demonstrate how that > works. Feel free to drop them or substitute actual columns as you see > fit. This will work best if there is an index for the food table on > p_id and id. Please let me know whether this works for you. >=20 > select p.id as p_id, p.fullname, f.id, f.foodtype, f.ts > from food f join person p > on f.p_id =3D p.id > and not exists (select * from food f2 where f2.p_id =3D f.p_id and f2.id = > > f.id) > order by p_id >=20 > Note that this construct works for inner or outer joins and works > regardless of how complex the logic for picking the best choice is. I > think one reason this tends to optimize well is that an EXISTS test can > finish as soon as it finds one matching row. >=20 > -Kevin >=20 >=20 > >>> Junaili Lie 06/08/05 2:34 PM >>> > Hi, > I have the following table: > person - primary key id, and some attributes > food - primary key id, foreign key p_id reference to table person. >=20 > table food store all the food that a person is eating. The more recent > food is indicated by the higher food.id. >=20 > I need to find what is the most recent food a person ate for every > person. > The query: > select f.p_id, max(f.id) from person p, food f where p.id=3Df.p_id group > by f.p_id will work. > But I understand this is not the most efficient way. Is there another > way to rewrite this query? (maybe one that involves order by desc > limit 1) >=20 > Thank you in advance. >=20 > ---------------------------(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 >=20 >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? >=20 > http://www.postgresql.org/docs/faq > From pgsql-performance-owner@postgresql.org Fri Jun 10 01:57: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 2CB8852921 for ; Fri, 10 Jun 2005 01:57:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91451-06 for ; Fri, 10 Jun 2005 04:57:05 +0000 (GMT) Received: from zoom.spline.inf.fu-berlin.de (zoom.spline.inf.fu-berlin.de [160.45.117.148]) by svr1.postgresql.org (Postfix) with ESMTP id A5786528E0 for ; Fri, 10 Jun 2005 01:57:04 -0300 (ADT) Received: by zoom.spline.inf.fu-berlin.de (Postfix, from userid 2091) id 6EE588C784; Fri, 10 Jun 2005 06:57:03 +0200 (CEST) Date: Fri, 10 Jun 2005 06:57:02 +0200 From: Yann Michel To: Richard Huxton Cc: pgsql-performance@postgresql.org Subject: Re: postgresql.conf runtime statistics default Message-ID: <20050610045702.GA19866@zoom.spline.inf.fu-berlin.de> References: <20050609100852.GA16538@zoom.spline.inf.fu-berlin.de> <42A83FFA.3030209@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42A83FFA.3030209@archonet.com> 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: 200506/229 X-Sequence-Number: 12866 Hi, On Thu, Jun 09, 2005 at 02:11:22PM +0100, Richard Huxton wrote: > > > >To my question: I found the parameter "stats_reset_on_server_start" > >which is set to true by default. Why did you choose this (and not false) > >and what are the impacts of changeing it to false? I mean, as long as I > >understood it, each query or statements generates some statistic data > >which is used by the optimizer (or anything equal) later on. So in my > >oppinion, wouldn't it be better so set this parameter to false and to > >enable a kind of a "startup reset_stats" option? > > This is administrator statistics (e.g. number of disk blocks read from > this index) not planner statistics. You're right - it would be foolish > to throw away planner stats. So what is best to set this parameter to and when? As I read this parameter is documented within the section "16.4.7.2. Query and Index Statistics Collector" so I guess it is better to set it to false as described above. Or am I wrong? Regards, Yann From pgsql-performance-owner@postgresql.org Fri Jun 10 03:03: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 42A4A528B1 for ; Fri, 10 Jun 2005 03:03:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08464-06 for ; Fri, 10 Jun 2005 06:03:21 +0000 (GMT) Received: from exchange.hostworks.com.au (exchange.hostworks.com.au [202.58.32.39]) by svr1.postgresql.org (Postfix) with ESMTP id 93C3B5287A for ; Fri, 10 Jun 2005 03:03:19 -0300 (ADT) Received: from EXCHANGEHW.au.corp.hostworks.com.au ([10.5.0.93]) by exchange.hostworks.com.au with Microsoft SMTPSVC(6.0.3790.211); Fri, 10 Jun 2005 15:33:17 +0930 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: Importing from pg_dump slow, low Disk IO Date: Fri, 10 Jun 2005 15:33:17 +0930 Message-ID: <13F3036A953F6A41BC91040310BD692A03EF1B3E@EXCHANGEHW.au.corp.hostworks.com.au> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Importing from pg_dump slow, low Disk IO Thread-Index: AcVsCbqVuSQ3UPyzQeCqjH+47jIeXQAnStbgADa44TA= From: "Steve Pollard" To: X-OriginalArrivalTime: 10 Jun 2005 06:03:17.0615 (UTC) FILETIME=[189E97F0:01C56D82] 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: 200506/230 X-Sequence-Number: 12867 Hi All, Not sure if this is correct fix or not, but a bit of research : http://archives.postgresql.org/pgsql-hackers/2001-04/msg01129.php And offical doco's from postgres : http://www.postgresql.org/docs/7.4/static/wal-configuration.html Lead me to try : wal_sync_method =3D open_sync And this has increased the speed on my Redhat 8 servers my 20X ! Steve -----Original Message----- From: Steve Pollard=20 Sent: Thursday, 9 June 2005 1:27 PM To: Steve Pollard; pgsql-performance@postgresql.org Subject: RE: [PERFORM] Importing from pg_dump slow, low Disk IO As a follow up to this ive installed on another test Rehat 8 machine with 7.3.4 and slow inserts are present, however on another machine with ES3 the same 15,000 inserts is about 20 times faster, anyone know of a change that would effect this, kernel or rehat release ? Steve -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Steve Pollard Sent: Wednesday, 8 June 2005 6:39 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] Importing from pg_dump slow, low Disk IO Hi Everyone, Im having a performance issue with version 7.3.4 which i first thought was Disk IO related, however now it seems like the problem is caused by really slow commits, this is running on Redhat 8. Basically im taking a .sql file with insert of about 15,000 lines and <'ing straight into psql DATABASENAME, the Disk writes never gets over about 2000 on this machine with a RAID5 SCSI setup, this happens in my PROD and DEV environment. Ive installed the latest version on RedHat ES3 and copied the configs across however the inserts are really really fast.. Was there a performce change from 7.3.4 to current to turn of autocommits by default or is buffering handled differently ? I have ruled out Disk IO issues as a siple 'cp' exceeds Disk writes to 60000 (using vmstat) If i do this with a BEGIN; and COMMIT; its really fast, however not practical as im setting up a cold-standby server for automation. Have been trying to debug for a few days now and see nothing.. here is some info : :::::::::::::: /proc/sys/kernel/shmall :::::::::::::: 2097152 :::::::::::::: /proc/sys/kernel/shmmax :::::::::::::: 134217728 :::::::::::::: /proc/sys/kernel/shmmni :::::::::::::: 4096 shared_buffers =3D 51200 max_fsm_relations =3D 1000 max_fsm_pages =3D 10000 max_locks_per_transaction =3D 64 wal_buffers =3D 64 effective_cache_size =3D 65536 MemTotal: 1547608 kB MemFree: 47076 kB MemShared: 0 kB Buffers: 134084 kB Cached: 1186596 kB SwapCached: 544 kB Active: 357048 kB ActiveAnon: 105832 kB ActiveCache: 251216 kB Inact_dirty: 321020 kB Inact_laundry: 719492 kB Inact_clean: 28956 kB Inact_target: 285300 kB HighTotal: 655336 kB HighFree: 1024 kB LowTotal: 892272 kB LowFree: 46052 kB SwapTotal: 1534056 kB SwapFree: 1526460 kB This is a real doosey for me, please provide any advise possible. Steve ---------------------------(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 Fri Jun 10 03:47: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 7B27252921 for ; Fri, 10 Jun 2005 03:47:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19741-06 for ; Fri, 10 Jun 2005 06:47:22 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id 9AEB25292C for ; Fri, 10 Jun 2005 03:47:19 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j5A6lE0A001632; Fri, 10 Jun 2005 08:47:16 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j5A6lEmB001631; Fri, 10 Jun 2005 08:47:14 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Fri, 10 Jun 2005 08:47:13 +0200 (CEST) Date: Fri, 10 Jun 2005 08:46:16 +0200 From: "Martin Fandel" To: Steve Pollard Cc: pgsql-performance@postgresql.org Message-ID: <1118385977.26833.44.camel@fandelm.ecommit.de> In-Reply-To: <13F3036A953F6A41BC91040310BD692A03EF1B3E@EXCHANGEHW.au.corp.ho> References: <13F3036A953F6A41BC91040310BD692A03EF1B3E@EXCHANGEHW.au.corp.ho> Subject: Re: Importing from pg_dump slow, low Disk IO x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.021 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/231 X-Sequence-Number: 12868 Hi, i'm trying this too :). My Dump (IN) is about 84 minutes. Now i'm testing how much time takes it with open_sync :). I'm anxious about the new results :). best regards, pingufreak Am Freitag, den 10.06.2005, 15:33 +0930 schrieb Steve Pollard: > Hi All, > > Not sure if this is correct fix or not, but a bit of research : > http://archives.postgresql.org/pgsql-hackers/2001-04/msg01129.php > And offical doco's from postgres : > http://www.postgresql.org/docs/7.4/static/wal-configuration.html > Lead me to try : > wal_sync_method = open_sync > And this has increased the speed on my Redhat 8 servers my 20X ! > > Steve > -----Original Message----- > From: Steve Pollard > Sent: Thursday, 9 June 2005 1:27 PM > To: Steve Pollard; pgsql-performance@postgresql.org > Subject: RE: [PERFORM] Importing from pg_dump slow, low Disk IO > > As a follow up to this ive installed on another test Rehat 8 machine > with > 7.3.4 and slow inserts are present, however on another machine with ES3 > the same 15,000 inserts is about 20 times faster, anyone know of a > change that would effect this, kernel or rehat release ? > > Steve > > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Steve > Pollard > Sent: Wednesday, 8 June 2005 6:39 PM > To: pgsql-performance@postgresql.org > Subject: [PERFORM] Importing from pg_dump slow, low Disk IO > > > Hi Everyone, > > Im having a performance issue with version 7.3.4 which i first thought > was Disk IO related, however now it seems like the problem is caused by > really slow commits, this is running on Redhat 8. > > Basically im taking a .sql file with insert of about 15,000 lines and > <'ing straight into psql DATABASENAME, the Disk writes never gets over > about 2000 on this machine with a RAID5 SCSI setup, this happens in my > PROD and DEV environment. > > Ive installed the latest version on RedHat ES3 and copied the configs > across however the inserts are really really fast.. > > Was there a performce change from 7.3.4 to current to turn of > autocommits by default or is buffering handled differently ? > > I have ruled out Disk IO issues as a siple 'cp' exceeds Disk writes to > 60000 (using vmstat) > > If i do this with a BEGIN; and COMMIT; its really fast, however not > practical as im setting up a cold-standby server for automation. > > Have been trying to debug for a few days now and see nothing.. here is > some info : > > :::::::::::::: > /proc/sys/kernel/shmall > :::::::::::::: > 2097152 > :::::::::::::: > /proc/sys/kernel/shmmax > :::::::::::::: > 134217728 > :::::::::::::: > /proc/sys/kernel/shmmni > :::::::::::::: > 4096 > > > shared_buffers = 51200 > max_fsm_relations = 1000 > max_fsm_pages = 10000 > max_locks_per_transaction = 64 > wal_buffers = 64 > effective_cache_size = 65536 > > MemTotal: 1547608 kB > MemFree: 47076 kB > MemShared: 0 kB > Buffers: 134084 kB > Cached: 1186596 kB > SwapCached: 544 kB > Active: 357048 kB > ActiveAnon: 105832 kB > ActiveCache: 251216 kB > Inact_dirty: 321020 kB > Inact_laundry: 719492 kB > Inact_clean: 28956 kB > Inact_target: 285300 kB > HighTotal: 655336 kB > HighFree: 1024 kB > LowTotal: 892272 kB > LowFree: 46052 kB > SwapTotal: 1534056 kB > SwapFree: 1526460 kB > > This is a real doosey for me, please provide any advise possible. > > Steve > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq From pgsql-performance-owner@postgresql.org Fri Jun 10 04:20: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 4E70052896 for ; Fri, 10 Jun 2005 04:20:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28522-06 for ; Fri, 10 Jun 2005 07:20:27 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 99E5C52960 for ; Fri, 10 Jun 2005 04:20:24 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id D6C0040C0F2; Fri, 10 Jun 2005 08:20:19 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id A06F115ED5; Fri, 10 Jun 2005 08:19:07 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20167-10; Fri, 10 Jun 2005 08:19:04 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 22D9A15EE9; Fri, 10 Jun 2005 08:17:38 +0100 (BST) Message-ID: <42A93E91.5070502@archonet.com> Date: Fri, 10 Jun 2005 08:17:37 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yann Michel Cc: pgsql-performance@postgresql.org Subject: Re: postgresql.conf runtime statistics default References: <20050609100852.GA16538@zoom.spline.inf.fu-berlin.de> <42A83FFA.3030209@archonet.com> <20050610045702.GA19866@zoom.spline.inf.fu-berlin.de> In-Reply-To: <20050610045702.GA19866@zoom.spline.inf.fu-berlin.de> 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.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/232 X-Sequence-Number: 12869 Yann Michel wrote: > Hi, > > On Thu, Jun 09, 2005 at 02:11:22PM +0100, Richard Huxton wrote: > >>>To my question: I found the parameter "stats_reset_on_server_start" >>>which is set to true by default. Why did you choose this (and not false) >>>and what are the impacts of changeing it to false? I mean, as long as I >>>understood it, each query or statements generates some statistic data >>>which is used by the optimizer (or anything equal) later on. So in my >>>oppinion, wouldn't it be better so set this parameter to false and to >>>enable a kind of a "startup reset_stats" option? >> >>This is administrator statistics (e.g. number of disk blocks read from >>this index) not planner statistics. You're right - it would be foolish >>to throw away planner stats. > > > So what is best to set this parameter to and when? As I read this > parameter is documented within the section "16.4.7.2. Query and Index > Statistics Collector" so I guess it is better to set it to false as > described above. Or am I wrong? It depends on whether you want to know how much activity your tables/indexes have received *ever* or since you last restarted. If you altered your database schema, added/removed indexes or changed hardware/configuration then you might want to reset the counts to zero to more easily see the effect of the new setup. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Jun 10 05:49: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 EC03F52921 for ; Fri, 10 Jun 2005 05:49:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48572-10 for ; Fri, 10 Jun 2005 08:49:43 +0000 (GMT) Received: from mail.nordicbet.com (mail.nordicbet.com [193.69.167.130]) by svr1.postgresql.org (Postfix) with ESMTP id BBB25528FF for ; Fri, 10 Jun 2005 05:49:36 -0300 (ADT) Received: from estneti-gw.online.ee ([62.65.34.222] helo=tobias.nordicbet.invalid) (Authenticated Sender=tobias@nordicbet.com) by mail.nordicbet.com with esmtpa (Exim 4.50 #1 (Debian)) id 1DgfCN-0004O1-RC; Fri, 10 Jun 2005 10:49:16 +0200 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id BA330DFE40; Fri, 10 Jun 2005 11:49:27 +0300 (EEST) Date: Fri, 10 Jun 2005 11:49:25 +0300 From: Tobias Brox To: Junaili Lie Cc: Bruno Wolff III , pgsql-performance@postgresql.org Subject: Re: Help with rewriting query Message-ID: <20050610084925.GA8451@tobias.nordicbet.com> References: <8d04ce990506081234121995f9@mail.gmail.com> <20050608195625.GM8451@tobias.nordicbet.com> <8d04ce990506081548355991bb@mail.gmail.com> <20050609025907.GB6139@wolff.to> <8d04ce9905060918264740a0da@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d04ce9905060918264740a0da@mail.gmail.com> Organization: Group Nordicbet User-Agent: Mutt/1.5.6i 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: 200506/233 X-Sequence-Number: 12870 [Junaili Lie - Thu at 06:26:09PM -0700] > Hi Bruno, > I followed your suggestion. > The query plan shows that it uses the index (id, person_id). However, > the execution time is still slow. I have to do ctl-C to stop it. What is the estimate planner cost? > Maybe something is wrong with my postgresql config. > It's running Solaris on dual Opteron, 4GB. > I allocated around 128MB for sorting and more than 80% for > effective_cache_size and shared_buffers = 32768. > Any further ideas is much appreciated. Sounds a bit excessive. Compare with the vanilla configuration, and see what is faster. -- Tobias Brox, +47-91700050 From pgsql-performance-owner@postgresql.org Fri Jun 10 06:05: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 030EA52951 for ; Fri, 10 Jun 2005 06:05:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55022-03 for ; Fri, 10 Jun 2005 09:05:46 +0000 (GMT) Received: from mx.mall.cz (mx.mall.cz [62.168.45.106]) by svr1.postgresql.org (Postfix) with ESMTP id 0E3D452862 for ; Fri, 10 Jun 2005 06:05:44 -0300 (ADT) Received: from localhost (asterix [127.0.0.1]) by mx.mall.cz (Postfix) with ESMTP id 29B7413F607 for ; Fri, 10 Jun 2005 11:05:44 +0200 (CEST) Received: from mx.mall.cz ([127.0.0.1]) by localhost (asterix [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 05373-02 for ; Fri, 10 Jun 2005 11:05:43 +0200 (CEST) Message-ID: <42A957E9.8040909@mall.cz> Date: Fri, 10 Jun 2005 11:05:45 +0200 From: Michal Taborsky User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: cs, en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Cleaning bloated pg_attribute Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at mall.cz 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: 200506/234 X-Sequence-Number: 12871 I managed, by extensive usage of temporary tables, to totally bloat pg_attribute. It currently has about 40000 pages with just 3000 tuples. The question is, how to restore it to it's former beauty? With ordinary table I'd just CLUSTER it, but alas! I cannot do that with system catalog. I always get: db=# cluster pg_attribute_relid_attnam_index on pg_attribute; ERROR: "pg_attribute" is a system catalog The only thing I could think of is VACUUM FULL, but from my former experience I guess it'll take maybe over an hour, effectively rendering the server unusable, because of the exclusive lock. It is a live 24/7 system, so I'd really prefer something less drastic than dumping and reloading the database (though it's still shorter downtime than with the vacuum.) Isn't there a way to somehow go around the above mentioned limitation and CLUSTER the table? Thanks for your ideas. -- Michal T�borsk� CTO, Internet Mall, a.s. Internet Mall - obchody, kter� si obl�b�te From pgsql-performance-owner@postgresql.org Fri Jun 10 07:10: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 578DD52862 for ; Fri, 10 Jun 2005 07:10:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70433-05 for ; Fri, 10 Jun 2005 10:10:34 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id ACA185284D for ; Fri, 10 Jun 2005 07:10:33 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 9F17F40D5C3; Fri, 10 Jun 2005 11:10:29 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 04E9A15ED7; Fri, 10 Jun 2005 11:07:20 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25008-06; Fri, 10 Jun 2005 11:07:17 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 909F915ED5; Fri, 10 Jun 2005 11:07:17 +0100 (BST) Message-ID: <42A96655.3090202@archonet.com> Date: Fri, 10 Jun 2005 11:07:17 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michal Taborsky Cc: pgsql-performance@postgresql.org Subject: Re: Cleaning bloated pg_attribute References: <42A957E9.8040909@mall.cz> In-Reply-To: <42A957E9.8040909@mall.cz> 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.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/235 X-Sequence-Number: 12872 Michal Taborsky wrote: > I managed, by extensive usage of temporary tables, to totally bloat > pg_attribute. It currently has about 40000 pages with just 3000 tuples. > The only thing I could think of is VACUUM FULL, but from my former > experience I guess it'll take maybe over an hour, effectively rendering > the server unusable, because of the exclusive lock. You can vacuum full a single table - shouldn't take an hour for just the one table. Unless your disk I/O is *constantly* running flat-out. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Jun 10 07:15: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 51A89528E0 for ; Fri, 10 Jun 2005 07:15:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73390-03 for ; Fri, 10 Jun 2005 10:15:41 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id E13DD5288D for ; Fri, 10 Jun 2005 07:15:39 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j5AAFb0A005574; Fri, 10 Jun 2005 12:15:38 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j5AAFbw7005573; Fri, 10 Jun 2005 12:15:37 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Fri, 10 Jun 2005 12:15:36 +0200 (CEST) Date: Fri, 10 Jun 2005 12:14:36 +0200 From: "Martin Fandel" To: Steve Pollard Cc: pgsql-performance@postgresql.org Message-ID: <1118398476.31750.3.camel@fandelm.ecommit.de> In-Reply-To: <13F3036A953F6A41BC91040310BD692A03EF1B3E@EXCHANGEHW.au.corp.ho> References: <13F3036A953F6A41BC91040310BD692A03EF1B3E@EXCHANGEHW.au.corp.ho> Subject: Re: Importing from pg_dump slow, low Disk IO x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline 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: 200506/236 X-Sequence-Number: 12873 Hmmm. In my configuration there are not much more performance: The Dump-size is 6-7GB on a PIV-3Ghz, 2GB-RAM, 4x10k disks on raid 10 for the db and 2x10k disks raid 1 for the system and the wal-logs. open_sync: real 79m1.980s user 25m25.285s sys 1m20.112s fsync: real 75m23.792s user 27m3.693s sys 1m26.538s best regards, martin Am Freitag, den 10.06.2005, 15:33 +0930 schrieb Steve Pollard: > Hi All, > > Not sure if this is correct fix or not, but a bit of research : > http://archives.postgresql.org/pgsql-hackers/2001-04/msg01129.php > And offical doco's from postgres : > http://www.postgresql.org/docs/7.4/static/wal-configuration.html > Lead me to try : > wal_sync_method = open_sync > And this has increased the speed on my Redhat 8 servers my 20X ! > > Steve > -----Original Message----- > From: Steve Pollard > Sent: Thursday, 9 June 2005 1:27 PM > To: Steve Pollard; pgsql-performance@postgresql.org > Subject: RE: [PERFORM] Importing from pg_dump slow, low Disk IO > > As a follow up to this ive installed on another test Rehat 8 machine > with > 7.3.4 and slow inserts are present, however on another machine with ES3 > the same 15,000 inserts is about 20 times faster, anyone know of a > change that would effect this, kernel or rehat release ? > > Steve > > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Steve > Pollard > Sent: Wednesday, 8 June 2005 6:39 PM > To: pgsql-performance@postgresql.org > Subject: [PERFORM] Importing from pg_dump slow, low Disk IO > > > Hi Everyone, > > Im having a performance issue with version 7.3.4 which i first thought > was Disk IO related, however now it seems like the problem is caused by > really slow commits, this is running on Redhat 8. > > Basically im taking a .sql file with insert of about 15,000 lines and > <'ing straight into psql DATABASENAME, the Disk writes never gets over > about 2000 on this machine with a RAID5 SCSI setup, this happens in my > PROD and DEV environment. > > Ive installed the latest version on RedHat ES3 and copied the configs > across however the inserts are really really fast.. > > Was there a performce change from 7.3.4 to current to turn of > autocommits by default or is buffering handled differently ? > > I have ruled out Disk IO issues as a siple 'cp' exceeds Disk writes to > 60000 (using vmstat) > > If i do this with a BEGIN; and COMMIT; its really fast, however not > practical as im setting up a cold-standby server for automation. > > Have been trying to debug for a few days now and see nothing.. here is > some info : > > :::::::::::::: > /proc/sys/kernel/shmall > :::::::::::::: > 2097152 > :::::::::::::: > /proc/sys/kernel/shmmax > :::::::::::::: > 134217728 > :::::::::::::: > /proc/sys/kernel/shmmni > :::::::::::::: > 4096 > > > shared_buffers = 51200 > max_fsm_relations = 1000 > max_fsm_pages = 10000 > max_locks_per_transaction = 64 > wal_buffers = 64 > effective_cache_size = 65536 > > MemTotal: 1547608 kB > MemFree: 47076 kB > MemShared: 0 kB > Buffers: 134084 kB > Cached: 1186596 kB > SwapCached: 544 kB > Active: 357048 kB > ActiveAnon: 105832 kB > ActiveCache: 251216 kB > Inact_dirty: 321020 kB > Inact_laundry: 719492 kB > Inact_clean: 28956 kB > Inact_target: 285300 kB > HighTotal: 655336 kB > HighFree: 1024 kB > LowTotal: 892272 kB > LowFree: 46052 kB > SwapTotal: 1534056 kB > SwapFree: 1526460 kB > > This is a real doosey for me, please provide any advise possible. > > Steve > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq From pgsql-performance-owner@postgresql.org Fri Jun 10 09:07: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 4CC14528B1 for ; Fri, 10 Jun 2005 09:07:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00886-10 for ; Fri, 10 Jun 2005 12:07:15 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 6E0BA52889 for ; Fri, 10 Jun 2005 09:07:14 -0300 (ADT) Received: (qmail 1878 invoked by uid 500); 10 Jun 2005 12:06:38 -0000 Date: Fri, 10 Jun 2005 07:06:38 -0500 From: Bruno Wolff III To: Junaili Lie Cc: pgsql-performance@postgresql.org Subject: Re: Help with rewriting query Message-ID: <20050610120638.GA1365@wolff.to> Mail-Followup-To: Bruno Wolff III , Junaili Lie , pgsql-performance@postgresql.org References: <8d04ce990506081234121995f9@mail.gmail.com> <20050608195625.GM8451@tobias.nordicbet.com> <8d04ce990506081548355991bb@mail.gmail.com> <20050609025907.GB6139@wolff.to> <8d04ce9905060918264740a0da@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d04ce9905060918264740a0da@mail.gmail.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: 200506/237 X-Sequence-Number: 12874 On Thu, Jun 09, 2005 at 18:26:09 -0700, Junaili Lie wrote: > Hi Bruno, > I followed your suggestion. > The query plan shows that it uses the index (id, person_id). However, > the execution time is still slow. I have to do ctl-C to stop it. > Maybe something is wrong with my postgresql config. > It's running Solaris on dual Opteron, 4GB. > I allocated around 128MB for sorting and more than 80% for > effective_cache_size and shared_buffers = 32768. > Any further ideas is much appreciated. It might be useful to see that plan and the actual query you used. There were only 569 entries in the people table, so I find it hard to believe that an index look up per person is taking so long that you need to cancel the query. > > > > > On 6/8/05, Bruno Wolff III wrote: > > On Wed, Jun 08, 2005 at 15:48:27 -0700, > > Junaili Lie wrote: > > > Hi, > > > The suggested query below took forever when I tried it. > > > In addition, as suggested by Tobias, I also tried to create index on > > > food(p_id, id), but still no goal (same query plan). > > > Here is the explain: > > > TEST1=# explain select f.p_id, max(f.id) from Food f, Person p where > > > (f.p_id = p.id) group by p.id; > > > > The above is going to require reading all the food table (assuming no > > orphaned records), so the plan below seems reasonable. > > > > > QUERY PLAN > > > ---------------------------------------------------------------------------------------------------------------- > > > GroupAggregate (cost=0.00..214585.51 rows=569 width=16) > > > -> Merge Join (cost=0.00..200163.50 rows=2884117 width=16) > > > Merge Cond: ("outer".id = "inner".p_id) > > > -> Index Scan using person_pkey on person p > > > (cost=0.00..25.17 rows=569 width=8) > > > -> Index Scan using person_id_food_index on food f > > > (cost=0.00..164085.54 rows=2884117 width=16) > > > (5 rows) > > > > > > > > > > > > > > > TEST1=# explain select p.id, (Select f.id from food f where > > > f.p_id=p.id order by f.id desc limit 1) from person p; > > > > Using a subselect seems to be the best hope of getting better performance. > > I think you almost got it right, but in order to use the index on > > (p_id, id) you need to order by f.p_id desc, f.id desc. Postgres won't > > deduce this index can be used because f.p_id is constant in the subselect, > > you need to give it some help. > > > > > QUERY PLAN > > > ----------------------------------------------------------------------------------------------------------- > > > Seq Scan on Person p (cost=100000000.00..100007015.24 rows=569 width=8) > > > SubPlan > > > -> Limit (cost=0.00..12.31 rows=1 width=8) > > > -> Index Scan Backward using food_pkey on food f > > > (cost=0.00..111261.90 rows=9042 width=8) > > > Filter: (p_id = $0) > > > (5 rows) > > > > > > any ideas or suggestions is appreciate. > > > > > > > > > On 6/8/05, Tobias Brox wrote: > > > > [Junaili Lie - Wed at 12:34:32PM -0700] > > > > > select f.p_id, max(f.id) from person p, food f where p.id=f.p_id group > > > > > by f.p_id will work. > > > > > But I understand this is not the most efficient way. Is there another > > > > > way to rewrite this query? (maybe one that involves order by desc > > > > > limit 1) > > > > > > > > eventually, try something like > > > > > > > > select p.id,(select f.id from food f where f.p_id=p.id order by f.id desc limit 1) > > > > from person p > > > > > > > > not tested, no warranties. > > > > > > > > Since subqueries can be inefficient, use "explain analyze" to see which one > > > > is actually better. > > > > > > > > This issue will be solved in future versions of postgresql. > > > > > > > > -- > > > > Tobias Brox, +47-91700050 > > > > Tallinn > > > > > > > > > > ---------------------------(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 > > From pgsql-performance-owner@postgresql.org Fri Jun 10 09:34: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 9BFBC52945 for ; Fri, 10 Jun 2005 09:34:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11947-06 for ; Fri, 10 Jun 2005 12:34:15 +0000 (GMT) Received: from www.bowmansystems.com (ns1.bowmansystems.com [65.166.193.2]) by svr1.postgresql.org (Postfix) with ESMTP id 261FC5293A for ; Fri, 10 Jun 2005 09:34:14 -0300 (ADT) Received: from ads2.ucomics.com (unknown [65.166.193.11]) by www.bowmansystems.com (Postfix) with ESMTP id 6FEDAC130 for ; Fri, 10 Jun 2005 07:30:06 -0500 (CDT) Subject: Re: Whence the Opterons? From: Richard Rowell To: pgsql-performance@postgresql.org In-Reply-To: <1115415551.427be3ffe44c8@webmail.telus.net> References: <14695.1115393034@sss.pgh.pa.us> <6CD32D5F-B466-4E6D-9E73-CFB8957B396F@torgo.978.org> <15121.1115395067@sss.pgh.pa.us> <1115415551.427be3ffe44c8@webmail.telus.net> Content-Type: text/plain Date: Fri, 10 Jun 2005 07:34:21 -0500 Message-Id: <1118406861.21216.58.camel@richard> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.393 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/238 X-Sequence-Number: 12875 I will second the nod to Penguin computing. We have a bit of Penguin hardware here (though the majority is Dell). We did have issues with one machine a couple of years ago, but Penguin was very pro-active in addressing that. We recently picked up a Dual Opteron system from them and have been very pleased with it so far. I would be careful of the RHES that it ships with though. We had machine lockups immediately after the suggested kernel update (had to down grade manually). Also, the RH supplied Postgres binary has issues, so you would need to compile Postgres yourself until the next RH update. On Fri, 2005-05-06 at 14:39 -0700, Mischa Sandberg wrote: > After reading the comparisons between Opteron and Xeon processors for Linux, > I'd like to add an Opteron box to our stable of Dells and Sparcs, for comparison. > > IBM, Sun and HP have their fairly pricey Opteron systems. > The IT people are not swell about unsupported purchases off ebay. > Anyone care to suggest any other vendors/distributors? > Looking for names with national support, so that we can recommend as much to our > customers. > > Many thanks in advance. -- -- Richard Rowell richard@bowmansystems.com Bowman Systems (318) 213-8780 From pgsql-performance-owner@postgresql.org Fri Jun 10 12:00: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 5186952945 for ; Fri, 10 Jun 2005 12:00:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52160-08 for ; Fri, 10 Jun 2005 15:00:27 +0000 (GMT) Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) by svr1.postgresql.org (Postfix) with ESMTP id 8F37152921 for ; Fri, 10 Jun 2005 12:00:26 -0300 (ADT) Received: from imail01.arbinet.com (localhost [127.0.0.1]) by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j5AEApAI001621 for ; Fri, 10 Jun 2005 14:11:02 GMT Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j5AEApvt001614; Fri, 10 Jun 2005 14:10:51 GMT X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.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: Whence the Opterons? Date: Fri, 10 Jun 2005 14:59:33 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Whence the Opterons? Thread-Index: AcVtuR1DZ+6CMke6SnC4iE4BVTJfqAAE8P0g From: "Mohan, Ross" To: X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST X-Scanned-By: MIMEDefang 2.39 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.108 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/239 X-Sequence-Number: 12876 Richard,=20 thanks for info.=20 "...the RH supplied Postgres binary has issues..." Would you have the time to provide a bit more info? Version of PG? Nature of issues? Methods that resolved? Thanks again,=20 -- Ross -----Original Message----- From: pgsql-performance-owner@postgresql.org = [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Richard = Rowell Sent: Friday, June 10, 2005 8:34 AM To: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Whence the Opterons? I will second the nod to Penguin computing. We have a bit of Penguin = hardware here (though the majority is Dell). We did have issues with = one machine a couple of years ago, but Penguin was very pro-active in = addressing that. We recently picked up a Dual Opteron system from them and have been very = pleased with it so far. =20 I would be careful of the RHES that it ships with though. We had = machine lockups immediately after the suggested kernel update (had to = down grade manually). Also, the RH supplied Postgres binary has issues, = so you would need to compile Postgres yourself until the next RH update. On Fri, 2005-05-06 at 14:39 -0700, Mischa Sandberg wrote: > After reading the comparisons between Opteron and Xeon processors for=20 > Linux, I'd like to add an Opteron box to our stable of Dells and=20 > Sparcs, for comparison. >=20 > IBM, Sun and HP have their fairly pricey Opteron systems. > The IT people are not swell about unsupported purchases off ebay.=20 > Anyone care to suggest any other vendors/distributors? Looking for=20 > names with national support, so that we can recommend as much to our=20 > customers. >=20 > Many thanks in advance. --=20 -- Richard Rowell richard@bowmansystems.com Bowman Systems (318) 213-8780 ---------------------------(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 Fri Jun 10 12:56: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 43D7552932 for ; Fri, 10 Jun 2005 12:56:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67796-02 for ; Fri, 10 Jun 2005 15:55:56 +0000 (GMT) Received: from mail.nordicbet.com (mail.nordicbet.com [193.69.167.130]) by svr1.postgresql.org (Postfix) with ESMTP id 01BAD52977 for ; Fri, 10 Jun 2005 12:55:50 -0300 (ADT) Received: from estneti-gw.online.ee ([62.65.34.222] helo=tobias.nordicbet.invalid) (Authenticated Sender=tobias@nordicbet.com) by mail.nordicbet.com with esmtpa (Exim 4.50 #1 (Debian)) id 1Dglqk-0006Vr-VI; Fri, 10 Jun 2005 17:55:24 +0200 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id 6CA72E0C54; Fri, 10 Jun 2005 18:55:35 +0300 (EEST) Date: Fri, 10 Jun 2005 18:55:35 +0300 From: Tobias Brox To: linux@alteeve.com Cc: pgsql-performance@postgresql.org Subject: Re: Index ot being used Message-ID: <20050610155535.GO8451@tobias.nordicbet.com> References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> Organization: Group Nordicbet User-Agent: Mutt/1.5.6i 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: 200506/241 X-Sequence-Number: 12878 [linux@alteeve.com - Fri at 12:10:19PM -0400] > tle-bu=> EXPLAIN ANALYZE SELECT file_type, file_parent_dir, file_name FROM > file_info_7; > QUERY PLAN > ---------------------------------------------------------------------------------------------------------------------- > Seq Scan on file_info_7 (cost=0.00..11028.35 rows=294035 width=118) > (actual time=0.122..2707.764 rows=294035 loops=1) > Total runtime: 3717.862 ms > (2 rows) > As far as I can see, you are selecting everything from the table without any sort order. The only rational thing to do then is a sequential scan, it's no point in an index scan. -- Tobias Brox, +47-91700050 From pgsql-performance-owner@postgresql.org Fri Jun 10 12:57: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 CCBC552965 for ; Fri, 10 Jun 2005 12:57:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67728-03 for ; Fri, 10 Jun 2005 15:57:23 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id 91A5E528E7 for ; Fri, 10 Jun 2005 12:57:18 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5AFv55G093447; Fri, 10 Jun 2005 17:57:06 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050610175543.0a63dc88@pop.interactivemediafactory.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Fri, 10 Jun 2005 17:57:01 +0200 To: linux@alteeve.com From: Jacques Caron Subject: Re: Index ot being used Cc: pgsql-performance@postgresql.org In-Reply-To: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> 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.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/242 X-Sequence-Number: 12879 Hi, At 18:10 10/06/2005, linux@alteeve.com wrote: >tle-bu=> EXPLAIN ANALYZE SELECT file_type, file_parent_dir, file_name FROM >file_info_7; What could the index be used for? Unless you have some WHERE or (in some cases) ORDER BY clause, there's absolutely no need for an index, since you are just asking for all rows from the table... Jacques. From pgsql-performance-owner@postgresql.org Fri Jun 10 12:42: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 91E8F52956 for ; Fri, 10 Jun 2005 12:42:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63539-03 for ; Fri, 10 Jun 2005 15:41:58 +0000 (GMT) Received: from srv1.alteeve.com (unknown [209.167.86.38]) by svr1.postgresql.org (Postfix) with ESMTP id 164F252953 for ; Fri, 10 Jun 2005 12:41:56 -0300 (ADT) Received: from srv1.alteeve.com (srv1.alteeve.com [127.0.0.1]) by srv1.alteeve.com (8.12.10/8.12.10) with ESMTP id j5AGAJpe029029 for ; Fri, 10 Jun 2005 12:10:19 -0400 Received: (from apache@localhost) by srv1.alteeve.com (8.12.10/8.12.10/Submit) id j5AGAJgB029027; Fri, 10 Jun 2005 12:10:19 -0400 From: linux@alteeve.com X-Authentication-Warning: srv1.alteeve.com: apache set sender to linux@localhost using -f Received: from guelph-ppp113388.sympatico.ca ([216.209.137.1]) (SquirrelMail authenticated user linux) by mail.alteeve.com with HTTP; Fri, 10 Jun 2005 12:10:19 -0400 (EDT) Message-ID: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> Date: Fri, 10 Jun 2005 12:10:19 -0400 (EDT) Subject: Index ot being used To: pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.0-1.7.x MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-Priority: 3 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.089 tagged_above=0 required=5 tests=AWL, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200506/240 X-Sequence-Number: 12877 Hi all, I have an index on a table that doesn't seem to want to be used. I'm hopig someone might be able to help point me in the right direction. My index is (typed, not copied): tle-bu=> \d file_info_7_display_idx; Index "public.file_info_7_display_idx" Column | Type -----------------+---------------------- file_type | character varying(2) file_parent_dir | text file_name | text btree, for table "public.file_info_7" tle-bu=> EXPLAIN ANALYZE SELECT file_type, file_parent_dir, file_name FROM file_info_7; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- Seq Scan on file_info_7 (cost=0.00..11028.35 rows=294035 width=118) (actual time=0.122..2707.764 rows=294035 loops=1) Total runtime: 3717.862 ms (2 rows) Can anyone see what's wrong? Should I post the table schema? Thanks all! Madison From pgsql-performance-owner@postgresql.org Fri Jun 10 14:45: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 D8AD652871 for ; Fri, 10 Jun 2005 14:45:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98787-01 for ; Fri, 10 Jun 2005 17:45:09 +0000 (GMT) Received: from vbp2.vbp2.com (vbp2.com [66.207.137.158]) by svr1.postgresql.org (Postfix) with ESMTP id 4F70C52932 for ; Fri, 10 Jun 2005 14:45:08 -0300 (ADT) Received: from vbp2.vbp2.com (localhost [127.0.0.1]) by vbp2.vbp2.com (8.13.1/8.13.1) with ESMTP id j5AHj6ZT019804 for ; Fri, 10 Jun 2005 13:45:06 -0400 (EDT) (envelope-from list@slatech.com) Received: from localhost (list@localhost) by vbp2.vbp2.com (8.13.1/8.13.1/Submit) with ESMTP id j5AHj5EP019801 for ; Fri, 10 Jun 2005 13:45:06 -0400 (EDT) (envelope-from list@slatech.com) X-Authentication-Warning: vbp2.vbp2.com: list owned process doing -bs Date: Fri, 10 Jun 2005 13:45:05 -0400 (EDT) From: Clark Slater X-X-Sender: list@vbp2.vbp2.com To: pgsql-performance@postgresql.org Subject: faster search Message-ID: <20050610132812.R94573@vbp2.vbp2.com> 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/243 X-Sequence-Number: 12880 Hi- Would someone please enlighten me as to why I'm not seeing a faster execution time on the simple scenario below? there are 412,485 rows in the table and the query matches on 132,528 rows, taking almost a minute to execute. vaccuum analyze was just run. Thanks! Clark test ------------------------- id | integer partnumber | character varying(32) productlistid | integer typeid | integer Indexes: "test_id" btree (id) "test_plid" btree (productlistid) "test_typeid" btree (typeid) "test_plidtypeid" btree (productlistid, typeid) explain analyze select * from test where productlistid=3 and typeid=9 order by partnumber limit 15; QUERY PLAN --------------------------------------------------------------------------------------------- Limit (cost=201073.76..201073.79 rows=15 width=722) (actual time=58092.477..58092.518 rows=15 loops=1) -> Sort (cost=201073.76..201451.76 rows=151200 width=722) (actual time=58092.470..58092.505 rows=15 loops=1) Sort Key: partnumber -> Seq Scan on test (cost=0.00..96458.27 rows=151200 width=722) (actual time=2.515..40201.275 rows=132528 loops=1) Filter: ((productlistid = 3) AND (typeid = 9)) Total runtime: 59664.765 ms (6 rows) System specs: PostgreSQL 7.4.2 on RedHat 9 dual AMD Athlon 2GHz processors 1 gig memory mirrored 7200 RPM IDE disks From pgsql-performance-owner@postgresql.org Fri Jun 10 14:51: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 DAA3B52823 for ; Fri, 10 Jun 2005 14:51:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98527-08 for ; Fri, 10 Jun 2005 17:51:40 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id D7C3B52875 for ; Fri, 10 Jun 2005 14:51:39 -0300 (ADT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1DgnfK-0006Jk-Ez for pgsql-performance@postgresql.org; Fri, 10 Jun 2005 19:51:37 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1DgnfI-0004ei-00 for ; Fri, 10 Jun 2005 19:51:32 +0200 Date: Fri, 10 Jun 2005 19:51:32 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: faster search Message-ID: <20050610175132.GA17744@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <20050610132812.R94573@vbp2.vbp2.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20050610132812.R94573@vbp2.vbp2.com> X-Operating-System: Linux 2.6.11.8 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.9i 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: 200506/244 X-Sequence-Number: 12881 On Fri, Jun 10, 2005 at 01:45:05PM -0400, Clark Slater wrote: > Indexes: > "test_id" btree (id) > "test_plid" btree (productlistid) > "test_typeid" btree (typeid) > "test_plidtypeid" btree (productlistid, typeid) > > > explain analyze select * from test where productlistid=3 and typeid=9 > order by partnumber limit 15; You do not have an index on partnumber. Try adding one. /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Fri Jun 10 15:01: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 E8818528B7 for ; Fri, 10 Jun 2005 15:01:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98787-09 for ; Fri, 10 Jun 2005 18:01:03 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 98728528B1 for ; Fri, 10 Jun 2005 15:01:02 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j5AI10ot023276; (envelope-from ) Fri, 10 Jun 2005 13:01:01 -0500 (CDT) Received: from [192.168.1.11] ([12.215.118.172]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j5AI0x7I005269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Fri, 10 Jun 2005 13:01:00 -0500 (CDT) Message-ID: <42A9D556.7070108@arbash-meinel.com> Date: Fri, 10 Jun 2005 13:00:54 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Clark Slater Cc: pgsql-performance@postgresql.org Subject: Re: faster search References: <20050610132812.R94573@vbp2.vbp2.com> In-Reply-To: <20050610132812.R94573@vbp2.vbp2.com> X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9A20CF5F1BDB9BD858893E30" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean 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: 200506/245 X-Sequence-Number: 12882 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9A20CF5F1BDB9BD858893E30 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Clark Slater wrote: > Hi- > > Would someone please enlighten me as > to why I'm not seeing a faster execution > time on the simple scenario below? > > there are 412,485 rows in the table and the > query matches on 132,528 rows, taking > almost a minute to execute. vaccuum > analyze was just run. Well, if you are matching 130k out of 400k rows, then a sequential scan is certainly prefered to an index scan. And then you have to sort those 130k rows by partnumber. This *might* be spilling to disk depending on what your workmem/sortmem is set to. I would also say that what you would really want is some way to get the whole thing from an index. And I think the way to do that is: CREATE INDEX test_partnum_listid_typeid_idx ON test(partnumber, productlistid, typeid); VACUUM ANALYZE test; EXPLAIN ANALYZE SELECT * FROM test WHERE productlistid=3 AND typeid=9 ORDER BY partnumber, productlistid, typeid LIMIT 15 ; The trick is that you have to match the order by exactly with the index, so the planner realizes it can do an indexed lookup to get the information. You could also just create an index on partnumber, and see how that affects your original query. I think the planner could use an index lookup on partnumber to get the ordering correct. But it will have to do filtering after the fact based on productlistid and typeid. With my extended index, I think the planner can be smarter and lookup all 3 by the index. > > Thanks! > Clark Good luck, John =:-> --------------enig9A20CF5F1BDB9BD858893E30 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.1 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFCqdVZJdeBCYSNAAMRAi3iAJ99hAuDUUDttUAvzpO7+b96NyEZAACfRUOx Z+BUvbxWcVRAWDcrABX48so= =jQ1Z -----END PGP SIGNATURE----- --------------enig9A20CF5F1BDB9BD858893E30-- From pgsql-performance-owner@postgresql.org Fri Jun 10 15:05: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 B29F452931 for ; Fri, 10 Jun 2005 15:05:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01453-08 for ; Fri, 10 Jun 2005 18:05:50 +0000 (GMT) Received: from mail.nordicbet.com (mail.nordicbet.com [193.69.167.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0332652971 for ; Fri, 10 Jun 2005 15:05:46 -0300 (ADT) Received: from estneti-gw.online.ee ([62.65.34.222] helo=tobias.nordicbet.invalid) (Authenticated Sender=tobias@nordicbet.com) by mail.nordicbet.com with esmtpa (Exim 4.50 #1 (Debian)) id 1DgnsZ-0005ds-2T; Fri, 10 Jun 2005 20:05:24 +0200 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id CABFDE0C54; Fri, 10 Jun 2005 21:05:35 +0300 (EEST) Date: Fri, 10 Jun 2005 21:05:35 +0300 From: Tobias Brox To: Clark Slater Cc: pgsql-performance@postgresql.org Subject: Re: faster search Message-ID: <20050610180535.GQ8451@tobias.nordicbet.com> References: <20050610132812.R94573@vbp2.vbp2.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050610132812.R94573@vbp2.vbp2.com> Organization: Group Nordicbet User-Agent: Mutt/1.5.6i 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: 200506/246 X-Sequence-Number: 12883 [Clark Slater - Fri at 01:45:05PM -0400] > Would someone please enlighten me as > to why I'm not seeing a faster execution > time on the simple scenario below? Just some thoughts from a novice PG-DBA .. :-) My general experience is that PG usually prefers sequal scans to indices if a large portion of the table is to be selected, because it is faster to do a seqscan than to follow an index and constantly seek between different positions on the hard disk. However, most of the time is spent sorting on partnumber, and you only want 15 rows, so of course you should have an index on partnumber! Picking up 15 rows will be ligtning fast with that index. If you may want to select significantly more than 15 rows, you can also try to make a partial index: create index test_pli3_ti9_by_part on test (partnumber) where productlistid=3 and typeid=9; If 3 and 9 are not constants in the query, try to make a three-key index (it's important with partnumber because a lot of time is spent sorting): create index test_pli_type_part on test (productslistid,typeid,partnumber); To get pg to recognize the index, you will probably have to help it a bit: select * from test where productlistid=3 and typeid=9 order by productlistid,typeid,partnumber limit 15; -- Tobias Brox, +47-91700050 From pgsql-performance-owner@postgresql.org Fri Jun 10 16:50: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 8A41852822 for ; Fri, 10 Jun 2005 16:50:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26516-05 for ; Fri, 10 Jun 2005 19:50:02 +0000 (GMT) Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) by svr1.postgresql.org (Postfix) with ESMTP id CB4B452885 for ; Fri, 10 Jun 2005 16:50:00 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Fri, 10 Jun 2005 14:50:00 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Date: Fri, 10 Jun 2005 14:49:57 -0500 From: "Kevin Grittner" To: Cc: Subject: Re: Help with rewriting query Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.064 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/247 X-Sequence-Number: 12884 With your current (apparently well-normalized) schema, I don't see how you can get a better query plan than that. There may be something you can do in terms of memory configuration to get it to execute somewhat faster, but the only way to make it really fast is to de-normalize. This is something which is often necessary for performance. If you add a column to the person table for "last_food_id" and triggers to maintain it when the food table is modified, voila! You have a simple and fast way to get the results you want. -Kevin >>> Junaili Lie 06/09/05 8:30 PM >>> Hi Kevin, Thanks for the reply. I tried that query. It definately faster, but not fast enough (took around 50 second to complete). I have around 2.5 million on food and 1000 on person. Here is the query plan: QUERY PLAN ---------------------------------------------------------------------------------------------------------------- Merge Join (cost=0.00..11662257.52 rows=1441579 width=16) Merge Cond: ("outer".id = "inner".p_id) -> Index Scan using person_pkey on person p (cost=0.00..25.17 rows=569 width=8) -> Index Scan using p_id_food_index on food f (cost=0.00..11644211.28 rows=1441579 width=16) Filter: (NOT (subplan)) SubPlan -> Index Scan using p_id_food_index on food f2 (cost=0.00..11288.47 rows=2835 width=177) Index Cond: (p_id = $0) Filter: (id > $1) (9 rows) I appreciate if you have further ideas to troubleshoot this issue. Thank you! On 6/8/05, Kevin Grittner wrote: > This is a pattern which I've seen many of times. I call it a "best > choice" query -- you can easily match a row from one table against any > of a number of rows in another, the trick is to pick the one that > matters most. I've generally found that I want the query results to > show more than the columns used for making the choice (and there can be > many), which rules out the min/max technique. What works in a pretty > straitforward way, and generally optimizes at least as well as the > alternatives, is to join to the set of candidate rows and add a "not > exists" test to eliminate all but the best choice. > > For your example, I've taken some liberties and added hypothetical > columns from both tables to the result set, to demonstrate how that > works. Feel free to drop them or substitute actual columns as you see > fit. This will work best if there is an index for the food table on > p_id and id. Please let me know whether this works for you. > > select p.id as p_id, p.fullname, f.id, f.foodtype, f.ts > from food f join person p > on f.p_id = p.id > and not exists (select * from food f2 where f2.p_id = f.p_id and f2.id > > f.id) > order by p_id > > Note that this construct works for inner or outer joins and works > regardless of how complex the logic for picking the best choice is. I > think one reason this tends to optimize well is that an EXISTS test can > finish as soon as it finds one matching row. > > -Kevin > > > >>> Junaili Lie 06/08/05 2:34 PM >>> > Hi, > I have the following table: > person - primary key id, and some attributes > food - primary key id, foreign key p_id reference to table person. > > table food store all the food that a person is eating. The more recent > food is indicated by the higher food.id. > > I need to find what is the most recent food a person ate for every > person. > The query: > select f.p_id, max(f.id) from person p, food f where p.id=f.p_id group > by f.p_id will work. > But I understand this is not the most efficient way. Is there another > way to rewrite this query? (maybe one that involves order by desc > limit 1) > > Thank you in advance. > > ---------------------------(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 > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings From pgsql-performance-owner@postgresql.org Fri Jun 10 17:12: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 CF04052889 for ; Fri, 10 Jun 2005 17:12:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32635-09 for ; Fri, 10 Jun 2005 20:12:14 +0000 (GMT) Received: from gp.word-to-the-wise.com (gp.word-to-the-wise.com [64.71.176.18]) by svr1.postgresql.org (Postfix) with ESMTP id 0AD7C52849 for ; Fri, 10 Jun 2005 17:12:13 -0300 (ADT) Received: by gp.word-to-the-wise.com (Postfix, from userid 500) id AD2A98FC07C; Fri, 10 Jun 2005 13:12:40 -0700 (PDT) Date: Fri, 10 Jun 2005 13:12:40 -0700 From: Steve Atkins To: pgsql-performance@postgresql.org Subject: Re: faster search Message-ID: <20050610201240.GA9822@gp.word-to-the-wise.com> References: <20050610132812.R94573@vbp2.vbp2.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050610132812.R94573@vbp2.vbp2.com> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.826 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST X-Spam-Level: X-Archive-Number: 200506/248 X-Sequence-Number: 12885 On Fri, Jun 10, 2005 at 01:45:05PM -0400, Clark Slater wrote: > Hi- > > Would someone please enlighten me as > to why I'm not seeing a faster execution > time on the simple scenario below? Because you need to extract a huge number of rows via a seqscan, sort them and then throw them away, I think. > explain analyze select * from test where productlistid=3 and typeid=9 > order by partnumber limit 15; Create an index on (productlistid, typeid, partnumber) then select * from test where productlistid=3 and typeid=9 order by productlistid, typeid, partnumber LIMIT 15; ? Cheers, Steve From pgsql-novice-owner@postgresql.org Fri Jun 10 18:13:08 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 BD5925284D for ; Fri, 10 Jun 2005 18:13:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43669-08 for ; Fri, 10 Jun 2005 21:12:58 +0000 (GMT) Received: from viefep11-int.chello.at (viefep11-int.chello.at [213.46.255.27]) by svr1.postgresql.org (Postfix) with ESMTP id 3B6085281E for ; Fri, 10 Jun 2005 18:12:55 -0300 (ADT) Received: from OTTO ([213.222.172.216]) by viefep11-int.chello.at (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with SMTP id <20050610211256.PEHD1768.viefep11-int.chello.at@OTTO> for ; Fri, 10 Jun 2005 23:12:56 +0200 Message-ID: <008601c56e01$2c114880$b000a8c0@OTTO> From: =?iso-8859-1?Q?Havasv=F6lgyi_Ott=F3?= To: References: <20050418174701.BDD1219007F@arica.terra.com.br> Subject: need suggestion for server sizing Date: Fri, 10 Jun 2005 23:12:56 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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-Archive-Number: 200506/63 X-Sequence-Number: 13656 Hi all, I need your help to determine the configuration of a server machine, and the PG DBMS. There will be not more than 25 concurrent users. They will use a business software that accesses tha database. The database will be not that large, it seems that none of the tables's recordcount will exceed 1-2 million, but there will be a lot of small (<5000 record) tables. The numbert of tables will be about 300. What server would you install to such a site to make the database respond quickly in any case? I would like to leave fsync on. Perhaps you need some additional information. In this case just indicate it. Thanks in advance, Otto From pgsql-performance-owner@postgresql.org Fri Jun 10 21:08: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 7EA3B5292E for ; Fri, 10 Jun 2005 21:08:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83933-09 for ; Sat, 11 Jun 2005 00:08:01 +0000 (GMT) Received: from vbp2.vbp2.com (vbp2.com [66.207.137.158]) by svr1.postgresql.org (Postfix) with ESMTP id 548AE528F3 for ; Fri, 10 Jun 2005 21:08:00 -0300 (ADT) Received: from vbp2.vbp2.com (localhost [127.0.0.1]) by vbp2.vbp2.com (8.13.1/8.13.1) with ESMTP id j5B081Xv041072 for ; Fri, 10 Jun 2005 20:08:01 -0400 (EDT) (envelope-from list@slatech.com) Received: from localhost (list@localhost) by vbp2.vbp2.com (8.13.1/8.13.1/Submit) with ESMTP id j5B07vY4041069 for ; Fri, 10 Jun 2005 20:08:01 -0400 (EDT) (envelope-from list@slatech.com) X-Authentication-Warning: vbp2.vbp2.com: list owned process doing -bs Date: Fri, 10 Jun 2005 20:07:57 -0400 (EDT) From: Clark Slater X-X-Sender: list@vbp2.vbp2.com To: pgsql-performance@postgresql.org Subject: Re: faster search In-Reply-To: <42A9D556.7070108@arbash-meinel.com> Message-ID: <20050610200358.R40688@vbp2.vbp2.com> References: <20050610132812.R94573@vbp2.vbp2.com> <42A9D556.7070108@arbash-meinel.com> 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/249 X-Sequence-Number: 12886 hmm, i'm baffled. i simplified the query and it is still taking forever... test ------------------------- id | integer partnumber | character varying(32) productlistid | integer typeid | integer Indexes: "test_productlistid" btree (productlistid) "test_typeid" btree (typeid) "test_productlistid_typeid" btree (productlistid, typeid) explain analyze select * from test where (productlistid=3 and typeid=9); QUERY PLAN ----------------------------------------------------------------------- Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual time=516.459..41930.250 rows=132528 loops=1) Filter: ((productlistid = 3) AND (typeid = 9)) Total runtime: 41975.154 ms (3 rows) System specs: PostgreSQL 7.4.2 on RedHat 9 dual AMD Athlon 2GHz processors 1 gig memory mirrored 7200 RPM IDE disks On Fri, 10 Jun 2005, John A Meinel wrote: > Clark Slater wrote: >> Hi- >> >> Would someone please enlighten me as >> to why I'm not seeing a faster execution >> time on the simple scenario below? >> >> there are 412,485 rows in the table and the >> query matches on 132,528 rows, taking >> almost a minute to execute. vaccuum >> analyze was just run. > > Well, if you are matching 130k out of 400k rows, then a sequential scan > is certainly prefered to an index scan. And then you have to sort those > 130k rows by partnumber. This *might* be spilling to disk depending on > what your workmem/sortmem is set to. > > I would also say that what you would really want is some way to get the > whole thing from an index. And I think the way to do that is: > > CREATE INDEX test_partnum_listid_typeid_idx ON > test(partnumber, productlistid, typeid); > > VACUUM ANALYZE test; > > EXPLAIN ANALYZE SELECT * FROM test > WHERE productlistid=3 AND typeid=9 > ORDER BY partnumber, productlistid, typeid > LIMIT 15 > ; > > The trick is that you have to match the order by exactly with the index, > so the planner realizes it can do an indexed lookup to get the information. > > You could also just create an index on partnumber, and see how that > affects your original query. I think the planner could use an index > lookup on partnumber to get the ordering correct. But it will have to do > filtering after the fact based on productlistid and typeid. > With my extended index, I think the planner can be smarter and lookup > all 3 by the index. > >> >> Thanks! >> Clark > > Good luck, > John > =:-> > From pgsql-performance-owner@postgresql.org Fri Jun 10 21:14: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 C0904528F3 for ; Fri, 10 Jun 2005 21:14:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82767-09 for ; Sat, 11 Jun 2005 00:14:04 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 052E652823 for ; Fri, 10 Jun 2005 21:14:03 -0300 (ADT) Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j5B03xa3000338; Fri, 10 Jun 2005 17:04:00 -0700 Message-ID: <42AA2CE9.8040901@commandprompt.com> Date: Fri, 10 Jun 2005 17:14:33 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Clark Slater Cc: pgsql-performance@postgresql.org Subject: Re: faster search References: <20050610132812.R94573@vbp2.vbp2.com> <42A9D556.7070108@arbash-meinel.com> <20050610200358.R40688@vbp2.vbp2.com> In-Reply-To: <20050610200358.R40688@vbp2.vbp2.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.027 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/250 X-Sequence-Number: 12887 Clark Slater wrote: > hmm, i'm baffled. i simplified the query > and it is still taking forever... What happens if you: alter table test alter column productlistid set statistics 150; alter table test alter column typeid set statistics 150; explain analyze select * from test where (productlistid=3 and typeid=9); Sincerely, Joshua D. Drake > > > test > ------------------------- > id | integer > partnumber | character varying(32) > productlistid | integer > typeid | integer > > > Indexes: > "test_productlistid" btree (productlistid) > "test_typeid" btree (typeid) > "test_productlistid_typeid" btree (productlistid, typeid) > > > explain analyze select * from test where (productlistid=3 and typeid=9); > > QUERY PLAN > ----------------------------------------------------------------------- > Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual > time=516.459..41930.250 rows=132528 loops=1) > Filter: ((productlistid = 3) AND (typeid = 9)) > Total runtime: 41975.154 ms > (3 rows) > > > System specs: > PostgreSQL 7.4.2 on RedHat 9 > dual AMD Athlon 2GHz processors > 1 gig memory > mirrored 7200 RPM IDE disks > > > On Fri, 10 Jun 2005, John A Meinel wrote: > >> Clark Slater wrote: >> >>> Hi- >>> >>> Would someone please enlighten me as >>> to why I'm not seeing a faster execution >>> time on the simple scenario below? >>> >>> there are 412,485 rows in the table and the >>> query matches on 132,528 rows, taking >>> almost a minute to execute. vaccuum >>> analyze was just run. >> >> >> Well, if you are matching 130k out of 400k rows, then a sequential scan >> is certainly prefered to an index scan. And then you have to sort those >> 130k rows by partnumber. This *might* be spilling to disk depending on >> what your workmem/sortmem is set to. >> >> I would also say that what you would really want is some way to get the >> whole thing from an index. And I think the way to do that is: >> >> CREATE INDEX test_partnum_listid_typeid_idx ON >> test(partnumber, productlistid, typeid); >> >> VACUUM ANALYZE test; >> >> EXPLAIN ANALYZE SELECT * FROM test >> WHERE productlistid=3 AND typeid=9 >> ORDER BY partnumber, productlistid, typeid >> LIMIT 15 >> ; >> >> The trick is that you have to match the order by exactly with the index, >> so the planner realizes it can do an indexed lookup to get the >> information. >> >> You could also just create an index on partnumber, and see how that >> affects your original query. I think the planner could use an index >> lookup on partnumber to get the ordering correct. But it will have to do >> filtering after the fact based on productlistid and typeid. >> With my extended index, I think the planner can be smarter and lookup >> all 3 by the index. >> >>> >>> Thanks! >>> Clark >> >> >> Good luck, >> John >> =:-> >> > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) -- Your PostgreSQL solutions provider, Command Prompt, Inc. 24x7 support - 1.800.492.2240, programming, and consulting Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit http://www.commandprompt.com / http://www.postgresql.org From pgsql-performance-owner@postgresql.org Fri Jun 10 21:20: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 D800752947 for ; Fri, 10 Jun 2005 21:20:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93078-01 for ; Sat, 11 Jun 2005 00:20:27 +0000 (GMT) Received: from vbp2.vbp2.com (vbp2.com [66.207.137.158]) by svr1.postgresql.org (Postfix) with ESMTP id 8644D528C6 for ; Fri, 10 Jun 2005 21:20:25 -0300 (ADT) Received: from vbp2.vbp2.com (localhost [127.0.0.1]) by vbp2.vbp2.com (8.13.1/8.13.1) with ESMTP id j5B0KPgH041411; Fri, 10 Jun 2005 20:20:25 -0400 (EDT) (envelope-from list@slatech.com) Received: from localhost (list@localhost) by vbp2.vbp2.com (8.13.1/8.13.1/Submit) with ESMTP id j5B0KP81041408; Fri, 10 Jun 2005 20:20:25 -0400 (EDT) (envelope-from list@slatech.com) X-Authentication-Warning: vbp2.vbp2.com: list owned process doing -bs Date: Fri, 10 Jun 2005 20:20:25 -0400 (EDT) From: Clark Slater X-X-Sender: list@vbp2.vbp2.com To: "Joshua D. Drake" Cc: pgsql-performance@postgresql.org Subject: Re: faster search In-Reply-To: <42AA2CE9.8040901@commandprompt.com> Message-ID: <20050610201740.R40688@vbp2.vbp2.com> References: <20050610132812.R94573@vbp2.vbp2.com> <42A9D556.7070108@arbash-meinel.com> <20050610200358.R40688@vbp2.vbp2.com> <42AA2CE9.8040901@commandprompt.com> 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/251 X-Sequence-Number: 12888 thanks for your suggestion. a small improvement. still pretty slow... vbp=# alter table test alter column productlistid set statistics 150; ALTER TABLE vbp=# alter table test alter column typeid set statistics 150; ALTER TABLE vbp=# explain analyze select * from test where (productlistid=3 and typeid=9); QUERY PLAN ------------------------------------------------------------------------------ Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual time=525.617..36802.556 rows=132528 loops=1) Filter: ((productlistid = 3) AND (typeid = 9)) Total runtime: 36847.754 ms (3 rows) Time: 36850.719 ms On Fri, 10 Jun 2005, Joshua D. Drake wrote: > Clark Slater wrote: >> hmm, i'm baffled. i simplified the query >> and it is still taking forever... > > What happens if you: > > alter table test alter column productlistid set statistics 150; > alter table test alter column typeid set statistics 150; > explain analyze select * from test where (productlistid=3 and typeid=9); > > Sincerely, > > Joshua D. Drake > > >> >> >> test >> ------------------------- >> id | integer >> partnumber | character varying(32) >> productlistid | integer >> typeid | integer >> >> >> Indexes: >> "test_productlistid" btree (productlistid) >> "test_typeid" btree (typeid) >> "test_productlistid_typeid" btree (productlistid, typeid) >> >> >> explain analyze select * from test where (productlistid=3 and typeid=9); >> >> QUERY PLAN >> ----------------------------------------------------------------------- >> Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual >> time=516.459..41930.250 rows=132528 loops=1) >> Filter: ((productlistid = 3) AND (typeid = 9)) >> Total runtime: 41975.154 ms >> (3 rows) >> >> >> System specs: >> PostgreSQL 7.4.2 on RedHat 9 >> dual AMD Athlon 2GHz processors >> 1 gig memory >> mirrored 7200 RPM IDE disks >> >> >> On Fri, 10 Jun 2005, John A Meinel wrote: >> >>> Clark Slater wrote: >>> >>>> Hi- >>>> >>>> Would someone please enlighten me as >>>> to why I'm not seeing a faster execution >>>> time on the simple scenario below? >>>> >>>> there are 412,485 rows in the table and the >>>> query matches on 132,528 rows, taking >>>> almost a minute to execute. vaccuum >>>> analyze was just run. >>> >>> >>> Well, if you are matching 130k out of 400k rows, then a sequential scan >>> is certainly prefered to an index scan. And then you have to sort those >>> 130k rows by partnumber. This *might* be spilling to disk depending on >>> what your workmem/sortmem is set to. >>> >>> I would also say that what you would really want is some way to get the >>> whole thing from an index. And I think the way to do that is: >>> >>> CREATE INDEX test_partnum_listid_typeid_idx ON >>> test(partnumber, productlistid, typeid); >>> >>> VACUUM ANALYZE test; >>> >>> EXPLAIN ANALYZE SELECT * FROM test >>> WHERE productlistid=3 AND typeid=9 >>> ORDER BY partnumber, productlistid, typeid >>> LIMIT 15 >>> ; >>> >>> The trick is that you have to match the order by exactly with the index, >>> so the planner realizes it can do an indexed lookup to get the >>> information. >>> >>> You could also just create an index on partnumber, and see how that >>> affects your original query. I think the planner could use an index >>> lookup on partnumber to get the ordering correct. But it will have to do >>> filtering after the fact based on productlistid and typeid. >>> With my extended index, I think the planner can be smarter and lookup >>> all 3 by the index. >>> >>>> >>>> Thanks! >>>> Clark >>> >>> >>> Good luck, >>> John >>> =:-> >>> >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 2: you can get off all lists at once with the unregister command >> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > > -- > Your PostgreSQL solutions provider, Command Prompt, Inc. > 24x7 support - 1.800.492.2240, programming, and consulting > Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit > http://www.commandprompt.com / http://www.postgresql.org > From pgsql-performance-owner@postgresql.org Fri Jun 10 21:46: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 C667A5280B for ; Fri, 10 Jun 2005 21:46:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94604-04 for ; Sat, 11 Jun 2005 00:46:24 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 22374528C6 for ; Fri, 10 Jun 2005 21:46:23 -0300 (ADT) Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j5B0aJa3002060; Fri, 10 Jun 2005 17:36:19 -0700 Message-ID: <42AA347D.2080407@commandprompt.com> Date: Fri, 10 Jun 2005 17:46:53 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Clark Slater Cc: pgsql-performance@postgresql.org Subject: Re: faster search References: <20050610132812.R94573@vbp2.vbp2.com> <42A9D556.7070108@arbash-meinel.com> <20050610200358.R40688@vbp2.vbp2.com> <42AA2CE9.8040901@commandprompt.com> <20050610201740.R40688@vbp2.vbp2.com> In-Reply-To: <20050610201740.R40688@vbp2.vbp2.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.026 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/252 X-Sequence-Number: 12889 Clark Slater wrote: > thanks for your suggestion. > a small improvement. still pretty slow... > > vbp=# alter table test alter column productlistid set statistics 150; > ALTER TABLE > vbp=# alter table test alter column typeid set statistics 150; > ALTER TABLE > vbp=# explain analyze select * from test where (productlistid=3 and > typeid=9); > QUERY PLAN > ------------------------------------------------------------------------------ > > Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual > time=525.617..36802.556 rows=132528 loops=1) > Filter: ((productlistid = 3) AND (typeid = 9)) > Total runtime: 36847.754 ms > (3 rows) > > Time: 36850.719 ms > > > On Fri, 10 Jun 2005, Joshua D. Drake wrote: > >> Clark Slater wrote: >> >>> hmm, i'm baffled. i simplified the query >>> and it is still taking forever... >> >> >> What happens if you: >> >> alter table test alter column productlistid set statistics 150; >> alter table test alter column typeid set statistics 150; >> explain analyze select * from test where (productlistid=3 and typeid=9); How many rows should it return? >> >> Sincerely, >> >> Joshua D. Drake >> >> >>> >>> >>> test >>> ------------------------- >>> id | integer >>> partnumber | character varying(32) >>> productlistid | integer >>> typeid | integer >>> >>> >>> Indexes: >>> "test_productlistid" btree (productlistid) >>> "test_typeid" btree (typeid) >>> "test_productlistid_typeid" btree (productlistid, typeid) >>> >>> >>> explain analyze select * from test where (productlistid=3 and typeid=9); >>> >>> QUERY PLAN >>> ----------------------------------------------------------------------- >>> Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual >>> time=516.459..41930.250 rows=132528 loops=1) >>> Filter: ((productlistid = 3) AND (typeid = 9)) >>> Total runtime: 41975.154 ms >>> (3 rows) >>> >>> >>> System specs: >>> PostgreSQL 7.4.2 on RedHat 9 >>> dual AMD Athlon 2GHz processors >>> 1 gig memory >>> mirrored 7200 RPM IDE disks >>> >>> >>> On Fri, 10 Jun 2005, John A Meinel wrote: >>> >>>> Clark Slater wrote: >>>> >>>>> Hi- >>>>> >>>>> Would someone please enlighten me as >>>>> to why I'm not seeing a faster execution >>>>> time on the simple scenario below? >>>>> >>>>> there are 412,485 rows in the table and the >>>>> query matches on 132,528 rows, taking >>>>> almost a minute to execute. vaccuum >>>>> analyze was just run. >>>> >>>> >>>> >>>> Well, if you are matching 130k out of 400k rows, then a sequential scan >>>> is certainly prefered to an index scan. And then you have to sort those >>>> 130k rows by partnumber. This *might* be spilling to disk depending on >>>> what your workmem/sortmem is set to. >>>> >>>> I would also say that what you would really want is some way to get the >>>> whole thing from an index. And I think the way to do that is: >>>> >>>> CREATE INDEX test_partnum_listid_typeid_idx ON >>>> test(partnumber, productlistid, typeid); >>>> >>>> VACUUM ANALYZE test; >>>> >>>> EXPLAIN ANALYZE SELECT * FROM test >>>> WHERE productlistid=3 AND typeid=9 >>>> ORDER BY partnumber, productlistid, typeid >>>> LIMIT 15 >>>> ; >>>> >>>> The trick is that you have to match the order by exactly with the >>>> index, >>>> so the planner realizes it can do an indexed lookup to get the >>>> information. >>>> >>>> You could also just create an index on partnumber, and see how that >>>> affects your original query. I think the planner could use an index >>>> lookup on partnumber to get the ordering correct. But it will have >>>> to do >>>> filtering after the fact based on productlistid and typeid. >>>> With my extended index, I think the planner can be smarter and lookup >>>> all 3 by the index. >>>> >>>>> >>>>> Thanks! >>>>> Clark >>>> >>>> >>>> >>>> Good luck, >>>> John >>>> =:-> >>>> >>> >>> ---------------------------(end of broadcast)--------------------------- >>> TIP 2: you can get off all lists at once with the unregister command >>> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >> >> >> >> -- >> Your PostgreSQL solutions provider, Command Prompt, Inc. >> 24x7 support - 1.800.492.2240, programming, and consulting >> Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit >> http://www.commandprompt.com / http://www.postgresql.org >> > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Your PostgreSQL solutions provider, Command Prompt, Inc. 24x7 support - 1.800.492.2240, programming, and consulting Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit http://www.commandprompt.com / http://www.postgresql.org From pgsql-performance-owner@postgresql.org Fri Jun 10 21:48: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 CEB3552969 for ; Fri, 10 Jun 2005 21:48:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98623-03 for ; Sat, 11 Jun 2005 00:48:09 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 72734528C6 for ; Fri, 10 Jun 2005 21:48:09 -0300 (ADT) Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j5B0c5a3002236; Fri, 10 Jun 2005 17:38:05 -0700 Message-ID: <42AA34E7.3060006@commandprompt.com> Date: Fri, 10 Jun 2005 17:48:39 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Clark Slater Cc: pgsql-performance@postgresql.org Subject: Re: faster search References: <20050610132812.R94573@vbp2.vbp2.com> <42A9D556.7070108@arbash-meinel.com> <20050610200358.R40688@vbp2.vbp2.com> <42AA2CE9.8040901@commandprompt.com> <20050610201740.R40688@vbp2.vbp2.com> In-Reply-To: <20050610201740.R40688@vbp2.vbp2.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.026 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/253 X-Sequence-Number: 12890 Clark Slater wrote: > thanks for your suggestion. > a small improvement. still pretty slow... > > vbp=# alter table test alter column productlistid set statistics 150; > ALTER TABLE > vbp=# alter table test alter column typeid set statistics 150; > ALTER TABLE > vbp=# explain analyze select * from test where (productlistid=3 and Hello, Also what happens if you: set enable_seqscan = false; explain analyze query.... Sincerely, Joshua D. Drake > typeid=9); > QUERY PLAN > ------------------------------------------------------------------------------ > > Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual > time=525.617..36802.556 rows=132528 loops=1) > Filter: ((productlistid = 3) AND (typeid = 9)) > Total runtime: 36847.754 ms > (3 rows) > > Time: 36850.719 ms > > > On Fri, 10 Jun 2005, Joshua D. Drake wrote: > >> Clark Slater wrote: >> >>> hmm, i'm baffled. i simplified the query >>> and it is still taking forever... >> >> >> What happens if you: >> >> alter table test alter column productlistid set statistics 150; >> alter table test alter column typeid set statistics 150; >> explain analyze select * from test where (productlistid=3 and typeid=9); >> >> Sincerely, >> >> Joshua D. Drake >> >> >>> >>> >>> test >>> ------------------------- >>> id | integer >>> partnumber | character varying(32) >>> productlistid | integer >>> typeid | integer >>> >>> >>> Indexes: >>> "test_productlistid" btree (productlistid) >>> "test_typeid" btree (typeid) >>> "test_productlistid_typeid" btree (productlistid, typeid) >>> >>> >>> explain analyze select * from test where (productlistid=3 and typeid=9); >>> >>> QUERY PLAN >>> ----------------------------------------------------------------------- >>> Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual >>> time=516.459..41930.250 rows=132528 loops=1) >>> Filter: ((productlistid = 3) AND (typeid = 9)) >>> Total runtime: 41975.154 ms >>> (3 rows) >>> >>> >>> System specs: >>> PostgreSQL 7.4.2 on RedHat 9 >>> dual AMD Athlon 2GHz processors >>> 1 gig memory >>> mirrored 7200 RPM IDE disks >>> >>> >>> On Fri, 10 Jun 2005, John A Meinel wrote: >>> >>>> Clark Slater wrote: >>>> >>>>> Hi- >>>>> >>>>> Would someone please enlighten me as >>>>> to why I'm not seeing a faster execution >>>>> time on the simple scenario below? >>>>> >>>>> there are 412,485 rows in the table and the >>>>> query matches on 132,528 rows, taking >>>>> almost a minute to execute. vaccuum >>>>> analyze was just run. >>>> >>>> >>>> >>>> Well, if you are matching 130k out of 400k rows, then a sequential scan >>>> is certainly prefered to an index scan. And then you have to sort those >>>> 130k rows by partnumber. This *might* be spilling to disk depending on >>>> what your workmem/sortmem is set to. >>>> >>>> I would also say that what you would really want is some way to get the >>>> whole thing from an index. And I think the way to do that is: >>>> >>>> CREATE INDEX test_partnum_listid_typeid_idx ON >>>> test(partnumber, productlistid, typeid); >>>> >>>> VACUUM ANALYZE test; >>>> >>>> EXPLAIN ANALYZE SELECT * FROM test >>>> WHERE productlistid=3 AND typeid=9 >>>> ORDER BY partnumber, productlistid, typeid >>>> LIMIT 15 >>>> ; >>>> >>>> The trick is that you have to match the order by exactly with the >>>> index, >>>> so the planner realizes it can do an indexed lookup to get the >>>> information. >>>> >>>> You could also just create an index on partnumber, and see how that >>>> affects your original query. I think the planner could use an index >>>> lookup on partnumber to get the ordering correct. But it will have >>>> to do >>>> filtering after the fact based on productlistid and typeid. >>>> With my extended index, I think the planner can be smarter and lookup >>>> all 3 by the index. >>>> >>>>> >>>>> Thanks! >>>>> Clark >>>> >>>> >>>> >>>> Good luck, >>>> John >>>> =:-> >>>> >>> >>> ---------------------------(end of broadcast)--------------------------- >>> TIP 2: you can get off all lists at once with the unregister command >>> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >> >> >> >> -- >> Your PostgreSQL solutions provider, Command Prompt, Inc. >> 24x7 support - 1.800.492.2240, programming, and consulting >> Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit >> http://www.commandprompt.com / http://www.postgresql.org >> > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Your PostgreSQL solutions provider, Command Prompt, Inc. 24x7 support - 1.800.492.2240, programming, and consulting Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit http://www.commandprompt.com / http://www.postgresql.org From pgsql-performance-owner@postgresql.org Fri Jun 10 21: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 75314528C6 for ; Fri, 10 Jun 2005 21:51:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00237-01 for ; Sat, 11 Jun 2005 00:51:42 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id B6A705280B for ; Fri, 10 Jun 2005 21:51:40 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j5B0pfch006243; (envelope-from ) Fri, 10 Jun 2005 19:51:41 -0500 (CDT) Received: from [192.168.1.11] ([12.215.118.172]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j5B0peU8006522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Fri, 10 Jun 2005 19:51:40 -0500 (CDT) Message-ID: <42AA3598.4080001@arbash-meinel.com> Date: Fri, 10 Jun 2005 19:51:36 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Clark Slater Cc: pgsql-performance@postgresql.org Subject: Re: faster search References: <20050610132812.R94573@vbp2.vbp2.com> <42A9D556.7070108@arbash-meinel.com> <20050610200358.R40688@vbp2.vbp2.com> In-Reply-To: <20050610200358.R40688@vbp2.vbp2.com> X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig7ACD2779A4F28991DF6B4A66" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean 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: 200506/254 X-Sequence-Number: 12891 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7ACD2779A4F28991DF6B4A66 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Clark Slater wrote: > hmm, i'm baffled. i simplified the query > and it is still taking forever... > > > test > ------------------------- > id | integer > partnumber | character varying(32) > productlistid | integer > typeid | integer > > > Indexes: > "test_productlistid" btree (productlistid) > "test_typeid" btree (typeid) > "test_productlistid_typeid" btree (productlistid, typeid) > > > explain analyze select * from test where (productlistid=3 and typeid=9); > > QUERY PLAN > ----------------------------------------------------------------------- > Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual > time=516.459..41930.250 rows=132528 loops=1) > Filter: ((productlistid = 3) AND (typeid = 9)) > Total runtime: 41975.154 ms > (3 rows) > > This query is still going to take a long time, because you have to scan the whole table. Your WHERE clause is not very specific (it takes 25% of the table). Convention says that any time you want > 5-10% of a table, a sequential scan is better, because it does it in order. Now if you did: explain analyze select * from test where (productlistid=3 and typeid=9) limit 15; I think that would be very fast. I am a little surprised that it is taking 40s to scan only 400k rows, though. On an older machine of mine (with only 256M ram and dual 450MHz Celerons), I have a table with 74k rows which takes about .5 sec. At those numbers it should take more like 4s not 40. John =:-> --------------enig7ACD2779A4F28991DF6B4A66 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.1 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFCqjWaJdeBCYSNAAMRAiFsAJwLQmLGof86V2lpc5fg0uNL/Fi13wCghqoq lSp8WQoB+lQQx5YrC0B3sVs= =bUxz -----END PGP SIGNATURE----- --------------enig7ACD2779A4F28991DF6B4A66-- From pgsql-performance-owner@postgresql.org Fri Jun 10 21: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 8F43852947 for ; Fri, 10 Jun 2005 21:52:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98666-06 for ; Sat, 11 Jun 2005 00:52:18 +0000 (GMT) Received: from vbp2.vbp2.com (vbp2.com [66.207.137.158]) by svr1.postgresql.org (Postfix) with ESMTP id C93F152960 for ; Fri, 10 Jun 2005 21:52:17 -0300 (ADT) Received: from vbp2.vbp2.com (localhost [127.0.0.1]) by vbp2.vbp2.com (8.13.1/8.13.1) with ESMTP id j5B0qHiN041980; Fri, 10 Jun 2005 20:52:17 -0400 (EDT) (envelope-from list@slatech.com) Received: from localhost (list@localhost) by vbp2.vbp2.com (8.13.1/8.13.1/Submit) with ESMTP id j5B0qH5g041977; Fri, 10 Jun 2005 20:52:17 -0400 (EDT) (envelope-from list@slatech.com) X-Authentication-Warning: vbp2.vbp2.com: list owned process doing -bs Date: Fri, 10 Jun 2005 20:52:17 -0400 (EDT) From: Clark Slater X-X-Sender: list@vbp2.vbp2.com To: "Joshua D. Drake" Cc: pgsql-performance@postgresql.org Subject: Re: faster search In-Reply-To: <42AA34E7.3060006@commandprompt.com> Message-ID: <20050610205113.V40688@vbp2.vbp2.com> References: <20050610132812.R94573@vbp2.vbp2.com> <42A9D556.7070108@arbash-meinel.com> <20050610200358.R40688@vbp2.vbp2.com> <42AA2CE9.8040901@commandprompt.com> <20050610201740.R40688@vbp2.vbp2.com> <42AA34E7.3060006@commandprompt.com> 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/255 X-Sequence-Number: 12892 Query should return 132,528 rows. vbp=# set enable_seqscan = false; SET vbp=# explain analyze select * from test where (productlistid=3 and typeid=9); QUERY PLAN ------------------------------------------------------------------------ Index Scan using test_typeid on test (cost=0.00..137223.89 rows=156194 width=725) (actual time=25.999..25708.478 rows=132528 loops=1) Index Cond: (typeid = 9) Filter: (productlistid = 3) Total runtime: 25757.679 ms (4 rows) On Fri, 10 Jun 2005, Joshua D. Drake wrote: > Clark Slater wrote: >> thanks for your suggestion. >> a small improvement. still pretty slow... >> >> vbp=# alter table test alter column productlistid set statistics 150; >> ALTER TABLE >> vbp=# alter table test alter column typeid set statistics 150; >> ALTER TABLE >> vbp=# explain analyze select * from test where (productlistid=3 and > > Hello, > > Also what happens if you: > > set enable_seqscan = false; > explain analyze query.... > > Sincerely, > > Joshua D. Drake > > > >> typeid=9); >> QUERY PLAN >> >> ------------------------------------------------------------------------------ >> Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual >> time=525.617..36802.556 rows=132528 loops=1) >> Filter: ((productlistid = 3) AND (typeid = 9)) >> Total runtime: 36847.754 ms >> (3 rows) >> >> Time: 36850.719 ms >> >> >> On Fri, 10 Jun 2005, Joshua D. Drake wrote: >> >>> Clark Slater wrote: >>> >>>> hmm, i'm baffled. i simplified the query >>>> and it is still taking forever... >>> >>> >>> What happens if you: >>> >>> alter table test alter column productlistid set statistics 150; >>> alter table test alter column typeid set statistics 150; >>> explain analyze select * from test where (productlistid=3 and typeid=9); >>> >>> Sincerely, >>> >>> Joshua D. Drake >>> >>> >>>> >>>> >>>> test >>>> ------------------------- >>>> id | integer >>>> partnumber | character varying(32) >>>> productlistid | integer >>>> typeid | integer >>>> >>>> >>>> Indexes: >>>> "test_productlistid" btree (productlistid) >>>> "test_typeid" btree (typeid) >>>> "test_productlistid_typeid" btree (productlistid, typeid) >>>> >>>> >>>> explain analyze select * from test where (productlistid=3 and typeid=9); >>>> >>>> QUERY PLAN >>>> ----------------------------------------------------------------------- >>>> Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual >>>> time=516.459..41930.250 rows=132528 loops=1) >>>> Filter: ((productlistid = 3) AND (typeid = 9)) >>>> Total runtime: 41975.154 ms >>>> (3 rows) >>>> >>>> >>>> System specs: >>>> PostgreSQL 7.4.2 on RedHat 9 >>>> dual AMD Athlon 2GHz processors >>>> 1 gig memory >>>> mirrored 7200 RPM IDE disks >>>> >>>> >>>> On Fri, 10 Jun 2005, John A Meinel wrote: >>>> >>>>> Clark Slater wrote: >>>>> >>>>>> Hi- >>>>>> >>>>>> Would someone please enlighten me as >>>>>> to why I'm not seeing a faster execution >>>>>> time on the simple scenario below? >>>>>> >>>>>> there are 412,485 rows in the table and the >>>>>> query matches on 132,528 rows, taking >>>>>> almost a minute to execute. vaccuum >>>>>> analyze was just run. >>>>> >>>>> >>>>> >>>>> Well, if you are matching 130k out of 400k rows, then a sequential scan >>>>> is certainly prefered to an index scan. And then you have to sort those >>>>> 130k rows by partnumber. This *might* be spilling to disk depending on >>>>> what your workmem/sortmem is set to. >>>>> >>>>> I would also say that what you would really want is some way to get the >>>>> whole thing from an index. And I think the way to do that is: >>>>> >>>>> CREATE INDEX test_partnum_listid_typeid_idx ON >>>>> test(partnumber, productlistid, typeid); >>>>> >>>>> VACUUM ANALYZE test; >>>>> >>>>> EXPLAIN ANALYZE SELECT * FROM test >>>>> WHERE productlistid=3 AND typeid=9 >>>>> ORDER BY partnumber, productlistid, typeid >>>>> LIMIT 15 >>>>> ; >>>>> >>>>> The trick is that you have to match the order by exactly with the index, >>>>> so the planner realizes it can do an indexed lookup to get the >>>>> information. >>>>> >>>>> You could also just create an index on partnumber, and see how that >>>>> affects your original query. I think the planner could use an index >>>>> lookup on partnumber to get the ordering correct. But it will have to do >>>>> filtering after the fact based on productlistid and typeid. >>>>> With my extended index, I think the planner can be smarter and lookup >>>>> all 3 by the index. >>>>> >>>>>> >>>>>> Thanks! >>>>>> Clark >>>>> >>>>> >>>>> >>>>> Good luck, >>>>> John >>>>> =:-> >>>>> >>>> >>>> ---------------------------(end of broadcast)--------------------------- >>>> TIP 2: you can get off all lists at once with the unregister command >>>> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >>> >>> >>> >>> -- >>> Your PostgreSQL solutions provider, Command Prompt, Inc. >>> 24x7 support - 1.800.492.2240, programming, and consulting >>> Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit >>> http://www.commandprompt.com / http://www.postgresql.org >>> >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > > -- > Your PostgreSQL solutions provider, Command Prompt, Inc. > 24x7 support - 1.800.492.2240, programming, and consulting > Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit > http://www.commandprompt.com / http://www.postgresql.org > From pgsql-performance-owner@postgresql.org Fri Jun 10 21:55: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 577F152947 for ; Fri, 10 Jun 2005 21:55:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95560-10 for ; Sat, 11 Jun 2005 00:55:24 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 1FC4852822 for ; Fri, 10 Jun 2005 21:55:24 -0300 (ADT) Received: from [192.168.1.100] (clbb-248.saw.net [64.146.135.248]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j5B0jHa3003274; Fri, 10 Jun 2005 17:45:20 -0700 Message-ID: <42AA3697.3040706@commandprompt.com> Date: Fri, 10 Jun 2005 17:55:51 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Clark Slater Cc: pgsql-performance@postgresql.org Subject: Re: faster search References: <20050610132812.R94573@vbp2.vbp2.com> <42A9D556.7070108@arbash-meinel.com> <20050610200358.R40688@vbp2.vbp2.com> <42AA2CE9.8040901@commandprompt.com> <20050610201740.R40688@vbp2.vbp2.com> <42AA34E7.3060006@commandprompt.com> <20050610205113.V40688@vbp2.vbp2.com> In-Reply-To: <20050610205113.V40688@vbp2.vbp2.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.026 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/256 X-Sequence-Number: 12893 Clark Slater wrote: > Query should return 132,528 rows. O.k. then the planner is doing fine it looks like. The problem is you are pulling 132,528 rows. I would suggest moving to a cursor which will allow you to fetch in smaller chunks much quicker. Sincerely, Joshua D. Drake > > vbp=# set enable_seqscan = false; > SET > vbp=# explain analyze select * from test where (productlistid=3 and > typeid=9); > > QUERY PLAN > ------------------------------------------------------------------------ > Index Scan using test_typeid on test (cost=0.00..137223.89 rows=156194 > width=725) (actual time=25.999..25708.478 rows=132528 > loops=1) > Index Cond: (typeid = 9) > Filter: (productlistid = 3) > Total runtime: 25757.679 ms > (4 rows) > > > On Fri, 10 Jun 2005, Joshua D. Drake wrote: > >> Clark Slater wrote: >> >>> thanks for your suggestion. >>> a small improvement. still pretty slow... >>> >>> vbp=# alter table test alter column productlistid set statistics 150; >>> ALTER TABLE >>> vbp=# alter table test alter column typeid set statistics 150; >>> ALTER TABLE >>> vbp=# explain analyze select * from test where (productlistid=3 and >> >> >> Hello, >> >> Also what happens if you: >> >> set enable_seqscan = false; >> explain analyze query.... >> >> Sincerely, >> >> Joshua D. Drake >> >> >> >>> typeid=9); >>> QUERY PLAN >>> >>> ------------------------------------------------------------------------------ >>> Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) >>> (actual time=525.617..36802.556 rows=132528 loops=1) >>> Filter: ((productlistid = 3) AND (typeid = 9)) >>> Total runtime: 36847.754 ms >>> (3 rows) >>> >>> Time: 36850.719 ms >>> >>> >>> On Fri, 10 Jun 2005, Joshua D. Drake wrote: >>> >>>> Clark Slater wrote: >>>> >>>>> hmm, i'm baffled. i simplified the query >>>>> and it is still taking forever... >>>> >>>> >>>> >>>> What happens if you: >>>> >>>> alter table test alter column productlistid set statistics 150; >>>> alter table test alter column typeid set statistics 150; >>>> explain analyze select * from test where (productlistid=3 and >>>> typeid=9); >>>> >>>> Sincerely, >>>> >>>> Joshua D. Drake >>>> >>>> >>>>> >>>>> >>>>> test >>>>> ------------------------- >>>>> id | integer >>>>> partnumber | character varying(32) >>>>> productlistid | integer >>>>> typeid | integer >>>>> >>>>> >>>>> Indexes: >>>>> "test_productlistid" btree (productlistid) >>>>> "test_typeid" btree (typeid) >>>>> "test_productlistid_typeid" btree (productlistid, typeid) >>>>> >>>>> >>>>> explain analyze select * from test where (productlistid=3 and >>>>> typeid=9); >>>>> >>>>> QUERY PLAN >>>>> ----------------------------------------------------------------------- >>>>> >>>>> Seq Scan on test (cost=0.00..96458.27 rows=156194 width=725) (actual >>>>> time=516.459..41930.250 rows=132528 loops=1) >>>>> Filter: ((productlistid = 3) AND (typeid = 9)) >>>>> Total runtime: 41975.154 ms >>>>> (3 rows) >>>>> >>>>> >>>>> System specs: >>>>> PostgreSQL 7.4.2 on RedHat 9 >>>>> dual AMD Athlon 2GHz processors >>>>> 1 gig memory >>>>> mirrored 7200 RPM IDE disks >>>>> >>>>> >>>>> On Fri, 10 Jun 2005, John A Meinel wrote: >>>>> >>>>>> Clark Slater wrote: >>>>>> >>>>>>> Hi- >>>>>>> >>>>>>> Would someone please enlighten me as >>>>>>> to why I'm not seeing a faster execution >>>>>>> time on the simple scenario below? >>>>>>> >>>>>>> there are 412,485 rows in the table and the >>>>>>> query matches on 132,528 rows, taking >>>>>>> almost a minute to execute. vaccuum >>>>>>> analyze was just run. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Well, if you are matching 130k out of 400k rows, then a sequential >>>>>> scan >>>>>> is certainly prefered to an index scan. And then you have to sort >>>>>> those >>>>>> 130k rows by partnumber. This *might* be spilling to disk >>>>>> depending on >>>>>> what your workmem/sortmem is set to. >>>>>> >>>>>> I would also say that what you would really want is some way to >>>>>> get the >>>>>> whole thing from an index. And I think the way to do that is: >>>>>> >>>>>> CREATE INDEX test_partnum_listid_typeid_idx ON >>>>>> test(partnumber, productlistid, typeid); >>>>>> >>>>>> VACUUM ANALYZE test; >>>>>> >>>>>> EXPLAIN ANALYZE SELECT * FROM test >>>>>> WHERE productlistid=3 AND typeid=9 >>>>>> ORDER BY partnumber, productlistid, typeid >>>>>> LIMIT 15 >>>>>> ; >>>>>> >>>>>> The trick is that you have to match the order by exactly with the >>>>>> index, >>>>>> so the planner realizes it can do an indexed lookup to get the >>>>>> information. >>>>>> >>>>>> You could also just create an index on partnumber, and see how that >>>>>> affects your original query. I think the planner could use an index >>>>>> lookup on partnumber to get the ordering correct. But it will have >>>>>> to do >>>>>> filtering after the fact based on productlistid and typeid. >>>>>> With my extended index, I think the planner can be smarter and lookup >>>>>> all 3 by the index. >>>>>> >>>>>>> >>>>>>> Thanks! >>>>>>> Clark >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Good luck, >>>>>> John >>>>>> =:-> >>>>>> >>>>> >>>>> ---------------------------(end of >>>>> broadcast)--------------------------- >>>>> TIP 2: you can get off all lists at once with the unregister command >>>>> (send "unregister YourEmailAddressHere" to >>>>> majordomo@postgresql.org) >>>> >>>> >>>> >>>> >>>> -- >>>> Your PostgreSQL solutions provider, Command Prompt, Inc. >>>> 24x7 support - 1.800.492.2240, programming, and consulting >>>> Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit >>>> http://www.commandprompt.com / http://www.postgresql.org >>>> >>> >>> ---------------------------(end of broadcast)--------------------------- >>> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >> >> >> >> -- >> Your PostgreSQL solutions provider, Command Prompt, Inc. >> 24x7 support - 1.800.492.2240, programming, and consulting >> Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit >> http://www.commandprompt.com / http://www.postgresql.org >> -- Your PostgreSQL solutions provider, Command Prompt, Inc. 24x7 support - 1.800.492.2240, programming, and consulting Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit http://www.commandprompt.com / http://www.postgresql.org From pgsql-performance-owner@postgresql.org Sat Jun 11 07:00: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 97A50528D1 for ; Sat, 11 Jun 2005 07:00:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22226-03 for ; Sat, 11 Jun 2005 10:00:10 +0000 (GMT) Received: from mail.nordicbet.com (mail.nordicbet.com [193.69.167.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6EE9E52819 for ; Sat, 11 Jun 2005 06:59:24 -0300 (ADT) Received: from estneti-gw.online.ee ([62.65.34.222] helo=tobias.nordicbet.invalid) (Authenticated Sender=tobias@nordicbet.com) by mail.nordicbet.com with esmtpa (Exim 4.50 #1 (Debian)) id 1Dh2lM-0008V2-Vy; Sat, 11 Jun 2005 11:58:58 +0200 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id BDB65E0C54; Sat, 11 Jun 2005 12:59:10 +0300 (EEST) Date: Sat, 11 Jun 2005 12:59:09 +0300 From: Tobias Brox To: Kevin Grittner Cc: junaili@gmail.com, pgsql-performance@postgresql.org Subject: Re: Help with rewriting query Message-ID: <20050611095909.GR8451@tobias.nordicbet.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Group Nordicbet User-Agent: Mutt/1.5.6i 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: 200506/257 X-Sequence-Number: 12894 [Kevin Grittner - Fri at 02:49:57PM -0500] > If you add a column to the person table for "last_food_id" and triggers > to maintain it when the food table is modified, voila! You have a > simple and fast way to get the results you want. Reminds me about the way the precursor software of our product was made, whenever it was needed to check the balance of a customer, it was needed to scan the whole transaction table and sum up all transactions. This operation eventually took 3-4 seconds before we released the new software, and the customers balance was supposed to show up at several web pages :-) By now we have the updated balance both in the customer table and as "post_balance" in the transaction table. Sometimes redundancy is good. Much easier to solve inconsistency problems as well :-) -- Tobias Brox, +47-91700050 From pgsql-performance-owner@postgresql.org Sat Jun 11 08: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 4542E52871 for ; Sat, 11 Jun 2005 08:12:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32395-10 for ; Sat, 11 Jun 2005 11:11:52 +0000 (GMT) Received: from smtp2.libero.it (smtp2.libero.it [193.70.192.52]) by svr1.postgresql.org (Postfix) with ESMTP id C6C4A5292C for ; Sat, 11 Jun 2005 08:11:38 -0300 (ADT) Received: from localhost (172.16.1.83) by smtp2.libero.it (7.0.027-DD01) id 41BDB663027DB704 for pgsql-performance@postgresql.org; Sat, 11 Jun 2005 13:11:58 +0200 Received: from [151.25.110.175] (151.25.110.175) by smtp20.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41D02BD30709F452 for pgsql-performance@postgresql.org; Sat, 11 Jun 2005 13:11:38 +0200 Message-ID: <42AAC593.4050406@streppone.it> Date: Sat, 11 Jun 2005 13:05:55 +0200 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: faster search References: <20050610132812.R94573@vbp2.vbp2.com> <20050610201240.GA9822@gp.word-to-the-wise.com> In-Reply-To: <20050610201240.GA9822@gp.word-to-the-wise.com> 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.04 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/258 X-Sequence-Number: 12895 Steve Atkins wrote: > On Fri, Jun 10, 2005 at 01:45:05PM -0400, Clark Slater wrote: > >>Hi- >> >>Would someone please enlighten me as >>to why I'm not seeing a faster execution >>time on the simple scenario below? > > [...] > > Create an index on (productlistid, typeid, partnumber) then > > select * from test where productlistid=3 and typeid=9 > order by productlistid, typeid, partnumber LIMIT 15; > Clark, try also adding (just for testing) partnumber to your where clause, like this: select * from test where productlistid=3 and typeid=9 and partnumber='foo' order by productlistid, typeid, partnumber; and check output of explain analyze. I had experiences of planner "bad" use of indexes when attribute types were integer and cardinality was low (a single attribute value, like "typeid=9" selects one or few rows). However, this was on 7.1.3, and probably is not relevant to your case. -- Cosimo From pgsql-performance-owner@postgresql.org Sat Jun 11 13:49: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 B097C5281A for ; Sat, 11 Jun 2005 13:49:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11843-10 for ; Sat, 11 Jun 2005 16:49: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 888BD5281E for ; Sat, 11 Jun 2005 13:49:33 -0300 (ADT) 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 j5BGnWx0011820; Sat, 11 Jun 2005 12:49:32 -0400 (EDT) To: John A Meinel Cc: Clark Slater , pgsql-performance@postgresql.org Subject: Re: faster search In-reply-to: <42AA3598.4080001@arbash-meinel.com> References: <20050610132812.R94573@vbp2.vbp2.com> <42A9D556.7070108@arbash-meinel.com> <20050610200358.R40688@vbp2.vbp2.com> <42AA3598.4080001@arbash-meinel.com> Comments: In-reply-to John A Meinel message dated "Fri, 10 Jun 2005 19:51:36 -0500" Date: Sat, 11 Jun 2005 12:49:32 -0400 Message-ID: <11819.1118508572@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: 200506/259 X-Sequence-Number: 12896 John A Meinel writes: > I am a little surprised that it is taking 40s to scan only 400k rows, > though. Yeah, that seemed high to me too. Table bloat maybe? It would be interesting to look at the output of "vacuum verbose test" to see how much dead space there is. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jun 12 11:12: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 0EDEF52864 for ; Sun, 12 Jun 2005 11:12:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82446-02 for ; Sun, 12 Jun 2005 14:12:23 +0000 (GMT) Received: from tomts13-srv.bellnexxia.net (tomts13.bellnexxia.net [209.226.175.34]) by svr1.postgresql.org (Postfix) with ESMTP id 61EE652834 for ; Sun, 12 Jun 2005 11:12:22 -0300 (ADT) Received: from [192.168.1.99] ([64.228.0.142]) by tomts13-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050612141225.DESI25800.tomts13-srv.bellnexxia.net@[192.168.1.99]>; Sun, 12 Jun 2005 10:12:25 -0400 Message-ID: <42AC42CB.8050703@alteeve.com> Date: Sun, 12 Jun 2005 10:12:27 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: Tobias Brox Cc: pgsql-performance@postgresql.org Subject: Re: Index ot being used References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> In-Reply-To: <20050610155535.GO8451@tobias.nordicbet.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: 200506/260 X-Sequence-Number: 12897 Tobias Brox wrote: > [linux@alteeve.com - Fri at 12:10:19PM -0400] > >>tle-bu=> EXPLAIN ANALYZE SELECT file_type, file_parent_dir, file_name FROM >>file_info_7; >> QUERY PLAN >>---------------------------------------------------------------------------------------------------------------------- >> Seq Scan on file_info_7 (cost=0.00..11028.35 rows=294035 width=118) >>(actual time=0.122..2707.764 rows=294035 loops=1) >> Total runtime: 3717.862 ms >>(2 rows) >> > > > As far as I can see, you are selecting everything from the table without any > sort order. The only rational thing to do then is a sequential scan, it's > no point in an index scan. > Thanks for replying, Tobias and Jacques! Doh! This is a case of over simplification, I think. I was trying to simplify my query as much as I could and then work it out to the actual query I want. It would seem I don't understand how to use indexes quite right. Do you think you might be able to help me with a useful index? Here is the 'file_info_7' schema, my query and the 'explain analyze' results: tle-bu=> \d file_info_7 Table "public.file_info_7" Column | Type | Modifiers ----------------------+----------------------+----------------------------------------- file_group_name | text | file_group_uid | bigint | not null file_mod_time | bigint | not null file_name | text | not null file_parent_dir | text | not null file_perm | text | not null file_size | bigint | not null file_type | character varying(2) | not null default 'f'::character varying file_user_name | text | file_user_uid | bigint | not null file_backup | boolean | not null default true file_display | boolean | not null default false file_restore_display | boolean | not null default false file_restore | boolean | not null default false Indexes: "file_info_7_display_idx" btree (file_type, file_parent_dir, file_name) Here is my full query: tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_type FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, file_name ASC; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- Sort (cost=14541.24..14603.48 rows=24895 width=118) (actual time=15751.804..15967.591 rows=25795 loops=1) Sort Key: file_parent_dir, file_name -> Seq Scan on file_info_7 (cost=0.00..11763.44 rows=24895 width=118) (actual time=19.289..3840.845 rows=25795 loops=1) Filter: ((file_type)::text = 'd'::text) Total runtime: 16043.075 ms (5 rows) This is my index (which I guess is wrong): tle-bu=> \d file_info_7_display_idx Index "public.file_info_7_display_idx" Column | Type -----------------+---------------------- file_type | character varying(2) file_parent_dir | text file_name | text btree, for table "public.file_info_7" Those are the three columns I am using in my restrictions so I thought that would create an index this query would use. Do I need to do something different because of the 'ORDER BY...'? Thanks again for the replies! Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Sun Jun 12 12: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 9412952822 for ; Sun, 12 Jun 2005 12:56:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00301-08 for ; Sun, 12 Jun 2005 15:56: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 0D7225280B for ; Sun, 12 Jun 2005 12:56:37 -0300 (ADT) 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 j5CFuNs6024637; Sun, 12 Jun 2005 11:56:23 -0400 (EDT) To: Madison Kelly Cc: Tobias Brox , pgsql-performance@postgresql.org Subject: Re: Index ot being used In-reply-to: <42AC42CB.8050703@alteeve.com> References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> Comments: In-reply-to Madison Kelly message dated "Sun, 12 Jun 2005 10:12:27 -0400" Date: Sun, 12 Jun 2005 11:56:23 -0400 Message-ID: <24636.1118591783@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: 200506/261 X-Sequence-Number: 12898 Madison Kelly writes: > Here is my full query: > tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_type > FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, > file_name ASC; > This is my index (which I guess is wrong): > tle-bu=> \d file_info_7_display_idx > Index "public.file_info_7_display_idx" > Column | Type > -----------------+---------------------- > file_type | character varying(2) > file_parent_dir | text > file_name | text > btree, for table "public.file_info_7" The index is fine, but you need to phrase the query as ... ORDER BY file_type, file_parent_dir, file_name; (Whether you use ASC or not doesn't matter.) Otherwise the planner won't make the connection to the sort ordering of the index. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jun 12 14:38: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 60479528D1 for ; Sun, 12 Jun 2005 14:38:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29060-08 for ; Sun, 12 Jun 2005 17:38:08 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 3EAC7528BF for ; Sun, 12 Jun 2005 14:38:07 -0300 (ADT) Received: (qmail 29079 invoked by uid 500); 12 Jun 2005 17:37:32 -0000 Date: Sun, 12 Jun 2005 12:37:32 -0500 From: Bruno Wolff III To: Madison Kelly Cc: Tobias Brox , pgsql-performance@postgresql.org Subject: Re: Index ot being used Message-ID: <20050612173732.GA28838@wolff.to> Mail-Followup-To: Bruno Wolff III , Madison Kelly , Tobias Brox , pgsql-performance@postgresql.org References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42AC42CB.8050703@alteeve.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: 200506/262 X-Sequence-Number: 12899 On Sun, Jun 12, 2005 at 10:12:27 -0400, Madison Kelly wrote: > Indexes: > "file_info_7_display_idx" btree (file_type, file_parent_dir, file_name) > Here is my full query: > > tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_type > FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, > file_name ASC; > QUERY PLAN > ----------------------------------------------------------------------------------------------------------------------------- This is a case where postgres's planner can't make a deduction needed for it to realize that the index can be used. Try rewriting the query as: SELECT file_name, file_parent_dir, file_type FROM file_info_7 WHERE file_type='d' ORDER BY file_type ASC, file_parent_dir ASC, file_name ASC; From pgsql-performance-owner@postgresql.org Sun Jun 12 14:40: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 ED15B52914 for ; Sun, 12 Jun 2005 14:40:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38859-02 for ; Sun, 12 Jun 2005 17:40:33 +0000 (GMT) Received: from europa.telenet-ops.be (europa.telenet-ops.be [195.130.132.60]) by svr1.postgresql.org (Postfix) with ESMTP id 1159A52906 for ; Sun, 12 Jun 2005 14:40:31 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by europa.telenet-ops.be (Postfix) with SMTP id 3E501198346 for ; Sun, 12 Jun 2005 19:40:31 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by europa.telenet-ops.be (Postfix) with ESMTP id B37A719832B for ; Sun, 12 Jun 2005 19:40:30 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: <579bc853ef3957c736c2773f13c444f7@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-5-704392228 From: Yves Vindevogel Subject: Updates on large tables are extremely slow Date: Sun, 12 Jun 2005 19:40:29 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/263 X-Sequence-Number: 12900 --Apple-Mail-5-704392228 Content-Type: multipart/alternative; boundary=Apple-Mail-6-704392229 --Apple-Mail-6-704392229 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi, I'm trying to update a table that has about 600.000 records. The update query is very simple : update mytable set pagesdesc =3D -=20= pages ; (I use pagesdesc to avoid problems with sort that have one field in=20 ascending order and one in descending order. That was a problem I had=20= a week ago) The query takes about half an hour to an hour to execute. I have tried=20= a lot of things. This is my setup Linux Slackware 10.1 Postgres 8.0.1 My filesystem has EXT2 filesystem so I don't have journaling. My partition is mounted in fstab with the noatime option. I have tried to change some settings in $PGDATA/postgresql.conf. But=20 that does not seem to matter a lot. I'm not even sure that file is being used. I ran KSysGuard when=20 executing my query and I don't see my processor being used more than=20 20% The memory increases for the cache, but not for the app itself. My testsystem is an Asus portable, P4 with 1 Gig of RAM. Disk is speedy. All runs fine except for the update queries. I would appreciate some help or a document to point me to the settings=20= I must change. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-6-704392229 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Hi, I'm trying to update a table that has about 600.000 records. The update query is very simple : update mytable set pagesdesc =3D - pages ; =20 (I use pagesdesc to avoid problems with sort that have one field in ascending order and one in descending order. That was a problem I had a week ago) The query takes about half an hour to an hour to execute. I have tried a lot of things. This is my setup Linux Slackware 10.1 Postgres 8.0.1 My filesystem has EXT2 filesystem so I don't have journaling. My partition is mounted in fstab with the noatime option. I have tried to change some settings in $PGDATA/postgresql.conf. But that does not seem to matter a lot. I'm not even sure that file is being used. I ran KSysGuard when executing my query and I don't see my processor being used more than 20% The memory increases for the cache, but not for the app itself. My testsystem is an Asus portable, P4 with 1 Gig of RAM. Disk is speedy. All runs fine except for the update queries. I would appreciate some help or a document to point me to the settings I must change. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-6-704392229-- --Apple-Mail-5-704392228 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAj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7RyIWHwOoH+CEBptU EaEITOFCEyLOF0FoJr16aUDpb9fbH+GAF0RSz2KgCABjdACSB4ED3V3YH+C8CjbCFAEwLP006EG8 G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-5-704392228 Content-Type: multipart/alternative; boundary=Apple-Mail-7-704392230 --Apple-Mail-7-704392230 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-7-704392230 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-7-704392230-- --Apple-Mail-5-704392228-- From pgsql-performance-owner@postgresql.org Sun Jun 12 14: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 AFFAA528D1 for ; Sun, 12 Jun 2005 14:58:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44759-01 for ; Sun, 12 Jun 2005 17:58:04 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id E141B528AE for ; Sun, 12 Jun 2005 14:58:02 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5CHvuD1097657; Sun, 12 Jun 2005 19:57:57 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050612195157.039cd170@pop.interactivemediafactory.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Sun, 12 Jun 2005 19:57:54 +0200 To: Yves Vindevogel From: Jacques Caron Subject: Re: Updates on large tables are extremely slow Cc: pgsql-performance@postgresql.org In-Reply-To: <579bc853ef3957c736c2773f13c444f7@implements.be> References: <579bc853ef3957c736c2773f13c444f7@implements.be> 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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/264 X-Sequence-Number: 12901 Hi, At 19:40 12/06/2005, Yves Vindevogel wrote: >Hi, > >I'm trying to update a table that has about 600.000 records. >The update query is very simple : update mytable set pagesdesc = - >pages ; > >(I use pagesdesc to avoid problems with sort that have one field in >ascending order and one in descending order. That was a problem I had a >week ago) An index on (-pages) would probably do exactly what you want without having to add another column. >The query takes about half an hour to an hour to execute. Depending on the total size of the table and associated indexes and on your exact setup (especially your hardare), this could be quite normal: the exuctor goes through all rows in the table, and for each, creates a copy with the additional column, updates indexes, and logs to WAL. You might want to look into moving your WAL files (pg_xlog) to a separate disk, increase WAL and checkpoint buffers, add more RAM, add more disks... But as I said, you might not even need to do that, just use an index on an expression... Jacques. From pgsql-performance-owner@postgresql.org Sun Jun 12 19: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 C1A8D528A6 for ; Sun, 12 Jun 2005 19:52:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12624-02 for ; Sun, 12 Jun 2005 22:52:14 +0000 (GMT) Received: from tomts13-srv.bellnexxia.net (tomts13.bellnexxia.net [209.226.175.34]) by svr1.postgresql.org (Postfix) with ESMTP id 6F84852899 for ; Sun, 12 Jun 2005 19:52:12 -0300 (ADT) Received: from [192.168.1.99] ([206.172.173.123]) by tomts13-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050612225213.GDII25800.tomts13-srv.bellnexxia.net@[192.168.1.99]>; Sun, 12 Jun 2005 18:52:13 -0400 Message-ID: <42ACBC95.9020404@alteeve.com> Date: Sun, 12 Jun 2005 18:52:05 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Tom Lane , bruno@wolff.to Subject: Re: Index ot being used References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> In-Reply-To: <24636.1118591783@sss.pgh.pa.us> 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: 200506/265 X-Sequence-Number: 12902 Tom Lane wrote: > Madison Kelly writes: > >> Here is my full query: > > >>tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_type >>FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, >>file_name ASC; > > >> This is my index (which I guess is wrong): > > >>tle-bu=> \d file_info_7_display_idx >> Index "public.file_info_7_display_idx" >> Column | Type >>-----------------+---------------------- >> file_type | character varying(2) >> file_parent_dir | text >> file_name | text >>btree, for table "public.file_info_7" > > > The index is fine, but you need to phrase the query as > > ... ORDER BY file_type, file_parent_dir, file_name; > > (Whether you use ASC or not doesn't matter.) Otherwise the planner > won't make the connection to the sort ordering of the index. > > regards, tom lane Hi Tom and Bruno, After sending that email I kept plucking away and in the course of doing so decided that I didn't need to return the 'file_type' column. Other than that, it would see my query now matches what you two have recommended in the 'ORDER BY...' front but I still can't get an index search. Here is the latest query and the new index: tle-bu=> \d file_info_7_display_idx; Index "public.file_info_7_display_idx" Column | Type -----------------+------ file_parent_dir | text file_name | text btree, for table "public.file_info_7" tle-bu=> EXPLAIN ANALYZE SELECT file_parent_dir, file_name, file_display FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, file_name ASC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- Sort (cost=14509.53..14571.76 rows=24895 width=114) (actual time=19995.250..20123.874 rows=25795 loops=1) Sort Key: file_parent_dir, file_name -> Seq Scan on file_info_7 (cost=0.00..11762.44 rows=24895 width=114) (actual time=0.123..3228.446 rows=25795 loops=1) Filter: ((file_type)::text = 'd'::text) Total runtime: 20213.443 ms The 'Sort' is taking 20 seconds on my pentium III 1GHz (not great, but...). If I follow you right, my index is 'file_parent_dir' first and 'file_name' second (does order matter?). So I figured the query: SELECT file_parent_dir, file_name, file_display FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, file_name ASC; Would hit the index for the sort. Is there any other way other than 'EXPLAIN ANALYZE...' to get a better understanding of what is happening in there? For what it's worth, there is a little under 300,000 entries in this table of which, as you can see above, 25,795 are being returned. Yet again, thank you both!! I'm off to keep trying to figure this out... Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Sun Jun 12 21:36: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 69F8D52809 for ; Sun, 12 Jun 2005 21:36:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42158-01 for ; Mon, 13 Jun 2005 00:36:00 +0000 (GMT) Received: from a.mail.sonic.net (a.mail.sonic.net [64.142.16.245]) by svr1.postgresql.org (Postfix) with ESMTP id 29F4252889 for ; Sun, 12 Jun 2005 21:35:54 -0300 (ADT) Received: from cookie.varlena.com (64-142-36-103.dsl.static.sonic.net [64.142.36.103]) by a.mail.sonic.net (8.13.3/8.13.3) with ESMTP id j5D0ZvK3010090 for ; Sun, 12 Jun 2005 17:35:57 -0700 Received: by cookie.varlena.com (Postfix, from userid 1000) id 660A2CCE; Sun, 12 Jun 2005 17:30:49 -0700 (PDT) Date: Sun, 12 Jun 2005 17:30:49 -0700 To: pgsql-performance@postgresql.org Cc: elein Subject: Resource Requirements Message-ID: <20050613003049.GT17206@varlena.com> Mail-Followup-To: pgsql-performance@postgresql.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6+20040907i From: elein@varlena.com (elein) 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: 200506/266 X-Sequence-Number: 12903 I've got a list of old resource requirements. I want to know how far off they are and if anything crucial is missing. My usual recommendation is "as much as you can afford" so I don't usually deal with real numbers :) RAM: Number of connections * 2MB Disk: Program and Manual 8-15MB Regression Tests 30MB Compiled Source 60-160MB Storage for user data ( as much as you can afford :) Please copy me since I'm not officially on this list. Thanks, Elein ============================================================ elein@varlena.com Varlena, LLC www.varlena.com PostgreSQL Consulting, Support & Training PostgreSQL General Bits http://www.varlena.com/GeneralBits/ ============================================================= I have always depended on the [QA] of strangers. From pgsql-performance-owner@postgresql.org Sun Jun 12 23:43: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 6949952875 for ; Sun, 12 Jun 2005 23:43:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68574-10 for ; Mon, 13 Jun 2005 02:43:43 +0000 (GMT) Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz [202.0.58.23]) by svr1.postgresql.org (Postfix) with ESMTP id D6D3152864 for ; Sun, 12 Jun 2005 23:43:39 -0300 (ADT) Received: from smtp-1.paradise.net.nz (smtp-1a.paradise.net.nz [202.0.32.194]) by linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id <0II000LAJ4WVTT@linda-4.paradise.net.nz> for pgsql-performance@postgresql.org; Mon, 13 Jun 2005 14:43:43 +1200 (NZST) Received: from [192.168.1.11] (218-101-14-40.paradise.net.nz [218.101.14.40]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id C30E582985; Mon, 13 Jun 2005 14:43:42 +1200 (NZST) Date: Mon, 13 Jun 2005 14:43:41 +1200 From: Mark Kirkwood Subject: Re: Updates on large tables are extremely slow In-reply-to: <579bc853ef3957c736c2773f13c444f7@implements.be> To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Message-id: <42ACF2DD.8090409@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050511) References: <579bc853ef3957c736c2773f13c444f7@implements.be> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.151 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/267 X-Sequence-Number: 12904 Yves Vindevogel wrote: > > I'm trying to update a table that has about 600.000 records. > The update query is very simple : update mytable set pagesdesc = - pages ; > > The query takes about half an hour to an hour to execute. I have tried a > lot of things. > Half an hour seem a bit long - I would expect less than 5 minutes on reasonable hardware. You may have dead tuple bloat - can you post the output of 'ANALYZE VERBOSE mytable' ? Cheers Mark From pgsql-performance-owner@postgresql.org Mon Jun 13 00:01: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 6C66252863 for ; Mon, 13 Jun 2005 00:00:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74812-04 for ; Mon, 13 Jun 2005 03:00:37 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 52C2C528E7 for ; Mon, 13 Jun 2005 00:00:35 -0300 (ADT) Received: (qmail 18789 invoked by uid 500); 13 Jun 2005 03:00:01 -0000 Date: Sun, 12 Jun 2005 22:00:01 -0500 From: Bruno Wolff III To: Madison Kelly Cc: pgsql-performance@postgresql.org, Tom Lane Subject: Re: Index ot being used Message-ID: <20050613030001.GB17491@wolff.to> Mail-Followup-To: Bruno Wolff III , Madison Kelly , pgsql-performance@postgresql.org, Tom Lane References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42ACBC95.9020404@alteeve.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: 200506/268 X-Sequence-Number: 12905 On Sun, Jun 12, 2005 at 18:52:05 -0400, Madison Kelly wrote: > > After sending that email I kept plucking away and in the course of > doing so decided that I didn't need to return the 'file_type' column. > Other than that, it would see my query now matches what you two have > recommended in the 'ORDER BY...' front but I still can't get an index > search. No it doesn't. Even if you don't return file_type you still need it in the order by clause if you want postgres to consider using your index. Is there some reason you didn't actually try out our suggestion, but are now asking for more advice? > > Here is the latest query and the new index: > > tle-bu=> \d file_info_7_display_idx; > Index "public.file_info_7_display_idx" > Column | Type > -----------------+------ > file_parent_dir | text > file_name | text > btree, for table "public.file_info_7" > > tle-bu=> EXPLAIN ANALYZE SELECT file_parent_dir, file_name, file_display > FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, > file_name ASC; From pgsql-performance-owner@postgresql.org Mon Jun 13 00:14: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 0AF9752864 for ; Mon, 13 Jun 2005 00:14:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84764-03 for ; Mon, 13 Jun 2005 03:13:55 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id A713952809 for ; Mon, 13 Jun 2005 00:13:52 -0300 (ADT) Received: (qmail 19119 invoked by uid 500); 13 Jun 2005 03:13:17 -0000 Date: Sun, 12 Jun 2005 22:13:17 -0500 From: Bruno Wolff III To: Madison Kelly , pgsql-performance@postgresql.org, Tom Lane Subject: Re: Index ot being used Message-ID: <20050613031317.GA18988@wolff.to> Mail-Followup-To: Bruno Wolff III , Madison Kelly , pgsql-performance@postgresql.org, Tom Lane References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050613030001.GB17491@wolff.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: 200506/269 X-Sequence-Number: 12906 On Sun, Jun 12, 2005 at 22:00:01 -0500, Bruno Wolff III wrote: > On Sun, Jun 12, 2005 at 18:52:05 -0400, > Madison Kelly wrote: > > > > After sending that email I kept plucking away and in the course of > > doing so decided that I didn't need to return the 'file_type' column. > > Other than that, it would see my query now matches what you two have > > recommended in the 'ORDER BY...' front but I still can't get an index > > search. > > No it doesn't. Even if you don't return file_type you still need it > in the order by clause if you want postgres to consider using your > index. I didn't notice that you had changed the index. The reason this index doesn't help is that you can't use it to select on records with the desired file_type. > > Is there some reason you didn't actually try out our suggestion, but are > now asking for more advice? > > > > > Here is the latest query and the new index: > > > > tle-bu=> \d file_info_7_display_idx; > > Index "public.file_info_7_display_idx" > > Column | Type > > -----------------+------ > > file_parent_dir | text > > file_name | text > > btree, for table "public.file_info_7" > > > > tle-bu=> EXPLAIN ANALYZE SELECT file_parent_dir, file_name, file_display > > FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, > > file_name ASC; > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq From pgsql-performance-owner@postgresql.org Mon Jun 13 00:35: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 7ED4C528BF for ; Mon, 13 Jun 2005 00:35:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87018-09 for ; Mon, 13 Jun 2005 03:35:24 +0000 (GMT) Received: from tomts25-srv.bellnexxia.net (tomts25.bellnexxia.net [209.226.175.188]) by svr1.postgresql.org (Postfix) with ESMTP id 667D75286D for ; Mon, 13 Jun 2005 00:35:23 -0300 (ADT) Received: from [192.168.2.99] ([206.172.173.123]) by tomts25-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050613033518.LCPK27245.tomts25-srv.bellnexxia.net@[192.168.2.99]>; Sun, 12 Jun 2005 23:35:18 -0400 Message-ID: <42ACFEEE.2050005@alteeve.com> Date: Sun, 12 Jun 2005 23:35:10 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Bruno Wolff III Subject: Re: Index ot being used References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> In-Reply-To: <20050613030001.GB17491@wolff.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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/270 X-Sequence-Number: 12907 Bruno Wolff III wrote: > On Sun, Jun 12, 2005 at 18:52:05 -0400, > Madison Kelly wrote: > >> After sending that email I kept plucking away and in the course of >>doing so decided that I didn't need to return the 'file_type' column. >>Other than that, it would see my query now matches what you two have >>recommended in the 'ORDER BY...' front but I still can't get an index >>search. > > > No it doesn't. Even if you don't return file_type you still need it > in the order by clause if you want postgres to consider using your > index. > > Is there some reason you didn't actually try out our suggestion, but are > now asking for more advice? No good excuse. I'll recreate the index and test out your suggestion... tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_type FROM file_info_7 WHERE file_type='d' ORDER BY file_type ASC, file_parent_dir ASC, file_name ASC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- Sort (cost=14789.92..14857.06 rows=26856 width=117) (actual time=16865.473..16989.104 rows=25795 loops=1) Sort Key: file_type, file_parent_dir, file_name -> Seq Scan on file_info_7 (cost=0.00..11762.44 rows=26856 width=117) (actual time=0.178..1920.413 rows=25795 loops=1) Filter: ((file_type)::text = 'd'::text) Total runtime: 17102.925 ms (5 rows) tle-bu=> \d file_info_7_display_idx Index "public.file_info_7_display_idx" Column | Type -----------------+---------------------- file_type | character varying(2) file_parent_dir | text file_name | text btree, for table "public.file_info_7" I'm still getting the sequential scan. Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Mon Jun 13 00:43: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 07AE152864 for ; Mon, 13 Jun 2005 00:43:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90458-10 for ; Mon, 13 Jun 2005 03:43:25 +0000 (GMT) Received: from tomts36-srv.bellnexxia.net (tomts36.bellnexxia.net [209.226.175.93]) by svr1.postgresql.org (Postfix) with ESMTP id 0471852835 for ; Mon, 13 Jun 2005 00:43:24 -0300 (ADT) Received: from [192.168.2.99] ([206.172.173.123]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050613034307.IWAI16985.tomts36-srv.bellnexxia.net@[192.168.2.99]>; Sun, 12 Jun 2005 23:43:07 -0400 Message-ID: <42AD008D.4080600@alteeve.com> Date: Sun, 12 Jun 2005 23:42:05 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Bruno Wolff III , Tom Lane Subject: Re: Index ot being used References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> In-Reply-To: <20050613031317.GA18988@wolff.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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/271 X-Sequence-Number: 12908 Bruno Wolff III wrote: > On Sun, Jun 12, 2005 at 22:00:01 -0500, > Bruno Wolff III wrote: > >>On Sun, Jun 12, 2005 at 18:52:05 -0400, >> Madison Kelly wrote: >> >>> After sending that email I kept plucking away and in the course of >>>doing so decided that I didn't need to return the 'file_type' column. >>>Other than that, it would see my query now matches what you two have >>>recommended in the 'ORDER BY...' front but I still can't get an index >>>search. >> >>No it doesn't. Even if you don't return file_type you still need it >>in the order by clause if you want postgres to consider using your >>index. > > > I didn't notice that you had changed the index. The reason this index > doesn't help is that you can't use it to select on records with the > desired file_type. As you probably saw in my last reply, I went back to the old index and tried the query you and Tom Lane recommended. Should this not have caught the index? At any rate, I am re-reading the documents on indexing for 7.4.x on postgresql.org... This is kind of flustering. Thanks again though for som much help! Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Mon Jun 13 00:54: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 67F52528AE for ; Mon, 13 Jun 2005 00:54:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92920-05 for ; Mon, 13 Jun 2005 03:54:21 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 3955D528AA for ; Mon, 13 Jun 2005 00:54:20 -0300 (ADT) Received: (qmail 21071 invoked by uid 500); 13 Jun 2005 03:53:46 -0000 Date: Sun, 12 Jun 2005 22:53:46 -0500 From: Bruno Wolff III To: Madison Kelly Cc: pgsql-performance@postgresql.org, Tom Lane Subject: Re: Index ot being used Message-ID: <20050613035346.GA20703@wolff.to> Mail-Followup-To: Bruno Wolff III , Madison Kelly , pgsql-performance@postgresql.org, Tom Lane References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42AD008D.4080600@alteeve.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: 200506/272 X-Sequence-Number: 12909 On Sun, Jun 12, 2005 at 23:42:05 -0400, Madison Kelly wrote: > > As you probably saw in my last reply, I went back to the old index and > tried the query you and Tom Lane recommended. Should this not have > caught the index? Probably, but there might be some other reason the planner thought it was better to not use it. Using indexes is not always faster. It would help to see your latest definition of the table and indexes, the exact query you used and explain analyze output. From pgsql-performance-owner@postgresql.org Mon Jun 13 01:29: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 3FD8352822 for ; Mon, 13 Jun 2005 01:29:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00733-09 for ; Mon, 13 Jun 2005 04:29:09 +0000 (GMT) Received: from tomts36-srv.bellnexxia.net (tomts36.bellnexxia.net [209.226.175.93]) by svr1.postgresql.org (Postfix) with ESMTP id D27CA52814 for ; Mon, 13 Jun 2005 01:29:08 -0300 (ADT) Received: from [192.168.2.99] ([206.172.173.123]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050613042907.IZWM16985.tomts36-srv.bellnexxia.net@[192.168.2.99]>; Mon, 13 Jun 2005 00:29:07 -0400 Message-ID: <42AD0B94.9090508@alteeve.com> Date: Mon, 13 Jun 2005 00:29:08 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Bruno Wolff III , Tom Lane Subject: Re: Index ot being used References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> In-Reply-To: <20050613035346.GA20703@wolff.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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/273 X-Sequence-Number: 12910 Bruno Wolff III wrote: > On Sun, Jun 12, 2005 at 23:42:05 -0400, > Madison Kelly wrote: > >>As you probably saw in my last reply, I went back to the old index and >>tried the query you and Tom Lane recommended. Should this not have >>caught the index? > > > Probably, but there might be some other reason the planner thought it > was better to not use it. Using indexes is not always faster. > > It would help to see your latest definition of the table and indexes, > the exact query you used and explain analyze output. > Okay, here's what I have at the moment: tle-bu=> \d file_info_7 Table "public.file_info_7" Column | Type | Modifiers ----------------------+----------------------+----------------------------------------- file_group_name | text | file_group_uid | bigint | not null file_mod_time | bigint | not null file_name | text | not null file_parent_dir | text | not null file_perm | text | not null file_size | bigint | not null file_type | character varying(2) | not null default 'f'::character varying file_user_name | text | file_user_uid | bigint | not null file_backup | boolean | not null default true file_display | boolean | not null default false file_restore_display | boolean | not null default false file_restore | boolean | not null default false Indexes: "file_info_7_display_idx" btree (file_parent_dir, file_name) tle-bu=> \d file_info_7_display_idx Index "public.file_info_7_display_idx" Column | Type -----------------+------ file_parent_dir | text file_name | text btree, for table "public.file_info_7" tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_display FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, file_name ASC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- Sort (cost=15091.53..15165.29 rows=29502 width=114) (actual time=12834.933..12955.136 rows=25795 loops=1) Sort Key: file_parent_dir, file_name -> Seq Scan on file_info_7 (cost=0.00..11762.44 rows=29502 width=114) (actual time=0.244..2533.388 rows=25795 loops=1) Filter: ((file_type)::text = 'd'::text) Total runtime: 13042.421 ms (5 rows) Since my last post I went back to a query closer to what I actually want. What is most important to me is that 'file_parent_dir, file_name, file_display' are returned and that the results are sorted by 'file_parent_dir, file_name' and the results are restricted to where 'file_info='d''. Basically what I am trying to do is display a directory tree in a file browser. I had this working before but it was far, far too slow once the number of directories to display got much higher than 1,000. That is what 'file_display' is, by the way. Again, thank you! Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Mon Jun 13 03:54: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 E05E352978 for ; Mon, 13 Jun 2005 03:54:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42015-04 for ; Mon, 13 Jun 2005 06:54:26 +0000 (GMT) Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56]) by svr1.postgresql.org (Postfix) with ESMTP id 8ECB85296E for ; Mon, 13 Jun 2005 03:54:24 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by adicia.telenet-ops.be (Postfix) with SMTP id D329044368 for ; Mon, 13 Jun 2005 08:54:22 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by adicia.telenet-ops.be (Postfix) with ESMTP id 63AB644302 for ; Mon, 13 Jun 2005 08:54:22 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: <9e1745a6fe1ae29c6f1c824128871d36@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-55-752024476 From: Yves Vindevogel Subject: View not using index Date: Mon, 13 Jun 2005 08:54:21 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/274 X-Sequence-Number: 12911 --Apple-Mail-55-752024476 Content-Type: multipart/alternative; boundary=Apple-Mail-56-752024476 --Apple-Mail-56-752024476 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi, I have a view that has something like this: select x, y, z from tbl=20 order by x, y I have created a special index on x + y I have run analyze Still, when I use explain, pg says it will first sort my tables instead=20= of using my index How is that possible ? When I do explain select x,y,z from tbl order by x, y, it works like=20= I want it to work Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-56-752024476 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Hi, I have a view that has something like this: select x, y, z from tbl order by x, y I have created a special index on x + y I have run analyze Still, when I use explain, pg says it will first sort my tables instead of using my index How is that possible ? When I do explain select x,y,z from tbl order by x, y, it works like I want it to work Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-56-752024476-- --Apple-Mail-55-752024476 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tWO/+FjlKVWtfijTNRBsvDbhrdP3NUAwY38KFfkc0PuNjRWLLz8ytiTUVdVlnjlA2 MWP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/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-55-752024476 Content-Type: multipart/alternative; boundary=Apple-Mail-57-752024477 --Apple-Mail-57-752024477 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-57-752024477 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-57-752024477-- --Apple-Mail-55-752024476-- From pgsql-performance-owner@postgresql.org Mon Jun 13 04:06: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 F084D52A2D for ; Mon, 13 Jun 2005 04:06:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48008-05 for ; Mon, 13 Jun 2005 07:06:40 +0000 (GMT) Received: from pws.com.au (mail.pws.com.au [210.23.138.139]) by svr1.postgresql.org (Postfix) with SMTP id E3C2B52978 for ; Mon, 13 Jun 2005 04:05:39 -0300 (ADT) Received: (qmail 17402 invoked from network); 13 Jun 2005 07:05:37 -0000 Received: from unknown (HELO wizzard.pws.com.au) (russell@pws.com.au@138.217.54.70) by mail.pws.com.au with SMTP; 13 Jun 2005 07:05:37 -0000 From: Russell Smith To: Yves Vindevogel Subject: Re: View not using index Date: Mon, 13 Jun 2005 17:05:35 +1000 User-Agent: KMail/1.7.2 Cc: pgsql-performance@postgresql.org References: <9e1745a6fe1ae29c6f1c824128871d36@implements.be> In-Reply-To: <9e1745a6fe1ae29c6f1c824128871d36@implements.be> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506131705.35852.mr-russ@pws.com.au> 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: 200506/275 X-Sequence-Number: 12912 On Mon, 13 Jun 2005 04:54 pm, Yves Vindevogel wrote: > Still, when I use explain, pg says it will first sort my tables instead > of using my index > How is that possible ? Can we see the output of the explain analyze? The definition of the view? Regards Russell Smith From pgsql-performance-owner@postgresql.org Mon Jun 13 04:18: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 3E27F528CE for ; Mon, 13 Jun 2005 04:18:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49918-08 for ; Mon, 13 Jun 2005 07:18:53 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id 429305283C for ; Mon, 13 Jun 2005 04:18:51 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id 21A3038005 for ; Mon, 13 Jun 2005 09:18:52 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id 6A38B3814F for ; Mon, 13 Jun 2005 09:18:51 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <200506131705.35852.mr-russ@pws.com.au> References: <9e1745a6fe1ae29c6f1c824128871d36@implements.be> <200506131705.35852.mr-russ@pws.com.au> Content-Type: multipart/mixed; boundary=Apple-Mail-69-753493705 Message-Id: From: Yves Vindevogel Subject: Re: View not using index Date: Mon, 13 Jun 2005 09:18:50 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/276 X-Sequence-Number: 12913 --Apple-Mail-69-753493705 Content-Type: multipart/alternative; boundary=Apple-Mail-70-753493705 --Apple-Mail-70-753493705 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed rvponp=3D# explain select * from vw_document_pagesperjob ; QUERY PLAN ------------------------------------------------------------------------=20= ---------------- Subquery Scan vw_document_pagesperjob (cost=3D82796.59..90149.20 =20 rows=3D588209 width=3D706) -> Sort (cost=3D82796.59..84267.11 rows=3D588209 width=3D74) Sort Key: tblprintjobs.descpages, tblprintjobs.documentname -> Seq Scan on tblprintjobs (cost=3D0.00..26428.61 = rows=3D588209 =20 width=3D74) (4 rows) rvponp=3D# explain select * from vw_document_pagesperjob limit 10 ; QUERY PLAN ------------------------------------------------------------------------=20= ---------------------- Limit (cost=3D82796.59..82796.72 rows=3D10 width=3D706) -> Subquery Scan vw_document_pagesperjob (cost=3D82796.59..90149.20 = =20 rows=3D588209 width=3D706) -> Sort (cost=3D82796.59..84267.11 rows=3D588209 width=3D74) Sort Key: tblprintjobs.descpages, =20 tblprintjobs.documentname -> Seq Scan on tblprintjobs (cost=3D0.00..26428.61 =20 rows=3D588209 width=3D74) (5 rows) rvponp=3D# explain select documentname, eventdate, eventtime, loginuser, = =20 pages from tblPrintjobs order by descpages, documentname ; QUERY PLAN ------------------------------------------------------------------------=20= ---- Sort (cost=3D81326.07..82796.59 rows=3D588209 width=3D74) Sort Key: descpages, documentname -> Seq Scan on tblprintjobs (cost=3D0.00..24958.09 rows=3D588209 =20= width=3D74) (3 rows) rvponp=3D# explain select documentname, eventdate, eventtime, loginuser, = =20 pages from tblPrintjobs order by descpages, documentname limit 10 ; QUERY PLAN ------------------------------------------------------------------------=20= ------------------------------------- Limit (cost=3D0.00..33.14 rows=3D10 width=3D74) -> Index Scan using ixprintjobspagesperjob on tblprintjobs =20 (cost=3D0.00..1949116.68 rows=3D588209 width=3D74) (2 rows) create or replace view vw_document_pagesperjob as select documentname, eventdate, eventtime, loginuser, fnFormatInt(pages) as pages from tblPrintjobs order by descpages, documentname ; On 13 Jun 2005, at 09:05, Russell Smith wrote: > On Mon, 13 Jun 2005 04:54 pm, Yves Vindevogel wrote: >> Still, when I use explain, pg says it will first sort my tables =20 >> instead >> of using my index >> How is that possible ? > > Can we see the output of the explain analyze? > The definition of the view? > > Regards > > Russell Smith > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-70-753493705 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 rvponp=3D# explain select * from vw_document_pagesperjob ; QUERY PLAN = =20 = --------------------------------------------------------------------------= -------------- Subquery Scan vw_document_pagesperjob (cost=3D82796.59..90149.20 rows=3D588209 width=3D706) -> Sort (cost=3D82796.59..84267.11 rows=3D588209 width=3D74) Sort Key: tblprintjobs.descpages, tblprintjobs.documentname -> Seq Scan on tblprintjobs (cost=3D0.00..26428.61 rows=3D588209 width=3D74) (4 rows) rvponp=3D# explain select * from vw_document_pagesperjob limit 10 ; QUERY PLAN = =20 = --------------------------------------------------------------------------= -------------------- Limit (cost=3D82796.59..82796.72 rows=3D10 width=3D706) -> Subquery Scan vw_document_pagesperjob (cost=3D82796.59..90149.20 rows=3D588209 width=3D706) -> Sort (cost=3D82796.59..84267.11 rows=3D588209 width=3D74) Sort Key: tblprintjobs.descpages, tblprintjobs.documentname -> Seq Scan on tblprintjobs (cost=3D0.00..26428.61 rows=3D588209 width=3D74) (5 rows) rvponp=3D# explain select documentname, eventdate, eventtime, loginuser, pages from tblPrintjobs order=20 by descpages, documentname ; QUERY PLAN = =20 = --------------------------------------------------------------------------= -- Sort (cost=3D81326.07..82796.59 rows=3D588209 width=3D74) Sort Key: descpages, documentname -> Seq Scan on tblprintjobs (cost=3D0.00..24958.09 rows=3D588209 width=3D74) (3 rows) rvponp=3D# explain select documentname, eventdate, eventtime, loginuser, pages from tblPrintjobs order=20 by descpages, documentname limit 10 ; QUERY PLAN = =20 = --------------------------------------------------------------------------= ----------------------------------- Limit (cost=3D0.00..33.14 rows=3D10 width=3D74) -> Index Scan using ixprintjobspagesperjob on tblprintjobs=20 (cost=3D0.00..1949116.68 rows=3D588209 width=3D74) (2 rows) create or replace view vw_document_pagesperjob as select documentname, eventdate, eventtime, loginuser, fnFormatInt(pages) as pages from tblPrintjobs =20 order by descpages, documentname ; On 13 Jun 2005, at 09:05, Russell Smith wrote: On Mon, 13 Jun 2005 04:54 pm, Yves Vindevogel wrote: Still, when I use explain, pg says it will first sort my tables instead=20 of using my index How is that possible ? Can we see the output of the explain analyze? The definition of the view? Regards Russell Smith Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-70-753493705-- --Apple-Mail-69-753493705 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-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VY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-69-753493705 Content-Type: multipart/alternative; boundary=Apple-Mail-71-753493707 --Apple-Mail-71-753493707 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-71-753493707 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-71-753493707-- --Apple-Mail-69-753493705-- From pgsql-performance-owner@postgresql.org Mon Jun 13 04: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 EFA765292A for ; Mon, 13 Jun 2005 04:19:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50362-06 for ; Mon, 13 Jun 2005 07:19:06 +0000 (GMT) Received: from pws.com.au (mail.pws.com.au [210.23.138.139]) by svr1.postgresql.org (Postfix) with SMTP id 5633C52914 for ; Mon, 13 Jun 2005 04:19:04 -0300 (ADT) Received: (qmail 17820 invoked from network); 13 Jun 2005 07:19:05 -0000 Received: from unknown (HELO wizzard.pws.com.au) (russell@pws.com.au@138.217.54.70) by mail.pws.com.au with SMTP; 13 Jun 2005 07:19:05 -0000 From: Russell Smith To: Yves Vindevogel Subject: Re: View not using index Date: Mon, 13 Jun 2005 17:18:59 +1000 User-Agent: KMail/1.7.2 Cc: Postgresql Performance References: <9e1745a6fe1ae29c6f1c824128871d36@implements.be> <200506131705.35852.mr-russ@pws.com.au> <7c61b484cf630efdb375ca61f92a68b9@implements.be> In-Reply-To: <7c61b484cf630efdb375ca61f92a68b9@implements.be> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506131719.00219.mr-russ@pws.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/277 X-Sequence-Number: 12914 Please CC the list. On Mon, 13 Jun 2005 05:11 pm, Yves Vindevogel wrote: > create or replace view vw_document_pagesperjob as > select documentname, eventdate, eventtime, loginuser, > fnFormatInt(pages) as pages > from tblPrintjobs > order by descpages, documentname ; > > rvponp=# explain select documentname, eventdate, eventtime, loginuser, > pages from tblPrintjobs order > by descpages, documentname ; > QUERY PLAN > ------------------------------------------------------------------------ > ---- > Sort (cost=81326.07..82796.59 rows=588209 width=74) > Sort Key: descpages, documentname > -> Seq Scan on tblprintjobs (cost=0.00..24958.09 rows=588209 > width=74) > (3 rows) > Postgresql must scan the entire heap anyway, so ordering in memory will be faster, and you don't have to load the pages from disk in a random order. > rvponp=# explain select documentname, eventdate, eventtime, loginuser, > pages from tblPrintjobs order > by descpages, documentname limit 10 ; > QUERY PLAN > ------------------------------------------------------------------------ > ------------------------------------- > Limit (cost=0.00..33.14 rows=10 width=74) > -> Index Scan using ixprintjobspagesperjob on tblprintjobs > (cost=0.00..1949116.68 rows=588209 width=74) > (2 rows) > That's because an index scan is only useful if you are scanning a small percentage of the table. Which you are doing when you have the limit clause. > Strange thing is, when I immediately add the limit clause, it runs like > I want it to run. I am not sure of the usefulness of the first query anyway, it returns a lot of data. How do you expect it not to scan the whole table when you want all the data form the table? > Problem is that I run this from Cocoon. Cocoon adds the limit clause > itself. > Maybe I need to rewrite everything in functions instead of views. > Functions, views. It will make not difference. The issue is the amount of data returned relative to the amount of data in the table. Regards Russell Smith From pgsql-performance-owner@postgresql.org Mon Jun 13 04:35: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 2D03752839 for ; Mon, 13 Jun 2005 04:35:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52890-05 for ; Mon, 13 Jun 2005 07:35:48 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id CECDD52824 for ; Mon, 13 Jun 2005 04:35:47 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id CC71B3828E for ; Mon, 13 Jun 2005 09:35:48 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id E652A38278 for ; Mon, 13 Jun 2005 09:35:47 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: References: <9e1745a6fe1ae29c6f1c824128871d36@implements.be> <200506131705.35852.mr-russ@pws.com.au> Content-Type: multipart/mixed; boundary=Apple-Mail-78-754510475 Message-Id: From: Yves Vindevogel Subject: Re: View not using index Date: Mon, 13 Jun 2005 09:35:47 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/278 X-Sequence-Number: 12915 --Apple-Mail-78-754510475 Content-Type: multipart/alternative; boundary=Apple-Mail-79-754510475 --Apple-Mail-79-754510475 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Note the last query below (prev post) There it does use the index rvponp=3D# create type tpJobsPerDay as rvponp-# ( documentname varchar(1000), rvponp(# eventdate date, rvponp(# eventtime time, rvponp(# loginuser varchar(255), rvponp(# pages varchar(20) rvponp(# ) ; CREATE TYPE rvponp=3D# create function fnJobsPerDay (bigint, bigint) returns setof =20= tpJobsPerDay as rvponp-# ' rvponp'# select documentname, eventdate, eventtime, loginuser, =20 fnFormatInt(pages) as pages rvponp'# from tblPrintjobs order by descpages, documentname rvponp'# offset $1 limit $2 ; rvponp'# ' language 'sql' ; CREATE FUNCTION rvponp=3D# analyze ; ANALYZE rvponp=3D# explain select * from fnJobsperday (1, 10) ; QUERY PLAN ----------------------------------------------------------------------- Function Scan on fnjobsperday (cost=3D0.00..12.50 rows=3D1000 = width=3D697) (1 row) With the function, it still is very slow. I can't see anything in the =20= explain here, but it seems to be using a table scan. On 13 Jun 2005, at 09:18, Yves Vindevogel wrote: > rvponp=3D# explain select * from vw_document_pagesperjob ; > QUERY PLAN > = -----------------------------------------------------------------------=20= > ----------------- > Subquery Scan vw_document_pagesperjob (cost=3D82796.59..90149.20 =20 > rows=3D588209 width=3D706) > -> Sort (cost=3D82796.59..84267.11 rows=3D588209 width=3D74) > Sort Key: tblprintjobs.descpages, tblprintjobs.documentname > -> Seq Scan on tblprintjobs (cost=3D0.00..26428.61 =20 > rows=3D588209 width=3D74) > (4 rows) > > rvponp=3D# explain select * from vw_document_pagesperjob limit 10 ; > QUERY PLAN > = -----------------------------------------------------------------------=20= > ----------------------- > Limit (cost=3D82796.59..82796.72 rows=3D10 width=3D706) > -> Subquery Scan vw_document_pagesperjob (cost=3D82796.59..90149.20= =20 > rows=3D588209 width=3D706) > -> Sort (cost=3D82796.59..84267.11 rows=3D588209 width=3D74) > Sort Key: tblprintjobs.descpages, =20 > tblprintjobs.documentname > -> Seq Scan on tblprintjobs (cost=3D0.00..26428.61 =20= > rows=3D588209 width=3D74) > (5 rows) > > rvponp=3D# explain select documentname, eventdate, eventtime, = loginuser, =20 > pages from tblPrintjobs order > by descpages, documentname ; > QUERY PLAN > = -----------------------------------------------------------------------=20= > ----- > Sort (cost=3D81326.07..82796.59 rows=3D588209 width=3D74) > Sort Key: descpages, documentname > -> Seq Scan on tblprintjobs (cost=3D0.00..24958.09 rows=3D588209 =20= > width=3D74) > (3 rows) > > rvponp=3D# explain select documentname, eventdate, eventtime, = loginuser, =20 > pages from tblPrintjobs order > by descpages, documentname limit 10 ; > QUERY PLAN > = -----------------------------------------------------------------------=20= > -------------------------------------- > Limit (cost=3D0.00..33.14 rows=3D10 width=3D74) > -> Index Scan using ixprintjobspagesperjob on tblprintjobs =20 > (cost=3D0.00..1949116.68 rows=3D588209 width=3D74) > (2 rows) > > > create or replace view vw_document_pagesperjob as > select documentname, eventdate, eventtime, loginuser, > fnFormatInt(pages) as pages > from tblPrintjobs > order by descpages, documentname ; > > > > > > > On 13 Jun 2005, at 09:05, Russell Smith wrote: > >> On Mon, 13 Jun 2005 04:54 pm, Yves Vindevogel wrote: >>> Still, when I use explain, pg says it will first sort my tables =20 >>> instead >>> of using my index >>> How is that possible ? >> >> Can we see the output of the explain analyze? >> The definition of the view? >> >> Regards >> >> Russell Smith >> >> > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > Yves Vindevogel > Implements > > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. = =20 > Then you win. > Mahatma Ghandi. > > ---------------------------(end of =20 > broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-79-754510475 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Note the last query below (prev post) There it does use the index rvponp=3D# create type tpJobsPerDay as rvponp-# ( documentname varchar(1000), rvponp(# eventdate date, rvponp(# eventtime time, rvponp(# loginuser varchar(255), rvponp(# pages varchar(20) rvponp(# ) ; CREATE TYPE rvponp=3D# create function fnJobsPerDay (bigint, bigint) returns setof tpJobsPerDay as rvponp-# ' rvponp'# select documentname, eventdate, eventtime, loginuser, fnFormatInt(pages) as pages rvponp'# from tblPrintjobs order by descpages, documentname rvponp'# offset $1 limit $2 ; rvponp'# ' language 'sql' ; CREATE FUNCTION rvponp=3D# analyze ; ANALYZE rvponp=3D# explain select * from fnJobsperday (1, 10) ; QUERY PLAN =20= ----------------------------------------------------------------------- Function Scan on fnjobsperday (cost=3D0.00..12.50 rows=3D1000 = width=3D697) (1 row) With the function, it still is very slow. I can't see anything in the explain here, but it seems to be using a table scan. On 13 Jun 2005, at 09:18, Yves Vindevogel wrote: rvponp=3D# explain select * from vw_document_pagesperjob ; QUERY PLAN = =20 = --------------------------------------------------------------------------= -------------- Subquery Scan vw_document_pagesperjob (cost=3D82796.59..90149.20 rows=3D588209 width=3D706) -> Sort (cost=3D82796.59..84267.11 rows=3D588209 width=3D74) Sort Key: tblprintjobs.descpages, tblprintjobs.documentname -> Seq Scan on tblprintjobs (cost=3D0.00..26428.61 rows=3D588209 width=3D74) (4 rows) rvponp=3D# explain select * from vw_document_pagesperjob limit 10 ; QUERY PLAN = =20 = --------------------------------------------------------------------------= -------------------- Limit (cost=3D82796.59..82796.72 rows=3D10 width=3D706) -> Subquery Scan vw_document_pagesperjob (cost=3D82796.59..90149.20 rows=3D588209 width=3D706) -> Sort (cost=3D82796.59..84267.11 rows=3D588209 width=3D74) Sort Key: tblprintjobs.descpages, tblprintjobs.documentname -> Seq Scan on tblprintjobs (cost=3D0.00..26428.61 rows=3D588209 width=3D74) (5 rows) rvponp=3D# explain select documentname, eventdate, eventtime, loginuser, pages from tblPrintjobs order=20 by descpages, documentname ; QUERY PLAN = =20 = --------------------------------------------------------------------------= -- Sort (cost=3D81326.07..82796.59 rows=3D588209 width=3D74) Sort Key: descpages, documentname -> Seq Scan on tblprintjobs (cost=3D0.00..24958.09 rows=3D588209 width=3D74) (3 rows) rvponp=3D# explain select documentname, eventdate, eventtime, loginuser, pages from tblPrintjobs order=20 by descpages, documentname limit 10 ; QUERY PLAN = =20 = --------------------------------------------------------------------------= ----------------------------------- Limit (cost=3D0.00..33.14 rows=3D10 width=3D74) -> Index Scan using ixprintjobspagesperjob on tblprintjobs=20 (cost=3D0.00..1949116.68 rows=3D588209 width=3D74) (2 rows) create or replace view vw_document_pagesperjob as select documentname, eventdate, eventtime, loginuser, fnFormatInt(pages) as pages from tblPrintjobs =20 order by descpages, documentname ; On 13 Jun 2005, at 09:05, Russell Smith wrote: On Mon, 13 Jun 2005 04:54 pm, Yves Vindevogel wrote: Still, when I use explain, pg says it will first sort my tables instead=20 of using my index How is that possible ? Can we see the output of the explain analyze? The definition of the view? Regards Russell Smith Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements < Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma Ghandi. ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-79-754510475-- --Apple-Mail-78-754510475 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tWO/+FjlKVWtfijTNRBsvDbhrdP3NUAwY38KFfkc0PuNjRWLLz8ytiTUVdVlnjlA2 MWPAWRAAM8LAAMjhhuR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/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-78-754510475 Content-Type: multipart/alternative; boundary=Apple-Mail-80-754510477 --Apple-Mail-80-754510477 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-80-754510477 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-80-754510477-- --Apple-Mail-78-754510475-- From pgsql-performance-owner@postgresql.org Mon Jun 13 05:54: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 71E475283C for ; Mon, 13 Jun 2005 05:54:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65732-07 for ; Mon, 13 Jun 2005 08:54:31 +0000 (GMT) Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz [202.0.58.21]) by svr1.postgresql.org (Postfix) with ESMTP id 152C452839 for ; Mon, 13 Jun 2005 05:54:26 -0300 (ADT) Received: from smtp-1.paradise.net.nz (smtp-1a.paradise.net.nz [202.0.32.194]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0II000DYAM2QJW@linda-2.paradise.net.nz> for pgsql-performance@postgresql.org; Mon, 13 Jun 2005 20:54:27 +1200 (NZST) Received: from [192.168.1.11] (218-101-14-40.paradise.net.nz [218.101.14.40]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 07ED282B40; Mon, 13 Jun 2005 20:54:26 +1200 (NZST) Date: Mon, 13 Jun 2005 20:54:23 +1200 From: Mark Kirkwood Subject: Re: Updates on large tables are extremely slow In-reply-to: To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Message-id: <42AD49BF.7050706@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050511) References: <579bc853ef3957c736c2773f13c444f7@implements.be> <42ACF2DD.8090409@paradise.net.nz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.147 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/279 X-Sequence-Number: 12916 Apologies - I should have said output of 'VACUUM VERBOSE mytable'. (been using 8.1, which displays dead tuple info in ANALYZE...). Mark Yves Vindevogel wrote: > rvponp=# analyze verbose tblPrintjobs ; > INFO: analyzing "public.tblprintjobs" > INFO: "tblprintjobs": 19076 pages, 3000 rows sampled, 588209 estimated > total rows > ANALYZE > > > On 13 Jun 2005, at 04:43, Mark Kirkwood wrote: > > Yves Vindevogel wrote: > > I'm trying to update a table that has about 600.000 records. > The update query is very simple : update mytable set pagesdesc = > - pages ; > The query takes about half an hour to an hour to execute. I have > tried a lot of things. > > > Half an hour seem a bit long - I would expect less than 5 minutes on > reasonable hardware. > > You may have dead tuple bloat - can you post the output of 'ANALYZE > VERBOSE mytable' ? From pgsql-performance-owner@postgresql.org Mon Jun 13 06:02: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 68EC452813 for ; Mon, 13 Jun 2005 06:02:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68443-02 for ; Mon, 13 Jun 2005 09:02:10 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id CDFF8528A6 for ; Mon, 13 Jun 2005 06:02:04 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id 212763821A for ; Mon, 13 Jun 2005 11:02:06 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id 15165381B1 for ; Mon, 13 Jun 2005 11:02:05 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <42AD49BF.7050706@paradise.net.nz> References: <579bc853ef3957c736c2773f13c444f7@implements.be> <42ACF2DD.8090409@paradise.net.nz> <42AD49BF.7050706@paradise.net.nz> Content-Type: multipart/mixed; boundary=Apple-Mail-85-759687226 Message-Id: <65760c67987848d35eafecdcccd8742c@implements.be> From: Yves Vindevogel Subject: Re: Updates on large tables are extremely slow Date: Mon, 13 Jun 2005 11:02:04 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/280 X-Sequence-Number: 12917 --Apple-Mail-85-759687226 Content-Type: multipart/alternative; boundary=Apple-Mail-86-759687226 --Apple-Mail-86-759687226 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed rvponp=3D# vacuum verbose tblPrintjobs ; INFO: vacuuming "public.tblprintjobs" INFO: index "pkprintjobs" now contains 622972 row versions in 8410=20 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.60s/0.31u sec elapsed 31.68 sec. INFO: index "uxprintjobs" now contains 622972 row versions in 3978=20 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.15s/0.48u sec elapsed 3.59 sec. INFO: index "ixprintjobsipaddress" now contains 622972 row versions in=20= 2542 pages DETAIL: 9526 index row versions were removed. 49 index pages have been deleted, 0 are currently reusable. CPU 0.13s/0.24u sec elapsed 2.57 sec. INFO: index "ixprintjobshostname" now contains 622972 row versions in=20= 2038 pages DETAIL: 9526 index row versions were removed. 35 index pages have been deleted, 0 are currently reusable. CPU 0.09s/0.30u sec elapsed 1.14 sec. INFO: index "ixprintjobsrecordnumber" now contains 622972 row versions=20= in 1850 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.28u sec elapsed 1.51 sec. INFO: index "ixprintjobseventdate" now contains 622972 row versions in=20= 1408 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.05s/0.24u sec elapsed 2.61 sec. INFO: index "ixprintjobseventtime" now contains 622972 row versions in=20= 1711 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.12s/0.53u sec elapsed 11.66 sec. INFO: index "ixprintjobseventcomputer" now contains 622972 row=20 versions in 2039 pages DETAIL: 9526 index row versions were removed. 36 index pages have been deleted, 0 are currently reusable. CPU 0.12s/0.23u sec elapsed 1.27 sec. INFO: index "ixprintjobseventuser" now contains 622972 row versions in=20= 2523 pages DETAIL: 9526 index row versions were removed. 19 index pages have been deleted, 0 are currently reusable. CPU 0.14s/0.24u sec elapsed 1.74 sec. INFO: index "ixprintjobsloginuser" now contains 622972 row versions in=20= 2114 pages DETAIL: 9526 index row versions were removed. 13 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.32u sec elapsed 4.29 sec. INFO: index "ixprintjobsprintqueue" now contains 622972 row versions=20 in 2201 pages DETAIL: 9526 index row versions were removed. 30 index pages have been deleted, 0 are currently reusable. CPU 0.10s/0.34u sec elapsed 1.92 sec. INFO: index "ixprintjobsprintport" now contains 622972 row versions in=20= 3040 pages DETAIL: 9526 index row versions were removed. 40 index pages have been deleted, 0 are currently reusable. CPU 0.18s/0.27u sec elapsed 2.63 sec. INFO: index "ixprintjobssize" now contains 622972 row versions in 1733=20= pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.16s/0.43u sec elapsed 4.07 sec. INFO: index "ixprintjobspages" now contains 622972 row versions in=20 1746 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.13s/0.22u sec elapsed 1.58 sec. INFO: index "ixprintjobsapplicationtype" now contains 622972 row=20 versions in 1395 pages DETAIL: 9526 index row versions were removed. 27 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.29u sec elapsed 1.20 sec. INFO: index "ixprintjobsusertype" now contains 622972 row versions in=20= 1393 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.22u sec elapsed 0.82 sec. INFO: index "ixprintjobsdocumentname" now contains 622972 row versions=20= in 4539 pages DETAIL: 9526 index row versions were removed. 6 index pages have been deleted, 0 are currently reusable. CPU 0.24s/0.38u sec elapsed 5.83 sec. INFO: index "ixprintjobsdesceventdate" now contains 622972 row=20 versions in 1757 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.08s/0.25u sec elapsed 1.16 sec. INFO: index "ixprintjobsdesceventtime" now contains 622972 row=20 versions in 1711 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.18s/0.52u sec elapsed 9.44 sec. INFO: index "ixprintjobsdescpages" now contains 622972 row versions in=20= 1748 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.06s/0.26u sec elapsed 0.94 sec. INFO: index "ixprintjobspagesperjob" now contains 622972 row versions=20= in 5259 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.31s/0.36u sec elapsed 5.47 sec. INFO: "tblprintjobs": removed 9526 row versions in 307 pages DETAIL: CPU 0.00s/0.06u sec elapsed 0.23 sec. INFO: "tblprintjobs": found 9526 removable, 622972 nonremovable row=20 versions in 19382 pages DETAIL: 0 dead row versions cannot be removed yet. There were 75443 unused item pointers. 0 pages are entirely empty. CPU 3.43s/6.83u sec elapsed 97.86 sec. INFO: vacuuming "pg_toast.pg_toast_2169880" INFO: index "pg_toast_2169880_index" now contains 0 row versions in 1=20= pages DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: "pg_toast_2169880": found 0 removable, 0 nonremovable row=20 versions in 0 pages DETAIL: 0 dead row versions cannot be removed yet. There were 0 unused item pointers. 0 pages are entirely empty. CPU 0.00s/0.00u sec elapsed 0.00 sec. VACUUM rvponp=3D# On 13 Jun 2005, at 10:54, Mark Kirkwood wrote: > Apologies - I should have said output of 'VACUUM VERBOSE mytable'. > > (been using 8.1, which displays dead tuple info in ANALYZE...). > > Mark > > Yves Vindevogel wrote: >> rvponp=3D# analyze verbose tblPrintjobs ; >> INFO: analyzing "public.tblprintjobs" >> INFO: "tblprintjobs": 19076 pages, 3000 rows sampled, 588209=20 >> estimated total rows >> ANALYZE >> On 13 Jun 2005, at 04:43, Mark Kirkwood wrote: >> Yves Vindevogel wrote: >> I'm trying to update a table that has about 600.000 records. >> The update query is very simple : update mytable set=20 >> pagesdesc =3D >> - pages ; >> The query takes about half an hour to an hour to execute. I=20= >> have >> tried a lot of things. >> Half an hour seem a bit long - I would expect less than 5 minutes=20= >> on >> reasonable hardware. >> You may have dead tuple bloat - can you post the output of=20 >> 'ANALYZE >> VERBOSE mytable' ? > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-86-759687226 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 rvponp=3D# vacuum verbose tblPrintjobs ; INFO: vacuuming "public.tblprintjobs" INFO: index "pkprintjobs" now contains 622972 row versions in 8410 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.60s/0.31u sec elapsed 31.68 sec. INFO: index "uxprintjobs" now contains 622972 row versions in 3978 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.15s/0.48u sec elapsed 3.59 sec. INFO: index "ixprintjobsipaddress" now contains 622972 row versions in 2542 pages DETAIL: 9526 index row versions were removed. 49 index pages have been deleted, 0 are currently reusable. CPU 0.13s/0.24u sec elapsed 2.57 sec. INFO: index "ixprintjobshostname" now contains 622972 row versions in 2038 pages DETAIL: 9526 index row versions were removed. 35 index pages have been deleted, 0 are currently reusable. CPU 0.09s/0.30u sec elapsed 1.14 sec. INFO: index "ixprintjobsrecordnumber" now contains 622972 row versions in 1850 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.28u sec elapsed 1.51 sec. INFO: index "ixprintjobseventdate" now contains 622972 row versions in 1408 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.05s/0.24u sec elapsed 2.61 sec. INFO: index "ixprintjobseventtime" now contains 622972 row versions in 1711 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.12s/0.53u sec elapsed 11.66 sec. INFO: index "ixprintjobseventcomputer" now contains 622972 row versions in 2039 pages DETAIL: 9526 index row versions were removed. 36 index pages have been deleted, 0 are currently reusable. CPU 0.12s/0.23u sec elapsed 1.27 sec. INFO: index "ixprintjobseventuser" now contains 622972 row versions in 2523 pages DETAIL: 9526 index row versions were removed. 19 index pages have been deleted, 0 are currently reusable. CPU 0.14s/0.24u sec elapsed 1.74 sec. INFO: index "ixprintjobsloginuser" now contains 622972 row versions in 2114 pages DETAIL: 9526 index row versions were removed. 13 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.32u sec elapsed 4.29 sec. INFO: index "ixprintjobsprintqueue" now contains 622972 row versions in 2201 pages DETAIL: 9526 index row versions were removed. 30 index pages have been deleted, 0 are currently reusable. CPU 0.10s/0.34u sec elapsed 1.92 sec. INFO: index "ixprintjobsprintport" now contains 622972 row versions in 3040 pages DETAIL: 9526 index row versions were removed. 40 index pages have been deleted, 0 are currently reusable. CPU 0.18s/0.27u sec elapsed 2.63 sec. INFO: index "ixprintjobssize" now contains 622972 row versions in 1733 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.16s/0.43u sec elapsed 4.07 sec. INFO: index "ixprintjobspages" now contains 622972 row versions in 1746 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.13s/0.22u sec elapsed 1.58 sec. INFO: index "ixprintjobsapplicationtype" now contains 622972 row versions in 1395 pages DETAIL: 9526 index row versions were removed. 27 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.29u sec elapsed 1.20 sec. INFO: index "ixprintjobsusertype" now contains 622972 row versions in 1393 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.22u sec elapsed 0.82 sec. INFO: index "ixprintjobsdocumentname" now contains 622972 row versions in 4539 pages DETAIL: 9526 index row versions were removed. 6 index pages have been deleted, 0 are currently reusable. CPU 0.24s/0.38u sec elapsed 5.83 sec. INFO: index "ixprintjobsdesceventdate" now contains 622972 row versions in 1757 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.08s/0.25u sec elapsed 1.16 sec. INFO: index "ixprintjobsdesceventtime" now contains 622972 row versions in 1711 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.18s/0.52u sec elapsed 9.44 sec. INFO: index "ixprintjobsdescpages" now contains 622972 row versions in 1748 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.06s/0.26u sec elapsed 0.94 sec. INFO: index "ixprintjobspagesperjob" now contains 622972 row versions in 5259 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.31s/0.36u sec elapsed 5.47 sec. INFO: "tblprintjobs": removed 9526 row versions in 307 pages DETAIL: CPU 0.00s/0.06u sec elapsed 0.23 sec. INFO: "tblprintjobs": found 9526 removable, 622972 nonremovable row versions in 19382 pages DETAIL: 0 dead row versions cannot be removed yet. There were 75443 unused item pointers. 0 pages are entirely empty. CPU 3.43s/6.83u sec elapsed 97.86 sec. INFO: vacuuming "pg_toast.pg_toast_2169880" INFO: index "pg_toast_2169880_index" now contains 0 row versions in 1 pages DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: "pg_toast_2169880": found 0 removable, 0 nonremovable row versions in 0 pages DETAIL: 0 dead row versions cannot be removed yet. There were 0 unused item pointers. 0 pages are entirely empty. CPU 0.00s/0.00u sec elapsed 0.00 sec. VACUUM rvponp=3D#=20 On 13 Jun 2005, at 10:54, Mark Kirkwood wrote: Apologies - I should have said output of 'VACUUM VERBOSE mytable'. (been using 8.1, which displays dead tuple info in ANALYZE...). Mark Yves Vindevogel wrote: rvponp=3D# analyze verbose tblPrintjobs ; INFO: analyzing "public.tblprintjobs" INFO: "tblprintjobs": 19076 pages, 3000 rows sampled, 588209 estimated total rows ANALYZE On 13 Jun 2005, at 04:43, Mark Kirkwood wrote: Yves Vindevogel wrote: I'm trying to update a table that has about 600.000 records. The update query is very simple : update mytable set pagesdesc =3D= - pages ; The query takes about half an hour to an hour to execute. I have tried a lot of things. Half an hour seem a bit long - I would expect less than 5 minutes on reasonable hardware. You may have dead tuple bloat - can you post the output of 'ANALYZE VERBOSE mytable' ? Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-86-759687226-- --Apple-Mail-85-759687226 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DD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fFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-85-759687226 Content-Type: multipart/alternative; boundary=Apple-Mail-87-759687228 --Apple-Mail-87-759687228 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-87-759687228 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-87-759687228-- --Apple-Mail-85-759687226-- From pgsql-performance-owner@postgresql.org Mon Jun 13 08:51: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 81F9F52835 for ; Mon, 13 Jun 2005 08:51:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97150-08 for ; Mon, 13 Jun 2005 11:51:42 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id 3E7C15282A for ; Mon, 13 Jun 2005 08:51:40 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id 2DBAD3815D for ; Mon, 13 Jun 2005 13:51:44 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id 88B7E38169 for ; Mon, 13 Jun 2005 13:51:42 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: <554ac970b5cdc99527b01cac3dfbffa4@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-112-769864825 From: Yves Vindevogel Subject: Fwd: Updates on large tables are extremely slow Date: Mon, 13 Jun 2005 13:51:41 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/281 X-Sequence-Number: 12918 --Apple-Mail-112-769864825 Content-Type: multipart/alternative; boundary=Apple-Mail-113-769864825 --Apple-Mail-113-769864825 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > I have started this on my testmachine at 11h20. It's still running=20 > and here it's 13h40. > > Setup: > Intel P4 2Ghz, 1 Gb ram > ReiserFS 3 (with atime in fstab, which is not optimal) > Slackware 10 > PG 7.4 > > I have the same problems on my OSX and other test machines. > > It's frustrating. Even Microsoft Access is faster !! > > On 13 Jun 2005, at 11:02, Yves Vindevogel wrote: > >> rvponp=3D# vacuum verbose tblPrintjobs ; >> INFO: vacuuming "public.tblprintjobs" >> INFO: index "pkprintjobs" now contains 622972 row versions in 8410=20= >> pages >> DETAIL: 9526 index row versions were removed. >> 0 index pages have been deleted, 0 are currently reusable. >> CPU 0.60s/0.31u sec elapsed 31.68 sec. >> INFO: index "uxprintjobs" now contains 622972 row versions in 3978=20= >> pages >> DETAIL: 9526 index row versions were removed. >> 0 index pages have been deleted, 0 are currently reusable. >> CPU 0.15s/0.48u sec elapsed 3.59 sec. >> INFO: index "ixprintjobsipaddress" now contains 622972 row versions=20= >> in 2542 pages >> DETAIL: 9526 index row versions were removed. >> 49 index pages have been deleted, 0 are currently reusable. >> CPU 0.13s/0.24u sec elapsed 2.57 sec. >> INFO: index "ixprintjobshostname" now contains 622972 row versions=20= >> in 2038 pages >> DETAIL: 9526 index row versions were removed. >> 35 index pages have been deleted, 0 are currently reusable. >> CPU 0.09s/0.30u sec elapsed 1.14 sec. >> INFO: index "ixprintjobsrecordnumber" now contains 622972 row=20 >> versions in 1850 pages >> DETAIL: 9526 index row versions were removed. >> 0 index pages have been deleted, 0 are currently reusable. >> CPU 0.07s/0.28u sec elapsed 1.51 sec. >> INFO: index "ixprintjobseventdate" now contains 622972 row versions=20= >> in 1408 pages >> DETAIL: 9526 index row versions were removed. >> 4 index pages have been deleted, 0 are currently reusable. >> CPU 0.05s/0.24u sec elapsed 2.61 sec. >> INFO: index "ixprintjobseventtime" now contains 622972 row versions=20= >> in 1711 pages >> DETAIL: 9526 index row versions were removed. >> 0 index pages have been deleted, 0 are currently reusable. >> CPU 0.12s/0.53u sec elapsed 11.66 sec. >> INFO: index "ixprintjobseventcomputer" now contains 622972 row=20 >> versions in 2039 pages >> DETAIL: 9526 index row versions were removed. >> 36 index pages have been deleted, 0 are currently reusable. >> CPU 0.12s/0.23u sec elapsed 1.27 sec. >> INFO: index "ixprintjobseventuser" now contains 622972 row versions=20= >> in 2523 pages >> DETAIL: 9526 index row versions were removed. >> 19 index pages have been deleted, 0 are currently reusable. >> CPU 0.14s/0.24u sec elapsed 1.74 sec. >> INFO: index "ixprintjobsloginuser" now contains 622972 row versions=20= >> in 2114 pages >> DETAIL: 9526 index row versions were removed. >> 13 index pages have been deleted, 0 are currently reusable. >> CPU 0.07s/0.32u sec elapsed 4.29 sec. >> INFO: index "ixprintjobsprintqueue" now contains 622972 row versions=20= >> in 2201 pages >> DETAIL: 9526 index row versions were removed. >> 30 index pages have been deleted, 0 are currently reusable. >> CPU 0.10s/0.34u sec elapsed 1.92 sec. >> INFO: index "ixprintjobsprintport" now contains 622972 row versions=20= >> in 3040 pages >> DETAIL: 9526 index row versions were removed. >> 40 index pages have been deleted, 0 are currently reusable. >> CPU 0.18s/0.27u sec elapsed 2.63 sec. >> INFO: index "ixprintjobssize" now contains 622972 row versions in=20 >> 1733 pages >> DETAIL: 9526 index row versions were removed. >> 0 index pages have been deleted, 0 are currently reusable. >> CPU 0.16s/0.43u sec elapsed 4.07 sec. >> INFO: index "ixprintjobspages" now contains 622972 row versions in=20= >> 1746 pages >> DETAIL: 9526 index row versions were removed. >> 24 index pages have been deleted, 0 are currently reusable. >> CPU 0.13s/0.22u sec elapsed 1.58 sec. >> INFO: index "ixprintjobsapplicationtype" now contains 622972 row=20 >> versions in 1395 pages >> DETAIL: 9526 index row versions were removed. >> 27 index pages have been deleted, 0 are currently reusable. >> CPU 0.07s/0.29u sec elapsed 1.20 sec. >> INFO: index "ixprintjobsusertype" now contains 622972 row versions=20= >> in 1393 pages >> DETAIL: 9526 index row versions were removed. >> 24 index pages have been deleted, 0 are currently reusable. >> CPU 0.07s/0.22u sec elapsed 0.82 sec. >> INFO: index "ixprintjobsdocumentname" now contains 622972 row=20 >> versions in 4539 pages >> DETAIL: 9526 index row versions were removed. >> 6 index pages have been deleted, 0 are currently reusable. >> CPU 0.24s/0.38u sec elapsed 5.83 sec. >> INFO: index "ixprintjobsdesceventdate" now contains 622972 row=20 >> versions in 1757 pages >> DETAIL: 9526 index row versions were removed. >> 4 index pages have been deleted, 0 are currently reusable. >> CPU 0.08s/0.25u sec elapsed 1.16 sec. >> INFO: index "ixprintjobsdesceventtime" now contains 622972 row=20 >> versions in 1711 pages >> DETAIL: 9526 index row versions were removed. >> 0 index pages have been deleted, 0 are currently reusable. >> CPU 0.18s/0.52u sec elapsed 9.44 sec. >> INFO: index "ixprintjobsdescpages" now contains 622972 row versions=20= >> in 1748 pages >> DETAIL: 9526 index row versions were removed. >> 24 index pages have been deleted, 0 are currently reusable. >> CPU 0.06s/0.26u sec elapsed 0.94 sec. >> INFO: index "ixprintjobspagesperjob" now contains 622972 row=20 >> versions in 5259 pages >> DETAIL: 9526 index row versions were removed. >> 4 index pages have been deleted, 0 are currently reusable. >> CPU 0.31s/0.36u sec elapsed 5.47 sec. >> INFO: "tblprintjobs": removed 9526 row versions in 307 pages >> DETAIL: CPU 0.00s/0.06u sec elapsed 0.23 sec. >> INFO: "tblprintjobs": found 9526 removable, 622972 nonremovable row=20= >> versions in 19382 pages >> DETAIL: 0 dead row versions cannot be removed yet. >> There were 75443 unused item pointers. >> 0 pages are entirely empty. >> CPU 3.43s/6.83u sec elapsed 97.86 sec. >> INFO: vacuuming "pg_toast.pg_toast_2169880" >> INFO: index "pg_toast_2169880_index" now contains 0 row versions in=20= >> 1 pages >> DETAIL: 0 index pages have been deleted, 0 are currently reusable. >> CPU 0.00s/0.00u sec elapsed 0.00 sec. >> INFO: "pg_toast_2169880": found 0 removable, 0 nonremovable row=20 >> versions in 0 pages >> DETAIL: 0 dead row versions cannot be removed yet. >> There were 0 unused item pointers. >> 0 pages are entirely empty. >> CPU 0.00s/0.00u sec elapsed 0.00 sec. >> VACUUM >> rvponp=3D# >> >> >> >> On 13 Jun 2005, at 10:54, Mark Kirkwood wrote: >> >>> Apologies - I should have said output of 'VACUUM VERBOSE mytable'. >>> >>> (been using 8.1, which displays dead tuple info in ANALYZE...). >>> >>> Mark >>> >>> Yves Vindevogel wrote: >>>> rvponp=3D# analyze verbose tblPrintjobs ; >>>> INFO: analyzing "public.tblprintjobs" >>>> INFO: "tblprintjobs": 19076 pages, 3000 rows sampled, 588209=20 >>>> estimated total rows >>>> ANALYZE >>>> On 13 Jun 2005, at 04:43, Mark Kirkwood wrote: >>>> Yves Vindevogel wrote: >>>> I'm trying to update a table that has about 600.000 = records. >>>> The update query is very simple : update mytable set=20 >>>> pagesdesc =3D >>>> - pages ; >>>> The query takes about half an hour to an hour to execute. I=20= >>>> have >>>> tried a lot of things. >>>> Half an hour seem a bit long - I would expect less than 5=20 >>>> minutes on >>>> reasonable hardware. >>>> You may have dead tuple bloat - can you post the output of=20 >>>> 'ANALYZE >>>> VERBOSE mytable' ? >>> >>> >> Met vriendelijke groeten, >> Bien =E0 vous, >> Kind regards, >> >> Yves Vindevogel >> Implements >> >> >> >> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 >> >> Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 >> >> Web: http://www.implements.be >> >> First they ignore you. Then they laugh at you. Then they fight you.=20= >> Then you win. >> Mahatma Ghandi. >> >> >> ---------------------------(end of=20 >> broadcast)--------------------------- >> TIP 7: don't forget to increase your free space map settings >> > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > Yves Vindevogel > Implements > --Apple-Mail-113-769864825 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 I have started this on my testmachine at 11h20. It's still running and here it's 13h40. Setup: Intel P4 2Ghz, 1 Gb ram ReiserFS 3 (with atime in fstab, which is not optimal) Slackware 10 PG 7.4 I have the same problems on my OSX and other test machines. It's frustrating. Even Microsoft Access is faster !! On 13 Jun 2005, at 11:02, Yves Vindevogel wrote: rvponp=3D# vacuum verbose tblPrintjobs ; INFO: vacuuming "public.tblprintjobs" INFO: index "pkprintjobs" now contains 622972 row versions in 8410 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.60s/0.31u sec elapsed 31.68 sec. INFO: index "uxprintjobs" now contains 622972 row versions in 3978 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.15s/0.48u sec elapsed 3.59 sec. INFO: index "ixprintjobsipaddress" now contains 622972 row versions in 2542 pages DETAIL: 9526 index row versions were removed. 49 index pages have been deleted, 0 are currently reusable. CPU 0.13s/0.24u sec elapsed 2.57 sec. INFO: index "ixprintjobshostname" now contains 622972 row versions in 2038 pages DETAIL: 9526 index row versions were removed. 35 index pages have been deleted, 0 are currently reusable. CPU 0.09s/0.30u sec elapsed 1.14 sec. INFO: index "ixprintjobsrecordnumber" now contains 622972 row versions in 1850 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.28u sec elapsed 1.51 sec. INFO: index "ixprintjobseventdate" now contains 622972 row versions in 1408 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.05s/0.24u sec elapsed 2.61 sec. INFO: index "ixprintjobseventtime" now contains 622972 row versions in 1711 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.12s/0.53u sec elapsed 11.66 sec. INFO: index "ixprintjobseventcomputer" now contains 622972 row versions in 2039 pages DETAIL: 9526 index row versions were removed. 36 index pages have been deleted, 0 are currently reusable. CPU 0.12s/0.23u sec elapsed 1.27 sec. INFO: index "ixprintjobseventuser" now contains 622972 row versions in 2523 pages DETAIL: 9526 index row versions were removed. 19 index pages have been deleted, 0 are currently reusable. CPU 0.14s/0.24u sec elapsed 1.74 sec. INFO: index "ixprintjobsloginuser" now contains 622972 row versions in 2114 pages DETAIL: 9526 index row versions were removed. 13 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.32u sec elapsed 4.29 sec. INFO: index "ixprintjobsprintqueue" now contains 622972 row versions in 2201 pages DETAIL: 9526 index row versions were removed. 30 index pages have been deleted, 0 are currently reusable. CPU 0.10s/0.34u sec elapsed 1.92 sec. INFO: index "ixprintjobsprintport" now contains 622972 row versions in 3040 pages DETAIL: 9526 index row versions were removed. 40 index pages have been deleted, 0 are currently reusable. CPU 0.18s/0.27u sec elapsed 2.63 sec. INFO: index "ixprintjobssize" now contains 622972 row versions in 1733 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.16s/0.43u sec elapsed 4.07 sec. INFO: index "ixprintjobspages" now contains 622972 row versions in 1746 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.13s/0.22u sec elapsed 1.58 sec. INFO: index "ixprintjobsapplicationtype" now contains 622972 row versions in 1395 pages DETAIL: 9526 index row versions were removed. 27 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.29u sec elapsed 1.20 sec. INFO: index "ixprintjobsusertype" now contains 622972 row versions in 1393 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.22u sec elapsed 0.82 sec. INFO: index "ixprintjobsdocumentname" now contains 622972 row versions in 4539 pages DETAIL: 9526 index row versions were removed. 6 index pages have been deleted, 0 are currently reusable. CPU 0.24s/0.38u sec elapsed 5.83 sec. INFO: index "ixprintjobsdesceventdate" now contains 622972 row versions in 1757 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.08s/0.25u sec elapsed 1.16 sec. INFO: index "ixprintjobsdesceventtime" now contains 622972 row versions in 1711 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.18s/0.52u sec elapsed 9.44 sec. INFO: index "ixprintjobsdescpages" now contains 622972 row versions in 1748 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.06s/0.26u sec elapsed 0.94 sec. INFO: index "ixprintjobspagesperjob" now contains 622972 row versions in 5259 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.31s/0.36u sec elapsed 5.47 sec. INFO: "tblprintjobs": removed 9526 row versions in 307 pages DETAIL: CPU 0.00s/0.06u sec elapsed 0.23 sec. INFO: "tblprintjobs": found 9526 removable, 622972 nonremovable row versions in 19382 pages DETAIL: 0 dead row versions cannot be removed yet. There were 75443 unused item pointers. 0 pages are entirely empty. CPU 3.43s/6.83u sec elapsed 97.86 sec. INFO: vacuuming "pg_toast.pg_toast_2169880" INFO: index "pg_toast_2169880_index" now contains 0 row versions in 1 pages DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: "pg_toast_2169880": found 0 removable, 0 nonremovable row versions in 0 pages DETAIL: 0 dead row versions cannot be removed yet. There were 0 unused item pointers. 0 pages are entirely empty. CPU 0.00s/0.00u sec elapsed 0.00 sec. VACUUM rvponp=3D#=20 On 13 Jun 2005, at 10:54, Mark Kirkwood wrote: Apologies - I should have said output of 'VACUUM VERBOSE mytable'. (been using 8.1, which displays dead tuple info in ANALYZE...). Mark Yves Vindevogel wrote: rvponp=3D# analyze verbose tblPrintjobs ; INFO: analyzing "public.tblprintjobs" INFO: "tblprintjobs": 19076 pages, 3000 rows sampled, 588209 estimated total rows ANALYZE On 13 Jun 2005, at 04:43, Mark Kirkwood wrote: Yves Vindevogel wrote: I'm trying to update a table that has about 600.000 records. The update query is very simple : update mytable set pagesdesc =3D= - pages ; The query takes about half an hour to an hour to execute. I have tried a lot of things. Half an hour seem a bit long - I would expect less than 5 minutes on reasonable hardware. You may have dead tuple bloat - can you post the output of 'ANALYZE VERBOSE mytable' ? Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements < Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma = Ghandi. ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-113-769864825-- --Apple-Mail-112-769864825 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADT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0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-112-769864825 Content-Type: multipart/alternative; boundary=Apple-Mail-114-769864827 --Apple-Mail-114-769864827 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. =20= > Then you win. > Mahatma Ghandi. > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-114-769864827 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma Ghandi. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-114-769864827-- --Apple-Mail-112-769864825 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKl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CRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-112-769864825 Content-Type: multipart/alternative; boundary=Apple-Mail-115-769864829 --Apple-Mail-115-769864829 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-115-769864829 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-115-769864829-- --Apple-Mail-112-769864825-- From pgsql-performance-owner@postgresql.org Mon Jun 13 09:17: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 B2A0B52906 for ; Mon, 13 Jun 2005 09:17:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99706-08 for ; Mon, 13 Jun 2005 12:17:35 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id B0667528CE for ; Mon, 13 Jun 2005 09:17:33 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id C804F3805F for ; Mon, 13 Jun 2005 14:17:36 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id 7CCCD38104 for ; Mon, 13 Jun 2005 14:17:35 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <554ac970b5cdc99527b01cac3dfbffa4@implements.be> References: <554ac970b5cdc99527b01cac3dfbffa4@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-117-771418092 Message-Id: <08ffbd2181662b4cde1d2e45815e03fa@implements.be> From: Yves Vindevogel Subject: Re: Updates on large tables are extremely slow Date: Mon, 13 Jun 2005 14:17:35 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/282 X-Sequence-Number: 12919 --Apple-Mail-117-771418092 Content-Type: multipart/alternative; boundary=Apple-Mail-118-771418093 --Apple-Mail-118-771418093 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed What else I don't understand is that an update is so slow, whereas this rvponp=3D# insert into tblTest (id, descpages) select oid, -pages from=20= tblPrintjobs ; INSERT 0 622972 rvponp=3D# delete from tblTest ; DELETE 622972 rvponp=3D# takes about 1 minute for the insert, and 5 seconds for the delete. On 13 Jun 2005, at 13:51, Yves Vindevogel wrote: >> >> I have started this on my testmachine at 11h20. It's still running=20= >> and here it's 13h40. >> >> Setup: >> Intel P4 2Ghz, 1 Gb ram >> ReiserFS 3 (with atime in fstab, which is not optimal) >> Slackware 10 >> PG 7.4 >> >> I have the same problems on my OSX and other test machines. >> >> It's frustrating. Even Microsoft Access is faster !! >> >> On 13 Jun 2005, at 11:02, Yves Vindevogel wrote: >> >>> rvponp=3D# vacuum verbose tblPrintjobs ; >>> INFO: vacuuming "public.tblprintjobs" >>> INFO: index "pkprintjobs" now contains 622972 row versions in 8410=20= >>> pages >>> DETAIL: 9526 index row versions were removed. >>> 0 index pages have been deleted, 0 are currently reusable. >>> CPU 0.60s/0.31u sec elapsed 31.68 sec. >>> INFO: index "uxprintjobs" now contains 622972 row versions in 3978=20= >>> pages >>> DETAIL: 9526 index row versions were removed. >>> 0 index pages have been deleted, 0 are currently reusable. >>> CPU 0.15s/0.48u sec elapsed 3.59 sec. >>> INFO: index "ixprintjobsipaddress" now contains 622972 row versions=20= >>> in 2542 pages >>> DETAIL: 9526 index row versions were removed. >>> 49 index pages have been deleted, 0 are currently reusable. >>> CPU 0.13s/0.24u sec elapsed 2.57 sec. >>> INFO: index "ixprintjobshostname" now contains 622972 row versions=20= >>> in 2038 pages >>> DETAIL: 9526 index row versions were removed. >>> 35 index pages have been deleted, 0 are currently reusable. >>> CPU 0.09s/0.30u sec elapsed 1.14 sec. >>> INFO: index "ixprintjobsrecordnumber" now contains 622972 row=20 >>> versions in 1850 pages >>> DETAIL: 9526 index row versions were removed. >>> 0 index pages have been deleted, 0 are currently reusable. >>> CPU 0.07s/0.28u sec elapsed 1.51 sec. >>> INFO: index "ixprintjobseventdate" now contains 622972 row versions=20= >>> in 1408 pages >>> DETAIL: 9526 index row versions were removed. >>> 4 index pages have been deleted, 0 are currently reusable. >>> CPU 0.05s/0.24u sec elapsed 2.61 sec. >>> INFO: index "ixprintjobseventtime" now contains 622972 row versions=20= >>> in 1711 pages >>> DETAIL: 9526 index row versions were removed. >>> 0 index pages have been deleted, 0 are currently reusable. >>> CPU 0.12s/0.53u sec elapsed 11.66 sec. >>> INFO: index "ixprintjobseventcomputer" now contains 622972 row=20 >>> versions in 2039 pages >>> DETAIL: 9526 index row versions were removed. >>> 36 index pages have been deleted, 0 are currently reusable. >>> CPU 0.12s/0.23u sec elapsed 1.27 sec. >>> INFO: index "ixprintjobseventuser" now contains 622972 row versions=20= >>> in 2523 pages >>> DETAIL: 9526 index row versions were removed. >>> 19 index pages have been deleted, 0 are currently reusable. >>> CPU 0.14s/0.24u sec elapsed 1.74 sec. >>> INFO: index "ixprintjobsloginuser" now contains 622972 row versions=20= >>> in 2114 pages >>> DETAIL: 9526 index row versions were removed. >>> 13 index pages have been deleted, 0 are currently reusable. >>> CPU 0.07s/0.32u sec elapsed 4.29 sec. >>> INFO: index "ixprintjobsprintqueue" now contains 622972 row=20 >>> versions in 2201 pages >>> DETAIL: 9526 index row versions were removed. >>> 30 index pages have been deleted, 0 are currently reusable. >>> CPU 0.10s/0.34u sec elapsed 1.92 sec. >>> INFO: index "ixprintjobsprintport" now contains 622972 row versions=20= >>> in 3040 pages >>> DETAIL: 9526 index row versions were removed. >>> 40 index pages have been deleted, 0 are currently reusable. >>> CPU 0.18s/0.27u sec elapsed 2.63 sec. >>> INFO: index "ixprintjobssize" now contains 622972 row versions in=20= >>> 1733 pages >>> DETAIL: 9526 index row versions were removed. >>> 0 index pages have been deleted, 0 are currently reusable. >>> CPU 0.16s/0.43u sec elapsed 4.07 sec. >>> INFO: index "ixprintjobspages" now contains 622972 row versions in=20= >>> 1746 pages >>> DETAIL: 9526 index row versions were removed. >>> 24 index pages have been deleted, 0 are currently reusable. >>> CPU 0.13s/0.22u sec elapsed 1.58 sec. >>> INFO: index "ixprintjobsapplicationtype" now contains 622972 row=20 >>> versions in 1395 pages >>> DETAIL: 9526 index row versions were removed. >>> 27 index pages have been deleted, 0 are currently reusable. >>> CPU 0.07s/0.29u sec elapsed 1.20 sec. >>> INFO: index "ixprintjobsusertype" now contains 622972 row versions=20= >>> in 1393 pages >>> DETAIL: 9526 index row versions were removed. >>> 24 index pages have been deleted, 0 are currently reusable. >>> CPU 0.07s/0.22u sec elapsed 0.82 sec. >>> INFO: index "ixprintjobsdocumentname" now contains 622972 row=20 >>> versions in 4539 pages >>> DETAIL: 9526 index row versions were removed. >>> 6 index pages have been deleted, 0 are currently reusable. >>> CPU 0.24s/0.38u sec elapsed 5.83 sec. >>> INFO: index "ixprintjobsdesceventdate" now contains 622972 row=20 >>> versions in 1757 pages >>> DETAIL: 9526 index row versions were removed. >>> 4 index pages have been deleted, 0 are currently reusable. >>> CPU 0.08s/0.25u sec elapsed 1.16 sec. >>> INFO: index "ixprintjobsdesceventtime" now contains 622972 row=20 >>> versions in 1711 pages >>> DETAIL: 9526 index row versions were removed. >>> 0 index pages have been deleted, 0 are currently reusable. >>> CPU 0.18s/0.52u sec elapsed 9.44 sec. >>> INFO: index "ixprintjobsdescpages" now contains 622972 row versions=20= >>> in 1748 pages >>> DETAIL: 9526 index row versions were removed. >>> 24 index pages have been deleted, 0 are currently reusable. >>> CPU 0.06s/0.26u sec elapsed 0.94 sec. >>> INFO: index "ixprintjobspagesperjob" now contains 622972 row=20 >>> versions in 5259 pages >>> DETAIL: 9526 index row versions were removed. >>> 4 index pages have been deleted, 0 are currently reusable. >>> CPU 0.31s/0.36u sec elapsed 5.47 sec. >>> INFO: "tblprintjobs": removed 9526 row versions in 307 pages >>> DETAIL: CPU 0.00s/0.06u sec elapsed 0.23 sec. >>> INFO: "tblprintjobs": found 9526 removable, 622972 nonremovable row=20= >>> versions in 19382 pages >>> DETAIL: 0 dead row versions cannot be removed yet. >>> There were 75443 unused item pointers. >>> 0 pages are entirely empty. >>> CPU 3.43s/6.83u sec elapsed 97.86 sec. >>> INFO: vacuuming "pg_toast.pg_toast_2169880" >>> INFO: index "pg_toast_2169880_index" now contains 0 row versions in=20= >>> 1 pages >>> DETAIL: 0 index pages have been deleted, 0 are currently reusable. >>> CPU 0.00s/0.00u sec elapsed 0.00 sec. >>> INFO: "pg_toast_2169880": found 0 removable, 0 nonremovable row=20 >>> versions in 0 pages >>> DETAIL: 0 dead row versions cannot be removed yet. >>> There were 0 unused item pointers. >>> 0 pages are entirely empty. >>> CPU 0.00s/0.00u sec elapsed 0.00 sec. >>> VACUUM >>> rvponp=3D# >>> >>> >>> >>> On 13 Jun 2005, at 10:54, Mark Kirkwood wrote: >>> >>>> Apologies - I should have said output of 'VACUUM VERBOSE mytable'. >>>> >>>> (been using 8.1, which displays dead tuple info in ANALYZE...). >>>> >>>> Mark >>>> >>>> Yves Vindevogel wrote: >>>>> rvponp=3D# analyze verbose tblPrintjobs ; >>>>> INFO: analyzing "public.tblprintjobs" >>>>> INFO: "tblprintjobs": 19076 pages, 3000 rows sampled, 588209=20 >>>>> estimated total rows >>>>> ANALYZE >>>>> On 13 Jun 2005, at 04:43, Mark Kirkwood wrote: >>>>> Yves Vindevogel wrote: >>>>> I'm trying to update a table that has about 600.000=20 >>>>> records. >>>>> The update query is very simple : update mytable set=20 >>>>> pagesdesc =3D >>>>> - pages ; >>>>> The query takes about half an hour to an hour to execute.=20= >>>>> I have >>>>> tried a lot of things. >>>>> Half an hour seem a bit long - I would expect less than 5=20 >>>>> minutes on >>>>> reasonable hardware. >>>>> You may have dead tuple bloat - can you post the output of=20 >>>>> 'ANALYZE >>>>> VERBOSE mytable' ? >>>> >>>> >>> Met vriendelijke groeten, >>> Bien =E0 vous, >>> Kind regards, >>> >>> Yves Vindevogel >>> Implements >>> >>> >>> >>> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 >>> >>> Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 >>> >>> Web: http://www.implements.be >>> >>> First they ignore you. Then they laugh at you. Then they fight=20 >>> you. Then you win. >>> Mahatma Ghandi. >>> >>> >>> >>> ---------------------------(end of=20 >>> broadcast)--------------------------- >>> TIP 7: don't forget to increase your free space map settings >>> >> Met vriendelijke groeten, >> Bien =E0 vous, >> Kind regards, >> >> Yves Vindevogel >> Implements >> > >> >> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 >> >> Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 >> >> Web: http://www.implements.be >> >> First they ignore you. Then they laugh at you. Then they fight you.=20= >> Then you win. >> Mahatma Ghandi. >> >> > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > Yves Vindevogel > Implements > > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. =20= > Then you win. > Mahatma Ghandi. > > ---------------------------(end of=20 > broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to=20 > majordomo@postgresql.org > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-118-771418093 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 What else I don't understand is that an update is so slow, whereas this rvponp=3D# insert into tblTest (id, descpages) select oid, -pages from tblPrintjobs ; INSERT 0 622972 rvponp=3D# delete from tblTest ; DELETE 622972 rvponp=3D# takes about 1 minute for the insert, and 5 seconds for the delete. On 13 Jun 2005, at 13:51, Yves Vindevogel wrote: I have started this on my testmachine at 11h20. It's still running and here it's 13h40. Setup: Intel P4 2Ghz, 1 Gb ram ReiserFS 3 (with atime in fstab, which is not optimal) Slackware 10 PG 7.4 I have the same problems on my OSX and other test machines. It's frustrating. Even Microsoft Access is faster !! On 13 Jun 2005, at 11:02, Yves Vindevogel wrote: rvponp=3D# vacuum verbose tblPrintjobs ; INFO: vacuuming "public.tblprintjobs" INFO: index "pkprintjobs" now contains 622972 row versions in 8410 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.60s/0.31u sec elapsed 31.68 sec. INFO: index "uxprintjobs" now contains 622972 row versions in 3978 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.15s/0.48u sec elapsed 3.59 sec. INFO: index "ixprintjobsipaddress" now contains 622972 row versions in 2542 pages DETAIL: 9526 index row versions were removed. 49 index pages have been deleted, 0 are currently reusable. CPU 0.13s/0.24u sec elapsed 2.57 sec. INFO: index "ixprintjobshostname" now contains 622972 row versions in 2038 pages DETAIL: 9526 index row versions were removed. 35 index pages have been deleted, 0 are currently reusable. CPU 0.09s/0.30u sec elapsed 1.14 sec. INFO: index "ixprintjobsrecordnumber" now contains 622972 row versions in 1850 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.28u sec elapsed 1.51 sec. INFO: index "ixprintjobseventdate" now contains 622972 row versions in 1408 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.05s/0.24u sec elapsed 2.61 sec. INFO: index "ixprintjobseventtime" now contains 622972 row versions in 1711 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.12s/0.53u sec elapsed 11.66 sec. INFO: index "ixprintjobseventcomputer" now contains 622972 row versions in 2039 pages DETAIL: 9526 index row versions were removed. 36 index pages have been deleted, 0 are currently reusable. CPU 0.12s/0.23u sec elapsed 1.27 sec. INFO: index "ixprintjobseventuser" now contains 622972 row versions in 2523 pages DETAIL: 9526 index row versions were removed. 19 index pages have been deleted, 0 are currently reusable. CPU 0.14s/0.24u sec elapsed 1.74 sec. INFO: index "ixprintjobsloginuser" now contains 622972 row versions in 2114 pages DETAIL: 9526 index row versions were removed. 13 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.32u sec elapsed 4.29 sec. INFO: index "ixprintjobsprintqueue" now contains 622972 row versions in 2201 pages DETAIL: 9526 index row versions were removed. 30 index pages have been deleted, 0 are currently reusable. CPU 0.10s/0.34u sec elapsed 1.92 sec. INFO: index "ixprintjobsprintport" now contains 622972 row versions in 3040 pages DETAIL: 9526 index row versions were removed. 40 index pages have been deleted, 0 are currently reusable. CPU 0.18s/0.27u sec elapsed 2.63 sec. INFO: index "ixprintjobssize" now contains 622972 row versions in 1733 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.16s/0.43u sec elapsed 4.07 sec. INFO: index "ixprintjobspages" now contains 622972 row versions in 1746 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.13s/0.22u sec elapsed 1.58 sec. INFO: index "ixprintjobsapplicationtype" now contains 622972 row versions in 1395 pages DETAIL: 9526 index row versions were removed. 27 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.29u sec elapsed 1.20 sec. INFO: index "ixprintjobsusertype" now contains 622972 row versions in 1393 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.07s/0.22u sec elapsed 0.82 sec. INFO: index "ixprintjobsdocumentname" now contains 622972 row versions in 4539 pages DETAIL: 9526 index row versions were removed. 6 index pages have been deleted, 0 are currently reusable. CPU 0.24s/0.38u sec elapsed 5.83 sec. INFO: index "ixprintjobsdesceventdate" now contains 622972 row versions in 1757 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.08s/0.25u sec elapsed 1.16 sec. INFO: index "ixprintjobsdesceventtime" now contains 622972 row versions in 1711 pages DETAIL: 9526 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 0.18s/0.52u sec elapsed 9.44 sec. INFO: index "ixprintjobsdescpages" now contains 622972 row versions in 1748 pages DETAIL: 9526 index row versions were removed. 24 index pages have been deleted, 0 are currently reusable. CPU 0.06s/0.26u sec elapsed 0.94 sec. INFO: index "ixprintjobspagesperjob" now contains 622972 row versions in 5259 pages DETAIL: 9526 index row versions were removed. 4 index pages have been deleted, 0 are currently reusable. CPU 0.31s/0.36u sec elapsed 5.47 sec. INFO: "tblprintjobs": removed 9526 row versions in 307 pages DETAIL: CPU 0.00s/0.06u sec elapsed 0.23 sec. INFO: "tblprintjobs": found 9526 removable, 622972 nonremovable row versions in 19382 pages DETAIL: 0 dead row versions cannot be removed yet. There were 75443 unused item pointers. 0 pages are entirely empty. CPU 3.43s/6.83u sec elapsed 97.86 sec. INFO: vacuuming "pg_toast.pg_toast_2169880" INFO: index "pg_toast_2169880_index" now contains 0 row versions in 1 pages DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: "pg_toast_2169880": found 0 removable, 0 nonremovable row versions in 0 pages DETAIL: 0 dead row versions cannot be removed yet. There were 0 unused item pointers. 0 pages are entirely empty. CPU 0.00s/0.00u sec elapsed 0.00 sec. VACUUM rvponp=3D#=20 On 13 Jun 2005, at 10:54, Mark Kirkwood wrote: Apologies - I should have said output of 'VACUUM VERBOSE mytable'. (been using 8.1, which displays dead tuple info in ANALYZE...). Mark Yves Vindevogel wrote: rvponp=3D# analyze verbose tblPrintjobs ; INFO: analyzing "public.tblprintjobs" INFO: "tblprintjobs": 19076 pages, 3000 rows sampled, 588209 estimated total rows ANALYZE On 13 Jun 2005, at 04:43, Mark Kirkwood wrote: Yves Vindevogel wrote: I'm trying to update a table that has about 600.000 records. The update query is very simple : update mytable set pagesdesc =3D= - pages ; The query takes about half an hour to an hour to execute. I have tried a lot of things. Half an hour seem a bit long - I would expect less than 5 minutes on reasonable hardware. You may have dead tuple bloat - can you post the output of 'ANALYZE VERBOSE mytable' ? Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements < Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma = Ghandi. ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements < Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma = Ghandi. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements < Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma Ghandi. ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-118-771418093-- --Apple-Mail-117-771418092 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vf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+H+FEE0LoEYEGTOCgCGEKH/2uMrGfI8GEF7RyIWHwOoH+CEBptU EaEITOFCEyLOF0FoJr16aUDpb9fbH+GAF0RSz2KgCABjdACSB4ED3V3YH+C8CjbCFAEwLP006EG8 G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-117-771418092 Content-Type: multipart/alternative; boundary=Apple-Mail-119-771418094 --Apple-Mail-119-771418094 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-119-771418094 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-119-771418094-- --Apple-Mail-117-771418092-- From pgsql-performance-owner@postgresql.org Mon Jun 13 10:02: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 9E7D952809 for ; Mon, 13 Jun 2005 10:02:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14144-01 for ; Mon, 13 Jun 2005 13:02:37 +0000 (GMT) Received: from mail49.messagelabs.com (mail49.messagelabs.com [193.109.255.19]) by svr1.postgresql.org (Postfix) with SMTP id 3E0E35280B for ; Mon, 13 Jun 2005 10:02:32 -0300 (ADT) X-VirusChecked: Checked X-Env-Sender: alexs@advfn.com X-Msg-Ref: server-11.tower-49.messagelabs.com!1118667755!2057012!1 X-StarScan-Version: 5.4.15; banners=-,-,- X-Originating-IP: [212.161.99.149] Received: (qmail 28304 invoked from network); 13 Jun 2005 13:02:35 -0000 Received: from mail.advfn.com (212.161.99.149) by server-11.tower-49.messagelabs.com with SMTP; 13 Jun 2005 13:02:35 -0000 Received: from [213.86.19.101] (helo=[192.168.0.185]) by mail.advfn.com with esmtp (Exim 4.22) id 1DhoaJ-0002cq-KW for pgsql-performance@postgresql.org; Mon, 13 Jun 2005 14:02:35 +0100 Mime-Version: 1.0 (Apple Message framework v730) Content-Transfer-Encoding: 7bit Message-Id: <2D1A68BF-B3A4-490E-8053-3CF6626B8DAF@advfn.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-performance@postgresql.org From: Alex Stapleton Subject: PostgreSQL using the wrong Index Date: Mon, 13 Jun 2005 14:02:30 +0100 X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/284 X-Sequence-Number: 12921 We have two index's like so l1_historical=# \d "N_intra_time_idx" Index "N_intra_time_idx" Column | Type --------+----------------------------- time | timestamp without time zone btree l1_historical=# \d "N_intra_pkey" Index "N_intra_pkey" Column | Type --------+----------------------------- symbol | text time | timestamp without time zone unique btree (primary key) and on queries like this select * from "N_intra" where symbol='SOMETHING WHICH DOESNT EXIST' order by time desc limit 1; PostgreSQL takes a very long time to complete, as it effectively scans the entire table, backwards. And the table is huge, about 450 million rows. (btw, there are no triggers or any other exciting things like that on our tables in this db.) but on things where the symbol does exist in the table, it's more or less fine, and nice and fast. Whilst the option the planner has taken might be faster most of the time, the worst case scenario is unacceptable for obvious reasons. I've googled for trying to force the use of a specific index, but can't find anything relevant. Does anyone have any suggestions on getting it to use an index which hopefully will have better worst case performance? From pgsql-performance-owner@postgresql.org Mon Jun 13 09:59: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 4DE385280B for ; Mon, 13 Jun 2005 09:59:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11465-04 for ; Mon, 13 Jun 2005 12:59:37 +0000 (GMT) Received: from oismail.com (unknown [38.117.22.100]) by svr1.postgresql.org (Postfix) with ESMTP id 649A552823 for ; Mon, 13 Jun 2005 09:59:36 -0300 (ADT) Received: from [192.168.8.103] ([213.173.234.215]) (authenticated bits=0) by oismail.com (8.12.11/8.12.11) with ESMTP id j5DCxiaO009802 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 13 Jun 2005 08:59:46 -0400 Message-ID: <42AD844F.3070700@oismail.com> Date: Mon, 13 Jun 2005 15:04:15 +0200 From: Jona User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: How to enhance the chance that data is in disk cache References: <579bc853ef3957c736c2773f13c444f7@implements.be> <42ACF2DD.8090409@paradise.net.nz> <42AD49BF.7050706@paradise.net.nz> In-Reply-To: <42AD49BF.7050706@paradise.net.nz> 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.133 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, NORMAL_HTTP_TO_IP X-Spam-Level: X-Archive-Number: 200506/283 X-Sequence-Number: 12920 Hi there I have a query (please refer to http://213.173.234.215:8080/get_content_plan.htm for the query as well as query plan) that is slow when it's run the first time and fast(ish) on all successive runs within a reasonable time period. That is, if the query is not run for like 30 min, execution time returns to the initial time. This leads me to suspect that when the query is first run, all used data have to be fetched from the disk where as once it has been run all data is available in the OS's disk cache. Comparing the execution times we're talking roughly a factor 35 in time difference, thus optimization would be handy. Is there anway to either enhance the chance that the data can be found in the disk cache or allowing the database to fetch the data faster? Is this what the CLUSTER command is for, if so, which tables would I need to cluster? Or is my only option to de-normalize the table structure around this query to speed it up? Furthermore, it seems the database spends the majority of its time in the loop marked with italic in the initial plan, any idea what it spends its time on there? Database is PG 7.3.9 on RH ES 3.0, with Dual XEON 1.9GHz processors and 2GB of RAM. effective_cache_size = 100k shared_buffers = 14k random_page_cost = 3 default_statistics_target = 50 VACUUM ANALYZE runs every few hours, so statistics should be up to date. Appreciate any input here. Cheers Jona From pgsql-performance-owner@postgresql.org Mon Jun 13 10:08: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 C7F055292F for ; Mon, 13 Jun 2005 10:08:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10850-09 for ; Mon, 13 Jun 2005 13:08:10 +0000 (GMT) Received: from mail49.messagelabs.com (mail49.messagelabs.com [193.109.255.19]) by svr1.postgresql.org (Postfix) with SMTP id C12B55292C for ; Mon, 13 Jun 2005 10:08:09 -0300 (ADT) X-VirusChecked: Checked X-Env-Sender: alexs@advfn.com X-Msg-Ref: server-9.tower-49.messagelabs.com!1118668092!2065986!1 X-StarScan-Version: 5.4.15; banners=-,-,- X-Originating-IP: [212.161.99.149] Received: (qmail 21545 invoked from network); 13 Jun 2005 13:08:12 -0000 Received: from mail.advfn.com (212.161.99.149) by server-9.tower-49.messagelabs.com with SMTP; 13 Jun 2005 13:08:12 -0000 Received: from [213.86.19.101] (helo=[192.168.0.185]) by mail.advfn.com with esmtp (Exim 4.22) id 1Dhofj-0003A9-1D; Mon, 13 Jun 2005 14:08:11 +0100 In-Reply-To: <2D1A68BF-B3A4-490E-8053-3CF6626B8DAF@advfn.com> References: <2D1A68BF-B3A4-490E-8053-3CF6626B8DAF@advfn.com> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Alex Stapleton Subject: Re: PostgreSQL using the wrong Index Date: Mon, 13 Jun 2005 14:08:08 +0100 To: Alex Stapleton X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/285 X-Sequence-Number: 12922 Oh, we are running 7.4.2 btw. And our random_page_cost = 1 On 13 Jun 2005, at 14:02, Alex Stapleton wrote: > We have two index's like so > > l1_historical=# \d "N_intra_time_idx" > Index "N_intra_time_idx" > Column | Type > --------+----------------------------- > time | timestamp without time zone > btree > > > l1_historical=# \d "N_intra_pkey" > Index "N_intra_pkey" > Column | Type > --------+----------------------------- > symbol | text > time | timestamp without time zone > unique btree (primary key) > > and on queries like this > > select * from "N_intra" where symbol='SOMETHING WHICH DOESNT EXIST' > order by time desc limit 1; > > PostgreSQL takes a very long time to complete, as it effectively > scans the entire table, backwards. And the table is huge, about 450 > million rows. (btw, there are no triggers or any other exciting > things like that on our tables in this db.) > > but on things where the symbol does exist in the table, it's more > or less fine, and nice and fast. > > Whilst the option the planner has taken might be faster most of the > time, the worst case scenario is unacceptable for obvious reasons. > I've googled for trying to force the use of a specific index, but > can't find anything relevant. Does anyone have any suggestions on > getting it to use an index which hopefully will have better worst > case performance? > > ---------------------------(end of > broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to > majordomo@postgresql.org > > From pgsql-novice-owner@postgresql.org Mon Jun 13 10:25:55 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 C106C52812 for ; Mon, 13 Jun 2005 10:25:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17970-02 for ; Mon, 13 Jun 2005 13:25:43 +0000 (GMT) Received: from pantheon-po06.its.yale.edu (pantheon-po06.its.yale.edu [130.132.50.36]) by svr1.postgresql.org (Postfix) with ESMTP id 874DA5281A for ; Mon, 13 Jun 2005 10:25:42 -0300 (ADT) Received: from [10.84.2.42] ([204.90.81.3]) by pantheon-po06.its.yale.edu (8.12.11/8.12.11) with ESMTP id j5DDPaPd021608; Mon, 13 Jun 2005 09:25:36 -0400 In-Reply-To: <008601c56e01$2c114880$b000a8c0@OTTO> References: <20050418174701.BDD1219007F@arica.terra.com.br> <008601c56e01$2c114880$b000a8c0@OTTO> Mime-Version: 1.0 (Apple Message framework v730) X-Priority: 3 Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: Cc: Content-Transfer-Encoding: quoted-printable From: =?ISO-8859-1?Q?J=E1nos?= Subject: Re: need suggestion for server sizing Date: Mon, 13 Jun 2005 09:25:30 -0400 To: =?ISO-8859-1?Q?Havasv=F6lgyi_Ott=F3?= X-Mailer: Apple Mail (2.730) X-YaleITSMailFilter: Version 1.2b (attachment(s) not renamed) 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: 200506/70 X-Sequence-Number: 13663 Any XServe from Apple will do it. J=E1nos On Jun 10, 2005, at 5:12 PM, Havasv=F6lgyi Ott=F3 wrote: > Hi all, > > I need your help to determine the configuration of a server =20 > machine, and the > PG DBMS. > There will be not more than 25 concurrent users. They will use a =20 > business > software that accesses tha database. The database will be not that =20 > large, it > seems that none of the tables's recordcount will exceed 1-2 =20 > million, but > there will be a lot of small (<5000 record) tables. The numbert of =20 > tables > will be about 300. What server would you install to such a site to =20 > make the > database respond quickly in any case? > I would like to leave fsync on. > Perhaps you need some additional information. In this case just =20 > indicate it. > > Thanks in advance, > Otto > > > > ---------------------------(end of =20 > broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that =20 > your > message can get through to the mailing list cleanly > ------------------------------------------ "There was a mighty king in the land of the Huns whose goodness and =20 wisdom had no equal." Nibelungen-Lied From pgsql-performance-owner@postgresql.org Mon Jun 13 10:29: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 3E2A352862 for ; Mon, 13 Jun 2005 10:29:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19273-01 for ; Mon, 13 Jun 2005 13:29:22 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id E17455281E for ; Mon, 13 Jun 2005 10:29:21 -0300 (ADT) Received: (qmail 2627 invoked by uid 500); 13 Jun 2005 13:28:52 -0000 Date: Mon, 13 Jun 2005 08:28:52 -0500 From: Bruno Wolff III To: Madison Kelly Cc: pgsql-performance@postgresql.org, Tom Lane Subject: Re: Index ot being used Message-ID: <20050613132852.GA31142@wolff.to> Mail-Followup-To: Bruno Wolff III , Madison Kelly , pgsql-performance@postgresql.org, Tom Lane References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42AD0B94.9090508@alteeve.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: 200506/286 X-Sequence-Number: 12923 On Mon, Jun 13, 2005 at 00:29:08 -0400, Madison Kelly wrote: > Bruno Wolff III wrote: > >On Sun, Jun 12, 2005 at 23:42:05 -0400, > > Madison Kelly wrote: > > > >>As you probably saw in my last reply, I went back to the old index and > >>tried the query you and Tom Lane recommended. Should this not have > >>caught the index? > > > > > >Probably, but there might be some other reason the planner thought it > >was better to not use it. Using indexes is not always faster. > > > >It would help to see your latest definition of the table and indexes, > >the exact query you used and explain analyze output. > > > > Okay, here's what I have at the moment: > > tle-bu=> \d file_info_7 Table > "public.file_info_7" > Column | Type | Modifiers > ----------------------+----------------------+----------------------------------------- > file_group_name | text | > file_group_uid | bigint | not null > file_mod_time | bigint | not null > file_name | text | not null > file_parent_dir | text | not null > file_perm | text | not null > file_size | bigint | not null > file_type | character varying(2) | not null default > 'f'::character varying > file_user_name | text | > file_user_uid | bigint | not null > file_backup | boolean | not null default true > file_display | boolean | not null default false > file_restore_display | boolean | not null default false > file_restore | boolean | not null default false > Indexes: > "file_info_7_display_idx" btree (file_parent_dir, file_name) > > > tle-bu=> \d file_info_7_display_idx > Index "public.file_info_7_display_idx" > Column | Type > -----------------+------ > file_parent_dir | text > file_name | text > btree, for table "public.file_info_7" > > > tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_display > FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, > file_name ASC; > QUERY PLAN > ---------------------------------------------------------------------------------------------------------------------------- > Sort (cost=15091.53..15165.29 rows=29502 width=114) (actual > time=12834.933..12955.136 rows=25795 loops=1) > Sort Key: file_parent_dir, file_name > -> Seq Scan on file_info_7 (cost=0.00..11762.44 rows=29502 > width=114) (actual time=0.244..2533.388 rows=25795 loops=1) > Filter: ((file_type)::text = 'd'::text) > Total runtime: 13042.421 ms > (5 rows) > > > Since my last post I went back to a query closer to what I actually > want. What is most important to me is that 'file_parent_dir, file_name, > file_display' are returned and that the results are sorted by > 'file_parent_dir, file_name' and the results are restricted to where > 'file_info='d''. I am guessing you mean 'file_type' instead of 'file_info'. To do this efficiently you want an index on (file_type, file_parent_dir, file_name). Currently you only have an index on (file_parent_dir, file_name) which won't help for this query. You also need to order by file_type even though it will be constant for all of the returned rows in order to help out the planner. This will allow an index scan over the desired rows that returns them in the desired order. Please actually try this before changing anything else. From pgsql-performance-owner@postgresql.org Mon Jun 13 11:18: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 4641B52809 for ; Mon, 13 Jun 2005 11:18:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30931-06 for ; Mon, 13 Jun 2005 14:18: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 E3C7552921 for ; Mon, 13 Jun 2005 11:18:21 -0300 (ADT) 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 j5DEIOdL019467; Mon, 13 Jun 2005 10:18:24 -0400 (EDT) To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: View not using index In-reply-to: References: <9e1745a6fe1ae29c6f1c824128871d36@implements.be> <200506131705.35852.mr-russ@pws.com.au> Comments: In-reply-to Yves Vindevogel message dated "Mon, 13 Jun 2005 09:18:50 +0200" Date: Mon, 13 Jun 2005 10:18:24 -0400 Message-ID: <19466.1118672304@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: 200506/287 X-Sequence-Number: 12924 Yves Vindevogel writes: > rvponp=# explain select * from vw_document_pagesperjob limit 10 ; > QUERY PLAN > ------------------------------------------------------------------------ > ---------------------- > Limit (cost=82796.59..82796.72 rows=10 width=706) > -> Subquery Scan vw_document_pagesperjob (cost=82796.59..90149.20 > rows=588209 width=706) > -> Sort (cost=82796.59..84267.11 rows=588209 width=74) > Sort Key: tblprintjobs.descpages, > tblprintjobs.documentname > -> Seq Scan on tblprintjobs (cost=0.00..26428.61 > rows=588209 width=74) > (5 rows) In general, putting an ORDER BY inside a view isn't a great idea --- it's not legal per SQL spec (hence not portable), and it defeats most forms of optimization of the view. CVS tip is actually able to do what you wish with the above case, but no existing release will optimize the view's ORDER BY in light of a LIMIT that's outside the view. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jun 13 11:21: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 448A45282A for ; Mon, 13 Jun 2005 11:21:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32211-05 for ; Mon, 13 Jun 2005 14:21:22 +0000 (GMT) Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) by svr1.postgresql.org (Postfix) with ESMTP id D966D52819 for ; Mon, 13 Jun 2005 11:21:21 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Mon, 13 Jun 2005 09:21:25 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Date: Mon, 13 Jun 2005 09:21:06 -0500 From: "Kevin Grittner" To: Cc: , Subject: Re: Help with rewriting query Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/288 X-Sequence-Number: 12925 I've done a lot of work with a bookkeeping system where we have such redundancy built in. The auditors, however, need to be able to generate lists of the financial transaction detail to support balances. These reports are among the most demanding in the system. I shudder to think how unacceptable performance would be without the redundancy. Also, due to multiple media failures, and backup process problems (on another database product), a large database was badly mangled. The redundancies allowed us to reconstruct much data, and to at least identify what was missing for the rest. There is, of course, some cost for the redundancy. Up front, someone needs to code routines to maintain it. It needs to be checked against the underlying detail periodically, to prevent "drift". And there is a cost, usually pretty minimal, for the software to do the work. I strongly recommend that some form of trigger (either native to the database or, if portability is an issue, within a middle tier framework) do the work of maintaining the redundant data. If you rely on application code to maintain it, you can expect that sooner or later it will get missed. >>> Tobias Brox 06/11/05 4:59 AM >>> [ Reminds me about the way the precursor software of our product was made, whenever it was needed to check the balance of a customer, it was needed to scan the whole transaction table and sum up all transactions. This operation eventually took 3-4 seconds before we released the new software, and the customers balance was supposed to show up at several web pages :-) By now we have the updated balance both in the customer table and as "post_balance" in the transaction table. Sometimes redundancy is good. Much easier to solve inconsistency problems as well :-) From pgsql-performance-owner@postgresql.org Mon Jun 13 11:32: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 7EDB152862 for ; Mon, 13 Jun 2005 11:32:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35063-04 for ; Mon, 13 Jun 2005 14:32:13 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 425F75280B for ; Mon, 13 Jun 2005 11:32:12 -0300 (ADT) 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 j5DEWG2t019629; Mon, 13 Jun 2005 10:32:16 -0400 (EDT) To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Updates on large tables are extremely slow In-reply-to: <65760c67987848d35eafecdcccd8742c@implements.be> References: <579bc853ef3957c736c2773f13c444f7@implements.be> <42ACF2DD.8090409@paradise.net.nz> <42AD49BF.7050706@paradise.net.nz> <65760c67987848d35eafecdcccd8742c@implements.be> Comments: In-reply-to Yves Vindevogel message dated "Mon, 13 Jun 2005 11:02:04 +0200" Date: Mon, 13 Jun 2005 10:32:16 -0400 Message-ID: <19628.1118673136@sss.pgh.pa.us> From: Tom Lane 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: 200506/289 X-Sequence-Number: 12926 Yves Vindevogel writes: > rvponp=3D# vacuum verbose tblPrintjobs ; > INFO: vacuuming "public.tblprintjobs" > [ twenty-one different indexes on one table ] Well, there's your problem. You think updating all those indexes is free? It's *expensive*. Heed the manual's advice: avoid creating indexes you are not certain you need for identifiable commonly-used queries. (The reason delete is fast is it doesn't have to touch the indexes ... the necessary work is left to be done by VACUUM.) regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jun 13 11:34: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 8398252926 for ; Mon, 13 Jun 2005 11:34:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33754-10 for ; Mon, 13 Jun 2005 14:34:34 +0000 (GMT) Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) by svr1.postgresql.org (Postfix) with ESMTP id 0745B52812 for ; Mon, 13 Jun 2005 11:34:33 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Mon, 13 Jun 2005 09:34:38 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Date: Mon, 13 Jun 2005 09:34:33 -0500 From: "Kevin Grittner" To: , Cc: , Subject: Re: Index ot being used Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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: 200506/290 X-Sequence-Number: 12927 It sure would be nice if the optimizer would consider that it had the leeway to add any column which was restricted to a single value to any point in the ORDER BY clause. Without that, the application programmer has to know what indexes are on the table, rather than being able to just worry about the set of data they want. Obviously, if a column can have only one value in the result set, adding to any point in the ORDER BY can't change anything but performance. That sure sounds like something which should fall within the scope of an optimizer. It really should be a DBA function to add or drop indexes to tune the performance of queries, without requiring application programmers to modify the queries for every DBA adjustment. (When you have a database with over 350 tables and thousands of queries, you really begin to appreciate the importance of this.) >>> Tom Lane 06/12/05 10:56 AM >>> Madison Kelly writes: > Here is my full query: > tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_type > FROM file_info_7 WHERE file_type='d' ORDER BY file_parent_dir ASC, > file_name ASC; > This is my index (which I guess is wrong): > tle-bu=> \d file_info_7_display_idx > Index "public.file_info_7_display_idx" > Column | Type > -----------------+---------------------- > file_type | character varying(2) > file_parent_dir | text > file_name | text > btree, for table "public.file_info_7" The index is fine, but you need to phrase the query as ... ORDER BY file_type, file_parent_dir, file_name; (Whether you use ASC or not doesn't matter.) Otherwise the planner won't make the connection to the sort ordering of the index. regards, tom lane ---------------------------(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 From pgsql-performance-owner@postgresql.org Mon Jun 13 12:01: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 7D5FD52918 for ; Mon, 13 Jun 2005 12:01:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44735-02 for ; Mon, 13 Jun 2005 15:01:25 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 2D169528E7 for ; Mon, 13 Jun 2005 12:01:23 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j5DF1G7e017186; (envelope-from ) Mon, 13 Jun 2005 10:01:20 -0500 (CDT) Received: from [192.168.1.11] ([12.215.118.172]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j5DElEmD029914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Mon, 13 Jun 2005 09:47:15 -0500 (CDT) Message-ID: <42AD9C6E.3000705@arbash-meinel.com> Date: Mon, 13 Jun 2005 09:47:10 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alex Stapleton Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL using the wrong Index References: <2D1A68BF-B3A4-490E-8053-3CF6626B8DAF@advfn.com> In-Reply-To: X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig01DE98644253D03897262417" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean 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: 200506/293 X-Sequence-Number: 12930 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig01DE98644253D03897262417 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Alex Stapleton wrote: > Oh, we are running 7.4.2 btw. And our random_page_cost = 1 > Which is only correct if your entire db fits into memory. Also, try updating to a later 7.4 version if at all possible. > On 13 Jun 2005, at 14:02, Alex Stapleton wrote: > >> We have two index's like so >> >> l1_historical=# \d "N_intra_time_idx" >> Index "N_intra_time_idx" >> Column | Type >> --------+----------------------------- >> time | timestamp without time zone >> btree >> Just so you are aware, writing this as: "We have an index on N_intra(time) and one on N_Intra(symbol, time)" is a lot more succinct. >> >> l1_historical=# \d "N_intra_pkey" >> Index "N_intra_pkey" >> Column | Type >> --------+----------------------------- >> symbol | text >> time | timestamp without time zone >> unique btree (primary key) >> >> and on queries like this >> >> select * from "N_intra" where symbol='SOMETHING WHICH DOESNT EXIST' >> order by time desc limit 1; >> >> PostgreSQL takes a very long time to complete, as it effectively >> scans the entire table, backwards. And the table is huge, about 450 >> million rows. (btw, there are no triggers or any other exciting >> things like that on our tables in this db.) >> >> but on things where the symbol does exist in the table, it's more or >> less fine, and nice and fast. > What happens if you do: SELECT * FROM "N_intra" WHERE symbol='doesnt exist' ORDER BY symbol, time DESC LIMIT 1; Yes, symbol is constant, but it frequently helps the planner realize it can use an index scan if you include all terms in the index in the ORDER BY clause. >> >> Whilst the option the planner has taken might be faster most of the >> time, the worst case scenario is unacceptable for obvious reasons. >> I've googled for trying to force the use of a specific index, but >> can't find anything relevant. Does anyone have any suggestions on >> getting it to use an index which hopefully will have better worst >> case performance? > Try the above first. You could also create a new index on symbol CREATE INDEX "N_intra_symbol_idx" ON "N_intra"(symbol); Then the WHERE clause should use the symbol index, which means it can know quickly that an entry doesn't exist. I'm not sure how many entries you have per symbol, though, so this might cause problems in the ORDER BY time portion. I'm guessing what you really want is to just do the ORDER BY symbol, time. John =:-> --------------enig01DE98644253D03897262417 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD4DBQFCrZxxJdeBCYSNAAMRArsiAJ4lhNxy7mnwvZkCyQW0JxzXRu7YPACWIYKo LXNvDF3+FCwWeHOJn/cbcg== =Ya71 -----END PGP SIGNATURE----- --------------enig01DE98644253D03897262417-- From pgsql-performance-owner@postgresql.org Mon Jun 13 11:51: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 3AC7D528E0 for ; Mon, 13 Jun 2005 11:51:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40617-03 for ; Mon, 13 Jun 2005 14:51: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 9349152889 for ; Mon, 13 Jun 2005 11:51:38 -0300 (ADT) 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 j5DEpd6V019819; Mon, 13 Jun 2005 10:51:39 -0400 (EDT) To: Jona Cc: pgsql-performance@postgresql.org Subject: Re: How to enhance the chance that data is in disk cache In-reply-to: <42AD844F.3070700@oismail.com> References: <579bc853ef3957c736c2773f13c444f7@implements.be> <42ACF2DD.8090409@paradise.net.nz> <42AD49BF.7050706@paradise.net.nz> <42AD844F.3070700@oismail.com> Comments: In-reply-to Jona message dated "Mon, 13 Jun 2005 15:04:15 +0200" Date: Mon, 13 Jun 2005 10:51:39 -0400 Message-ID: <19818.1118674299@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, NORMAL_HTTP_TO_IP X-Spam-Level: X-Archive-Number: 200506/291 X-Sequence-Number: 12928 Jona writes: > I have a query (please refer to > http://213.173.234.215:8080/get_content_plan.htm for the query as well > as query plan) that is slow when it's run the first time and fast(ish) > on all successive runs within a reasonable time period. > This leads me to suspect that when the query is first run, all used data > have to be fetched from the disk where as once it has been run all data > is available in the OS's disk cache. Sounds like that to me too. > Is there anway to either enhance the chance that the data can be found > in the disk cache or allowing the database to fetch the data faster? Run the query more often? Also, that pile of INNER JOINs is forcing a probably-bad join order; you need to think carefully about the order you want things joined in, or else convert the query to non-JOIN syntax. See the "Performance Tips" chapter of the manual. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jun 13 12: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 CBB5B52812 for ; Mon, 13 Jun 2005 12:01:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42367-06 for ; Mon, 13 Jun 2005 15:01:41 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 0141D5293D for ; Mon, 13 Jun 2005 12:01:40 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j5DF1G7m017186; (envelope-from ) Mon, 13 Jun 2005 10:01:24 -0500 (CDT) Received: from [192.168.1.11] ([12.215.118.172]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j5DEpwZr001897 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Mon, 13 Jun 2005 09:51:59 -0500 (CDT) Message-ID: <42AD9D8D.9060503@arbash-meinel.com> Date: Mon, 13 Jun 2005 09:51:57 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Grittner Cc: linux@alteeve.com, tgl@sss.pgh.pa.us, tobias@nordicbet.com, pgsql-performance@postgresql.org Subject: Re: Index ot being used References: In-Reply-To: X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig1B4739F3434CF4A3D7E765CE" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean 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: 200506/294 X-Sequence-Number: 12931 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig1B4739F3434CF4A3D7E765CE Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Kevin Grittner wrote: >It sure would be nice if the optimizer would consider that it had the >leeway to add any column which was restricted to a single value to any >point in the ORDER BY clause. Without that, the application programmer >has to know what indexes are on the table, rather than being able to >just worry about the set of data they want. Obviously, if a column can >have only one value in the result set, adding to any point in the ORDER >BY can't change anything but performance. That sure sounds like >something which should fall within the scope of an optimizer. > >It really should be a DBA function to add or drop indexes to tune the >performance of queries, without requiring application programmers to >modify the queries for every DBA adjustment. (When you have a database >with over 350 tables and thousands of queries, you really begin to >appreciate the importance of this.) > > I agree that having a smarter optimizer, which can recognize when an index can be used for ORDER BY would be useful. I don't know if there are specific reasons why not, other than just not being implemented yet. It might be tricky to get it correct (for instance, how do you know which columns can be added, which ones will be constant) Perhaps you could just potentially add the WHERE items if they have an equality constraint with a constant. But I'm guessing there are more cases than that where the optimization could be performed. Also, the more options you give the planner, the longer it takes on average to plan any single query. Yes, it is beneficial for this use case, but does that balance out slowing down all the other queries by a tiny bit. I'm guessing the optimization wasn't as important as some of the others that have been done, so it hasn't been implemented yet. John =:-> --------------enig1B4739F3434CF4A3D7E765CE 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCrZ2NJdeBCYSNAAMRAupyAJ9BmItUj+XItfezX2JDOVc8nVlX/ACfedtU lWLgtWkyYIdTpfDd3A2sqhs= =JP7u -----END PGP SIGNATURE----- --------------enig1B4739F3434CF4A3D7E765CE-- From pgsql-performance-owner@postgresql.org Mon Jun 13 11: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 9F69852906 for ; Mon, 13 Jun 2005 11:54:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41812-01 for ; Mon, 13 Jun 2005 14:54:49 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id C8840528E0 for ; Mon, 13 Jun 2005 11:54:48 -0300 (ADT) 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 j5DEsqYW019855; Mon, 13 Jun 2005 10:54:52 -0400 (EDT) To: Alex Stapleton Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL using the wrong Index In-reply-to: <2D1A68BF-B3A4-490E-8053-3CF6626B8DAF@advfn.com> References: <2D1A68BF-B3A4-490E-8053-3CF6626B8DAF@advfn.com> Comments: In-reply-to Alex Stapleton message dated "Mon, 13 Jun 2005 14:02:30 +0100" Date: Mon, 13 Jun 2005 10:54:52 -0400 Message-ID: <19854.1118674492@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: 200506/292 X-Sequence-Number: 12929 Alex Stapleton writes: > l1_historical=# \d "N_intra_pkey" > Index "N_intra_pkey" > Column | Type > --------+----------------------------- > symbol | text > time | timestamp without time zone > unique btree (primary key) > and on queries like this > select * from "N_intra" where symbol='SOMETHING WHICH DOESNT EXIST' > order by time desc limit 1; This was just covered in excruciating detail yesterday ... You need to write order by symbol desc, time desc limit 1 to get the planner to recognize the connection to the sort order of this index. Since you're only selecting one value of symbol, the actual output doesn't change. > Oh, we are running 7.4.2 btw. And our random_page_cost = 1 I'll bet lunch that that is a bad selection of random_page_cost, unless your database is so small that it all fits in RAM. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jun 13 12:20: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 D494F52819 for ; Mon, 13 Jun 2005 12:20:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49463-01 for ; Mon, 13 Jun 2005 15:20:31 +0000 (GMT) Received: from mail49.messagelabs.com (mail49.messagelabs.com [193.109.255.19]) by svr1.postgresql.org (Postfix) with SMTP id 6E67952812 for ; Mon, 13 Jun 2005 12:20:29 -0300 (ADT) X-VirusChecked: Checked X-Env-Sender: alexs@advfn.com X-Msg-Ref: server-6.tower-49.messagelabs.com!1118676021!19551909!1 X-StarScan-Version: 5.4.15; banners=-,-,- X-Originating-IP: [212.161.99.149] Received: (qmail 4524 invoked from network); 13 Jun 2005 15:20:22 -0000 Received: from mail.advfn.com (212.161.99.149) by server-6.tower-49.messagelabs.com with SMTP; 13 Jun 2005 15:20:22 -0000 Received: from [213.86.19.101] (helo=[192.168.0.185]) by mail.advfn.com with esmtp (Exim 4.22) id 1Dhqjd-0006Y6-20; Mon, 13 Jun 2005 16:20:21 +0100 In-Reply-To: <42AD9C6E.3000705@arbash-meinel.com> References: <2D1A68BF-B3A4-490E-8053-3CF6626B8DAF@advfn.com> <42AD9C6E.3000705@arbash-meinel.com> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Alex Stapleton Subject: Re: PostgreSQL using the wrong Index Date: Mon, 13 Jun 2005 16:20:19 +0100 To: John A Meinel X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/295 X-Sequence-Number: 12932 On 13 Jun 2005, at 15:47, John A Meinel wrote: > Alex Stapleton wrote: > > >> Oh, we are running 7.4.2 btw. And our random_page_cost = 1 >> >> > Which is only correct if your entire db fits into memory. Also, try > updating to a later 7.4 version if at all possible. > I am aware of this, I didn't configure this machine though unfortuantely. >> On 13 Jun 2005, at 14:02, Alex Stapleton wrote: >> >> >>> We have two index's like so >>> >>> l1_historical=# \d "N_intra_time_idx" >>> Index "N_intra_time_idx" >>> Column | Type >>> --------+----------------------------- >>> time | timestamp without time zone >>> btree >>> >>> > Just so you are aware, writing this as: "We have an index on > N_intra(time) and one on N_Intra(symbol, time)" is a lot more > succinct. > Sorry, I happened to have them there in my clipboard at the time so I just blindly pasted them in. >>> >>> l1_historical=# \d "N_intra_pkey" >>> Index "N_intra_pkey" >>> Column | Type >>> --------+----------------------------- >>> symbol | text >>> time | timestamp without time zone >>> unique btree (primary key) >>> >>> and on queries like this >>> >>> select * from "N_intra" where symbol='SOMETHING WHICH DOESNT EXIST' >>> order by time desc limit 1; >>> >>> PostgreSQL takes a very long time to complete, as it effectively >>> scans the entire table, backwards. And the table is huge, about 450 >>> million rows. (btw, there are no triggers or any other exciting >>> things like that on our tables in this db.) >>> >>> but on things where the symbol does exist in the table, it's >>> more or >>> less fine, and nice and fast. >>> >> >> > What happens if you do: > SELECT * FROM "N_intra" WHERE symbol='doesnt exist' ORDER BY symbol, > time DESC LIMIT 1; Hurrah! I should of thought of this, considering i've done it in the past :) Thanks a lot, that's great. > Yes, symbol is constant, but it frequently helps the planner > realize it > can use an index scan if you include all terms in the index in the > ORDER > BY clause. > >>> >>> Whilst the option the planner has taken might be faster most of the >>> time, the worst case scenario is unacceptable for obvious reasons. >>> I've googled for trying to force the use of a specific index, but >>> can't find anything relevant. Does anyone have any suggestions on >>> getting it to use an index which hopefully will have better worst >>> case performance? >>> >> >> > Try the above first. You could also create a new index on symbol > CREATE INDEX "N_intra_symbol_idx" ON "N_intra"(symbol); > > Then the WHERE clause should use the symbol index, which means it can > know quickly that an entry doesn't exist. I'm not sure how many > entries > you have per symbol, though, so this might cause problems in the ORDER > BY time portion. > > I'm guessing what you really want is to just do the ORDER BY > symbol, time. > > John > =:-> > > From pgsql-performance-owner@postgresql.org Mon Jun 13 12:40: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 B942152809 for ; Mon, 13 Jun 2005 12:39:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53801-01 for ; Mon, 13 Jun 2005 15:39:51 +0000 (GMT) Received: from ylpvm12.prodigy.net (ylpvm12-ext.prodigy.net [207.115.57.43]) by svr1.postgresql.org (Postfix) with ESMTP id C88D552813 for ; Mon, 13 Jun 2005 12:39:49 -0300 (ADT) Received: from pimout6-ext.prodigy.net (pimout6-int.prodigy.net [207.115.4.22]) by ylpvm12.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id j5DFdmG4024296 for ; Mon, 13 Jun 2005 11:39:48 -0400 X-ORBL: [69.177.163.214] Received: from [192.168.1.207] (214.adsl.snet.net [69.177.163.214] (may be forged)) by pimout6-ext.prodigy.net (8.12.10 milter /8.12.10) with ESMTP id j5DFddhe128714; Mon, 13 Jun 2005 11:39:43 -0400 Message-ID: <42ADAA92.7000200@kencast.com> Date: Mon, 13 Jun 2005 11:47:30 -0400 From: Wei Weng User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Alex Stapleton , pgsql-performance@postgresql.org Subject: Re: PostgreSQL using the wrong Index References: <2D1A68BF-B3A4-490E-8053-3CF6626B8DAF@advfn.com> <19854.1118674492@sss.pgh.pa.us> In-Reply-To: <19854.1118674492@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=1.195 tagged_above=0 required=5 tests=AWL, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: * X-Archive-Number: 200506/296 X-Sequence-Number: 12933 Tom Lane wrote: > > > This was just covered in excruciating detail yesterday ... > > You need to write > order by symbol desc, time desc limit 1 > to get the planner to recognize the connection to the sort order > of this index. Since you're only selecting one value of symbol, > the actual output doesn't change. > Is this the right behavior (not a bug)? Is postgresql planning on changing this soon? Thanks Wei From pgsql-performance-owner@postgresql.org Mon Jun 13 12:49: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 E4F99528CE for ; Mon, 13 Jun 2005 12:49:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56487-01 for ; Mon, 13 Jun 2005 15:49:09 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 72F21528C1 for ; Mon, 13 Jun 2005 12:49:07 -0300 (ADT) Received: (qmail 9962 invoked by uid 500); 13 Jun 2005 15:48:34 -0000 Date: Mon, 13 Jun 2005 10:48:34 -0500 From: Bruno Wolff III To: John A Meinel Cc: Kevin Grittner , linux@alteeve.com, tgl@sss.pgh.pa.us, tobias@nordicbet.com, pgsql-performance@postgresql.org Subject: Re: Index ot being used Message-ID: <20050613154834.GA9203@wolff.to> Mail-Followup-To: Bruno Wolff III , John A Meinel , Kevin Grittner , linux@alteeve.com, tgl@sss.pgh.pa.us, tobias@nordicbet.com, pgsql-performance@postgresql.org References: <42AD9D8D.9060503@arbash-meinel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42AD9D8D.9060503@arbash-meinel.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: 200506/297 X-Sequence-Number: 12934 On Mon, Jun 13, 2005 at 09:51:57 -0500, John A Meinel wrote: > > I don't know if there are specific reasons why not, other than just not > being implemented yet. It might be tricky to get it correct (for > instance, how do you know which columns can be added, which ones will be > constant) Perhaps you could just potentially add the WHERE items if they > have an equality constraint with a constant. But I'm guessing there are > more cases than that where the optimization could be performed. I think there is already some intelligence about which expressions are constant in particular parts of a plan. I think you need to be able to do two things. One is to drop constant expressions from order by lists. The other is when looking for an index to produce a specific ordering, to ingore leading constant expressions when comparing to the order by expressions. > Also, the more options you give the planner, the longer it takes on > average to plan any single query. Yes, it is beneficial for this use > case, but does that balance out slowing down all the other queries by a > tiny bit. But there aren't that many possible indexes, so I don't expect this will slow things down much more than the current check for potentially useful indexes. From pgsql-performance-owner@postgresql.org Mon Jun 13 12:50: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 E88725292C for ; Mon, 13 Jun 2005 12:49:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55547-03 for ; Mon, 13 Jun 2005 15:49:52 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id 4667052921 for ; Mon, 13 Jun 2005 12:49:50 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id B3A8838281 for ; Mon, 13 Jun 2005 17:49:48 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id BE25E380C9 for ; Mon, 13 Jun 2005 17:49:47 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: <6243ad910c02150d526b7b32d4cfef9d@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-142-784150487 From: Yves Vindevogel Subject: Fwd: Updates on large tables are extremely slow Date: Mon, 13 Jun 2005 17:49:47 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/298 X-Sequence-Number: 12935 --Apple-Mail-142-784150487 Content-Type: multipart/alternative; boundary=Apple-Mail-143-784150488 --Apple-Mail-143-784150488 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed I forgot cc Begin forwarded message: > From: Yves Vindevogel > Date: Mon 13 Jun 2005 17:45:19 CEST > To: Tom Lane > Subject: Re: [PERFORM] Updates on large tables are extremely slow > > Yes, but if I update one column, why should PG update 21 indexes ? > There's only one index affected ! > > On 13 Jun 2005, at 16:32, Tom Lane wrote: > >> Yves Vindevogel writes: >>> rvponp=3D3D# vacuum verbose tblPrintjobs ; >>> INFO: vacuuming "public.tblprintjobs" >>> [ twenty-one different indexes on one table ] >> >> Well, there's your problem. You think updating all those indexes is >> free? It's *expensive*. Heed the manual's advice: avoid creating >> indexes you are not certain you need for identifiable commonly-used >> queries. >> >> (The reason delete is fast is it doesn't have to touch the indexes = ... >> the necessary work is left to be done by VACUUM.) >> >> regards, tom lane >> >> > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > Yves Vindevogel > Implements > --Apple-Mail-143-784150488 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 I forgot cc Begin forwarded message: 0000,0000,0000From: Yves Vindevogel < 0000,0000,0000Date: Mon 13 Jun 2005 17:45:19 CEST 0000,0000,0000To: Tom Lane < 0000,0000,0000Subject: Re: [PERFORM] Updates on large tables are extremely slow=20 Yes, but if I update one column, why should PG update 21 indexes ? There's only one index affected ! On 13 Jun 2005, at 16:32, Tom Lane wrote: Yves Vindevogel < writes: rvponp=3D3D# vacuum verbose tblPrintjobs ; INFO: vacuuming "public.tblprintjobs" [ twenty-one different indexes on one table ] Well, there's your problem. You think updating all those indexes is free? It's *expensive*. Heed the manual's advice: avoid creating indexes you are not certain you need for identifiable commonly-used queries. (The reason delete is fast is it doesn't have to touch the indexes ... the necessary work is left to be done by VACUUM.) regards, tom lane Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-143-784150488-- --Apple-Mail-142-784150487 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7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HPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-142-784150487 Content-Type: multipart/alternative; boundary=Apple-Mail-144-784150489 --Apple-Mail-144-784150489 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. =20= > Then you win. > Mahatma Ghandi. > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-144-784150489 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma Ghandi. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-144-784150489-- --Apple-Mail-142-784150487 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tWO/+FjlKVWtfijT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7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-142-784150487 Content-Type: multipart/alternative; boundary=Apple-Mail-145-784150491 --Apple-Mail-145-784150491 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-145-784150491 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-145-784150491-- --Apple-Mail-142-784150487-- From pgsql-performance-owner@postgresql.org Mon Jun 13 13:05: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 DE9E852824 for ; Mon, 13 Jun 2005 13:05:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57049-07 for ; Mon, 13 Jun 2005 16:05:24 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id BCB3B52809 for ; Mon, 13 Jun 2005 13:05:23 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id A29FF40E079; Mon, 13 Jun 2005 17:05:10 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id DB81715ED7; Mon, 13 Jun 2005 17:02:26 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01349-10; Mon, 13 Jun 2005 17:02:24 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 5860C15ED5; Mon, 13 Jun 2005 17:02:24 +0100 (BST) Message-ID: <42ADAE10.6050204@archonet.com> Date: Mon, 13 Jun 2005 17:02:24 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Fwd: Updates on large tables are extremely slow References: <6243ad910c02150d526b7b32d4cfef9d@implements.be> In-Reply-To: <6243ad910c02150d526b7b32d4cfef9d@implements.be> 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.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/299 X-Sequence-Number: 12936 Yves Vindevogel wrote: > I forgot cc > > Begin forwarded message: > >> From: Yves Vindevogel >> Date: Mon 13 Jun 2005 17:45:19 CEST >> To: Tom Lane >> Subject: Re: [PERFORM] Updates on large tables are extremely slow >> >> Yes, but if I update one column, why should PG update 21 indexes ? >> There's only one index affected ! No - all 21 are affected. MVCC creates a new row on disk. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Mon Jun 13 13:22: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 D65E6528C6 for ; Mon, 13 Jun 2005 13:22:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62713-05 for ; Mon, 13 Jun 2005 16:22: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 B56BE52809 for ; Mon, 13 Jun 2005 13:22:37 -0300 (ADT) 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 j5DGMFgn020543; Mon, 13 Jun 2005 12:22:15 -0400 (EDT) To: Bruno Wolff III Cc: John A Meinel , Kevin Grittner , linux@alteeve.com, tobias@nordicbet.com, pgsql-performance@postgresql.org Subject: Re: Index ot being used In-reply-to: <20050613154834.GA9203@wolff.to> References: <42AD9D8D.9060503@arbash-meinel.com> <20050613154834.GA9203@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Mon, 13 Jun 2005 10:48:34 -0500" Date: Mon, 13 Jun 2005 12:22:14 -0400 Message-ID: <20542.1118679734@sss.pgh.pa.us> From: Tom Lane 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: 200506/300 X-Sequence-Number: 12937 > John A Meinel wrote: >> I don't know if there are specific reasons why not, other than just not >> being implemented yet. It might be tricky to get it correct Not so much tricky to get correct, as potentially expensive to test for; it'd be quite easy to waste a lot of cycles trying to match ORDER BY keys in multiple ways to completely-irrelevant indexes. Since this will only be helpful for a minority of queries but the costs would be paid on almost everything with an ORDER BY, that consideration has been looming large in my mind. Bruno Wolff III writes: > I think you need to be able to do two things. One is to drop constant > expressions from order by lists. The other is when looking for an index > to produce a specific ordering, to ingore leading constant expressions > when comparing to the order by expressions. I've been thinking about this some more this morning, and I think I see how it could be relatively inexpensive to recognize x=constant restrictions that allow ordering columns of an index to be ignored. We are already doing 90% of the work for that just as a byproduct of trying to match the x=constant clause to the index in the first place, so it's mostly a matter of refactoring the code to allow that work to be reused. I don't, however, see an equally inexpensive way to ignore ORDER BY columns. That would imply associating the '=' operator of the restriction clause with the '<' or '>' operator of the ORDER BY clause, which means searching for a btree opclass that has them in common, which is not cheap since there's no indexing on pg_amop that would allow us to find it easily. (There are various places where we do in fact do that sort of thing, but they aren't so performance-critical.) This doesn't come up in the other case because we already know the relevant opclass from the index. I don't think the use-case has been shown that justifies doing this much work to ignore useless ORDER BY clauses. The examples that have come up in the past all suggest ignoring index columns not the other way 'round. Can you make a case that we need to do that part of it? regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jun 13 13:46: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 7B9AD528D0 for ; Mon, 13 Jun 2005 13:46:07 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67890-07 for ; Mon, 13 Jun 2005 16:46:01 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id 2F435528B2 for ; Mon, 13 Jun 2005 13:46:00 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id BCC193821E for ; Mon, 13 Jun 2005 18:46:00 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id 39FD538026 for ; Mon, 13 Jun 2005 18:46:00 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <42ADAE10.6050204@archonet.com> References: <6243ad910c02150d526b7b32d4cfef9d@implements.be> <42ADAE10.6050204@archonet.com> Content-Type: multipart/mixed; boundary=Apple-Mail-146-787522189 Message-Id: <93fcaa35413e2059526ab3aa562a17dd@implements.be> From: Yves Vindevogel Subject: Re: Updates on large tables are extremely slow Date: Mon, 13 Jun 2005 18:45:59 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/301 X-Sequence-Number: 12938 --Apple-Mail-146-787522189 Content-Type: multipart/alternative; boundary=Apple-Mail-147-787522190 --Apple-Mail-147-787522190 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Ok, if all 21 are affected, I can understand the problem. But allow me to say that this is a "functional error" On 13 Jun 2005, at 18:02, Richard Huxton wrote: > Yves Vindevogel wrote: >> I forgot cc >> Begin forwarded message: >>> From: Yves Vindevogel >>> Date: Mon 13 Jun 2005 17:45:19 CEST >>> To: Tom Lane >>> Subject: Re: [PERFORM] Updates on large tables are extremely slow >>> >>> Yes, but if I update one column, why should PG update 21 indexes ? >>> There's only one index affected ! > > No - all 21 are affected. MVCC creates a new row on disk. > > --=20 > Richard Huxton > Archonet Ltd > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-147-787522190 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Ok, if all 21 are affected, I can understand the problem. But allow me to say that this is a "functional error" On 13 Jun 2005, at 18:02, Richard Huxton wrote: Yves Vindevogel wrote: I forgot cc Begin forwarded message: From: Yves Vindevogel < Date: Mon 13 Jun 2005 17:45:19 CEST To: Tom Lane < Subject: Re: [PERFORM] Updates on large tables are extremely slow Yes, but if I update one column, why should PG update 21 indexes ? There's only one index affected ! No - all 21 are affected. MVCC creates a new row on disk. --=20 Richard Huxton Archonet Ltd Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-147-787522190-- --Apple-Mail-146-787522189 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupj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7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-146-787522189 Content-Type: multipart/alternative; boundary=Apple-Mail-148-787522191 --Apple-Mail-148-787522191 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-148-787522191 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-148-787522191-- --Apple-Mail-146-787522189-- From pgsql-performance-owner@postgresql.org Mon Jun 13 13:47: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 B1FB6528BF for ; Mon, 13 Jun 2005 13:47:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70185-01 for ; Mon, 13 Jun 2005 16:47:01 +0000 (GMT) Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) by svr1.postgresql.org (Postfix) with ESMTP id 7FCF6528AA for ; Mon, 13 Jun 2005 13:46:59 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Mon, 13 Jun 2005 11:46:58 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Date: Mon, 13 Jun 2005 11:46:46 -0500 From: "Kevin Grittner" To: , Cc: , , , Subject: Re: Index ot being used Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.032 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/302 X-Sequence-Number: 12939 I agree that ignoring useless columns in an ORDER BY clause is less important than ignoring index columns where the value is fixed. There is one use case for ignoring useless ORDER BY columns that leaps to mind, however -- a column is added to the ORDER BY clause of a query to help out the optimizer, then the indexes are modified such that that column is no longer useful. Whether this merits the programming effort and performance hit you describe seems highly questionable, though. -Kevin >>> Tom Lane 06/13/05 11:22 AM >>> I don't think the use-case has been shown that justifies doing this much work to ignore useless ORDER BY clauses. The examples that have come up in the past all suggest ignoring index columns not the other way 'round. Can you make a case that we need to do that part of it? From pgsql-performance-owner@postgresql.org Mon Jun 13 13:50: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 22CEB528B2 for ; Mon, 13 Jun 2005 13:50:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68350-08 for ; Mon, 13 Jun 2005 16:50:04 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 08F1C52889 for ; Mon, 13 Jun 2005 13:50:03 -0300 (ADT) Received: (qmail 13455 invoked by uid 500); 13 Jun 2005 16:49:29 -0000 Date: Mon, 13 Jun 2005 11:49:29 -0500 From: Bruno Wolff III To: Tom Lane Cc: John A Meinel , Kevin Grittner , linux@alteeve.com, tobias@nordicbet.com, pgsql-performance@postgresql.org Subject: Re: Index ot being used Message-ID: <20050613164929.GA12557@wolff.to> Mail-Followup-To: Bruno Wolff III , Tom Lane , John A Meinel , Kevin Grittner , linux@alteeve.com, tobias@nordicbet.com, pgsql-performance@postgresql.org References: <42AD9D8D.9060503@arbash-meinel.com> <20050613154834.GA9203@wolff.to> <20542.1118679734@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20542.1118679734@sss.pgh.pa.us> User-Agent: Mutt/1.5.6i 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: 200506/303 X-Sequence-Number: 12940 On Mon, Jun 13, 2005 at 12:22:14 -0400, Tom Lane wrote: > > I don't think the use-case has been shown that justifies doing this much > work to ignore useless ORDER BY clauses. The examples that have come up > in the past all suggest ignoring index columns not the other way 'round. > Can you make a case that we need to do that part of it? I don't think so. I don't think people are likely to order by constant expressions except by adding them to the front to help optimization. When I was thinking about this I was looking at what equivalences could be used and didn't look back to see which ones would be useful in the normal case. And I think it is a lot more likely people will leave out columns they know not to be relevant than to include them. From pgsql-performance-owner@postgresql.org Mon Jun 13 13: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 337F6528AA for ; Mon, 13 Jun 2005 13:55:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70305-10 for ; Mon, 13 Jun 2005 16:55:32 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 48AD552813 for ; Mon, 13 Jun 2005 13:55:31 -0300 (ADT) Received: from 216-154-15-201.dsl.look.ca (216-154-15-201.dsl.look.ca [216.154.15.201]) by tht.net (Postfix) with ESMTP id 1DC2476A21; Mon, 13 Jun 2005 12:55:33 -0400 (EDT) Subject: Re: Updates on large tables are extremely slow From: Rod Taylor To: Yves Vindevogel Cc: pgsql-performance@postgresql.org In-Reply-To: <93fcaa35413e2059526ab3aa562a17dd@implements.be> References: <6243ad910c02150d526b7b32d4cfef9d@implements.be> <42ADAE10.6050204@archonet.com> <93fcaa35413e2059526ab3aa562a17dd@implements.be> Content-Type: text/plain; charset=ISO-8859-1 Date: Mon, 13 Jun 2005 12:53:19 -0400 Message-Id: <1118681599.723.105.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 8bit 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: 200506/305 X-Sequence-Number: 12942 > Ok, if all 21 are affected, I can understand the problem. > But allow me to say that this is a "functional error" It's a choice between total throughput on a high load, high connection basis (MVCC dramatically wins here), versus a single user, low load scenario (MS Access is designed for this). Believe me when I say that a lot of people have spent a lot of time explicitly making the system work that way. > On 13 Jun 2005, at 18:02, Richard Huxton wrote: > > Yves Vindevogel wrote: > I forgot cc > Begin forwarded message: > From: Yves Vindevogel > > Date: Mon 13 Jun 2005 17:45:19 CEST > To: Tom Lane > Subject: Re: [PERFORM] Updates on large tables > are extremely slow > > Yes, but if I update one column, why should PG > update 21 indexes ? > There's only one index affected ! > > No - all 21 are affected. MVCC creates a new row on disk. > > -- > Richard Huxton > Archonet Ltd > > > Met vriendelijke groeten, > Bien � vous, > Kind regards, > > Yves Vindevogel > Implements > > > > ______________________________________________________________________ > > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. > Then you win. > Mahatma Ghandi. > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq -- From pgsql-performance-owner@postgresql.org Mon Jun 13 13:54: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 57B29528AA for ; Mon, 13 Jun 2005 13:54:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74711-01 for ; Mon, 13 Jun 2005 16:54:28 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 62F17528BF for ; Mon, 13 Jun 2005 13:54:28 -0300 (ADT) Received: (qmail 13699 invoked by uid 500); 13 Jun 2005 16:53:55 -0000 Date: Mon, 13 Jun 2005 11:53:55 -0500 From: Bruno Wolff III To: Kevin Grittner Cc: tgl@sss.pgh.pa.us, linux@alteeve.com, john@arbash-meinel.com, tobias@nordicbet.com, pgsql-performance@postgresql.org Subject: Re: Index ot being used Message-ID: <20050613165355.GB12557@wolff.to> Mail-Followup-To: Bruno Wolff III , Kevin Grittner , tgl@sss.pgh.pa.us, linux@alteeve.com, john@arbash-meinel.com, tobias@nordicbet.com, pgsql-performance@postgresql.org References: 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.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/304 X-Sequence-Number: 12941 On Mon, Jun 13, 2005 at 11:46:46 -0500, Kevin Grittner wrote: > I agree that ignoring useless columns in an ORDER BY clause is less > important than ignoring index columns where the value is fixed. There > is one use case for ignoring useless ORDER BY columns that leaps to > mind, however -- a column is added to the ORDER BY clause of a query to > help out the optimizer, then the indexes are modified such that that > column is no longer useful. Whether this merits the programming effort > and performance hit you describe seems highly questionable, though. I suspect that this isn't a big deal. There was a question like that that has been going back and forth over the last couple of days. If you remove the constant expression from the index, you aren't likely going to use the index anyway, but will instead sort the output rows from either a sequential scan or an index scan based on an index that does use the constant expression. From pgsql-performance-owner@postgresql.org Mon Jun 13 14:06: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 4203952889 for ; Mon, 13 Jun 2005 14:06:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70855-10 for ; Mon, 13 Jun 2005 17:05:59 +0000 (GMT) Received: from oismail.com (unknown [38.117.22.100]) by svr1.postgresql.org (Postfix) with ESMTP id B57FE5280A for ; Mon, 13 Jun 2005 14:05:57 -0300 (ADT) Received: from [192.168.8.103] ([213.173.234.215]) (authenticated bits=0) by oismail.com (8.12.11/8.12.11) with ESMTP id j5DH64Df016980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 13 Jun 2005 13:06:06 -0400 Message-ID: <42ADBE08.10700@oismail.com> Date: Mon, 13 Jun 2005 19:10:32 +0200 From: Jona User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: How to enhance the chance that data is in disk cache References: <579bc853ef3957c736c2773f13c444f7@implements.be> <42ACF2DD.8090409@paradise.net.nz> <42AD49BF.7050706@paradise.net.nz> <42AD844F.3070700@oismail.com> <19818.1118674299@sss.pgh.pa.us> In-Reply-To: <19818.1118674299@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------090704020202080705080502" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.161 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_30_40, HTML_MESSAGE, NORMAL_HTTP_TO_IP X-Spam-Level: X-Archive-Number: 200506/306 X-Sequence-Number: 12943 This is a multi-part message in MIME format. --------------090704020202080705080502 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Thank you for the response Tom, I bet you get a lot of mails with "trivial" solutions (mine likely being one of them) I for one however truly appreciate you taking the time to answer them. >Run the query more often? > > The query is dynamically constructed from user input, although the total number of different queries that can be run is limited (around 10k different combinations I suspect) it seems rather pointless to run all of them (or even the most common) more often just to keep the data in the disk cache. Is there a way to make the data more accessible on the disk? >Also, that pile of INNER JOINs is forcing a probably-bad join order; >you need to think carefully about the order you want things joined in, >or else convert the query to non-JOIN syntax. See the "Performance >Tips" chapter of the manual. > > You're probably right here, the join order must be bad though it just flattening the join and letting the planner decide on what would be best makes the plan change for every execution. Have query cost variering from from 1350 to 4500. I wager it ends up using GEQO due to the number of possiblities for a join order that the query has and thus just decides on a "good" plan out of those it examined. In any case, the "right" way to do this is definning a good explicit join order, no? On top of my head I'm not sure how to re-write it proberly, suppose trial and errors is the only way.... From the plan it appears that the following part is where the cost dramatically increases (although the time does not??): -> Nested Loop (cost=0.00..1207.19 rows=75 width=32) (actual time=0.28..18.47 rows=164 loops=1) -> Nested Loop (cost=0.00..868.23 rows=58 width=20) (actual time=0.16..13.91 rows=164 loops=1) -> Index Scan using subcat_uq on sct2subcattype_tbl (cost=0.00..479.90 rows=82 width=8) (actual time=0.11..9.47 rows=164 loops=1) Index Cond: (subcattpid = 50) Filter: (NOT (subplan)) SubPlan -> Seq Scan on aff2sct2subcattype_tbl (cost=0.00..1.92 rows=1 width=4) (actual time=0.05..0.05 rows=0 loops=164) Filter: ((affid = 8) AND ($0 = sctid)) -> Index Scan using aff_price_uq on price_tbl (cost=0.00..4.72 rows=1 width=12) (actual time=0.02..0.02 rows=1 loops=164) Index Cond: ((price_tbl.affid = 8) AND (price_tbl.sctid = outer".sctid))" -> Index Scan using ctp_statcon on statcon_tbl (cost=0.00..5.86 rows=1 width=12) (actual time=0.02..0.02 rows=1 loops=164) Index Cond: ((statcon_tbl.sctid = outer".sctid) AND (statcon_tbl.ctpid = 1))" Especially the index scan on subcat_uq seems rather expensive, but is pretty fast. Can there be drawn a relation between estimated cost and execution time? Any other pointers in the right direction would be very much appreciated. For the full query and query plan, please refer to: http://213.173.234.215:8080/get_content_plan.htm Cheers Jona Tom Lane wrote: >Jona writes: > > >>I have a query (please refer to >>http://213.173.234.215:8080/get_content_plan.htm for the query as well >>as query plan) that is slow when it's run the first time and fast(ish) >>on all successive runs within a reasonable time period. >> >> > > > >>This leads me to suspect that when the query is first run, all used data >>have to be fetched from the disk where as once it has been run all data >>is available in the OS's disk cache. >> >> > >Sounds like that to me too. > > > >>Is there anway to either enhance the chance that the data can be found >>in the disk cache or allowing the database to fetch the data faster? >> >> > > > >Run the query more often? > > The query is dynamically constructed from user input, although the total number of different queries that can be run is limited (around 10k different combinations I suspect) it seems rather pointless to run all of them (or even the most common) more often just to keep the data in the disk cache. Is there a way to make the data more accessible on the disk? >Also, that pile of INNER JOINs is forcing a probably-bad join order; >you need to think carefully about the order you want things joined in, >or else convert the query to non-JOIN syntax. See the "Performance >Tips" chapter of the manual. > > You're probably right herem though I'm not sure I can > regards, tom lane > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster > > --------------090704020202080705080502 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thank you for the response Tom, I bet you get a lot of mails with "trivial" solutions (mine likely being one of them)
I for one however truly appreciate you taking the time to answer them.

Run the query more often?
  
The query is dynamically constructed from user input, although the total number of different queries that can be run is limited (around 10k different combinations I suspect) it seems rather pointless to run all of them (or even the most common) more often just to keep the data in the disk cache.
Is there a way to make the data more accessible on the disk?
Also, that pile of INNER JOINs is forcing a probably-bad join order;
you need to think carefully about the order you want things joined in,
or else convert the query to non-JOIN syntax.  See the "Performance
Tips" chapter of the manual.
  
You're probably right here, the join order must be bad though it just flattening the join and letting the planner decide on what would be best makes the plan change for every execution.
Have query cost variering from from 1350 to 4500.
I wager it ends up using GEQO due to the number of possiblities for a join order that the query has and thus just decides on a "good" plan out of those it examined.
In any case, the "right" way to do this is definning a good explicit join order, no?
On top of my head I'm not sure how to re-write it proberly, suppose trial and errors is the only way....
>From the plan it appears that the following part is where the cost dramatically increases (although the time does not??):
->  Nested Loop  (cost=0.00..1207.19 rows=75 width=32) (actual time=0.28..18.47 rows=164 loops=1)     
    ->  Nested Loop  (cost=0.00..868.23 rows=58 width=20) (actual time=0.16..13.91 rows=164 loops=1)    
        ->  Index Scan using subcat_uq on sct2subcattype_tbl  (cost=0.00..479.90 rows=82 width=8) (actual time=0.11..9.47 rows=164 loops=1)
              Index Cond: (subcattpid = 50)    
              Filter: (NOT (subplan))    
              SubPlan    
              ->  Seq Scan on aff2sct2subcattype_tbl  (cost=0.00..1.92 rows=1 width=4) (actual time=0.05..0.05 rows=0 loops=164)    
                    Filter: ((affid = 8) AND ($0 = sctid))    
        ->  Index Scan using aff_price_uq on price_tbl  (cost=0.00..4.72 rows=1 width=12) (actual time=0.02..0.02 rows=1 loops=164)    
              Index Cond: ((price_tbl.affid = 8) AND (price_tbl.sctid = outer".sctid))"    
    ->  Index Scan using ctp_statcon on statcon_tbl  (cost=0.00..5.86 rows=1 width=12) (actual time=0.02..0.02 rows=1 loops=164)    
          Index Cond: ((statcon_tbl.sctid = outer".sctid) AND (statcon_tbl.ctpid = 1))"    
Especially the index scan on subcat_uq seems rather expensive, but is pretty fast.
Can there be drawn a relation between estimated cost and execution time?
Any other pointers in the right direction would be very much appreciated.

For the full query and query plan, please refer to: http://213.173.234.215:8080/get_content_plan.htm

Cheers
Jona

Tom Lane wrote:
Jona <jonanews@oismail.com> writes:
  
I have a query (please refer to 
http://213.173.234.215:8080/get_content_plan.htm for the query as well 
as query plan) that is slow when it's run the first time and fast(ish) 
on all successive runs within a reasonable time period.
    

  
This leads me to suspect that when the query is first run, all used data 
have to be fetched from the disk where as once it has been run all data 
is available in the OS's disk cache.
    

Sounds like that to me too.

  
Is there anway to either enhance the chance that the data can be found 
in the disk cache or allowing the database to fetch the data faster?
    

  

Run the query more often?
  
The query is dynamically constructed from user input, although the total number of different queries that can be run is limited (around 10k different combinations I suspect) it seems rather pointless to run all of them (or even the most common) more often just to keep the data in the disk cache.
Is there a way to make the data more accessible on the disk?
Also, that pile of INNER JOINs is forcing a probably-bad join order;
you need to think carefully about the order you want things joined in,
or else convert the query to non-JOIN syntax.  See the "Performance
Tips" chapter of the manual.
  
You're probably right herem though I'm not sure I can
			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
  

--------------090704020202080705080502-- From pgsql-performance-owner@postgresql.org Mon Jun 13 14:22: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 8E404528D0 for ; Mon, 13 Jun 2005 14:22:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83239-02 for ; Mon, 13 Jun 2005 17:22:13 +0000 (GMT) Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56]) by svr1.postgresql.org (Postfix) with ESMTP id CA9EE528AA for ; Mon, 13 Jun 2005 14:22:12 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by adicia.telenet-ops.be (Postfix) with SMTP id 88E114438C for ; Mon, 13 Jun 2005 19:22:09 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by adicia.telenet-ops.be (Postfix) with ESMTP id E015E4432D for ; Mon, 13 Jun 2005 19:22:08 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <93fcaa35413e2059526ab3aa562a17dd@implements.be> References: <6243ad910c02150d526b7b32d4cfef9d@implements.be> <42ADAE10.6050204@archonet.com> <93fcaa35413e2059526ab3aa562a17dd@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-155-789690552 Message-Id: From: Yves Vindevogel Subject: Re: Updates on large tables are extremely slow Date: Mon, 13 Jun 2005 19:22:07 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/307 X-Sequence-Number: 12944 --Apple-Mail-155-789690552 Content-Type: multipart/alternative; boundary=Apple-Mail-156-789690552 --Apple-Mail-156-789690552 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed I just dropped 19 of the 21 indexes. I just left the primary key=20 constraint and my unique index on 3 fields ... I did a vacuum full and an analyse .... I just ran the query again=20 some 20 minutes ago. Guess what .... It's still running !! So it's not that much faster for the moment. I just want to update a single field in one table with a simple value=20 (negative value of another field) That can not be that hard ... Or is it the MVCC that is responsible for this ? It can't be indexes on other tables, right ? That would be absolutely sick On 13 Jun 2005, at 18:45, Yves Vindevogel wrote: > Ok, if all 21 are affected, I can understand the problem. > But allow me to say that this is a "functional error" > > On 13 Jun 2005, at 18:02, Richard Huxton wrote: > >> Yves Vindevogel wrote: >>> I forgot cc >>> Begin forwarded message: >>>> From: Yves Vindevogel >>>> Date: Mon 13 Jun 2005 17:45:19 CEST >>>> To: Tom Lane >>>> Subject: Re: [PERFORM] Updates on large tables are extremely slow >>>> >>>> Yes, but if I update one column, why should PG update 21 indexes ? >>>> There's only one index affected ! >> >> No - all 21 are affected. MVCC creates a new row on disk. >> >> --=20 >> Richard Huxton >> Archonet Ltd >> >> > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > Yves Vindevogel > Implements > > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. =20= > Then you win. > Mahatma Ghandi. > > ---------------------------(end of=20 > broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-156-789690552 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 I just dropped 19 of the 21 indexes. I just left the primary key constraint and my unique index on 3 fields ... I did a vacuum full and an analyse .... I just ran the query again some 20 minutes ago. Guess what .... It's still running !! So it's not that much faster for the moment. I just want to update a single field in one table with a simple value (negative value of another field) That can not be that hard ... Or is it the MVCC that is responsible for this ? It can't be indexes on other tables, right ? That would be absolutely sick On 13 Jun 2005, at 18:45, Yves Vindevogel wrote: Ok, if all 21 are affected, I can understand the problem. But allow me to say that this is a "functional error" On 13 Jun 2005, at 18:02, Richard Huxton wrote: Yves Vindevogel wrote: I forgot cc Begin forwarded message: From: Yves Vindevogel < Date: Mon 13 Jun 2005 17:45:19 CEST To: Tom Lane < Subject: Re: [PERFORM] Updates on large tables are extremely slow Yes, but if I update one column, why should PG update 21 indexes ? There's only one index affected ! No - all 21 are affected. MVCC creates a new row on disk. --=20 Richard Huxton Archonet Ltd Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements < Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma Ghandi. ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-156-789690552-- --Apple-Mail-155-789690552 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/o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qHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-155-789690552 Content-Type: multipart/alternative; boundary=Apple-Mail-157-789690554 --Apple-Mail-157-789690554 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-157-789690554 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-157-789690554-- --Apple-Mail-155-789690552-- From pgsql-performance-owner@postgresql.org Mon Jun 13 14:36: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 AFAB15280A for ; Mon, 13 Jun 2005 14:36:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86961-02 for ; Mon, 13 Jun 2005 17:36:54 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id B9EF352809 for ; Mon, 13 Jun 2005 14:36:52 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5DHanGx013038; Mon, 13 Jun 2005 19:36:49 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050613193502.039de7c8@pop.interactivemediafactory.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Mon, 13 Jun 2005 19:36:45 +0200 To: Yves Vindevogel From: Jacques Caron Subject: Re: Updates on large tables are extremely slow Cc: pgsql-performance@postgresql.org In-Reply-To: References: <6243ad910c02150d526b7b32d4cfef9d@implements.be> <42ADAE10.6050204@archonet.com> <93fcaa35413e2059526ab3aa562a17dd@implements.be> 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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/308 X-Sequence-Number: 12945 Hi, At 19:22 13/06/2005, Yves Vindevogel wrote: >It can't be indexes on other tables, right ? It could be foreign keys from that table referencing other tables or foreign keys from other tables referencing that table, especially if you don't have the matching indexes... Jacques. From pgsql-performance-owner@postgresql.org Mon Jun 13 14:51: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 7896652819 for ; Mon, 13 Jun 2005 14:51:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87110-09 for ; Mon, 13 Jun 2005 17:50:55 +0000 (GMT) Received: from tomts13-srv.bellnexxia.net (tomts13-srv.bellnexxia.net [209.226.175.34]) by svr1.postgresql.org (Postfix) with ESMTP id 18DCE52814 for ; Mon, 13 Jun 2005 14:50:52 -0300 (ADT) Received: from [192.168.2.99] ([64.228.1.94]) by tomts13-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050613175050.MKWU25800.tomts13-srv.bellnexxia.net@[192.168.2.99]>; Mon, 13 Jun 2005 13:50:50 -0400 Message-ID: <42ADC77B.7000007@alteeve.com> Date: Mon, 13 Jun 2005 13:50:51 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Bruno Wolff III , Tom Lane Subject: Re: Index ot being used References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> <20050613132852.GA31142@wolff.to> In-Reply-To: <20050613132852.GA31142@wolff.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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/309 X-Sequence-Number: 12946 Bruno Wolff III wrote: > I am guessing you mean 'file_type' instead of 'file_info'. > > To do this efficiently you want an index on (file_type, file_parent_dir, > file_name). Currently you only have an index on (file_parent_dir, file_name) > which won't help for this query. You also need to order by file_type > even though it will be constant for all of the returned rows in order > to help out the planner. This will allow an index scan over the desired > rows that returns them in the desired order. > > Please actually try this before changing anything else. If I follow then I tried it but still got the sequential scan. Here's the index and query (copied from the 'psql' shell): tle-bu=> \d file_info_7_display_idx Index "public.file_info_7_display_idx" Column | Type -----------------+---------------------- file_type | character varying(2) file_parent_dir | text file_name | text btree, for table "public.file_info_7" tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_display FROM file_info_7 WHERE file_type='d' ORDER BY file_type ASC, file_parent_dir ASC, file_name ASC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- Sort (cost=14810.92..14874.65 rows=25490 width=119) (actual time=15523.767..15731.136 rows=25795 loops=1) Sort Key: file_type, file_parent_dir, file_name -> Seq Scan on file_info_7 (cost=0.00..11956.84 rows=25490 width=119) (actual time=0.132..2164.757 rows=25795 loops=1) Filter: ((file_type)::text = 'd'::text) Total runtime: 15884.188 ms (5 rows) If I follow all three 'ORDER BY...' items match the three columns in the index. Again, thanks! Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Mon Jun 13 14:57: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 41DF45280A for ; Mon, 13 Jun 2005 14:57:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92096-06 for ; Mon, 13 Jun 2005 17:57:31 +0000 (GMT) Received: from tomts16-srv.bellnexxia.net (tomts16-srv.bellnexxia.net [209.226.175.4]) by svr1.postgresql.org (Postfix) with ESMTP id 9215D52814 for ; Mon, 13 Jun 2005 14:57:29 -0300 (ADT) Received: from [192.168.2.99] ([64.228.1.94]) by tomts16-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050613175729.WEAD27508.tomts16-srv.bellnexxia.net@[192.168.2.99]>; Mon, 13 Jun 2005 13:57:29 -0400 Message-ID: <42ADC90B.4040808@alteeve.com> Date: Mon, 13 Jun 2005 13:57:31 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Kevin Grittner , tgl@sss.pgh.pa.us, tobias@nordicbet.com Subject: Re: Index ot being used References: 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/310 X-Sequence-Number: 12947 Kevin Grittner wrote: >>tle-bu=> \d file_info_7_display_idx >> Index "public.file_info_7_display_idx" >> Column | Type >>-----------------+---------------------- >> file_type | character varying(2) >> file_parent_dir | text >> file_name | text >>btree, for table "public.file_info_7" > > > The index is fine, but you need to phrase the query as > > ... ORDER BY file_type, file_parent_dir, file_name; > > (Whether you use ASC or not doesn't matter.) Otherwise the planner > won't make the connection to the sort ordering of the index. > > regards, tom lane With Bruno's help I've gone back and tried just this with no luck. I've re-written the query to include all three items in the 'ORDER BY...' column in the same order but the sort still takes a long time and a sequential scan is being done instead of using the index. For what it's worth, and being somewhat of a n00b, I agree with the idea of a smarter, more flexible planner. I guess the trade off is the added overhead neaded versus the size of the average query. Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Mon Jun 13 15:13: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 12929528C1 for ; Mon, 13 Jun 2005 15:13:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93452-08 for ; Mon, 13 Jun 2005 18:13: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 79A7A52889 for ; Mon, 13 Jun 2005 15:13:23 -0300 (ADT) 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 j5DIDNbM022128; Mon, 13 Jun 2005 14:13:23 -0400 (EDT) To: Madison Kelly Cc: pgsql-performance@postgresql.org, Bruno Wolff III Subject: Re: Index ot being used In-reply-to: <42ADC77B.7000007@alteeve.com> References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> <20050613132852.GA31142@wolff.to> <42ADC77B.7000007@alteeve.com> Comments: In-reply-to Madison Kelly message dated "Mon, 13 Jun 2005 13:50:51 -0400" Date: Mon, 13 Jun 2005 14:13:23 -0400 Message-ID: <22127.1118686403@sss.pgh.pa.us> From: Tom Lane 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: 200506/311 X-Sequence-Number: 12948 Madison Kelly writes: > Bruno Wolff III wrote: >> Please actually try this before changing anything else. > If I follow then I tried it but still got the sequential scan. Given the fairly large number of rows being selected, it seems likely that the planner thinks this is faster than an indexscan. It could be right, too. Have you tried "set enable_seqscan = off" to see if the index is used then? If so, is it faster or slower? Comparing EXPLAIN ANALYZE results with enable_seqscan on and off would be useful. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jun 13 16:22: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 1B2AF5280B for ; Mon, 13 Jun 2005 16:22:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11565-05 for ; Mon, 13 Jun 2005 19:22:33 +0000 (GMT) Received: from tomts13-srv.bellnexxia.net (tomts13-srv.bellnexxia.net [209.226.175.34]) by svr1.postgresql.org (Postfix) with ESMTP id 54FAC5292A for ; Mon, 13 Jun 2005 16:22:32 -0300 (ADT) Received: from [192.168.2.99] ([206.172.171.129]) by tomts13-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050613192232.NHCS25800.tomts13-srv.bellnexxia.net@[192.168.2.99]>; Mon, 13 Jun 2005 15:22:32 -0400 Message-ID: <42ADD8DC.1000001@alteeve.com> Date: Mon, 13 Jun 2005 15:05:00 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Tom Lane , Bruno Wolff III Subject: Re: Index ot being used References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> <20050613132852.GA31142@wolff.to> <42ADC77B.7000007@alteeve.com> <22127.1118686403@sss.pgh.pa.us> In-Reply-To: <22127.1118686403@sss.pgh.pa.us> 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: 200506/312 X-Sequence-Number: 12949 Tom Lane wrote: > Madison Kelly writes: > >>Bruno Wolff III wrote: >> >>>Please actually try this before changing anything else. > > >> If I follow then I tried it but still got the sequential scan. > > > Given the fairly large number of rows being selected, it seems likely > that the planner thinks this is faster than an indexscan. It could > be right, too. Have you tried "set enable_seqscan = off" to see if > the index is used then? If so, is it faster or slower? Comparing > EXPLAIN ANALYZE results with enable_seqscan on and off would be useful. Wow! With the sequence scan off my query took less than 2sec. When I turned it back on the time jumped back up to just under 14sec. tle-bu=> set enable_seqscan = off; SET tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_display FROM file_info_7 WHERE file_type='d' ORDER BY file_type ASC, file_parent_dir ASC, file_name ASC; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------- Index Scan using file_info_7_display_idx on file_info_7 (cost=0.00..83171.78 rows=25490 width=119) (actual time=141.405..1700.459 rows=25795 loops=1) Index Cond: ((file_type)::text = 'd'::text) Total runtime: 1851.366 ms (3 rows) tle-bu=> set enable_seqscan = on; SET tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_display FROM file_info_7 WHERE file_type='d' ORDER BY file_type ASC, file_parent_dir ASC, file_name ASC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- Sort (cost=14810.92..14874.65 rows=25490 width=119) (actual time=13605.185..13728.436 rows=25795 loops=1) Sort Key: file_type, file_parent_dir, file_name -> Seq Scan on file_info_7 (cost=0.00..11956.84 rows=25490 width=119) (actual time=0.048..2018.996 rows=25795 loops=1) Filter: ((file_type)::text = 'd'::text) Total runtime: 13865.830 ms (5 rows) So the index obiously provides a major performance boost! I just need to figure out how to tell the planner how to use it... Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Mon Jun 13 16:56: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 B83AA52800 for ; Mon, 13 Jun 2005 16:56:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17581-05 for ; Mon, 13 Jun 2005 19:56:38 +0000 (GMT) Received: from web51306.mail.yahoo.com (web51306.mail.yahoo.com [206.190.38.172]) by svr1.postgresql.org (Postfix) with SMTP id BEED15283C for ; Mon, 13 Jun 2005 16:56:36 -0300 (ADT) Received: (qmail 24499 invoked by uid 60001); 13 Jun 2005 19:56:38 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=z+Ho99dJJIxYZWJcD02A7GaNG0ZQzWGDUFyp1kUxeLC7KBcH+tfWcuB2r24ukEqXbYJ6GwoII5Kcdk8nrTQCs3uytp9cCJYfeoTd77LiOunBmrUl/dNENMiX46+eHmyTfVkbyvvfny5JW+a9uG2QNqoj05ErsOaWuUEORlIxeLo= ; Message-ID: <20050613195638.24497.qmail@web51306.mail.yahoo.com> Received: from [216.199.70.171] by web51306.mail.yahoo.com via HTTP; Mon, 13 Jun 2005 12:56:37 PDT Date: Mon, 13 Jun 2005 12:56:37 -0700 (PDT) From: Saranya Sivakumar Subject: System Requirement To: pgsqlperform MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-92063631-1118692597=:22409" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.531 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, HTML_20_30, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200506/313 X-Sequence-Number: 12950 --0-92063631-1118692597=:22409 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi All, We are looking to upgrade to 8.0 from 7.3.2 on production server. The current production system we are using is ---------------------------------------- 2 x 2.4 Ghz Intel Xeon CPU with HT(4 virtual CPUs) RAM - 1GB HDD - 34GB SCSI ------------------------------------- Production DB size: 10.89 GB Number of tables: 253 We are planning to get a new server/system and upgrade to 8.0 on it. What is the recommended system requirement for Postgres 8.0? Please give me your inputs on this. Thanks Saranya --------------------------------- Yahoo! Mail Mobile Take Yahoo! Mail with you! Check email on your mobile phone. --0-92063631-1118692597=:22409 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit

Hi All,

We are looking to upgrade to 8.0 from 7.3.2 on production server. The current production system we are using is

----------------------------------------

2 x 2.4 Ghz Intel Xeon CPU with HT(4 virtual CPUs)

RAM - 1GB

HDD - 34GB SCSI

-------------------------------------

Production DB size: 10.89 GB

Number of tables: 253

We are planning to get a new server/system and upgrade to 8.0 on it. What is the recommended system requirement for Postgres 8.0?

Please give me your inputs on this.

Thanks

Saranya


Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone. --0-92063631-1118692597=:22409-- From pgsql-performance-owner@postgresql.org Mon Jun 13 17:10: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 D24ED528BF for ; Mon, 13 Jun 2005 17:10:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23101-01 for ; Mon, 13 Jun 2005 20:10:29 +0000 (GMT) Received: from tomts10-srv.bellnexxia.net (tomts10.bellnexxia.net [209.226.175.54]) by svr1.postgresql.org (Postfix) with ESMTP id 7B3A3528AD for ; Mon, 13 Jun 2005 17:10:27 -0300 (ADT) Received: from [192.168.2.99] ([206.172.171.129]) by tomts10-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050613201026.GKMR26102.tomts10-srv.bellnexxia.net@[192.168.2.99]>; Mon, 13 Jun 2005 16:10:26 -0400 Message-ID: <42ADE82C.7090902@alteeve.com> Date: Mon, 13 Jun 2005 16:10:20 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: pgsqlperform Cc: Saranya Sivakumar Subject: Re: System Requirement References: <20050613195638.24497.qmail@web51306.mail.yahoo.com> In-Reply-To: <20050613195638.24497.qmail@web51306.mail.yahoo.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: 200506/314 X-Sequence-Number: 12951 Saranya Sivakumar wrote: > Hi All, > > We are looking to upgrade to 8.0 from 7.3.2 on production server. The > current production system we are using is > > ---------------------------------------- > > 2 x 2.4 Ghz Intel Xeon CPU with HT(4 virtual CPUs) > > RAM - 1GB > > HDD - 34GB SCSI > > ------------------------------------- > > Production DB size: 10.89 GB > > Number of tables: 253 > > We are planning to get a new server/system and upgrade to 8.0 on it. > What is the recommended system requirement for Postgres 8.0? > > Please give me your inputs on this. > > Thanks > > Saranya Hi, Let me be the first to recommend RAM. From what little I know so far I think it is still important to know more about what your database looks like and how is it used/accessed. Can you post some more information on the details of your database? Is it a few users with large datasets (like a research project) or many users with small data sets (like a website)? http://www.postgresql.org/docs/8.0/interactive/kernel-resources.html See if that helps a bit. My first suggestion would be to simply increase your RAM to at least 2GB. Anything more would be beneficial up to the point of being able to load your entire DB into RAM (16GB RAM should allow for that plus other OS overhead). Well, I'm relatively new so defer to others but this is my suggestion. Best of luck! Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Mon Jun 13 17: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 E64F5528AD for ; Mon, 13 Jun 2005 17:46:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30054-01 for ; Mon, 13 Jun 2005 20:46:41 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 27AE052899 for ; Mon, 13 Jun 2005 17:46:37 -0300 (ADT) Received: (qmail 2659 invoked by uid 500); 13 Jun 2005 20:46:00 -0000 Date: Mon, 13 Jun 2005 15:45:59 -0500 From: Bruno Wolff III To: Madison Kelly Cc: pgsql-performance@postgresql.org, Tom Lane Subject: Re: Index ot being used Message-ID: <20050613204559.GA1346@wolff.to> Mail-Followup-To: Bruno Wolff III , Madison Kelly , pgsql-performance@postgresql.org, Tom Lane References: <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> <20050613132852.GA31142@wolff.to> <42ADC77B.7000007@alteeve.com> <22127.1118686403@sss.pgh.pa.us> <42ADD8DC.1000001@alteeve.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42ADD8DC.1000001@alteeve.com> User-Agent: Mutt/1.5.6i 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: 200506/315 X-Sequence-Number: 12952 On Mon, Jun 13, 2005 at 15:05:00 -0400, Madison Kelly wrote: > Wow! > > With the sequence scan off my query took less than 2sec. When I turned > it back on the time jumped back up to just under 14sec. > > > tle-bu=> set enable_seqscan = off; SET > tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_display > FROM file_info_7 WHERE file_type='d' ORDER BY file_type ASC, > file_parent_dir ASC, file_name ASC; > > QUERY PLAN > -------------------------------------------------------------------------------------------------------------------------------------------------------- > Index Scan using file_info_7_display_idx on file_info_7 > (cost=0.00..83171.78 rows=25490 width=119) (actual > time=141.405..1700.459 rows=25795 loops=1) > Index Cond: ((file_type)::text = 'd'::text) > Total runtime: 1851.366 ms > (3 rows) > > > tle-bu=> set enable_seqscan = on; SET > tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_display > FROM file_info_7 WHERE file_type='d' ORDER BY file_type ASC, > file_parent_dir ASC, file_name ASC; > QUERY PLAN > ---------------------------------------------------------------------------------------------------------------------------- > Sort (cost=14810.92..14874.65 rows=25490 width=119) (actual > time=13605.185..13728.436 rows=25795 loops=1) > Sort Key: file_type, file_parent_dir, file_name > -> Seq Scan on file_info_7 (cost=0.00..11956.84 rows=25490 > width=119) (actual time=0.048..2018.996 rows=25795 loops=1) > Filter: ((file_type)::text = 'd'::text) > Total runtime: 13865.830 ms > (5 rows) > > So the index obiously provides a major performance boost! I just need > to figure out how to tell the planner how to use it... The two things you probably want to look at are (in postgresql.conf): effective_cache_size = 10000 # typically 8KB each random_page_cost = 2 # units are one sequential page fetch cost Increasing effective cache size and decreasing the penalty for random disk fetches will favor using index scans. People have reported that dropping random_page_cost from the default of 4 to 2 works well. Effective cache size should be set to some reasonable estimate of the memory available on your system to postgres, not counting that set aside for shared buffers. However, since the planner thought the index scan plan was going to be 6 times slower than the sequential scan plan, I don't know if tweaking these values enough to switch the plan choice won't cause problems for other queries. From pgsql-performance-owner@postgresql.org Mon Jun 13 17:54: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 24EDC5292C for ; Mon, 13 Jun 2005 17:54:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29628-06 for ; Mon, 13 Jun 2005 20:54:01 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id C8C325290B for ; Mon, 13 Jun 2005 17:53:59 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1DhvwO-0008Sm-00; Mon, 13 Jun 2005 16:53:52 -0400 To: Madison Kelly Cc: pgsql-performance@postgresql.org, Tom Lane , Bruno Wolff III Subject: Re: Index ot being used References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> <20050613132852.GA31142@wolff.to> <42ADC77B.7000007@alteeve.com> <22127.1118686403@sss.pgh.pa.us> <42ADD8DC.1000001@alteeve.com> In-Reply-To: <42ADD8DC.1000001@alteeve.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 13 Jun 2005 16:53:51 -0400 Message-ID: <87hdg22d28.fsf@stark.xeocode.com> Lines: 21 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.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/316 X-Sequence-Number: 12953 Madison Kelly writes: > So the index obiously provides a major performance boost! I just need to > figure out how to tell the planner how to use it... Be careful extrapolating too much from a single query in a single context. Notably you might want to test the same query after not touching this table for a little while. The index is probably benefiting disproportionately from having you repeatedly running this one query and having the entire table in cache. That said, you should look at lowering random_page_cost. The default is 4 but if this query is representative of your system's performance then much of your database is in cache and the effective value will be closer to 1. Try 2 or even 1.5 or 1.2. But like I said, test other queries and test under more representative conditions other than repeating a single query over and over. -- greg From pgsql-performance-owner@postgresql.org Mon Jun 13 18:00: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 2C73E52889 for ; Mon, 13 Jun 2005 18:00:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32002-06 for ; Mon, 13 Jun 2005 21:00: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 B2088528AD for ; Mon, 13 Jun 2005 18:00:03 -0300 (ADT) 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 j5DL04Ec003644; Mon, 13 Jun 2005 17:00:04 -0400 (EDT) To: Madison Kelly Cc: pgsql-performance@postgresql.org, Bruno Wolff III Subject: Re: Index ot being used In-reply-to: <42ADD8DC.1000001@alteeve.com> References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> <20050613132852.GA31142@wolff.to> <42ADC77B.7000007@alteeve.com> <22127.1118686403@sss.pgh.pa.us> <42ADD8DC.1000001@alteeve.com> Comments: In-reply-to Madison Kelly message dated "Mon, 13 Jun 2005 15:05:00 -0400" Date: Mon, 13 Jun 2005 17:00:04 -0400 Message-ID: <3643.1118696404@sss.pgh.pa.us> From: Tom Lane 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: 200506/317 X-Sequence-Number: 12954 Madison Kelly writes: > So the index obiously provides a major performance boost! I just need > to figure out how to tell the planner how to use it... Simple division shows that the planner's cost estimate ratio between the seqscan and the indexscan (11956.84 vs 83171.78) is off by a factor of more than 8 compared to reality (2018.996 vs 1700.459). Also the cost of the sort seems to be drastically underestimated. I suspect this may be a combination of random_page_cost being too high (since your test case, at least, is no doubt fully cached in RAM) and cpu_operator_cost being too low. I'm wondering if text comparisons are really slow on your machine --- possibly due to strcoll being inefficient in the locale you are using, which you didn't say. That would account for both the seqscan being slower than expected and the sort taking a long time. It'd be interesting to look at the actual runtimes of this seqscan vs one that is doing a simple integer comparison over the same number of rows (and, preferably, returning about the same number of rows as this). regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jun 13 18:18: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 3F09A52867 for ; Mon, 13 Jun 2005 18:18:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37332-02 for ; Mon, 13 Jun 2005 21:18:49 +0000 (GMT) Received: from tomts10-srv.bellnexxia.net (tomts10.bellnexxia.net [209.226.175.54]) by svr1.postgresql.org (Postfix) with ESMTP id 0B98952809 for ; Mon, 13 Jun 2005 18:18:48 -0300 (ADT) Received: from [192.168.2.99] ([206.172.171.129]) by tomts10-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050613211848.GXVH26102.tomts10-srv.bellnexxia.net@[192.168.2.99]>; Mon, 13 Jun 2005 17:18:48 -0400 Message-ID: <42ADF83B.1030706@alteeve.com> Date: Mon, 13 Jun 2005 17:18:51 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: pgsql-performance@postgresql.org Cc: Tom Lane Subject: Pseudo-Solved was: (Re: Index ot being used) References: <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> <20050613132852.GA31142@wolff.to> <42ADC77B.7000007@alteeve.com> <22127.1118686403@sss.pgh.pa.us> <42ADD8DC.1000001@alteeve.com> <20050613204559.GA1346@wolff.to> In-Reply-To: <20050613204559.GA1346@wolff.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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/318 X-Sequence-Number: 12955 Bruno Wolff III wrote: > On Mon, Jun 13, 2005 at 15:05:00 -0400, > Madison Kelly wrote: > >>Wow! >> >>With the sequence scan off my query took less than 2sec. When I turned >>it back on the time jumped back up to just under 14sec. >> >> >>tle-bu=> set enable_seqscan = off; SET >>tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_display >>FROM file_info_7 WHERE file_type='d' ORDER BY file_type ASC, >>file_parent_dir ASC, file_name ASC; >> >>QUERY PLAN >>-------------------------------------------------------------------------------------------------------------------------------------------------------- >> Index Scan using file_info_7_display_idx on file_info_7 >>(cost=0.00..83171.78 rows=25490 width=119) (actual >>time=141.405..1700.459 rows=25795 loops=1) >> Index Cond: ((file_type)::text = 'd'::text) >> Total runtime: 1851.366 ms >>(3 rows) >> >> >>tle-bu=> set enable_seqscan = on; SET >>tle-bu=> EXPLAIN ANALYZE SELECT file_name, file_parent_dir, file_display >>FROM file_info_7 WHERE file_type='d' ORDER BY file_type ASC, >>file_parent_dir ASC, file_name ASC; >> QUERY PLAN >>---------------------------------------------------------------------------------------------------------------------------- >> Sort (cost=14810.92..14874.65 rows=25490 width=119) (actual >>time=13605.185..13728.436 rows=25795 loops=1) >> Sort Key: file_type, file_parent_dir, file_name >> -> Seq Scan on file_info_7 (cost=0.00..11956.84 rows=25490 >>width=119) (actual time=0.048..2018.996 rows=25795 loops=1) >> Filter: ((file_type)::text = 'd'::text) >> Total runtime: 13865.830 ms >>(5 rows) >> >> So the index obiously provides a major performance boost! I just need >>to figure out how to tell the planner how to use it... > > > The two things you probably want to look at are (in postgresql.conf): > effective_cache_size = 10000 # typically 8KB each > random_page_cost = 2 # units are one sequential page fetch cost > > Increasing effective cache size and decreasing the penalty for random > disk fetches will favor using index scans. People have reported that > dropping random_page_cost from the default of 4 to 2 works well. > Effective cache size should be set to some reasonable estimate of > the memory available on your system to postgres, not counting that > set aside for shared buffers. > > However, since the planner thought the index scan plan was going to be 6 times > slower than the sequential scan plan, I don't know if tweaking these values > enough to switch the plan choice won't cause problems for other queries. Hmm, In this case I am trying to avoid modifying 'postgres.conf' and am trying to handle any performance tweaks within my program through SQL calls. This is because (I hope) my program will be installed by many users and I don't want to expect them to be able/comfortable playing with 'postgres.conf'. I do plan later though to create a section in the docs with extra tweaks for more advanced users and in that case I will come back to this and try/record just that. In the mean time Tom's recommendation works from perl by calling: $DB->do("SET ENABLE_SEQSCAN TO OFF") || die... $DB->do("SET ENABLE_SEQSCAN TO ON") || die... Forces the index to be used. It isn't clean but it works for now and I don't need to do anything outside my program. Lacking any other ideas, thank you very, very much for sticking with this and helping me out! Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Mon Jun 13 18:30: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 ED4665284D for ; Mon, 13 Jun 2005 18:30:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39047-02 for ; Mon, 13 Jun 2005 21:30:32 +0000 (GMT) Received: from tomts5-srv.bellnexxia.net (tomts5.bellnexxia.net [209.226.175.25]) by svr1.postgresql.org (Postfix) with ESMTP id 82CD152834 for ; Mon, 13 Jun 2005 18:30:28 -0300 (ADT) Received: from [192.168.2.99] ([206.172.171.129]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050613213029.ZSIQ26128.tomts5-srv.bellnexxia.net@[192.168.2.99]> for ; Mon, 13 Jun 2005 17:30:29 -0400 Message-ID: <42ADFAF8.7080107@alteeve.com> Date: Mon, 13 Jun 2005 17:30:32 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Index ot being used References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> <20050613132852.GA31142@wolff.to> <42ADC77B.7000007@alteeve.com> <22127.1118686403@sss.pgh.pa.us> <42ADD8DC.1000001@alteeve.com> <3643.1118696404@sss.pgh.pa.us> In-Reply-To: <3643.1118696404@sss.pgh.pa.us> 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: 200506/319 X-Sequence-Number: 12956 Tom Lane wrote: > Madison Kelly writes: > >> So the index obiously provides a major performance boost! I just need >>to figure out how to tell the planner how to use it... > > > Simple division shows that the planner's cost estimate ratio between the > seqscan and the indexscan (11956.84 vs 83171.78) is off by a factor of > more than 8 compared to reality (2018.996 vs 1700.459). Also the cost of > the sort seems to be drastically underestimated. > > I suspect this may be a combination of random_page_cost being too high > (since your test case, at least, is no doubt fully cached in RAM) and > cpu_operator_cost being too low. I'm wondering if text comparisons > are really slow on your machine --- possibly due to strcoll being > inefficient in the locale you are using, which you didn't say. That > would account for both the seqscan being slower than expected and the > sort taking a long time. > > It'd be interesting to look at the actual runtimes of this seqscan vs > one that is doing a simple integer comparison over the same number of > rows (and, preferably, returning about the same number of rows as this). > > regards, tom lane This is where I should mention that though 'n00b' might be a little harsh, I am still somewhat of a beginner (only been using postgres or programming at all for a little over a year). What is, and how do I check, 'strcoll'? Is there a way that I can clear the psql cache to make the tests more accurate to real-world situations? For what it's worth, the program is working (I am doing stress-testing and optimizing now) and the data in this table is actual data, not a construct. As I mentioned to Bruno in my reply to him, I am trying to keep as many tweaks as I can inside my program. The reason for this is that this is a backup program that I am trying to aim to more mainstream users or where a techy would set it up and then it would be used by mainstream users. At this point I want to avoid, as best I can, any changes from default to the 'postgres.conf' file or other external files. Later though, once I finish this testing phase, I plan to write a section of external tweaking where I will test these changes out and note my success for mre advanced users who feel more comfortable playing with postgres (and web server, rsync, etc) configs. If there is any way that I can make changes like this similar from inside my (perl) program I would prefer that. For example, I implemented the 'enable_seqscan' via: $DB->do("SET ENABLE_SEQSCAN TO OFF") || die... ... $DB->do("SET ENABLE_SEQSCAN TO ON") || die... Thank you very kindly! You and Bruno are wonderfully helpful! (as are the other's who have replied ^_^;) Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Mon Jun 13 19:04: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 508D2528AD for ; Mon, 13 Jun 2005 19:04:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45573-02 for ; Mon, 13 Jun 2005 22:04:26 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 228275286D for ; Mon, 13 Jun 2005 19:04:25 -0300 (ADT) 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 7480475; Mon, 13 Jun 2005 15:06:33 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: elein Subject: Re: Resource Requirements Date: Mon, 13 Jun 2005 15:06:13 -0700 User-Agent: KMail/1.8 Cc: pgsql-performance@postgresql.org References: <20050613003049.GT17206@varlena.com> In-Reply-To: <20050613003049.GT17206@varlena.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506131506.13803.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/320 X-Sequence-Number: 12957 Elein, > I've got a list of old resource requirements. > I want to know how far off they are and if anything > crucial is missing. My usual recommendation is > "as much as you can afford" so I don't usually deal > with real numbers :) These look very approximate. > RAM: > Number of connections * 2MB That's not a bad recommendation, but not an actual requirement. It really depends on how much sort_mem you need. Could vary from 0.5mb to as much as 256mb per connection, depending on your application. > Disk: > Program and Manual 8-15MB > Regression Tests 30MB > Compiled Source 60-160MB Well, my compiled source takes up 87mb, and the installed PostgreSQL seems to be about 41mb including WAL. Not sure how much the regression tests are. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jun 13 22:46: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 5B18152800 for ; Mon, 13 Jun 2005 22:28:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96390-05 for ; Tue, 14 Jun 2005 01:28:43 +0000 (GMT) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 885C652943 for ; Mon, 13 Jun 2005 22:28:41 -0300 (ADT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id AD80324FDD; Tue, 14 Jun 2005 09:28:42 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 8F0E624FCE; Tue, 14 Jun 2005 09:28:42 +0800 (WST) Message-ID: <42AE32F8.5020208@familyhealth.com.au> Date: Tue, 14 Jun 2005 09:29:28 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Updates on large tables are extremely slow References: <6243ad910c02150d526b7b32d4cfef9d@implements.be> <42ADAE10.6050204@archonet.com> <93fcaa35413e2059526ab3aa562a17dd@implements.be> In-Reply-To: <93fcaa35413e2059526ab3aa562a17dd@implements.be> 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.063 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/321 X-Sequence-Number: 12958 > Ok, if all 21 are affected, I can understand the problem. > But allow me to say that this is a "functional error" No, it's normal MVCC design... From pgsql-performance-owner@postgresql.org Tue Jun 14 05:32: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 07F4F5287A for ; Tue, 14 Jun 2005 05:32:07 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96096-05 for ; Tue, 14 Jun 2005 08:32:05 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id A4EF65286D for ; Tue, 14 Jun 2005 05:32:04 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 50so1973946wri for ; Tue, 14 Jun 2005 01:32:07 -0700 (PDT) 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:content-disposition:references; b=aIuSpZVogmAtzqZadYkl9SSaMX3lDcQbcFah+r8XIGLn0miiITnzwc/kWsbifk+/FwVxzLx/y1s7ZjYwel93CWzNWtc9R5r/FjEvoJZAQ+5T/RvyLK/9vQauqyKKf7H04KUj4ceC6DBcKXwnb9jOA3WopkVuu+KqFTLq99pFFNg= Received: by 10.54.35.71 with SMTP id i71mr3055344wri; Tue, 14 Jun 2005 01:32:06 -0700 (PDT) Received: by 10.54.13.24 with HTTP; Tue, 14 Jun 2005 01:32:06 -0700 (PDT) Message-ID: <9e4684ce050614013232f9dbbd@mail.gmail.com> Date: Tue, 14 Jun 2005 10:32:06 +0200 From: hubert depesz lubaczewski Reply-To: hubert depesz lubaczewski To: Saranya Sivakumar Subject: Re: System Requirement Cc: pgsqlperform In-Reply-To: <20050613195638.24497.qmail@web51306.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050613195638.24497.qmail@web51306.mail.yahoo.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.078 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/322 X-Sequence-Number: 12959 On 6/13/05, Saranya Sivakumar wrote: > 2 x 2.4 Ghz Intel Xeon CPU with HT(4 virtual CPUs)=20 switch to amd opteron (dual cpu). for the same price you get 2x performance - comparing to xeon boxes. > RAM - 1GB=20 you'd definitelly could use more ram. the more the better. > HDD - 34GB SCSI=20 is it one drive of 34G? if yes, buy another one and setup raid1 over them. should boost performance as well. > Production DB size: 10.89 GB=20 not much. you could even consider buing 12 or 16g of ram to make it fit in memory. depesz From pgsql-performance-owner@postgresql.org Tue Jun 14 10:04: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 D296252867 for ; Tue, 14 Jun 2005 10:04:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49636-06 for ; Tue, 14 Jun 2005 13:04:18 +0000 (GMT) Received: from web51309.mail.yahoo.com (web51309.mail.yahoo.com [206.190.38.175]) by svr1.postgresql.org (Postfix) with SMTP id 076BA52876 for ; Tue, 14 Jun 2005 10:04:16 -0300 (ADT) Received: (qmail 26899 invoked by uid 60001); 14 Jun 2005 13:04:20 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=GHDNjzUvT4TQvd2v8t15YR4Ry1GIx3AlZCG/pie/40IvEAaSOj4bnOjGF6aWxApmFm7arCbINr4a38N+/flyWkhWvuuJNrPqPq+LdrGgj8iJDe0+n88MVRDWzCCoekfFPtLl5iIBvski2WSZv/Gwx19iOe0qaADDANK533kaxak= ; Message-ID: <20050614130420.26897.qmail@web51309.mail.yahoo.com> Received: from [216.199.70.171] by web51309.mail.yahoo.com via HTTP; Tue, 14 Jun 2005 06:04:20 PDT Date: Tue, 14 Jun 2005 06:04:20 -0700 (PDT) From: Saranya Sivakumar Subject: Re: System Requirement To: pgsqlperform Cc: Saranya Sivakumar In-Reply-To: <42ADE82C.7090902@alteeve.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-790464236-1118754260=:26623" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.645 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, HTML_20_30, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200506/323 X-Sequence-Number: 12960 --0-790464236-1118754260=:26623 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, Thanks for the advice on increasing RAM and switching to AMD processors. To tell more about our DB: Our DB is transaction intensive. Interaction to the DB is through a web based application. Typically at any instant there are over 100 users using the application and we have customers worldwide. The DB size is 10.89 GB with 250+ tables. Also, regarding upgrading to 8.0, it is better to first upgrade to 7.4 (from 7.3.2--current version on production) and then upgrade to 8.0. Am I right? Thanks, Saranya __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --0-790464236-1118754260=:26623 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi,
 
Thanks for the advice on increasing RAM and switching to AMD processors.
 
To tell more about our DB: Our DB is transaction intensive. Interaction to the DB is through a web based application. Typically at any instant there are over 100 users using the application and we have customers  worldwide. The DB size is 10.89 GB with 250+ tables.
Also, regarding upgrading to 8.0, it is better to first upgrade to 7.4 (from 7.3.2--current version on production) and then upgrade to 8.0. Am I right?
 
Thanks,
 
Saranya

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com --0-790464236-1118754260=:26623-- From pgsql-novice-owner@postgresql.org Tue Jun 14 13:31:20 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 68CFA5292C for ; Tue, 14 Jun 2005 13:31:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04737-02 for ; Tue, 14 Jun 2005 16:31:13 +0000 (GMT) Received: from viefep15-int.chello.at (viefep15-int.chello.at [213.46.255.19]) by svr1.postgresql.org (Postfix) with ESMTP id 4DC0C52921 for ; Tue, 14 Jun 2005 13:31:10 -0300 (ADT) Received: from OTTO ([213.222.172.216]) by viefep15-int.chello.at (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with SMTP id <20050614163108.IFYY26662.viefep15-int.chello.at@OTTO> for ; Tue, 14 Jun 2005 18:31:08 +0200 Message-ID: <008d01c570fe$7882f6a0$b000a8c0@OTTO> From: =?ISO-8859-1?Q?Havasv=F6lgyi_Ott=F3?= To: References: <20050418174701.BDD1219007F@arica.terra.com.br> <008601c56e01$2c114880$b000a8c0@OTTO> Subject: Re: need suggestion for server sizing Date: Tue, 14 Jun 2005 18:31:09 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit 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-Archive-Number: 200506/81 X-Sequence-Number: 13674 Janos, Thank you. Sorry, but I wanted to install Linux on the server, I haven't mentioned it. I am not that familiar in the server-world. So, what configuration is enough on X86 (32 bit) architecture for PostgreSQL with the conditions listed in my previous post? Thanks, Otto ----- Original Message ----- From: "J�nos" To: "Havasv�lgyi Ott�" Cc: Sent: Monday, June 13, 2005 3:25 PM Subject: Re: [NOVICE] need suggestion for server sizing Any XServe from Apple will do it. J�nos On Jun 10, 2005, at 5:12 PM, Havasv�lgyi Ott� wrote: > Hi all, > > I need your help to determine the configuration of a server > machine, and the > PG DBMS. > There will be not more than 25 concurrent users. They will use a > business > software that accesses tha database. The database will be not that > large, it > seems that none of the tables's recordcount will exceed 1-2 > million, but > there will be a lot of small (<5000 record) tables. The numbert of > tables > will be about 300. What server would you install to such a site to > make the > database respond quickly in any case? > I would like to leave fsync on. > Perhaps you need some additional information. In this case just > indicate it. > > Thanks in advance, > Otto > > > > ---------------------------(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 > ------------------------------------------ "There was a mighty king in the land of the Huns whose goodness and wisdom had no equal." Nibelungen-Lied ---------------------------(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 From pgsql-performance-owner@postgresql.org Tue Jun 14 13:40: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 C37745289B for ; Tue, 14 Jun 2005 13:40:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06006-05 for ; Tue, 14 Jun 2005 16:40:34 +0000 (GMT) Received: from slice.med.uottawa.ca (slice.med.uottawa.ca [137.122.232.91]) by svr1.postgresql.org (Postfix) with ESMTP id 765F1528E0 for ; Tue, 14 Jun 2005 13:40:31 -0300 (ADT) Received: from localhost (pfortier@localhost) by slice.med.uottawa.ca (8.11.6/8.11.6) with ESMTP id j5EGeVY23016 for ; Tue, 14 Jun 2005 12:40:31 -0400 X-Authentication-Warning: slice.med.uottawa.ca: pfortier owned process doing -bs Date: Tue, 14 Jun 2005 12:40:31 -0400 (EDT) From: "Pierre A. Fortier" X-X-Sender: pfortier@slice.med.uottawa.ca To: pgsql-performance@postgresql.org Subject: regular expression search Message-ID: 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: 200506/324 X-Sequence-Number: 12961 I search for particular strings using regular expressions (e.g. where column ~* $query) through a text data type column which contains notes (some html code like bold is included). It works but my question is whether there would be a way to speed up searches? From my limited investigation, I see the features "CREATE INDEX" and "tsearch2" but I'm not clear on how these work, whether they would be appropriate, and whether there would be a better approach. I'd appreciate being pointed in the right direction. Pierre From pgsql-novice-owner@postgresql.org Tue Jun 14 16:18:23 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 03AF0528E7 for ; Tue, 14 Jun 2005 16:18:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48039-02 for ; Tue, 14 Jun 2005 19:18:15 +0000 (GMT) Received: from web33303.mail.mud.yahoo.com (web33303.mail.mud.yahoo.com [68.142.206.118]) by svr1.postgresql.org (Postfix) with SMTP id A0FF2528C1 for ; Tue, 14 Jun 2005 16:18:11 -0300 (ADT) Received: (qmail 8967 invoked by uid 60001); 14 Jun 2005 19:18:10 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=XsOY/u7ORpZ/r5+VR7DVPTAUQMHlIkS0M82kCk849kV3d1QuXxRsxR9qLdX4QIFle8AXwlMkTaAT7e46CrRjyzBvk0fzYws78MJzVBF4oQ6puK730YqrhZJPXpF5BBpzwHohAuhCglCjTSTylCs8OyO5DXNKsZAdwhfkm9eOJ1o= ; Message-ID: <20050614191810.8965.qmail@web33303.mail.mud.yahoo.com> Received: from [12.9.179.126] by web33303.mail.mud.yahoo.com via HTTP; Tue, 14 Jun 2005 12:18:10 PDT Date: Tue, 14 Jun 2005 12:18:10 -0700 (PDT) From: Subject: PGDATA To: pgsql-novice@postgresql.org In-Reply-To: <008d01c570fe$7882f6a0$b000a8c0@OTTO> 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=2.38 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_YAHOO_RCVD, NO_REAL_NAME X-Spam-Level: ** X-Archive-Number: 200506/82 X-Sequence-Number: 13675 i currently develop on a winxp laptop. i use cygwin and my pgsql version is 7.4.x (x=3, maybe?). i have to manually start up apache and pgsql. i'm spending some time learning linux. i found that i could edit my .bash_profile so i don't have to type the path to cygserver every time i tried to start it. i'd like to do something similar when using pg_ctl to start and stop the postmaster. i read the the help files for pg_ctl and it said PGDATA was the default if there was no -D flag and then a directy path to the data directory. i want to set PGDATA path to my DATA directory, but i can't find PGDATA on my system. can anyone help here? tia... __________________________________ Yahoo! Mail Mobile Take Yahoo! Mail with you! Check email on your mobile phone. http://mobile.yahoo.com/learn/mail From pgsql-novice-owner@postgresql.org Tue Jun 14 16:34:58 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 3464852875 for ; Tue, 14 Jun 2005 16:34:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53105-05 for ; Tue, 14 Jun 2005 19:34:46 +0000 (GMT) Received: from web33311.mail.mud.yahoo.com (web33311.mail.mud.yahoo.com [68.142.206.126]) by svr1.postgresql.org (Postfix) with SMTP id B91F352874 for ; Tue, 14 Jun 2005 16:34:42 -0300 (ADT) Received: (qmail 72769 invoked by uid 60001); 14 Jun 2005 19:34:43 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=twJ7oAbT6GtvAU4RhDtALtKJKUjLS5qUnlFD92mVCiuQM/3/h6lstJ/frAw2PDnwCiXVgUTbJoEymApAk2KtsravSJf/rG0220ojJuGXPZioEd7AndUYVe4fXGiba4dz0u4ce6k8oluDJb+XlGGPClYVHSS97oV+2cxZyNmU52s= ; Message-ID: <20050614193443.72767.qmail@web33311.mail.mud.yahoo.com> Received: from [12.9.179.126] by web33311.mail.mud.yahoo.com via HTTP; Tue, 14 Jun 2005 12:34:43 PDT Date: Tue, 14 Jun 2005 12:34:43 -0700 (PDT) From: Subject: Re: PGDATA - SOLVED To: pgsql-novice@postgresql.org In-Reply-To: <20050614191810.8965.qmail@web33303.mail.mud.yahoo.com> 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=2.466 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_YAHOO_RCVD, NO_REAL_NAME X-Spam-Level: ** X-Archive-Number: 200506/83 X-Sequence-Number: 13676 --- operationsengineer1@yahoo.com wrote: > i currently develop on a winxp laptop. i use cygwin > and my pgsql version is 7.4.x (x=3, maybe?). > > i have to manually start up apache and pgsql. i'm > spending some time learning linux. i found that i > could edit my .bash_profile so i don't have to type > the path to cygserver every time i tried to start > it. > > i'd like to do something similar when using pg_ctl > to > start and stop the postmaster. > > i read the the help files for pg_ctl and it said > PGDATA was the default if there was no -D flag and > then a directy path to the data directory. > > i want to set PGDATA path to my DATA directory, but > i > can't find PGDATA on my system. > > can anyone help here? > > tia... i was able to solve this one. i added... export PGDATA=/usr/share/postgresql/data export PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/share/postgresql/data to my .bash_profile (i want a local configuration). now all i have to do in cygwin to start up pgsql is to type the following... first... cygserver & once cygserver is up and running, i hit [enter] to get a prompt then... second... pg_ctl start -o -i kinda cool for a rookie - and we won't mention i've been typing the directory path for almost a year... -lol- __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail From pgsql-novice-owner@postgresql.org Tue Jun 14 17:41:54 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 3834C528BF for ; Tue, 14 Jun 2005 17:41:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78231-10 for ; Tue, 14 Jun 2005 20:41:44 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.194]) by svr1.postgresql.org (Postfix) with ESMTP id 30CF952876 for ; Tue, 14 Jun 2005 17:41:43 -0300 (ADT) Received: by rproxy.gmail.com with SMTP id a41so2153588rng for ; Tue, 14 Jun 2005 13:41:45 -0700 (PDT) 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:content-disposition:references; b=s7QDU7d5c9DfyQKFIirNJZ3N/tKQ666XCi9jQ8OnhVytVwmXdnSNPN0wr9AL6bVxbRmiZAksHGuuWySw4CCtYPSyRVJQUy2hzvBh1b/6cU5JHxMtdZx4C9T6DsBiV71ZzvNT3c1V7z2Yrqv8Gcz6fKT74UtsoWlQtiZWRX8tqDw= Received: by 10.38.86.31 with SMTP id j31mr1690084rnb; Tue, 14 Jun 2005 13:41:45 -0700 (PDT) Received: by 10.38.24.57 with HTTP; Tue, 14 Jun 2005 13:41:45 -0700 (PDT) Message-ID: <8ca4228205061413412de7e75e@mail.gmail.com> Date: Tue, 14 Jun 2005 16:41:45 -0400 From: Mike <1100100@gmail.com> Reply-To: Mike <1100100@gmail.com> To: "operationsengineer1@yahoo.com" Subject: Re: PGDATA - SOLVED Cc: pgsql-novice@postgresql.org In-Reply-To: <20050614193443.72767.qmail@web33311.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20050614191810.8965.qmail@web33303.mail.mud.yahoo.com> <20050614193443.72767.qmail@web33311.mail.mud.yahoo.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.455 tagged_above=0 required=5 tests=AWL, FROM_ALL_NUMS, FROM_ENDS_IN_NUMS, RCVD_BY_IP, TO_ADDRESS_EQ_REAL X-Spam-Level: ** X-Archive-Number: 200506/84 X-Sequence-Number: 13677 Mr. Operations, I've had a similar frustrating experience with PGDATA; basically, i can't make it "stick." Once I shut down the postgresql server the PGDATA configuration is cleared and has to be stated again before starting postgres, or I'll get an error message. So I had to insert the command into the system start-up process. In Gentoo, it's /etc/conf.d/local.start and the command that works is --- export PGDATA=3D/var/lib/postgresql/data Mike On 6/14/05, operationsengineer1@yahoo.com w= rote: > --- operationsengineer1@yahoo.com wrote: >=20 > > i currently develop on a winxp laptop. i use cygwin > > and my pgsql version is 7.4.x (x=3D3, maybe?). > > > > i have to manually start up apache and pgsql. i'm > > spending some time learning linux. i found that i > > could edit my .bash_profile so i don't have to type > > the path to cygserver every time i tried to start > > it. > > > > i'd like to do something similar when using pg_ctl > > to > > start and stop the postmaster. > > > > i read the the help files for pg_ctl and it said > > PGDATA was the default if there was no -D flag and > > then a directy path to the data directory. > > > > i want to set PGDATA path to my DATA directory, but > > i > > can't find PGDATA on my system. > > > > can anyone help here? > > > > tia... >=20 > i was able to solve this one. i added... >=20 > export PGDATA=3D/usr/share/postgresql/data > export > PATH=3D/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/share/postgresql/data >=20 > to my .bash_profile (i want a local configuration). >=20 > now all i have to do in cygwin to start up pgsql is to > type the following... >=20 > first... > cygserver & >=20 > once cygserver is up and running, i hit [enter] to get > a prompt then... >=20 > second... > pg_ctl start -o -i >=20 > kinda cool for a rookie - and we won't mention i've > been typing the directory path for almost a year... -lol- >=20 >=20 >=20 > __________________________________ > Do you Yahoo!? > Yahoo! Mail - Helps protect you from nasty viruses. > http://promotions.yahoo.com/new_mail >=20 > ---------------------------(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 Tue Jun 14 19:36: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 12F6552943 for ; Tue, 14 Jun 2005 19:36:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02706-04 for ; Tue, 14 Jun 2005 22:36:02 +0000 (GMT) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by svr1.postgresql.org (Postfix) with ESMTP id 41E2F52925 for ; Tue, 14 Jun 2005 19:36:01 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DiJvR-0005H9-UL for pgsql-performance@postgresql.org; Wed, 15 Jun 2005 00:30:30 +0200 Received: from simba.summersault.com ([12.161.105.182]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 15 Jun 2005 00:30:29 +0200 Received: from mark by simba.summersault.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 15 Jun 2005 00:30:29 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Mark Stosberg Subject: Re: Most effective tuning choices for busy website? Date: Tue, 14 Jun 2005 17:34:52 -0500 Lines: 41 Message-ID: References: <42A3AF2D.4000802@samurai.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: simba.summersault.com User-Agent: KNode/0.8.1 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: 200506/325 X-Sequence-Number: 12962 Neil Conway wrote: > Mark Stosberg wrote: >> I've used PQA to analyze my queries and happy overall with how they are >> running. About 55% of the query time is going to variations of the pet >> searching query, which seems like where it should be going. The query is >> frequent and complex. It has already been combed over for appropriate >> indexing. > > It might be worth posting the EXPLAIN ANALYZE and relevant schema > definitions for this query, in case there is additional room for > optimization. > >> Our hardware: Dual 3 Ghz processors 3 GB RAM, running on FreeBSD. > > Disk? > > You are presumably using Xeon processors, right? If so, check the list > archives for information on the infamous "context switching storm" that > causes performance problems for some people using SMP Xeons. I wanted to follow-up to report a positive outcome to tuning this Xeon SMP machine on FreeBSD. We applied the following techniques, and saw the average CPU usage drop by about 25%. - in /etc/sysctl.conf, we set it to use raw RAM for shared memory: kern.ipc.shm_use_phys=1 - We updated our kernel config and postmaster.conf to set shared_buffers to about 8000. - We disabled hyperthreading in the BIOS, which had a label like "Logical Processors? : Disabled". I recall there was tweak my co-worker made that's not on my list. I realize it's not particularly scientific because we changed several things at once...but at least it is working well enough for now. Mark From pgsql-performance-owner@postgresql.org Sun Jun 19 01: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 1DE0952814 for ; Tue, 14 Jun 2005 21:00:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17467-07 for ; Wed, 15 Jun 2005 00:00:16 +0000 (GMT) Received: from tektite.k12usa.com (tektite.k12hq.com [12.160.186.24]) by svr1.postgresql.org (Postfix) with SMTP id EC2DF52915 for ; Tue, 14 Jun 2005 21:00:14 -0300 (ADT) Received: (qmail 15398 invoked by uid 1001); 14 Jun 2005 23:59:37 -0000 Date: Tue, 14 Jun 2005 19:59:37 -0400 From: Christopher Weimann To: Mark Stosberg Cc: pgsql-performance@postgresql.org Subject: Re: Most effective tuning choices for busy website? Message-ID: <20050614235937.GA97567@tektite.k12usa.internal> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i 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: 200506/361 X-Sequence-Number: 12998 On 06/01/2005-07:19PM, Mark Stosberg wrote: > > - I saw the hardware tip to "Separate the Transaction Log from the > Database". We have about 60% SELECT statements and 14% UPDATE > statements. Focusing more on SELECT performance seems more important > for us. > I would think that would help SELECT If the spindle isn't busy writing Transaction log it can be reading for your SELECTs. You did say you were CPU bound though. -- ------------------------------------------------------------ Christopher Weimann http://www.k12usa.com K12USA.com Cool Tools for Schools! ------------------------------------------------------------ From pgsql-performance-owner@postgresql.org Tue Jun 14 22: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 DD0DD5289A for ; Tue, 14 Jun 2005 22:19:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35382-05 for ; Wed, 15 Jun 2005 01:19:36 +0000 (GMT) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id C38B452847 for ; Tue, 14 Jun 2005 22:19:32 -0300 (ADT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id E771A24FF1; Wed, 15 Jun 2005 09:19:34 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id E514D24FEE; Wed, 15 Jun 2005 09:19:34 +0800 (WST) Message-ID: <42AF8282.10706@familyhealth.com.au> Date: Wed, 15 Jun 2005 09:21:06 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Pierre A. Fortier" Cc: pgsql-performance@postgresql.org Subject: Re: regular expression search 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.063 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/326 X-Sequence-Number: 12963 Just read the docs in contrib/tsearch2 in the PostgreSQL distribution. Pierre A. Fortier wrote: > I search for particular strings using regular expressions (e.g. where > column ~* $query) through a text data type column which contains notes > (some html code like bold is included). > > It works but my question is whether there would be a way to speed up > searches? > >>From my limited investigation, I see the features "CREATE INDEX" and > "tsearch2" but I'm not clear on how these work, whether they would be > appropriate, and whether there would be a better approach. > > I'd appreciate being pointed in the right direction. > > Pierre > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings From pgsql-performance-owner@postgresql.org Tue Jun 14 23:51: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 43692528D0 for ; Tue, 14 Jun 2005 23:50:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54520-04 for ; Wed, 15 Jun 2005 02:50:51 +0000 (GMT) Received: from wmail05dat.netvigator.com (unknown [218.102.48.220]) by svr1.postgresql.org (Postfix) with ESMTP id 1B89552889 for ; Tue, 14 Jun 2005 23:50:49 -0300 (ADT) Received: from n2.netvigator.com ([218.103.186.150]) by wmail05dat.netvigator.com (InterMail vM.6.01.04.01 201-2131-118-101-20041129) with ESMTP id <20050615025052.IKOQ1079.wmail05dat.netvigator.com@n2.netvigator.com> for ; Wed, 15 Jun 2005 10:50:52 +0800 Message-Id: <6.2.1.2.0.20050615100524.04f9d6a8@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.1.2 Date: Wed, 15 Jun 2005 10:46:56 +0800 To: pgsql-performance@postgresql.org From: K C Lau Subject: SELECT LIMIT 1 VIEW Performance Issue 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=1.892 tagged_above=0 required=5 tests=DNS_FROM_RFC_POST, FROM_ENDS_IN_NUMS X-Spam-Level: * X-Archive-Number: 200506/327 X-Sequence-Number: 12964 Hi All, I previously posted the following as a sequel to my SELECT DISTINCT Performance Issue question. We would most appreciate any clue or suggestions on how to overcome this show-stopping issue. We are using 8.0.3 on Windows. Is it a known limitation when using a view with SELECT ... LIMIT 1? Would the forthcoming performance enhancement with MAX help when used within a view, as in: create or replace view VCurPlayer as select * from Player a where a.AtDate = (select Max(b.AtDate) from Player b where a.PlayerID = b.PlayerID); select PlayerID,AtDate from VCurPlayer where PlayerID='22220'; Thanks and regards, KC. --------- At 19:45 05/06/06, PFC wrote: >>Previously, we have also tried to use LIMIT 1 instead of DISTINCT, but >>the performance was no better: >>select PlayerID,AtDate from Player where PlayerID='22220' order by >>PlayerID desc, AtDate desc LIMIT 1 > > The DISTINCT query will pull out all the rows and keep only one, > so the >one with LIMIT should be faster. Can you post explain analyze of the LIMIT >query ? Actually the problem with LIMIT 1 query is when we use views with the LIMIT 1 construct. The direct SQL is ok: esdt=> explain analyze select PlayerID,AtDate from Player where PlayerID='22220' order by PlayerID desc, AtDate desc LIMIT 1; Limit (cost=0.00..1.37 rows=1 width=23) (actual time=0.000..0.000 rows=1 loops=1) -> Index Scan Backward using pk_player on player (cost=0.00..16074.23 rows=11770 width=23) (actual time=0.000..0.000 rows=1 loops=1) Index Cond: ((playerid)::text = '22220'::text) Total runtime: 0.000 ms esdt=> create or replace view VCurPlayer3 as select * from Player a where AtDate = (select b.AtDate from Player b where a.PlayerID = b.PlayerID order by b.PlayerID desc, b.AtDate desc LIMIT 1); esdt=> explain analyze select PlayerID,AtDate,version from VCurPlayer3 where PlayerID='22220'; Index Scan using pk_player on player a (cost=0.00..33072.78 rows=59 width=27) (actual time=235.000..235.000 rows=1 loops=1) Index Cond: ((playerid)::text = '22220'::text) Filter: ((atdate)::text = ((subplan))::text) SubPlan -> Limit (cost=0.00..1.44 rows=1 width=23) (actual time=0.117..0.117 rows=1 loops=1743) -> Index Scan Backward using pk_player on player b (cost=0.00..14023.67 rows=9727 width=23) (actual time=0.108..0.108 rows=1 loops=1743) Index Cond: (($0)::text = (playerid)::text) Total runtime: 235.000 ms The problem appears to be in the loops=1743 scanning all 1743 data records for that player. Regards, KC. From pgsql-performance-owner@postgresql.org Wed Jun 15 06:06: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 0C3EA52881 for ; Wed, 15 Jun 2005 06:06:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43872-03 for ; Wed, 15 Jun 2005 09:06:34 +0000 (GMT) Received: from fed1rmmtao05.cox.net (fed1rmmtao05.cox.net [68.230.241.34]) by svr1.postgresql.org (Postfix) with ESMTP id CF1325287A for ; Wed, 15 Jun 2005 06:06:29 -0300 (ADT) Received: from [192.168.2.107] (really [24.251.200.200]) by fed1rmmtao05.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050615090631.WAGU8651.fed1rmmtao05.cox.net@[192.168.2.107]> for ; Wed, 15 Jun 2005 05:06:31 -0400 Mime-Version: 1.0 (Apple Message framework v730) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-performance@postgresql.org From: Todd Landfried Subject: Needed: Simplified guide to optimal memory configuration Date: Wed, 15 Jun 2005 02:06:27 -0700 X-Mailer: Apple Mail (2.730) 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: 200506/328 X-Sequence-Number: 12965 I deeply apologize if this has been covered with some similar topic before, but I need a little guidance in the optimization department. We use Postgres as our database and we're having some issues dealing with customers who are, shall we say, "thrifty" when it comes to buying RAM. We tell them to buy at least 1GB, but there's always the bargain chaser who thinks 256MB of RAM "is more than enough. So here's what I need--in layman's terms 'cause I'll need to forward this message on to them to prove what I'm saying (don't ya love customers?). 1. Our database has a total of 35 tables and maybe 300 variables 2. There are five primary tables and only two of these are written to every minute, sometimes up to a menial 1500 transactions per minute. 3. Our customers usually buy RAM in 256MB, 512MB, 1GB or 2GB. We've tried to come up with a optimization scheme based on what we've been able to discern from lists like this, but we don't have a lot of confidence. Using the default settings seems to work best with 1GB, but we need help with the other RAM sizes. What's the problem? The sucker gets s-l-o-w on relatively simple queries. For example, simply listing all of the users online at one time takes 30-45 seconds if we're talking about 800 users. We've adjusted the time period for vacuuming the tables to the point where it occurs once an hour, but we're getting only a 25% performance gain from that. We're looking at the system settings now to see how those can be tweaked. So, what I need is to be pointed to (or told) what are the best settings for our database given these memory configurations. What should we do? Thanks Todd Don't know if this will help, but here's the result of show all: NOTICE: enable_seqscan is on NOTICE: enable_indexscan is on NOTICE: enable_tidscan is on NOTICE: enable_sort is on NOTICE: enable_nestloop is on NOTICE: enable_mergejoin is on NOTICE: enable_hashjoin is on NOTICE: ksqo is off NOTICE: geqo is on NOTICE: tcpip_socket is on NOTICE: ssl is off NOTICE: fsync is on NOTICE: silent_mode is off NOTICE: log_connections is off NOTICE: log_timestamp is off NOTICE: log_pid is off NOTICE: debug_print_query is off NOTICE: debug_print_parse is off NOTICE: debug_print_rewritten is off NOTICE: debug_print_plan is off NOTICE: debug_pretty_print is off NOTICE: show_parser_stats is off NOTICE: show_planner_stats is off NOTICE: show_executor_stats is off NOTICE: show_query_stats is off NOTICE: stats_start_collector is on NOTICE: stats_reset_on_server_start is on NOTICE: stats_command_string is off NOTICE: stats_row_level is off NOTICE: stats_block_level is off NOTICE: trace_notify is off NOTICE: hostname_lookup is off NOTICE: show_source_port is off NOTICE: sql_inheritance is on NOTICE: australian_timezones is off NOTICE: fixbtree is on NOTICE: password_encryption is off NOTICE: transform_null_equals is off NOTICE: geqo_threshold is 20 NOTICE: geqo_pool_size is 0 NOTICE: geqo_effort is 1 NOTICE: geqo_generations is 0 NOTICE: geqo_random_seed is -1 NOTICE: deadlock_timeout is 1000 NOTICE: syslog is 0 NOTICE: max_connections is 64 NOTICE: shared_buffers is 256 NOTICE: port is 5432 NOTICE: unix_socket_permissions is 511 NOTICE: sort_mem is 2048 NOTICE: vacuum_mem is 126622 NOTICE: max_files_per_process is 1000 NOTICE: debug_level is 0 NOTICE: max_expr_depth is 10000 NOTICE: max_fsm_relations is 500 NOTICE: max_fsm_pages is 10000 NOTICE: max_locks_per_transaction is 64 NOTICE: authentication_timeout is 60 NOTICE: pre_auth_delay is 0 NOTICE: checkpoint_segments is 3 NOTICE: checkpoint_timeout is 300 NOTICE: wal_buffers is 8 NOTICE: wal_files is 0 NOTICE: wal_debug is 0 NOTICE: commit_delay is 0 NOTICE: commit_siblings is 5 NOTICE: effective_cache_size is 79350 NOTICE: random_page_cost is 2 NOTICE: cpu_tuple_cost is 0.01 NOTICE: cpu_index_tuple_cost is 0.001 NOTICE: cpu_operator_cost is 0.0025 NOTICE: geqo_selection_bias is 2 NOTICE: default_transaction_isolation is read committed NOTICE: dynamic_library_path is $libdir NOTICE: krb_server_keyfile is FILE:/etc/pgsql/krb5.keytab NOTICE: syslog_facility is LOCAL0 NOTICE: syslog_ident is postgres NOTICE: unix_socket_group is unset NOTICE: unix_socket_directory is unset NOTICE: virtual_host is unset NOTICE: wal_sync_method is fdatasync NOTICE: DateStyle is ISO with US (NonEuropean) conventions NOTICE: Time zone is unset NOTICE: TRANSACTION ISOLATION LEVEL is READ COMMITTED NOTICE: Current client encoding is 'SQL_ASCII' NOTICE: Current server encoding is 'SQL_ASCII' NOTICE: Seed for random number generator is unavailable From pgsql-performance-owner@postgresql.org Wed Jun 15 06: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 67F715288E for ; Wed, 15 Jun 2005 06:25:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42235-10 for ; Wed, 15 Jun 2005 09:25:38 +0000 (GMT) Received: from zigo.dhs.org (c8233a.g-aen.bostream.se [194.236.34.191]) by svr1.postgresql.org (Postfix) with ESMTP id 706C952824 for ; Wed, 15 Jun 2005 06:25:35 -0300 (ADT) Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) by zigo.dhs.org (Postfix) with ESMTP id B9F008467; Wed, 15 Jun 2005 11:25:37 +0200 (CEST) Date: Wed, 15 Jun 2005 11:25:37 +0200 (CEST) From: Dennis Bjorklund To: Todd Landfried Cc: pgsql-performance@postgresql.org Subject: Re: Needed: Simplified guide to optimal memory configuration In-Reply-To: Message-ID: 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.328 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/329 X-Sequence-Number: 12966 On Wed, 15 Jun 2005, Todd Landfried wrote: > So, what I need is to be pointed to (or told) what are the best > settings for our database given these memory configurations. What > should we do? Maybe this will help: http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html > NOTICE: shared_buffers is 256 This looks like it's way too low. Try something like 2048. -- /Dennis Bj�rklund From pgsql-performance-owner@postgresql.org Wed Jun 15 11:18: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 E1AA352818 for ; Wed, 15 Jun 2005 11:18:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08997-06 for ; Wed, 15 Jun 2005 14:18: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 CC48652835 for ; Wed, 15 Jun 2005 11:18:21 -0300 (ADT) 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 j5FEIP0g002609; Wed, 15 Jun 2005 10:18:25 -0400 (EDT) To: Dennis Bjorklund Cc: Todd Landfried , pgsql-performance@postgresql.org Subject: Re: Needed: Simplified guide to optimal memory configuration In-reply-to: References: Comments: In-reply-to Dennis Bjorklund message dated "Wed, 15 Jun 2005 11:25:37 +0200" Date: Wed, 15 Jun 2005 10:18:25 -0400 Message-ID: <2608.1118845105@sss.pgh.pa.us> From: Tom Lane 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: 200506/330 X-Sequence-Number: 12967 Dennis Bjorklund writes: > On Wed, 15 Jun 2005, Todd Landfried wrote: >> NOTICE: shared_buffers is 256 > This looks like it's way too low. Try something like 2048. It also is evidently PG 7.2 or before; SHOW's output hasn't looked like that in years. Try a more recent release --- there's usually nontrivial performance improvements in each major release. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 15 11: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 D82335282C for ; Wed, 15 Jun 2005 11:20:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10847-03 for ; Wed, 15 Jun 2005 14:20:14 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id F0CA952814 for ; Wed, 15 Jun 2005 11:20:13 -0300 (ADT) Received: (qmail 8019 invoked by uid 500); 15 Jun 2005 14:19:49 -0000 Date: Wed, 15 Jun 2005 09:19:49 -0500 From: Bruno Wolff III To: Todd Landfried Cc: pgsql-performance@postgresql.org Subject: Re: Needed: Simplified guide to optimal memory configuration Message-ID: <20050615141949.GB7595@wolff.to> Mail-Followup-To: Bruno Wolff III , Todd Landfried , pgsql-performance@postgresql.org References: 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.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/331 X-Sequence-Number: 12968 On Wed, Jun 15, 2005 at 02:06:27 -0700, Todd Landfried wrote: > > What's the problem? The sucker gets s-l-o-w on relatively simple > queries. For example, simply listing all of the users online at one > time takes 30-45 seconds if we're talking about 800 users. We've > adjusted the time period for vacuuming the tables to the point where > it occurs once an hour, but we're getting only a 25% performance gain > from that. We're looking at the system settings now to see how those > can be tweaked. It might be useful to see example slow queries and the corresponding explain analyze output. From pgsql-performance-owner@postgresql.org Sun Jun 19 01:55: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 974B052902 for ; Wed, 15 Jun 2005 12:35:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29273-01 for ; Wed, 15 Jun 2005 15:34:55 +0000 (GMT) Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) by svr1.postgresql.org (Postfix) with ESMTP id 5A6DA52881 for ; Wed, 15 Jun 2005 12:34:52 -0300 (ADT) Received: from xyz (pcp05009530pcs.sanarb01.mi.comcast.net[68.40.151.218]) by comcast.net (sccrmhc11) with SMTP id <2005061515344901100cs736e>; Wed, 15 Jun 2005 15:34:49 +0000 From: "Ken Shaw" To: Subject: How to determine whether to VACUUM or CLUSTER Date: Wed, 15 Jun 2005 11:34:18 -0400 Message-ID: <011301c571bf$b83c77f0$800101df@xyz> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 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=1.558 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS X-Spam-Level: * X-Archive-Number: 200506/360 X-Sequence-Number: 12997 Hi All, I have an app that updates a PostgreSQL db in a batch fashion. After each batch (or several batches), it issues VACUUM and ANALYZE calls on the updated tables. Now I want to cluster some tables for better performance. I understand that doing a VACUUM and a CLUSTER on a table is wasteful as the CLUSTER makes the VACUUM superfluous. The app does not have a built-in list of the tables and whether each is clustered or not. It looks to me as if the only way to determine whether to issue a VACUUM (on a non-clustered table) or a CLUSTER (on a clustered table) is to query the table "pg_index", much like view "pg_indexes" does, for the column "indisclustered". Is this right? Also, how expensive is CLUSTER compared to VACUUM? Does CLUSTER read in the whole table, sort it, and write it back out? Or write out a completely new file? Is the time for a CLUSTER the same whether one row is out of place or the table is completely disordered? Thanks, Ken From pgsql-performance-owner@postgresql.org Wed Jun 15 13:54: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 C2E2752881 for ; Wed, 15 Jun 2005 13:54:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44529-09 for ; Wed, 15 Jun 2005 16:54:16 +0000 (GMT) Received: from veggie-fuel.com (veggie-fuel.com [200.46.208.238]) by svr1.postgresql.org (Postfix) with ESMTP id 8345B5282A for ; Wed, 15 Jun 2005 13:54:13 -0300 (ADT) Received: from localhost (unknown [200.46.204.144]) by veggie-fuel.com (Postfix) with ESMTP id BA8CC35F960 for ; Wed, 15 Jun 2005 16:54:13 +0000 (GMT) Received: from veggie-fuel.com ([200.46.208.238]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47351-01; Wed, 15 Jun 2005 16:54:06 +0000 (GMT) Received: from [10.0.0.7] (63-229-122-71.phnx.qwest.net [63.229.122.71]) by veggie-fuel.com (Postfix) with ESMTP id 6767335F95A; Wed, 15 Jun 2005 16:54:05 +0000 (GMT) Subject: Re: Index ot being used From: Karim Nassar Reply-To: karim.nassar@acm.org To: Madison Kelly Cc: pgsql-performance@postgresql.org In-Reply-To: <42ADFAF8.7080107@alteeve.com> References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> <20050613132852.GA31142@wolff.to> <42ADC77B.7000007@alteeve.com> <22127.1118686403@sss.pgh.pa.us> <42ADD8DC.1000001@alteeve.com> <3643.1118696404@sss.pgh.pa.us> <42ADFAF8.7080107@alteeve.com> Content-Type: text/plain Date: Wed, 15 Jun 2005 09:52:02 -0700 Message-Id: <1118854322.7135.133.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.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: 200506/332 X-Sequence-Number: 12969 On Mon, 2005-06-13 at 17:30 -0400, Madison Kelly wrote: > As I mentioned to Bruno in my reply to him, I am trying to keep as > many tweaks as I can inside my program. The reason for this is that this > is a backup program that I am trying to aim to more mainstream users or > where a techy would set it up and then it would be used by mainstream > users. At this point I want to avoid, as best I can, any changes from > default to the 'postgres.conf' file or other external files. Later > though, once I finish this testing phase, I plan to write a section of > external tweaking where I will test these changes out and note my > success for mre advanced users who feel more comfortable playing with > postgres (and web server, rsync, etc) configs. > > If there is any way that I can make changes like this similar from > inside my (perl) program I would prefer that. For example, I implemented > the 'enable_seqscan' via: > > $DB->do("SET ENABLE_SEQSCAN TO OFF") || die... > ... > $DB->do("SET ENABLE_SEQSCAN TO ON") || die... Your goal is admirable. However, many people tweak their postgresql.conf files, and your program can't know whether or not this has happened. It might be a good idea to have a var $do_db_optimization, which defaults to on. Then, if your users have trouble or are advanced admins they can turn it off. My personal opinion is that there are too many architectures and configurations for you to accurately optimize inside your program, and this gives you and your users an easy out. if ($do_db_optimization == 1) { $DB->do("SET ENABLE_SEQSCAN TO OFF") || die... } else { # do nothing -- postgresql will figure it out } -- Karim Nassar From pgsql-performance-owner@postgresql.org Wed Jun 15 14:33: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 EC8855281E for ; Wed, 15 Jun 2005 14:33:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56505-03 for ; Wed, 15 Jun 2005 17:33:23 +0000 (GMT) Received: from srv1.alteeve.com (unknown [209.167.86.38]) by svr1.postgresql.org (Postfix) with ESMTP id B026F5280C for ; Wed, 15 Jun 2005 14:33:21 -0300 (ADT) Received: from [192.168.1.99] (nabiki.thelinuxexperience.com [209.167.86.34]) by srv1.alteeve.com (8.12.10/8.12.10) with ESMTP id j5FI2Ipe025858; Wed, 15 Jun 2005 14:02:19 -0400 Message-ID: <42B06660.1060504@alteeve.com> Date: Wed, 15 Jun 2005 13:33:20 -0400 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en-us, en, ja MIME-Version: 1.0 To: karim.nassar@acm.org Cc: pgsql-performance@postgresql.org Subject: Re: Index ot being used References: <1825.216.209.137.1.1118419819.squirrel@mail.alteeve.com> <20050610155535.GO8451@tobias.nordicbet.com> <42AC42CB.8050703@alteeve.com> <24636.1118591783@sss.pgh.pa.us> <42ACBC95.9020404@alteeve.com> <20050613030001.GB17491@wolff.to> <20050613031317.GA18988@wolff.to> <42AD008D.4080600@alteeve.com> <20050613035346.GA20703@wolff.to> <42AD0B94.9090508@alteeve.com> <20050613132852.GA31142@wolff.to> <42ADC77B.7000007@alteeve.com> <22127.1118686403@sss.pgh.pa.us> <42ADD8DC.1000001@alteeve.com> <3643.1118696404@sss.pgh.pa.us> <42ADFAF8.7080107@alteeve.com> <1118854322.7135.133.camel@localhost.localdomain> In-Reply-To: <1118854322.7135.133.camel@localhost.localdomain> 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.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/333 X-Sequence-Number: 12970 Karim Nassar wrote: > Your goal is admirable. However, many people tweak their postgresql.conf > files, and your program can't know whether or not this has happened. It > might be a good idea to have a var $do_db_optimization, which defaults > to on. Then, if your users have trouble or are advanced admins they can > turn it off. My personal opinion is that there are too many > architectures and configurations for you to accurately optimize inside > your program, and this gives you and your users an easy out. > > if ($do_db_optimization == 1) { > $DB->do("SET ENABLE_SEQSCAN TO OFF") || die... > } else { > # do nothing -- postgresql will figure it out > } That is a wonderful idea and I already have the foundation in place to easily implement this. Thanks!! Madison -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Madison Kelly (Digimer) TLE-BU, The Linux Experience; Back Up http://tle-bu.thelinuxexperience.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- From pgsql-performance-owner@postgresql.org Wed Jun 15 15:35: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 F1E0A5280D for ; Wed, 15 Jun 2005 15:32:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65853-08 for ; Wed, 15 Jun 2005 18:32:53 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 2E26F52874 for ; Wed, 15 Jun 2005 15:32:52 -0300 (ADT) 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 7488452; Wed, 15 Jun 2005 11:34:59 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Dennis Bjorklund Subject: Re: Needed: Simplified guide to optimal memory configuration Date: Wed, 15 Jun 2005 11:34:43 -0700 User-Agent: KMail/1.8 Cc: Todd Landfried , pgsql-performance@postgresql.org References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506151134.44096.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/334 X-Sequence-Number: 12971 Dennis, > http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html > > > NOTICE: shared_buffers is 256 For everyone's info, the current (8.0) version is at: http://www.powerpostgresql.com/PerfList -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Jun 16 11:46: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 7EB1352836 for ; Thu, 16 Jun 2005 11:46:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63649-02 for ; Thu, 16 Jun 2005 14:46:50 +0000 (GMT) Received: from mailrelay.t-mobile.com (m6f095e42.tmodns.net [66.94.9.111]) by svr1.postgresql.org (Postfix) with ESMTP id 0082E5282F for ; Thu, 16 Jun 2005 11:46:49 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailrelay.t-mobile.com (Postfix) with ESMTP id D030299DC for ; Thu, 16 Jun 2005 07:40:29 -0700 (PDT) Received: from mailrelay.t-mobile.com ([127.0.0.1]) by localhost (mailrelay.t-mobile.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 17672-07 for ; Thu, 16 Jun 2005 07:40:28 -0700 (PDT) Received: from [10.253.139.181] (unknown [10.253.139.181]) by mailrelay.t-mobile.com (Postfix) with ESMTP for ; Thu, 16 Jun 2005 07:40:23 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v730) In-Reply-To: <2608.1118845105@sss.pgh.pa.us> References: <2608.1118845105@sss.pgh.pa.us> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9A491A53-A5F5-4061-B1EA-8E4216299407@viatornetworks.com> Content-Transfer-Encoding: 7bit From: Todd Landfried Subject: Re: Needed: Simplified guide to optimal memory configuration Date: Thu, 16 Jun 2005 07:46:45 -0700 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.882 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, RCVD_IN_BL_SPAMCOP_NET X-Spam-Level: * X-Archive-Number: 200506/335 X-Sequence-Number: 12972 Yes, it is 7.2. Why? because an older version of our software runs on RH7.3 and that was the latest supported release of Postgresql for RH7.3 (that we can find). We're currently ported to 8, but we still have a large installed base with the other version. On Jun 15, 2005, at 7:18 AM, Tom Lane wrote: > Dennis Bjorklund writes: > >> On Wed, 15 Jun 2005, Todd Landfried wrote: >> >>> NOTICE: shared_buffers is 256 >>> > > >> This looks like it's way too low. Try something like 2048. >> > > It also is evidently PG 7.2 or before; SHOW's output hasn't looked > like > that in years. Try a more recent release --- there's usually > nontrivial > performance improvements in each major release. > > regards, tom lane > > ---------------------------(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 Thu Jun 16 14:01: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 D644D52925 for ; Thu, 16 Jun 2005 14:01:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95668-09 for ; Thu, 16 Jun 2005 17:01:04 +0000 (GMT) Received: from mir3-fs.mir3.com (www.mir3.com [216.74.11.46]) by svr1.postgresql.org (Postfix) with ESMTP id 83320528FE for ; Thu, 16 Jun 2005 14:01:01 -0300 (ADT) Received: from archimedes.mirlogic.com ([172.16.2.68]) by mir3-fs.mir3.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 16 Jun 2005 10:03:37 -0700 Subject: Re: Needed: Simplified guide to optimal memory From: Mark Lewis To: Todd Landfried Cc: pgsql-performance@postgresql.org In-Reply-To: <9A491A53-A5F5-4061-B1EA-8E4216299407@viatornetworks.com> References: <2608.1118845105@sss.pgh.pa.us> <9A491A53-A5F5-4061-B1EA-8E4216299407@viatornetworks.com> Content-Type: text/plain Organization: MIR3, Inc. Date: Thu, 16 Jun 2005 10:01:00 -0700 Message-Id: <1118941260.698.5.camel@archimedes.mirlogic.com> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-16) Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 Jun 2005 17:03:37.0171 (UTC) FILETIME=[56319230:01C57295] X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/336 X-Sequence-Number: 12973 We run the RPM's for RH 7.3 on our 7.2 install base with no problems. RPM's as recent as for PostgreSQL 7.4.2 are available here: ftp://ftp10.us.postgresql.org/pub/postgresql/binary/v7.4.2/redhat/redhat-7.3/ Or you can always compile from source. There isn't any such thing as a 'supported' package for RH7.2 anyway. -- Mark Lewis On Thu, 2005-06-16 at 07:46 -0700, Todd Landfried wrote: > Yes, it is 7.2. Why? because an older version of our software runs on > RH7.3 and that was the latest supported release of Postgresql for > RH7.3 (that we can find). We're currently ported to 8, but we still > have a large installed base with the other version. > > > On Jun 15, 2005, at 7:18 AM, Tom Lane wrote: > > > Dennis Bjorklund writes: > > > >> On Wed, 15 Jun 2005, Todd Landfried wrote: > >> > >>> NOTICE: shared_buffers is 256 > >>> > > > > > >> This looks like it's way too low. Try something like 2048. > >> > > > > It also is evidently PG 7.2 or before; SHOW's output hasn't looked > > like > > that in years. Try a more recent release --- there's usually > > nontrivial > > performance improvements in each major release. > > > > regards, tom lane > > > > ---------------------------(end of > > broadcast)--------------------------- > > TIP 2: you can get off all lists at once with the unregister command > > (send "unregister YourEmailAddressHere" to > > majordomo@postgresql.org) > > > > > ---------------------------(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 From pgsql-performance-owner@postgresql.org Thu Jun 16 14:03: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 CB2E15293D for ; Thu, 16 Jun 2005 14:03:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97767-08 for ; Thu, 16 Jun 2005 17:03:43 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id ADAE552906 for ; Thu, 16 Jun 2005 14:03:41 -0300 (ADT) Received: (qmail 11680 invoked by uid 500); 16 Jun 2005 17:03:10 -0000 Date: Thu, 16 Jun 2005 12:03:10 -0500 From: Bruno Wolff III To: Todd Landfried Cc: pgsql-performance@postgresql.org Subject: Re: Needed: Simplified guide to optimal memory configuration Message-ID: <20050616170310.GA11563@wolff.to> Mail-Followup-To: Bruno Wolff III , Todd Landfried , pgsql-performance@postgresql.org References: <2608.1118845105@sss.pgh.pa.us> <9A491A53-A5F5-4061-B1EA-8E4216299407@viatornetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9A491A53-A5F5-4061-B1EA-8E4216299407@viatornetworks.com> User-Agent: Mutt/1.5.6i 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: 200506/337 X-Sequence-Number: 12974 On Thu, Jun 16, 2005 at 07:46:45 -0700, Todd Landfried wrote: > Yes, it is 7.2. Why? because an older version of our software runs on > RH7.3 and that was the latest supported release of Postgresql for > RH7.3 (that we can find). We're currently ported to 8, but we still > have a large installed base with the other version. You can build it from source. I run 8.0 stable from CVS on a RH 6.1 box. From pgsql-performance-owner@postgresql.org Thu Jun 16 15:04: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 604B85280B for ; Thu, 16 Jun 2005 15:04:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 07633-10 for ; Thu, 16 Jun 2005 18:04:43 +0000 (GMT) Received: from web33703.mail.mud.yahoo.com (web33703.mail.mud.yahoo.com [68.142.201.200]) by svr1.postgresql.org (Postfix) with SMTP id C9BA852824 for ; Thu, 16 Jun 2005 15:04:42 -0300 (ADT) Received: (qmail 8985 invoked by uid 60001); 16 Jun 2005 18:04:42 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ah1x3PohhLJQHVxVXriubJvmOi1uYb5fWefN6mq7T3XMbXxucmy2/zzuqC5i6Miksfg8+0AQB1ritTsopC/kUPxmwr1v7rmTq1swm5gV2xCMeXMY6Hv7U+Q96wBpUS4x1Zpo9vUEHf+hHTKsp7Phdi9KXe10afL9rlARWDxrPCc= ; Message-ID: <20050616180442.8983.qmail@web33703.mail.mud.yahoo.com> Received: from [68.40.151.218] by web33703.mail.mud.yahoo.com via HTTP; Thu, 16 Jun 2005 11:04:41 PDT Date: Thu, 16 Jun 2005 11:04:41 -0700 (PDT) From: ken shaw Subject: How to determine whether to VACUUM or CLUSTER To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1679030748-1118945081=:7587" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=4.736 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_YAHOO_RCVD, FROM_ENDS_IN_NUMS, HTML_10_20, HTML_MESSAGE X-Spam-Level: **** X-Archive-Number: 200506/338 X-Sequence-Number: 12975 --0-1679030748-1118945081=:7587 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi All, I have an app that updates a PostgreSQL db in a batch fashion. After each batch (or several batches), it issues VACUUM and ANALYZE calls on the updated tables. Now I want to cluster some tables for better performance. I understand that doing a VACUUM and a CLUSTER on a table is wasteful as the CLUSTER makes the VACUUM superfluous. The app does not have a built-in list of the tables and whether each is clustered or not. It looks to me as if the only way to determine whether to issue a VACUUM (on a non-clustered table) or a CLUSTER (on a clustered table) is to query the table "pg_index", much like view "pg_indexes" does, for the column "indisclustered". Is this right? Also, how expensive is CLUSTER compared to VACUUM? Does CLUSTER read in the whole table, sort it, and write it back out? Or write out a completely new file? Is the time for a CLUSTER the same whether one row is out of place or the table is completely disordered? Thanks, Ken --------------------------------- Discover Yahoo! Find restaurants, movies, travel & more fun for the weekend. Check it out! --0-1679030748-1118945081=:7587 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit

Hi All,

I have an app that updates a PostgreSQL db in a batch fashion. After each batch (or several batches), it issues VACUUM and ANALYZE calls on the updated tables. Now I want to cluster some tables for better performance. I understand that doing a VACUUM and a CLUSTER on a table is wasteful as the CLUSTER makes the VACUUM superfluous. The app does not have a built-in list of the tables and whether each is clustered or not. It looks to me as if the only way to determine whether to issue a VACUUM (on a non-clustered table) or a CLUSTER (on a clustered table) is to query the table "pg_index", much like view "pg_indexes" does, for the column "indisclustered". Is this right?

Also, how expensive is CLUSTER compared to VACUUM? Does CLUSTER read in the whole table, sort it, and write it back out? Or write out a completely new file? Is the time for a CLUSTER the same whether one row is out of place or the table is completely disordered?

Thanks,

Ken


Discover Yahoo!
Find restaurants, movies, travel & more fun for the weekend. Check it out! --0-1679030748-1118945081=:7587-- From pgsql-performance-owner@postgresql.org Thu Jun 16 16:28: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 B551252849 for ; Thu, 16 Jun 2005 16:28:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28931-02 for ; Thu, 16 Jun 2005 19:28:40 +0000 (GMT) Received: from smtp-out-02.utu.fi (smtp-out-02.utu.fi [130.232.202.172]) by svr1.postgresql.org (Postfix) with ESMTP id 3DA935283C for ; Thu, 16 Jun 2005 16:28:39 -0300 (ADT) Received: from izar.utu.fi (mailhost.utu.fi [130.232.1.5]) by smtp02.mess.utu.fi (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) with ESMTP id <0II60030XZFOV5F0@smtp02.mess.utu.fi> for pgsql-performance@postgresql.org; Thu, 16 Jun 2005 22:28:36 +0300 (EEST) Received: from [192.168.1.51] (mcinen-dsl.utu.fi [130.232.39.52]) by izar.utu.fi (Postfix) with ESMTP id AE4F02CB83 for ; Thu, 16 Jun 2005 22:28:35 +0300 (EET DST) Date: Thu, 16 Jun 2005 22:28:30 +0300 From: =?ISO-8859-1?Q?Veikko_M=E4kinen?= Subject: How does the transaction buffer work? To: pgsql-performance@postgresql.org Message-id: <42B1D2DE.4020709@ecom.fi> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) 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: 200506/339 X-Sequence-Number: 12976 Hey, How does Postgres (8.0.x) buffer changes to a database within a transaction? I need to insert/update more than a thousand rows (mayde even more than 10000 rows, ~100 bytes/row) in a table but the changes must not be visible to other users/transactions before every row is updated. One way of doing this that I thought of was start a transaction, delete everything and then just dump new data in (copy perhaps). The old data would be usable to other transactions until I commit my insert. This would be the fastest way, but how much memory would this use? Will this cause performance issues on a heavily loaded server with too little memory even to begin with :) -veikko From pgsql-performance-owner@postgresql.org Thu Jun 16 16:36: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 2BC1D5283D for ; Thu, 16 Jun 2005 16:36:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31083-01 for ; Thu, 16 Jun 2005 19:36:13 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id 8678952836 for ; Thu, 16 Jun 2005 16:36:12 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050616193609m9100ngufse>; Thu, 16 Jun 2005 19:36:13 +0000 Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id BFDC655FCA; Thu, 16 Jun 2005 14:36:07 -0500 (CDT) Message-ID: <42B1D4A7.60407@arbash-meinel.com> Date: Thu, 16 Jun 2005 14:36:07 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Veikko_M=E4kinen?= Cc: pgsql-performance@postgresql.org Subject: Re: How does the transaction buffer work? References: <42B1D2DE.4020709@ecom.fi> In-Reply-To: <42B1D2DE.4020709@ecom.fi> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig43DEAECC775450173E44EF25" 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: 200506/340 X-Sequence-Number: 12977 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig43DEAECC775450173E44EF25 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Veikko M=E4kinen wrote: > Hey, > > How does Postgres (8.0.x) buffer changes to a database within a=20 > transaction? I need to insert/update more than a thousand rows (mayde=20 > even more than 10000 rows, ~100 bytes/row) in a table but the changes=20 > must not be visible to other users/transactions before every row is=20 > updated. One way of doing this that I thought of was start a=20 > transaction, delete everything and then just dump new data in (copy=20 > perhaps). The old data would be usable to other transactions until I=20 > commit my insert. This would be the fastest way, but how much memory=20 > would this use? Will this cause performance issues on a heavily loaded = > server with too little memory even to begin with :) > Postgres does indeed keep track of who can see what. Such that changes=20 won't be seen until a final commit. If you are trying to insert bulk data, definitely consider COPY. But UPDATE should also be invisible until the commit. So if you are only = changing data, there really isn't any reason to do a DELETE and INSERT.=20 Especially since you'll have problems with foreign keys at the DELETE sta= ge. John =3D:-> > > -veikko --------------enig43DEAECC775450173E44EF25 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCsdSnJdeBCYSNAAMRAlEtAJ9SjVXnBlARTRTCF8QsEhlqFsXrcACfdCoW tczQPVs2jxvqEGY0tM6PdlU= =Bhn2 -----END PGP SIGNATURE----- --------------enig43DEAECC775450173E44EF25-- From pgsql-performance-owner@postgresql.org Thu Jun 16 17:13: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 729A152836 for ; Thu, 16 Jun 2005 17:13:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35017-05 for ; Thu, 16 Jun 2005 20:13:00 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 1253852861 for ; Thu, 16 Jun 2005 17:12:58 -0300 (ADT) Received: (qmail 28563 invoked from network); 16 Jun 2005 22:13:12 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 16 Jun 2005 22:13:12 +0200 To: "John A Meinel" , =?iso-8859-15?Q?Veikko_M=E4kinen?= Cc: pgsql-performance@postgresql.org Subject: Re: How does the transaction buffer work? References: <42B1D2DE.4020709@ecom.fi> <42B1D4A7.60407@arbash-meinel.com> Message-ID: Date: Thu, 16 Jun 2005 22:12:59 +0200 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: <42B1D4A7.60407@arbash-meinel.com> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/341 X-Sequence-Number: 12978 >> transaction, delete everything and then just dump new data in (copy >> perhaps). The old data would be usable to other transactions until I >> commit my insert. This would be the fastest way, but how much memory >> would this use? Will this cause performance issues on a heavily loaded >> server with too little memory even to begin with :) Well. If you DELETE everything in your table and then COPY in new rows, it will be fast, old rows will still be visible until the COMMIT. I hope you haven't anything referencing this table with ON DELETE CASCADE on it, or else you might delete more stuff than you think. Also you have to consider locking. You could TRUNCATE the table instead of deleting, but then anyone trying to SELECT from it will block until the updater transaction is finished. If you DELETE you could also vacuum afterwards. You could also COPY your rows to a temporary table and use a Joined Update to update your table in place. This might well be the more elegant solution, and the only one if the updated table has foreign key references pointing to it. From pgsql-performance-owner@postgresql.org Thu Jun 16 17:53: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 6247452823 for ; Thu, 16 Jun 2005 17:53:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42341-10 for ; Thu, 16 Jun 2005 20:53:23 +0000 (GMT) Received: from superman.pns.networktel.net (superman.pns.networktel.net [216.83.236.232]) by svr1.postgresql.org (Postfix) with ESMTP id 441B052836 for ; Thu, 16 Jun 2005 17:53:21 -0300 (ADT) Received: from jor-l.pns.networktel.net (jor-l.pns.networktel.net [216.83.236.236]) by superman.pns.networktel.net (8.12.9/8.12.6) with ESMTP id j5GFqKrr021022 for ; Thu, 16 Jun 2005 15:52:20 GMT (envelope-from justin.davis@rapidsys.net) Received: from JustinIBM (216-107-99-186.wan.networktel.net [216.107.99.186]) by jor-l.pns.networktel.net (8.13.3/8.12.11) with ESMTP id j5GKr7bh071294 for ; Thu, 16 Jun 2005 20:53:12 GMT (envelope-from justin.davis@rapidsys.net) Message-Id: <200506162053.j5GKr7bh071294@jor-l.pns.networktel.net> From: "Justin Davis" To: Subject: could not send data to client: Date: Thu, 16 Jun 2005 16:53:44 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0028_01C57293.FAD6D770" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Thread-Index: AcVytXuoLijkEeAPQyafRX868/tdBA== X-Virus-Scanned: ClamAV version 0.85.1, clamav-milter version 0.85 on jor-l.pns.networktel.net X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.452 tagged_above=0 required=5 tests=HTML_50_60, HTML_MESSAGE, HTML_TEXT_AFTER_BODY, HTML_TEXT_AFTER_HTML X-Spam-Level: X-Archive-Number: 200506/342 X-Sequence-Number: 12979 This is a multi-part message in MIME format. ------=_NextPart_000_0028_01C57293.FAD6D770 Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: 7bit I have 6 Windows PC in a test environment accessing a very small Postgres DB on a 2003 Server. The PC's access the database with a cobol app via ODBC. 3 of the PC's operate very efficiently and quickly. 3 of them do not. The 3 that do not are all new Dell XP Pro with SP2. They all produce the error in the log file as below: 2005-06-16 16:17:30 LOG: could not send data to client: No connection could be made because the target machine actively refused it. 2005-06-16 16:17:30 LOG: could not receive data from client: No connection could be made because the target machine actively refused it. 2005-06-16 16:17:30 LOG: unexpected EOF on client connection Thanks, Justin Davis Rapid Systems, Inc. 800.356.8952 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.7.3/15 - Release Date: 6/14/2005 ------=_NextPart_000_0028_01C57293.FAD6D770 Content-Type: text/html; charset="windows-1250" Content-Transfer-Encoding: quoted-printable
I have = 6 Windows PC=20 in a test environment accessing a very small Postgres DB on a 2003 = Server. =20 The PC's access the database with a cobol app via ODBC.  3 of the = PC's=20 operate very efficiently and quickly.  3 of them do not.  The = 3 that=20 do not are all new Dell XP Pro with SP2.  They all produce the = error in the=20 log file as below:
 
2005-06-16 16:17:30=20 LOG:  could not send data to client: No connection could be made = because=20 the target machine actively refused it.
 
2005-06-16 16:17:30=20 LOG:  could not receive data from client: No connection could be = made=20 because the target machine actively refused it.
 
2005-06-16 16:17:30 LOG:  unexpected EOF on client=20 connection
 
Thanks,
 
Justin Davis
Rapid Systems, = Inc.
800.356.8952
 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.7.3/15 - Release Date: = 6/14/2005

------=_NextPart_000_0028_01C57293.FAD6D770-- From pgsql-performance-owner@postgresql.org Thu Jun 16 18:51: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 12AA752824 for ; Thu, 16 Jun 2005 18:51:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58237-01 for ; Thu, 16 Jun 2005 21:51:44 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 00A6F5282C for ; Thu, 16 Jun 2005 18:51:43 -0300 (ADT) 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 7493771; Thu, 16 Jun 2005 14:53:51 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Veikko =?iso-8859-1?q?M=E4kinen?= Subject: Re: How does the transaction buffer work? Date: Thu, 16 Jun 2005 14:53:36 -0700 User-Agent: KMail/1.8 Cc: pgsql-performance@postgresql.org References: <42B1D2DE.4020709@ecom.fi> In-Reply-To: <42B1D2DE.4020709@ecom.fi> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506161453.37194.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/343 X-Sequence-Number: 12980 Veikko, > One way of doing this that I thought of was start a > transaction, delete everything and then just dump new data in (copy > perhaps). The old data would be usable to other transactions until I > commit my insert. This would be the fastest way, but how much memory > would this use? Starting a transaction doesn't use any more memory than without one. Unlike Some Other Databases, PostgreSQL's transactions occur in WAL and on data pages, not in RAM. > Will this cause performance issues on a heavily loaded > server with too little memory even to begin with :) Quite possibly, but the visibility issue won't be the problem. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Jun 16 23:15: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 0CF3C5289D for ; Thu, 16 Jun 2005 23:15:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32152-08 for ; Fri, 17 Jun 2005 02:15:10 +0000 (GMT) Received: from smtp001.bizmail.yahoo.com (smtp001.bizmail.yahoo.com [216.136.172.125]) by svr1.postgresql.org (Postfix) with SMTP id 2B2ED52867 for ; Thu, 16 Jun 2005 23:15:09 -0300 (ADT) Received: from unknown (HELO ?192.168.5.9?) (tlandfried%viatornetworks.com@68.120.115.197 with plain) by smtp001.bizmail.yahoo.com with SMTP; 17 Jun 2005 02:15:12 -0000 Mime-Version: 1.0 (Apple Message framework v730) In-Reply-To: <1118941260.698.5.camel@archimedes.mirlogic.com> References: <2608.1118845105@sss.pgh.pa.us> <9A491A53-A5F5-4061-B1EA-8E4216299407@viatornetworks.com> <1118941260.698.5.camel@archimedes.mirlogic.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <97CA7057-5DEE-4AA5-A4F3-8DEC1CAE720F@viatornetworks.com> Content-Transfer-Encoding: 7bit From: Todd Landfried Subject: Re: Needed: Simplified guide to optimal memory Date: Thu, 16 Jun 2005 19:15:08 -0700 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.730) 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: 200506/344 X-Sequence-Number: 12981 Thanks for the link. I'll look into those. I'm going only on what my engineers are telling me, but they say upgrading breaks a lot of source code with some SQL commands that are a pain to hunt down and kill. Not sure if that's true, but that's what I'm told. Todd On Jun 16, 2005, at 10:01 AM, Mark Lewis wrote: > We run the RPM's for RH 7.3 on our 7.2 install base with no problems. > RPM's as recent as for PostgreSQL 7.4.2 are available here: > ftp://ftp10.us.postgresql.org/pub/postgresql/binary/v7.4.2/redhat/ > redhat-7.3/ > > Or you can always compile from source. There isn't any such thing > as a > 'supported' package for RH7.2 anyway. > > -- Mark Lewis > > > On Thu, 2005-06-16 at 07:46 -0700, Todd Landfried wrote: > > >> Yes, it is 7.2. Why? because an older version of our software runs on >> RH7.3 and that was the latest supported release of Postgresql for >> RH7.3 (that we can find). We're currently ported to 8, but we still >> have a large installed base with the other version. >> >> >> On Jun 15, 2005, at 7:18 AM, Tom Lane wrote: >> >> >> >>> Dennis Bjorklund writes: >>> >>> >>> >>>> On Wed, 15 Jun 2005, Todd Landfried wrote: >>>> >>>> >>>> >>>>> NOTICE: shared_buffers is 256 >>>>> >>>>> >>>>> >>> >>> >>> >>> >>>> This looks like it's way too low. Try something like 2048. >>>> >>>> >>>> >>> >>> It also is evidently PG 7.2 or before; SHOW's output hasn't looked >>> like >>> that in years. Try a more recent release --- there's usually >>> nontrivial >>> performance improvements in each major release. >>> >>> regards, tom lane >>> >>> ---------------------------(end of >>> broadcast)--------------------------- >>> TIP 2: you can get off all lists at once with the unregister command >>> (send "unregister YourEmailAddressHere" to >>> majordomo@postgresql.org) >>> >>> >>> >> >> >> ---------------------------(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 >> >> > > > ---------------------------(end of > broadcast)--------------------------- > TIP 8: explain analyze is your friend > > From pgsql-performance-owner@postgresql.org Fri Jun 17 00:47: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 D706352896 for ; Fri, 17 Jun 2005 00:47:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86145-04 for ; Fri, 17 Jun 2005 03:47: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 E1D9C5281E for ; Fri, 17 Jun 2005 00:47:34 -0300 (ADT) 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 j5H3lY7e015402; Thu, 16 Jun 2005 23:47:34 -0400 (EDT) To: ken shaw Cc: pgsql-performance@postgresql.org Subject: Re: How to determine whether to VACUUM or CLUSTER In-reply-to: <20050616180442.8983.qmail@web33703.mail.mud.yahoo.com> References: <20050616180442.8983.qmail@web33703.mail.mud.yahoo.com> Comments: In-reply-to ken shaw message dated "Thu, 16 Jun 2005 11:04:41 -0700" Date: Thu, 16 Jun 2005 23:47:33 -0400 Message-ID: <15401.1118980053@sss.pgh.pa.us> From: Tom Lane 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: 200506/345 X-Sequence-Number: 12982 ken shaw writes: > It looks to me as if the only way to determine whether to issue a > VACUUM (on a non-clustered table) or a CLUSTER (on a clustered table) > is to query the table "pg_index", much like view "pg_indexes" does, > for the column "indisclustered". Is this right? indisclustered is certainly the ground truth here, and [ ... digs around in the source code ... ] it doesn't look like there are any views that present the information in a different fashion. So yup, that's what you gotta do. > Also, how expensive is CLUSTER compared to VACUUM? Well, it's definitely expensive compared to plain VACUUM, but compared to VACUUM FULL the case is not clear-cut. I would say that if you had a seriously bloated table (where VACUUM FULL would have to move all or most of the live tuples in order to compact the table completely) then CLUSTER will be faster --- not to mention any possible future benefits from having the table more or less in order with respect to the index. As near as I can tell, VACUUM FULL was designed to work nicely when you had maybe 10%-25% free space in the table and you want it all compacted out. In a scenario where it has to move all the tuples it is certainly not faster than CLUSTER; plus the end result is much worse as far as the state of the indexes goes, because VACUUM FULL does *nothing* for compacting indexes. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jun 17 01:08: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 8CCF95283F for ; Fri, 17 Jun 2005 01:08:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87491-08 for ; Fri, 17 Jun 2005 04:08: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 3830552818 for ; Fri, 17 Jun 2005 01:08:12 -0300 (ADT) 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 j5H489o2015556; Fri, 17 Jun 2005 00:08:09 -0400 (EDT) To: =?ISO-8859-1?Q?Veikko_M=E4kinen?= Cc: pgsql-performance@postgresql.org Subject: Re: How does the transaction buffer work? In-reply-to: <42B1D2DE.4020709@ecom.fi> References: <42B1D2DE.4020709@ecom.fi> Comments: In-reply-to =?ISO-8859-1?Q?Veikko_M=E4kinen?= message dated "Thu, 16 Jun 2005 22:28:30 +0300" Date: Fri, 17 Jun 2005 00:08:09 -0400 Message-ID: <15555.1118981289@sss.pgh.pa.us> From: Tom Lane 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: 200506/346 X-Sequence-Number: 12983 =?ISO-8859-1?Q?Veikko_M=E4kinen?= writes: > How does Postgres (8.0.x) buffer changes to a database within a > transaction? I need to insert/update more than a thousand rows (mayde > even more than 10000 rows, ~100 bytes/row) in a table but the changes > must not be visible to other users/transactions before every row is > updated. There were some other responses already, but I wanted to add this: there isn't any "transaction buffer" in Postgres. The above scenario won't cause us any noticeable problem, because what we do is mark each row with its originating transaction ID, and then readers compare that to the set of transaction IDs that they think are "in the past". The number of rows affected by a transaction is not really a factor at all. Now of course this isn't Nirvana, you must pay somewhere ;-) and our weak spot is the need for VACUUM. But you have no need to fear large individual transactions. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jun 17 01:46: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 487E0528B2 for ; Fri, 17 Jun 2005 01:46:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97157-06 for ; Fri, 17 Jun 2005 04:46:39 +0000 (GMT) Received: from mr2.surnet.cl (smtp2.surnet.cl [216.155.73.163]) by svr1.postgresql.org (Postfix) with ESMTP id 7C55A52831 for ; Fri, 17 Jun 2005 01:46:37 -0300 (ADT) Received: from smtp2.surnet.cl (216.155.73.169) by mr2.surnet.cl (7.0.031.3) id 4259ADFA00F0474F; Fri, 17 Jun 2005 00:46:44 -0400 Received: from smtp2.surnet.cl (mr2.surnet.cl []) by mr2.surnet.cl ([216.155.73.169]); Fri, 17 Jun 2005 04:46:43 +0000 Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl (7.0.031.3) id 4259ADE3008FC185; Fri, 17 Jun 2005 00:46:43 -0400 Received: from localhost (216.155.79.59) by cluster.surnet.cl (7.0.031.3) id 42B1480300026BEC; Fri, 17 Jun 2005 00:46:37 -0400 Received: by localhost (Postfix, from userid 1000) id 62CB2C2DC08; Fri, 17 Jun 2005 00:46:43 -0400 (CLT) Date: Fri, 17 Jun 2005 00:46:43 -0400 From: Alvaro Herrera To: Todd Landfried Cc: pgsql-performance@postgresql.org Subject: Re: Needed: Simplified guide to optimal memory Message-ID: <20050617044643.GA19751@surnet.cl> References: <2608.1118845105@sss.pgh.pa.us> <9A491A53-A5F5-4061-B1EA-8E4216299407@viatornetworks.com> <1118941260.698.5.camel@archimedes.mirlogic.com> <97CA7057-5DEE-4AA5-A4F3-8DEC1CAE720F@viatornetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <97CA7057-5DEE-4AA5-A4F3-8DEC1CAE720F@viatornetworks.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.562 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/347 X-Sequence-Number: 12984 On Thu, Jun 16, 2005 at 07:15:08PM -0700, Todd Landfried wrote: > Thanks for the link. I'll look into those. > > I'm going only on what my engineers are telling me, but they say > upgrading breaks a lot of source code with some SQL commands that are > a pain to hunt down and kill. Not sure if that's true, but that's > what I'm told. This is true. Migrating to a newer version is not a one-day thing. But increasing shared_buffers is trivially done, would get you lots of benefit, and it's very unlikely to break anything. (Migrating one version can be painful already -- migrating three versions on one shot might be a nightmare. OTOH it's much better to pay the cost of migration once rather than three times ...) -- Alvaro Herrera () "The Postgresql hackers have what I call a "NASA space shot" mentality. Quite refreshing in a world of "weekend drag racer" developers." (Scott Marlowe) From pgsql-performance-owner@postgresql.org Fri Jun 17 02:07: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 5C2EF528F3 for ; Fri, 17 Jun 2005 02:07:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06188-02 for ; Fri, 17 Jun 2005 05:07:20 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id E11B95281E for ; Fri, 17 Jun 2005 02:07:19 -0300 (ADT) Received: from 216-154-15-201.dsl.look.ca (216-154-15-201.dsl.look.ca [216.154.15.201]) by tht.net (Postfix) with ESMTP id 1150276A19; Fri, 17 Jun 2005 01:07:26 -0400 (EDT) Subject: Re: How does the transaction buffer work? From: Rod Taylor To: Tom Lane Cc: pgsql-performance@postgresql.org, Veikko =?ISO-8859-1?Q?M=E4kinen?= In-Reply-To: <15555.1118981289@sss.pgh.pa.us> References: <42B1D2DE.4020709@ecom.fi> <15555.1118981289@sss.pgh.pa.us> Content-Type: text/plain Date: Fri, 17 Jun 2005 01:05:15 -0400 Message-Id: <1118984715.78366.240.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port 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: 200506/348 X-Sequence-Number: 12985 > Now of course this isn't Nirvana, you must pay somewhere ;-) and our > weak spot is the need for VACUUM. But you have no need to fear large > individual transactions. No need to fear long running transactions other than their ability to stop VACUUM from doing what it's supposed to be doing, thus possibly impacting performance. -- From pgsql-performance-owner@postgresql.org Fri Jun 17 09:49: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 3543752932 for ; Fri, 17 Jun 2005 09:49:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11974-01 for ; Fri, 17 Jun 2005 12:49:16 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id C956E5295A for ; Fri, 17 Jun 2005 09:49:12 -0300 (ADT) 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.5.7226.0 Subject: Re: could not send data to client: Date: Fri, 17 Jun 2005 08:49:15 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2B07@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] could not send data to client: thread-index: AcVytXuoLijkEeAPQyafRX868/tdBAAhP/KQ From: "Merlin Moncure" To: "Justin Davis" Cc: 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: 200506/349 X-Sequence-Number: 12986 Justin wrote: I have 6 Windows PC in a test environment accessing a very small = Postgres DB on a 2003 Server.=A0 The PC's access the database with a = cobol app via ODBC.=A0 3 of the PC's operate very efficiently and = quickly.=A0 3 of them do not.=A0 The 3 that do not are all new Dell XP = Pro with SP2.=A0 They all produce the error in the log file as below: =A0 2005-06-16 16:17:30 LOG:=A0 could not send data to client: No connection = could be made because the target machine actively refused it. =A0 2005-06-16 16:17:30 LOG:=A0 could not receive data from client: No = connection could be made because the target machine actively refused it. =A0 2005-06-16 16:17:30 LOG:=A0 unexpected EOF on client connection [...] Have you tried other ODBC app (excel, etc) to connect to the database = from the machines? If so and it works, 1. what version odbc driver 2. what cobol compiler=20 3. what technology to map cobol i/o to sql (Acu4GL for example) This is probably more appropriate on pgsql-odbc and plain text is = preferred for these mailing lists. Merlin From pgsql-performance-owner@postgresql.org Fri Jun 17 13:42: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 3A67B52931 for ; Fri, 17 Jun 2005 13:42:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67499-04 for ; Fri, 17 Jun 2005 16:42:20 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 2819152949 for ; Fri, 17 Jun 2005 13:42:19 -0300 (ADT) 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 7496929; Fri, 17 Jun 2005 09:44:26 -0700 From: Josh Berkus Organization: Aglio Database Solutions To: Todd Landfried Subject: Re: Needed: Simplified guide to optimal memory Date: Fri, 17 Jun 2005 09:42:37 -0700 User-Agent: KMail/1.8 Cc: pgsql-performance@postgresql.org References: <1118941260.698.5.camel@archimedes.mirlogic.com> <97CA7057-5DEE-4AA5-A4F3-8DEC1CAE720F@viatornetworks.com> In-Reply-To: <97CA7057-5DEE-4AA5-A4F3-8DEC1CAE720F@viatornetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506170942.37789.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: 200506/350 X-Sequence-Number: 12987 Todd, > I'm going only on what my engineers are telling me, but they say > upgrading breaks a lot of source code with some SQL commands that are > a pain to hunt down and kill. Not sure if that's true, but that's > what I'm told. Depends on your app, but certainly that can be true. Oddly, 7.2 -> 8.0 is less trouble than 7.2 -> 7.4 because of some type casting issues which were resolved. Mind you, in the past a quick "sed" script has been adequate for me to fix compatibility issues. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jun 17 16:34: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 2180C528D9 for ; Fri, 17 Jun 2005 16:34:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03878-10 for ; Fri, 17 Jun 2005 19:34:19 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id 69CCF528C6 for ; Fri, 17 Jun 2005 16:34:17 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id 8B417380BF for ; Fri, 17 Jun 2005 21:34:15 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id AE28E380FF for ; Fri, 17 Jun 2005 21:34:14 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: <7a1914222f313b7c5e88bedb8a662f12@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-140--1004261579 From: Yves Vindevogel Subject: Multiple disks: RAID 5 or PG Cluster Date: Fri, 17 Jun 2005 21:34:19 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/351 X-Sequence-Number: 12988 --Apple-Mail-140--1004261579 Content-Type: multipart/alternative; boundary=Apple-Mail-141--1004261578 --Apple-Mail-141--1004261578 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi, We are looking to build a new machine for a big PG database. We were wondering if a machine with 5 scsi-disks would perform better=20 if we use a hardware raid 5 controller or if we would go for the=20 clustering in PG. If we cluster in PG, do we have redundancy on the data like in a RAID 5=20= ? First concern is performance, not redundancy (we can do that a=20 different way because all data comes from upload files) Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-141--1004261578 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Hi, We are looking to build a new machine for a big PG database. We were wondering if a machine with 5 scsi-disks would perform better if we use a hardware raid 5 controller or if we would go for the clustering in PG. If we cluster in PG, do we have redundancy on the data like in a RAID 5 ? First concern is performance, not redundancy (we can do that a different way because all data comes from upload files) Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-141--1004261578-- --Apple-Mail-140--1004261579 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMB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5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-140--1004261579 Content-Type: multipart/alternative; boundary=Apple-Mail-142--1004261575 --Apple-Mail-142--1004261575 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-142--1004261575 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-142--1004261575-- --Apple-Mail-140--1004261579-- From pgsql-performance-owner@postgresql.org Fri Jun 17 17:22: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 11BEE52969 for ; Fri, 17 Jun 2005 17:22:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15190-04 for ; Fri, 17 Jun 2005 20:21:58 +0000 (GMT) Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by svr1.postgresql.org (Postfix) with ESMTP id 1552452935 for ; Fri, 17 Jun 2005 17:21:52 -0300 (ADT) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id B2791B80C for ; Fri, 17 Jun 2005 16:21:53 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v730) In-Reply-To: <7a1914222f313b7c5e88bedb8a662f12@implements.be> References: <7a1914222f313b7c5e88bedb8a662f12@implements.be> Content-Type: multipart/alternative; boundary=Apple-Mail-1--1001409393 Message-Id: <271D9FF6-9726-4D69-8C45-98B187EE0B82@khera.org> From: Vivek Khera Subject: Re: Multiple disks: RAID 5 or PG Cluster Date: Fri, 17 Jun 2005 16:21:51 -0400 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.162 tagged_above=0 required=5 tests=AWL, HTML_60_70, HTML_FONT_BIG, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200506/352 X-Sequence-Number: 12989 --Apple-Mail-1--1001409393 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Jun 17, 2005, at 3:34 PM, Yves Vindevogel wrote: > We are looking to build a new machine for a big PG database. > We were wondering if a machine with 5 scsi-disks would perform > better if we use a hardware raid 5 controller or if we would go for > the clustering in PG. > If we cluster in PG, do we have redundancy on the data like in a > RAID 5 ? > I'd recommend 4 disks in a hardware RAID10 plus a hot spare, or use the 5th disk as boot + OS if you're feeling lucky. Vivek Khera, Ph.D. +1-301-869-4449 x806 --Apple-Mail-1--1001409393 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=US-ASCII
On Jun 17, 2005, = at 3:34 PM, Yves Vindevogel wrote:

We are looking to build a new = machine for a big PG database.

We were wondering if a machine with 5 scsi-disks would = perform better if we use a hardware raid 5 controller or if we would go = for the clustering in PG.

If we cluster in PG, do we have redundancy on the data like in = a RAID 5 ?



I'd recommend 4 disks in a = hardware RAID10 plus a hot spare, or use the 5th disk as boot + OS if = you're feeling lucky.


Vivek Khera, Ph.D.

+1-301-869-4449 x806



= --Apple-Mail-1--1001409393-- From pgsql-performance-owner@postgresql.org Fri Jun 17 17:38: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 2725252973 for ; Fri, 17 Jun 2005 17:38:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18083-10 for ; Fri, 17 Jun 2005 20:38:41 +0000 (GMT) Received: from mail0.rawbw.com (mail0.rawbw.com [198.144.192.41]) by svr1.postgresql.org (Postfix) with ESMTP id 0F70252969 for ; Fri, 17 Jun 2005 17:38:39 -0300 (ADT) Received: (from www@localhost) by mail0.rawbw.com (8.11.6p2/8.11.6) id j5HKcfN76675 for pgsql-performance@postgresql.org; Fri, 17 Jun 2005 13:38:41 -0700 (PDT) Received: from cybs-gw.ic3.com (cybs-gw.ic3.com [66.185.177.10]) by webmail.rawbw.com (IMP) with HTTP for ; Fri, 17 Jun 2005 13:38:41 -0700 Message-ID: <1119040721.42b334d1c3ec9@webmail.rawbw.com> Date: Fri, 17 Jun 2005 13:38:41 -0700 From: mudfoot@rawbw.com To: pgsql-performance@postgresql.org Subject: Re: Multiple disks: RAID 5 or PG Cluster References: <7a1914222f313b7c5e88bedb8a662f12@implements.be> In-Reply-To: <7a1914222f313b7c5e88bedb8a662f12@implements.be> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.1 X-Originating-IP: 66.185.177.10 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: 200506/353 X-Sequence-Number: 12990 If you truly do not care about data protection -- either from drive loss or from sudden power failure, or anything else -- and just want to get the fastest possible performance, then do RAID 0 (striping). It may be faster to do that with software RAID on the host than with a special RAID controller. And turn off fsyncing the write ahead log in postgresql.conf (fsync = false). But be prepared to replace your whole database from scratch (or backup or whatever) if you lose a single hard drive. And if you have a sudden power loss or other type of unclean system shutdown (kernel panic or something) then your data integrity will be at risk as well. To squeeze evena little bit more performance, put your operating system, swap and PostgreSQL binaries on a cheap IDE or SATA drive--and only your data on the 5 striped SCSI drives. I do not know what clustering would do for you. But striping will provide a high level of assurance that each of your hard drives will process equivalent amounts of IO operations. Quoting Yves Vindevogel : > Hi, > > We are looking to build a new machine for a big PG database. > We were wondering if a machine with 5 scsi-disks would perform better > if we use a hardware raid 5 controller or if we would go for the > clustering in PG. > If we cluster in PG, do we have redundancy on the data like in a RAID 5 > ? > > First concern is performance, not redundancy (we can do that a > different way because all data comes from upload files) > > Met vriendelijke groeten, > Bien � vous, > Kind regards, > > Yves Vindevogel > Implements > > From pgsql-performance-owner@postgresql.org Fri Jun 17 18:30: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 10736528D0 for ; Fri, 17 Jun 2005 18:30:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28741-07 for ; Fri, 17 Jun 2005 21:30:23 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id 2B77A528BF for ; Fri, 17 Jun 2005 18:30:19 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id 1FA183806A for ; Fri, 17 Jun 2005 23:30:22 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id 8D93638078 for ; Fri, 17 Jun 2005 23:30:21 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: <30dcefefa83f93cb069019fd41427a03@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-158--997292775 From: Yves Vindevogel Subject: Fwd: Multiple disks: RAID 5 or PG Cluster Date: Fri, 17 Jun 2005 23:30:27 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/354 X-Sequence-Number: 12991 --Apple-Mail-158--997292775 Content-Type: multipart/alternative; boundary=Apple-Mail-159--997292774 --Apple-Mail-159--997292774 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Ok, I will hate that day, but it's only 6 months Begin forwarded message: > From: Vivek Khera > Date: Fri 17 Jun 2005 23:26:43 CEST > To: Yves Vindevogel > Subject: Re: [PERFORM] Multiple disks: RAID 5 or PG Cluster > > > On Jun 17, 2005, at 5:24 PM, Yves Vindevogel wrote: > >> That means that only 2 / 5 of my discs are actual storage. That's a=20= >> bit low, imho. >> >> Maybe I can ask my question again: >> Would I go for RAID 5, RAID 0 or PG clustering >> >> On 17 Jun 2005, at 22:21, Vivek Khera wrote: > If you're allergic to RAID10, then do RAID5.=A0 but you'll sacrifice=20= > performance.=A0 You'll hate life the day you blow a disk and have to=20= > rebuild everything, even if it is all easily restored. > > > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-159--997292774 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Ok, I will hate that day, but it's only 6 months Begin forwarded message: 0000,0000,0000From: Vivek Khera < 0000,0000,0000Date: Fri 17 Jun 2005 23:26:43 CEST 0000,0000,0000To: Yves Vindevogel < 0000,0000,0000Subject: Re: [PERFORM] Multiple disks: RAID 5 or PG Cluster On Jun 17, 2005, at 5:24 PM, Yves Vindevogel wrote: GeorgiaThat means that only 2 / 5 of my discs are actual storage. That's a bit low, = imho. GeorgiaMaybe I can ask my question again: GeorgiaWould I go for RAID 5, RAID 0 or PG clustering GeorgiaOn 17 Jun 2005, at 22:21, Vivek Khera wrote: 0000,0000,DDDDIf you're allergic to RAID10, then do RAID5.=A0 but you'll sacrifice performance.=A0 You'll = hate life the day you blow a disk and have to rebuild everything, even if it is all easily restored. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-159--997292774-- --Apple-Mail-158--997292775 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/g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 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-158--997292775 Content-Type: multipart/alternative; boundary=Apple-Mail-160--997292773 --Apple-Mail-160--997292773 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-160--997292773 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-160--997292773-- --Apple-Mail-158--997292775-- From pgsql-performance-owner@postgresql.org Fri Jun 17 18:31: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 8F81C52849 for ; Fri, 17 Jun 2005 18:30:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24208-10 for ; Fri, 17 Jun 2005 21:30:53 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id 9B9575282C for ; Fri, 17 Jun 2005 18:30:52 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id EC03F3815A for ; Fri, 17 Jun 2005 23:30:54 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id C36BB3804F for ; Fri, 17 Jun 2005 23:30:53 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: Content-Type: multipart/mixed; boundary=Apple-Mail-161--997260469 From: Yves Vindevogel Subject: Fwd: Multiple disks: RAID 5 or PG Cluster Date: Fri, 17 Jun 2005 23:31:00 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/355 X-Sequence-Number: 12992 --Apple-Mail-161--997260469 Content-Type: multipart/alternative; boundary=Apple-Mail-162--997260469 --Apple-Mail-162--997260469 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed BTW, tnx for the opinion ... I forgot to cc list ... Begin forwarded message: > From: Yves Vindevogel > Date: Fri 17 Jun 2005 23:29:32 CEST > To: mudfoot@rawbw.com > Subject: Re: [PERFORM] Multiple disks: RAID 5 or PG Cluster > > Ok, striping is a good option ... > > I'll tell you why I don't care about dataloss > > 1) The database will run 6 months, no more. > 2) The database is fed with upload files. So, if I have a backup each=20= > day, plus my files of that day, I can restore pretty quickly. > 3) Power failure is out of the question: battery backup (UPS), disk=20 > failure is minimal change: new server, new discs, 6 months ... > > We do have about 500.000 new records each day in that database, so=20 > that's why I want performance > Records are uploaded in one major table and then denormalised into=20 > several others. > > But, I would like to hear somebody about the clustering method. Isn't=20= > that much used ? > Or isn't it used in a single machine ? > > On 17 Jun 2005, at 22:38, mudfoot@rawbw.com wrote: > >> If you truly do not care about data protection -- either from drive=20= >> loss or from >> sudden power failure, or anything else -- and just want to get the=20 >> fastest >> possible performance, then do RAID 0 (striping). It may be faster to=20= >> do that >> with software RAID on the host than with a special RAID controller. =20= >> And turn >> off fsyncing the write ahead log in postgresql.conf (fsync =3D = false). >> >> But be prepared to replace your whole database from scratch (or=20 >> backup or >> whatever) if you lose a single hard drive. And if you have a sudden=20= >> power loss >> or other type of unclean system shutdown (kernel panic or something)=20= >> then your >> data integrity will be at risk as well. >> >> To squeeze evena little bit more performance, put your operating=20 >> system, swap >> and PostgreSQL binaries on a cheap IDE or SATA drive--and only your=20= >> data on the >> 5 striped SCSI drives. >> >> I do not know what clustering would do for you. But striping will=20 >> provide a >> high level of assurance that each of your hard drives will process=20 >> equivalent >> amounts of IO operations. >> >> Quoting Yves Vindevogel : >> >>> Hi, >>> >>> We are looking to build a new machine for a big PG database. >>> We were wondering if a machine with 5 scsi-disks would perform = better >>> if we use a hardware raid 5 controller or if we would go for the >>> clustering in PG. >>> If we cluster in PG, do we have redundancy on the data like in a=20 >>> RAID 5 >>> ? >>> >>> First concern is performance, not redundancy (we can do that a >>> different way because all data comes from upload files) >>> >>> Met vriendelijke groeten, >>> Bien =E0 vous, >>> Kind regards, >>> >>> Yves Vindevogel >>> Implements >>> >>> >> >> >> >> ---------------------------(end of=20 >> broadcast)--------------------------- >> TIP 8: explain analyze is your friend >> >> > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > Yves Vindevogel > Implements > --Apple-Mail-162--997260469 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 BTW, tnx for the opinion ... I forgot to cc list ... Begin forwarded message: 0000,0000,0000From: Yves Vindevogel < 0000,0000,0000Date: Fri 17 Jun 2005 23:29:32 CEST 0000,0000,0000To: mudfoot@rawbw.com 0000,0000,0000Subject: Re: [PERFORM] Multiple disks: RAID 5 or PG Cluster Ok, striping is a good option ... I'll tell you why I don't care about dataloss 1) The database will run 6 months, no more. 2) The database is fed with upload files. So, if I have a backup each day, plus my files of that day, I can restore pretty quickly. 3) Power failure is out of the question: battery backup (UPS), disk failure is minimal change: new server, new discs, 6 months ... We do have about 500.000 new records each day in that database, so that's why I want performance Records are uploaded in one major table and then denormalised into several others. But, I would like to hear somebody about the clustering method. Isn't that much used ? Or isn't it used in a single machine ? On 17 Jun 2005, at 22:38, mudfoot@rawbw.com wrote: If you truly do not care about data protection -- either from drive loss or from sudden power failure, or anything else -- and just want to get the fastest possible performance, then do RAID 0 (striping). It may be faster to do that with software RAID on the host than with a special RAID controller.=20 And turn off fsyncing the write ahead log in postgresql.conf (fsync =3D false). But be prepared to replace your whole database from scratch (or backup or whatever) if you lose a single hard drive. And if you have a sudden power loss or other type of unclean system shutdown (kernel panic or something) then your data integrity will be at risk as well. To squeeze evena little bit more performance, put your operating system, swap and PostgreSQL binaries on a cheap IDE or SATA drive--and only your data on the 5 striped SCSI drives. I do not know what clustering would do for you. But striping will provide a high level of assurance that each of your hard drives will process equivalent amounts of IO operations. Quoting Yves Vindevogel <: Hi, We are looking to build a new machine for a big PG database. We were wondering if a machine with 5 scsi-disks would perform better=20 if we use a hardware raid 5 controller or if we would go for the=20 clustering in PG. If we cluster in PG, do we have redundancy on the data like in a RAID 5=20 ? First concern is performance, not redundancy (we can do that a=20 different way because all data comes from upload files) Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-162--997260469-- --Apple-Mail-161--997260469 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NV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aE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-161--997260469 Content-Type: multipart/alternative; boundary=Apple-Mail-163--997260467 --Apple-Mail-163--997260467 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. =20= > Then you win. > Mahatma Ghandi. > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-163--997260467 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma Ghandi. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-163--997260467-- --Apple-Mail-161--997260469 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUG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2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-161--997260469 Content-Type: multipart/alternative; boundary=Apple-Mail-164--997260465 --Apple-Mail-164--997260465 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-164--997260465 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-164--997260465-- --Apple-Mail-161--997260469-- From pgsql-performance-owner@postgresql.org Sat Jun 18 13:00: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 B98DB52854 for ; Sat, 18 Jun 2005 13:00:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89224-08 for ; Sat, 18 Jun 2005 16:00:18 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 632F35280D for ; Sat, 18 Jun 2005 13:00:17 -0300 (ADT) Received: (qmail 9186 invoked from network); 18 Jun 2005 18:00:29 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 18 Jun 2005 18:00:29 +0200 To: mudfoot@rawbw.com, pgsql-performance@postgresql.org Subject: Re: Multiple disks: RAID 5 or PG Cluster References: <7a1914222f313b7c5e88bedb8a662f12@implements.be> <1119040721.42b334d1c3ec9@webmail.rawbw.com> Message-ID: Date: Sat, 18 Jun 2005 18:00:14 +0200 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: <1119040721.42b334d1c3ec9@webmail.rawbw.com> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/356 X-Sequence-Number: 12993 > I do not know what clustering would do for you. But striping will > provide a > high level of assurance that each of your hard drives will process > equivalent > amounts of IO operations. I don't know what I'm talking about, but wouldn't mirorring be faster than striping for random reads like you often get on a database ? (ie. the reads can be dispatched to any disk) ? (or course, not for writes, but if you won't use fsync, random writes should be reduced no ?) From pgsql-performance-owner@postgresql.org Sat Jun 18 13:24: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 E170E5283A for ; Sat, 18 Jun 2005 13:24:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93776-08 for ; Sat, 18 Jun 2005 16:24:31 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id 186BA52831 for ; Sat, 18 Jun 2005 13:24:29 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5IGOP6U004686; Sat, 18 Jun 2005 18:24:26 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050618181239.0446d7a8@pop.interactivemediafactory.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Sat, 18 Jun 2005 18:24:21 +0200 To: PFC From: Jacques Caron Subject: Re: Multiple disks: RAID 5 or PG Cluster Cc: mudfoot@rawbw.com, pgsql-performance@postgresql.org In-Reply-To: References: <7a1914222f313b7c5e88bedb8a662f12@implements.be> <1119040721.42b334d1c3ec9@webmail.rawbw.com> 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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/357 X-Sequence-Number: 12994 Hi, At 18:00 18/06/2005, PFC wrote: > I don't know what I'm talking about, but wouldn't mirorring be > faster >than striping for random reads like you often get on a database ? (ie. the >reads can be dispatched to any disk) ? (or course, not for writes, but if >you won't use fsync, random writes should be reduced no ?) Roughly, for random reads, the performance (in terms of operations/s) compared to a single disk setup, with N being the number of drives, is: RAID 0 (striping): - read = N - write = N - capacity = N - redundancy = 0 RAID 1 (mirroring, N=2): - read = N - write = 1 - capacity = 1 - redundancy = 1 RAID 5 (striping + parity, N>=3) - read = N-1 - write = 1/2 - capacity = N-1 - redundancy = 1 RAID 10 (mirroring + striping, N=2n, N>=4) - read = N - write = N/2 - capacity = N/2 - redundancy < N/2 So depending on your app, i.e. your read/write ratio, how much data can be cached, whether the data is important or not, how much data you have, etc, one or the other option might be better. Jacques. From pgsql-performance-owner@postgresql.org Sat Jun 18 13:42: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 60B0D5284E for ; Sat, 18 Jun 2005 13:42:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98316-06 for ; Sat, 18 Jun 2005 16:42:24 +0000 (GMT) Received: from europa.telenet-ops.be (europa.telenet-ops.be [195.130.132.60]) by svr1.postgresql.org (Postfix) with ESMTP id B15E452836 for ; Sat, 18 Jun 2005 13:42:23 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by europa.telenet-ops.be (Postfix) with SMTP id B22E3198054 for ; Sat, 18 Jun 2005 18:42:19 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by europa.telenet-ops.be (Postfix) with ESMTP id 9D19719801F for ; Sat, 18 Jun 2005 18:42:18 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: Content-Type: multipart/mixed; boundary=Apple-Mail-169--928173618 From: Yves Vindevogel Subject: Fwd: Multiple disks: RAID 5 or PG Cluster Date: Sat, 18 Jun 2005 18:42:27 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/358 X-Sequence-Number: 12995 --Apple-Mail-169--928173618 Content-Type: multipart/alternative; boundary=Apple-Mail-170--928173618 --Apple-Mail-170--928173618 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed cc ... Begin forwarded message: > From: Yves Vindevogel > Date: Sat 18 Jun 2005 18:18:53 CEST > To: PFC > Subject: Re: [PERFORM] Multiple disks: RAID 5 or PG Cluster > > There's a basic difference between striping (raid 0) and mirroring=20 > (raid 1) > > With striping, each file is distributed over several disks, making the=20= > physical write faster because several disks can do the work. Same for=20= > reading, multiple disks return a part of the file. > Striping can not be used for safety/backup, if one disk fails, your=20 > file is lost (if it is partly on that failing disk). With mirroring=20= > you do not lose any disk space. > > Mirroring is a technique for avoiding disasters when you have a disk=20= > failure. Every file is written twice, each time to a different disk,=20= > which is a mirror of the first one. > You effectively lose half of your diskspace to that mirror. But when=20= > a disk fails, you don't lose anything, since you can rely on the other=20= > mirrored disk. > > Raid 10, which is the combination of that, has both. You have=20 > multiple disks that form your first part of the raid and you have an=20= > equal amount of disks for the mirror. > On each part of the mirror, striping is used to spread the files like=20= > in a raid 0. This is a very costly operation. You need a minimum of=20= > 4 disks, and you lose 50% of your capacity. > > BTW: mirroring is always slower than striping. > > On 18 Jun 2005, at 18:00, PFC wrote: > >> >> >>> I do not know what clustering would do for you. But striping will=20= >>> provide a >>> high level of assurance that each of your hard drives will process=20= >>> equivalent >>> amounts of IO operations. >> >> I don't know what I'm talking about, but wouldn't mirorring be=20= >> faster than striping for random reads like you often get on a=20 >> database ? (ie. the reads can be dispatched to any disk) ? (or=20 >> course, not for writes, but if you won't use fsync, random writes=20 >> should be reduced no ?) >> >> =09 >> >> ---------------------------(end of=20 >> broadcast)--------------------------- >> TIP 5: Have you checked our extensive FAQ? >> >> http://www.postgresql.org/docs/faq >> >> > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > Yves Vindevogel > Implements > --Apple-Mail-170--928173618 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 cc ... Begin forwarded message: 0000,0000,0000From: Yves Vindevogel < 0000,0000,0000Date: Sat 18 Jun 2005 18:18:53 CEST 0000,0000,0000To: PFC < 0000,0000,0000Subject: Re: [PERFORM] Multiple disks: RAID 5 or PG Cluster There's a basic difference between striping (raid 0) and mirroring (raid 1) With striping, each file is distributed over several disks, making the physical write faster because several disks can do the work. Same for reading, multiple disks return a part of the file. Striping can not be used for safety/backup, if one disk fails, your file is lost (if it is partly on that failing disk). With mirroring you do not lose any disk space. Mirroring is a technique for avoiding disasters when you have a disk failure. Every file is written twice, each time to a different disk, which is a mirror of the first one. You effectively lose half of your diskspace to that mirror. But when a disk fails, you don't lose anything, since you can rely on the other mirrored disk. Raid 10, which is the combination of that, has both. You have multiple disks that form your first part of the raid and you have an equal amount of disks for the mirror. On each part of the mirror, striping is used to spread the files like in a raid 0. This is a very costly operation. You need a minimum of 4 disks, and you lose 50% of your capacity. BTW: mirroring is always slower than striping. On 18 Jun 2005, at 18:00, PFC wrote: I do not know what clustering would do for you. But striping will provide a high level of assurance that each of your hard drives will process equivalent amounts of IO operations. I don't know what I'm talking about, but wouldn't mirorring be = faster than striping for random reads like you often get on a database ? (ie. the reads can be dispatched to any disk) ? (or course, not for writes, but if you won't use fsync, random writes should be reduced no ?) =09 ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-170--928173618-- --Apple-Mail-169--928173618 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzg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ABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-169--928173618 Content-Type: multipart/alternative; boundary=Apple-Mail-171--928173615 --Apple-Mail-171--928173615 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. =20= > Then you win. > Mahatma Ghandi. > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-171--928173615 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma Ghandi. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-171--928173615-- --Apple-Mail-169--928173618 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJ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AAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-169--928173618 Content-Type: multipart/alternative; boundary=Apple-Mail-172--928173614 --Apple-Mail-172--928173614 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-172--928173614 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-172--928173614-- --Apple-Mail-169--928173618-- From pgsql-performance-owner@postgresql.org Sat Jun 18 19:58: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 9D26852828 for ; Sat, 18 Jun 2005 19:57:56 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72542-01 for ; Sat, 18 Jun 2005 22:57:48 +0000 (GMT) Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by svr1.postgresql.org (Postfix) with ESMTP id 484E7528CD for ; Sat, 18 Jun 2005 19:57:47 -0300 (ADT) Received: from osgiliath.mathom.us ([70.108.108.63]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IIA00HBUYGDDKZ8@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Sat, 18 Jun 2005 17:57:50 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 33108612797 for ; Sat, 18 Jun 2005 18:57:49 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 03618-03 for ; Sat, 18 Jun 2005 18:57:49 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 107B76031F9; Sat, 18 Jun 2005 18:57:49 -0400 (EDT) Date: Sat, 18 Jun 2005 18:57:49 -0400 From: Michael Stone Subject: Re: Fwd: Multiple disks: RAID 5 or PG Cluster In-reply-to: To: pgsql-performance@postgresql.org Mail-Followup-To: pgsql-performance@postgresql.org Message-id: <20050618225748.GI25854@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.035 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/359 X-Sequence-Number: 12996 On Sat, Jun 18, 2005 at 06:42:27PM +0200, Yves Vindevogel wrote: >>With striping, each file is distributed over several disks, making >>the physical write faster because several disks can do the work. >>Same for reading, multiple disks return a part of the file. A mirror behaves almost exactly the same for reads, with a caveat: for a large enough file, multiple disks *must* be accessed in a striped configuration, while in a mirrored configuration the controller may access either one or more disks to read any file. >>BTW: mirroring is always slower than striping. That's simply not true. Striping speeds up writes but has no advantage over a simlarly sized mirror for reading. In fact, the mirror will be faster for pathological cases in which the reads are aligned in such a way that they would all be have to be read from the same stripe of a striped array. The striped configuration has an advantage when more than two disks are used, but that derives from the number of spindles, not from the striping; it is possible to have a mirror of more than two disks (which would have the same read advantage as the striped configuration with the same number of disks) but this is rarely seen because it is expensive. Mike Stone From pgsql-performance-owner@postgresql.org Sun Jun 19 01:58: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 DD53A52883 for ; Sun, 19 Jun 2005 01:58:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44104-02 for ; Sun, 19 Jun 2005 04:58:48 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) by svr1.postgresql.org (Postfix) with ESMTP id 7606C52871 for ; Sun, 19 Jun 2005 01:58:46 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so244404wra for ; Sat, 18 Jun 2005 21:58:47 -0700 (PDT) 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:references; b=rvSrVOuriozcGF+dYXWOz63cVx1zgk1LeKHXsIUO+9PBWlYaVAF4rot7T3+0JwnTl5CC4VFIyBm8537i7kkZGP6qw2wuPdZiiFhaauzyLAftSC8V+XpHJvtLqSArVSHDZJRJDsbKXscu9j9KSeFp9HR04MlhatnhnUKingXvkQc= Received: by 10.54.50.77 with SMTP id x77mr2068225wrx; Sat, 18 Jun 2005 21:58:47 -0700 (PDT) Received: by 10.54.86.15 with HTTP; Sat, 18 Jun 2005 21:58:47 -0700 (PDT) Message-ID: <33c6269f050618215872479c8d@mail.gmail.com> Date: Sun, 19 Jun 2005 00:58:47 -0400 From: Alex Turner Reply-To: Alex Turner To: Jacques Caron Subject: Re: Multiple disks: RAID 5 or PG Cluster Cc: PFC , mudfoot@rawbw.com, pgsql-performance@postgresql.org In-Reply-To: <6.2.0.14.0.20050618181239.0446d7a8@pop.interactivemediafactory.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7342_25943775.1119157127132" References: <7a1914222f313b7c5e88bedb8a662f12@implements.be> <1119040721.42b334d1c3ec9@webmail.rawbw.com> <6.2.0.14.0.20050618181239.0446d7a8@pop.interactivemediafactory.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.358 tagged_above=0 required=5 tests=AWL, HTML_20_30, HTML_MESSAGE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/362 X-Sequence-Number: 12999 ------=_Part_7342_25943775.1119157127132 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Of course these numbers are not true as soon as you exceed the stripe size= =20 for a read operation, which is often only 128k. Typically a stripe of=20 mirrors will not read from seperate halves of the mirrors either, so RAID 1= 0=20 is only N/2 best case in my experience, Raid 0+1 is a mirror of stripes and= =20 will read from independant halves, but gives worse redundancy. Alex Turner NetEconomist On 6/18/05, Jacques Caron wrote: >=20 > Hi, >=20 > At 18:00 18/06/2005, PFC wrote: > > I don't know what I'm talking about, but wouldn't mirorring be > > faster > >than striping for random reads like you often get on a database ? (ie.= =20 > the > >reads can be dispatched to any disk) ? (or course, not for writes, but i= f > >you won't use fsync, random writes should be reduced no ?) >=20 > Roughly, for random reads, the performance (in terms of operations/s) > compared to a single disk setup, with N being the number of drives, is: >=20 > RAID 0 (striping): > - read =3D N > - write =3D N > - capacity =3D N > - redundancy =3D 0 >=20 > RAID 1 (mirroring, N=3D2): > - read =3D N > - write =3D 1 > - capacity =3D 1 > - redundancy =3D 1 >=20 > RAID 5 (striping + parity, N>=3D3) > - read =3D N-1 > - write =3D 1/2 > - capacity =3D N-1 > - redundancy =3D 1 >=20 > RAID 10 (mirroring + striping, N=3D2n, N>=3D4) > - read =3D N > - write =3D N/2 > - capacity =3D N/2 > - redundancy < N/2 >=20 > So depending on your app, i.e. your read/write ratio, how much data can b= e > cached, whether the data is important or not, how much data you have, etc= , > one or the other option might be better. >=20 > Jacques. >=20 >=20 >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if you= r > joining column's datatypes do not match > ------=_Part_7342_25943775.1119157127132 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Of course these numbers are not true as soon as you exceed the stripe size for a read operation, which is often only 128k.  Typically a stripe of mirrors will not read from seperate halves of the mirrors either, so RAID 10 is only N/2 best case in my experience, Raid 0+1 is a mirror of stripes and will read from independant halves, but gives worse redundancy.

Alex Turner
NetEconomist

On 6/18/05, Jacques Caron <jc@directinfos.com> wrote:
Hi,

At 18:00 18/06/2005, PFC wrote:
>    &= nbsp;    I don't know what I'm talking about, but wouldn't m= irorring be
> faster
>than striping for random reads like you o= ften get on a database ? (ie. the
>reads can be dispatched to any disk) ? (or course, not for writes, but = if
>you won't use fsync, random writes should be reduced no ?)
Roughly, for random reads, the performance (in terms of operations/s)
compared to a single disk setup, with N being the number of drives, is:
=
RAID 0 (striping):
- read =3D N
- write =3D N
- capacity =3D N=
- redundancy =3D 0

RAID 1 (mirroring, N=3D2):
- read =3D N- write =3D 1
- capacity =3D 1
- redundancy =3D 1

RAID 5 (striping + parity= , N>=3D3)
- read =3D N-1
- write =3D 1/2
- capacity =3D N-1
= - redundancy =3D 1

RAID 10 (mirroring + striping, N=3D2n, N>=3D4)=
- read =3D N
- write =3D N/2
- capacity =3D N/2
- redundancy < N/2

S= o depending on your app, i.e. your read/write ratio, how much data can becached, whether the data is important or not, how much data you have, etc= ,
one or the other option might be better.

Jacques.


---------------------------(end of broadcast)---------------------------TIP 9: the planner will ignore your desire to choose an index scan if you= r
      joining column's datatypes do not m= atch

------=_Part_7342_25943775.1119157127132-- From pgsql-performance-owner@postgresql.org Sun Jun 19 02: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 69E2E52809 for ; Sun, 19 Jun 2005 02:54:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51253-05 for ; Sun, 19 Jun 2005 05:53:59 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 1275752806 for ; Sun, 19 Jun 2005 02:53:58 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1Djskg-0002D9-00; Sun, 19 Jun 2005 01:53:50 -0400 To: Michael Stone Cc: pgsql-performance@postgresql.org Subject: Re: Fwd: Multiple disks: RAID 5 or PG Cluster References: <20050618225748.GI25854@mathom.us> In-Reply-To: <20050618225748.GI25854@mathom.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 19 Jun 2005 01:53:50 -0400 Message-ID: <8764wa3n9t.fsf@stark.xeocode.com> Lines: 13 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.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/363 X-Sequence-Number: 13000 Michael Stone writes: > it is possible to have a mirror of more than two disks (which would have the > same read advantage as the striped configuration with the same number of > disks) but this is rarely seen because it is expensive. Actually three-way mirrors are quite common for backup purposes. To take a backup you break the mirror by taking one of the three copies out. Back it up at your leisure, then just resync it in time for the next backup. -- greg From pgsql-performance-owner@postgresql.org Mon Jun 20 03:53: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 9D2BA52839 for ; Mon, 20 Jun 2005 03:53:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67802-01 for ; Mon, 20 Jun 2005 06:53:52 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id C61E052812 for ; Mon, 20 Jun 2005 03:53:51 -0300 (ADT) Received: by flake.decibel.org (Postfix, from userid 1001) id 60E9E15293; Mon, 20 Jun 2005 01:53:49 -0500 (CDT) Date: Mon, 20 Jun 2005 01:53:49 -0500 From: "Jim C. Nasby" To: Ken Shaw Cc: pgsql-performance@postgresql.org Subject: Re: How to determine whether to VACUUM or CLUSTER Message-ID: <20050620065349.GK5113@decibel.org> References: <011301c571bf$b83c77f0$800101df@xyz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <011301c571bf$b83c77f0$800101df@xyz> X-Operating-System: FreeBSD 4.11-RELEASE i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i 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: 200506/364 X-Sequence-Number: 13001 On Wed, Jun 15, 2005 at 11:34:18AM -0400, Ken Shaw wrote: > Hi All, > > I have an app that updates a PostgreSQL db in a batch fashion. After > each batch (or several batches), it issues VACUUM and ANALYZE calls on > the updated tables. Now I want to cluster some tables for better > performance. I understand that doing a VACUUM and a CLUSTER on a table > is wasteful as the CLUSTER makes the VACUUM superfluous. The app does > not have a built-in list of the tables and whether each is clustered or > not. It looks to me as if the only way to determine whether to issue a > VACUUM (on a non-clustered table) or a CLUSTER (on a clustered table) is > to query the table "pg_index", much like view "pg_indexes" does, for the > column "indisclustered". Is this right? I don't think that's what you want. 'indisclustered' only indicates if the last time the table was clustered was on that index. The best thing that comes to mind is looking at the correlation of the first field in the index for the table. You'll find this info in pg_stats. > Also, how expensive is CLUSTER compared to VACUUM? Does CLUSTER read in > the whole table, sort it, and write it back out? Or write out a > completely new file? Is the time for a CLUSTER the same whether one row > is out of place or the table is completely disordered? AFAIK, cluster completely re-creates the table from scratch, then rebuilds all the indexes. It's basically the most expensive operation you can perform on a table. There probably will be some increased performance from the sort if the table is already mostly in the right order though. -- 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 Mon Jun 20 11:44: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 17E96528F7 for ; Mon, 20 Jun 2005 11:44:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59267-10 for ; Mon, 20 Jun 2005 14:44:10 +0000 (GMT) Received: from mail49.messagelabs.com (mail49.messagelabs.com [193.109.255.19]) by svr1.postgresql.org (Postfix) with SMTP id 53433528B7 for ; Mon, 20 Jun 2005 11:44:07 -0300 (ADT) X-VirusChecked: Checked X-Env-Sender: alexs@advfn.com X-Msg-Ref: server-10.tower-49.messagelabs.com!1119278651!1152949!1 X-StarScan-Version: 5.4.15; banners=-,-,- X-Originating-IP: [212.161.99.149] Received: (qmail 5041 invoked from network); 20 Jun 2005 14:44:11 -0000 Received: from mail.advfn.com (212.161.99.149) by server-10.tower-49.messagelabs.com with SMTP; 20 Jun 2005 14:44:11 -0000 Received: from [213.86.19.101] (helo=[192.168.0.185]) by mail.advfn.com with esmtp (Exim 4.22) id 1DkNVS-00037s-VT for pgsql-performance@postgresql.org; Mon, 20 Jun 2005 15:44:11 +0100 Mime-Version: 1.0 (Apple Message framework v730) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-performance@postgresql.org From: Alex Stapleton Subject: autovacuum suggestions for 500,000,000+ row tables? Date: Mon, 20 Jun 2005 15:44:08 +0100 X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/365 X-Sequence-Number: 13002 Hi, i'm trying to optimise our autovacuum configuration so that it vacuums / analyzes some of our larger tables better. It has been set to the default settings for quite some time. We never delete anything (well not often, and not much) from the tables, so I am not so worried about the VACUUM status, but I am wary of XID wraparound nuking us at some point if we don't sort vacuuming out so we VACUUM at least once every year ;) However not running ANALYZE for such huge periods of time is probably impacting the statistics accuracy somewhat, and I have seen some unusually slow queries at times. Anyway, does anyone think we might benefit from a more aggressive autovacuum configuration? From pgsql-performance-owner@postgresql.org Mon Jun 20 11:59: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 389A052846 for ; Mon, 20 Jun 2005 11:59:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64140-02 for ; Mon, 20 Jun 2005 14:59:44 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id CA3675282E for ; Mon, 20 Jun 2005 11:59:39 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5KExZF8094277; Mon, 20 Jun 2005 16:59:36 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050620165134.03b61140@pop.interactivemediafactory.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Mon, 20 Jun 2005 16:59:29 +0200 To: Alex Stapleton From: Jacques Caron Subject: Re: autovacuum suggestions for 500,000,000+ row Cc: pgsql-performance@postgresql.org In-Reply-To: References: 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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/366 X-Sequence-Number: 13003 Hi, At 16:44 20/06/2005, Alex Stapleton wrote: >We never delete >anything (well not often, and not much) from the tables, so I am not >so worried about the VACUUM status DELETEs are not the only reason you might need to VACUUM. UPDATEs are important as well, if not more. Tables that are constantly updated (statistics, session data, queues...) really need to be VACUUMed a lot. >but I am wary of XID wraparound >nuking us at some point if we don't sort vacuuming out so we VACUUM >at least once every year ;) That would give you a maximum average of 31 transactions/sec... Don't know if that's high or low for you. > However not running ANALYZE for such huge >periods of time is probably impacting the statistics accuracy >somewhat, and I have seen some unusually slow queries at times. >Anyway, does anyone think we might benefit from a more aggressive >autovacuum configuration? ANALYZE is not a very expensive operation, however VACUUM can definitely be a big strain and take a looooong time on big tables, depending on your setup. I've found that partitioning tables (at the application level) can be quite helpful if you manage to keep each partition to a reasonable size (under or close to available memory), especially if the partitioning scheme is somehow time-related. YMMV. Jacques. From pgsql-performance-owner@postgresql.org Mon Jun 20 12:06: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 596D652814 for ; Mon, 20 Jun 2005 12:06:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64140-05 for ; Mon, 20 Jun 2005 15:06:04 +0000 (GMT) Received: from mail49.messagelabs.com (mail49.messagelabs.com [193.109.255.19]) by svr1.postgresql.org (Postfix) with SMTP id 98A175283A for ; Mon, 20 Jun 2005 12:06:02 -0300 (ADT) X-VirusChecked: Checked X-Env-Sender: alexs@advfn.com X-Msg-Ref: server-15.tower-49.messagelabs.com!1119279960!2190368!1 X-StarScan-Version: 5.4.15; banners=-,-,- X-Originating-IP: [212.161.99.149] Received: (qmail 8753 invoked from network); 20 Jun 2005 15:06:00 -0000 Received: from mail.advfn.com (212.161.99.149) by server-15.tower-49.messagelabs.com with SMTP; 20 Jun 2005 15:06:00 -0000 Received: from [213.86.19.101] (helo=[192.168.0.185]) by mail.advfn.com with esmtp (Exim 4.22) id 1DkNqZ-00025u-61; Mon, 20 Jun 2005 16:05:59 +0100 In-Reply-To: <6.2.0.14.0.20050620165134.03b61140@pop.interactivemediafactory.net> References: <6.2.0.14.0.20050620165134.03b61140@pop.interactivemediafactory.net> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Alex Stapleton Subject: Re: autovacuum suggestions for 500,000,000+ row tables? Date: Mon, 20 Jun 2005 16:05:56 +0100 To: Jacques Caron X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/367 X-Sequence-Number: 13004 On 20 Jun 2005, at 15:59, Jacques Caron wrote: > Hi, > > At 16:44 20/06/2005, Alex Stapleton wrote: > >> We never delete >> anything (well not often, and not much) from the tables, so I am not >> so worried about the VACUUM status >> > > DELETEs are not the only reason you might need to VACUUM. UPDATEs > are important as well, if not more. Tables that are constantly > updated (statistics, session data, queues...) really need to be > VACUUMed a lot. We UPDATE it even less often. > >> but I am wary of XID wraparound >> nuking us at some point if we don't sort vacuuming out so we VACUUM >> at least once every year ;) >> > > That would give you a maximum average of 31 transactions/sec... > Don't know if that's high or low for you. It's high as far as inserts go for us. It does them all at the end of each minute. > >> However not running ANALYZE for such huge >> periods of time is probably impacting the statistics accuracy >> somewhat, and I have seen some unusually slow queries at times. >> Anyway, does anyone think we might benefit from a more aggressive >> autovacuum configuration? >> > > ANALYZE is not a very expensive operation, however VACUUM can > definitely be a big strain and take a looooong time on big tables, > depending on your setup. I've found that partitioning tables (at > the application level) can be quite helpful if you manage to keep > each partition to a reasonable size (under or close to available > memory), especially if the partitioning scheme is somehow time- > related. YMMV. > > Jacques. That's not currently an option as it would require a pretty large amount of work to implement. I think we will have to keep that in mind though. From pgsql-performance-owner@postgresql.org Mon Jun 20 12: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 7CB9852822 for ; Mon, 20 Jun 2005 12:20:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67681-07 for ; Mon, 20 Jun 2005 15:20:45 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id 68D8652814 for ; Mon, 20 Jun 2005 12:20:43 -0300 (ADT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.3/8.12.9) with ESMTP id j5KFKeRm007341; (envelope-from ) Mon, 20 Jun 2005 10:20:40 -0500 (CDT) Received: from [192.168.1.100] ([12.214.18.81]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j5KFKZI1011642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Mon, 20 Jun 2005 10:20:40 -0500 (CDT) Message-ID: <42B6DEC5.3080008@arbash-meinel.com> Date: Mon, 20 Jun 2005 10:20:37 -0500 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alex Stapleton , Postgresql Performance Subject: Re: autovacuum suggestions for 500,000,000+ row tables? References: <6.2.0.14.0.20050620165134.03b61140@pop.interactivemediafactory.net> In-Reply-To: X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigA84180580675F413A1EE46C6" X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV version 0.83, clamav-milter version 0.83 on clamav.icaen.uiowa.edu X-Virus-Status: Clean 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: 200506/368 X-Sequence-Number: 13005 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA84180580675F413A1EE46C6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Alex Stapleton wrote: > > On 20 Jun 2005, at 15:59, Jacques Caron wrote: > ... >> ANALYZE is not a very expensive operation, however VACUUM can >> definitely be a big strain and take a looooong time on big tables, >> depending on your setup. I've found that partitioning tables (at the >> application level) can be quite helpful if you manage to keep each >> partition to a reasonable size (under or close to available memory), >> especially if the partitioning scheme is somehow time- related. YMMV. >> >> Jacques. > > > That's not currently an option as it would require a pretty large > amount of work to implement. I think we will have to keep that in > mind though. Remember, you can fake it with a low-level set of tables, and then wrap them into a UNION ALL view. So you get something like: CREATE VIEW orig_table AS SELECT * FROM table_2005_04 UNION ALL SELECT * FROM table_2005_05 UNION ALL SELECT * FROM table_2005_06 ... ; Then at least your individual operations are fast. As you insert, you can create a rule that on insert into orig_table do instead ... insert into table_2005_07 (or whatever the current table is). It takes a little bit of maintenance on the DB admin's part, since every month they have to create a new table, and then update all of the views and triggers. But it is pretty straightforward. If you are doing append-only inserting, then you have the nice feature that only the last table is ever modified, which means that the older tables don't really need to be vacuumed or analyzed. And even if you have to have each table modified as you go, you still can break up a VACUUM into only doing one of the sub tables at a time. I don't know you db schema, but I thought I would mention that true partitioning isn't implemented yet, you can still get something very similar with views, triggers and rules. John =:-> --------------enigA84180580675F413A1EE46C6 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 iD8DBQFCtt7FJdeBCYSNAAMRArhQAJ9pCuosGdZek7n6zeCThnmbRMBfegCgsDuH DC8XMOqzWW3aPGUTm35yKI0= =feW3 -----END PGP SIGNATURE----- --------------enigA84180580675F413A1EE46C6-- From pgsql-performance-owner@postgresql.org Mon Jun 20 14:46: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 25F555280B for ; Mon, 20 Jun 2005 14:46:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01881-07 for ; Mon, 20 Jun 2005 17:46:24 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id C4FF85280F for ; Mon, 20 Jun 2005 14:46:23 -0300 (ADT) 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 7507562; Mon, 20 Jun 2005 10:48:30 -0700 From: Josh Berkus Organization: Aglio Database Solutions To: Alex Stapleton Subject: Re: autovacuum suggestions for 500,000,000+ row tables? Date: Mon, 20 Jun 2005 10:46:41 -0700 User-Agent: KMail/1.8 Cc: pgsql-performance@postgresql.org References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506201046.42062.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: 200506/369 X-Sequence-Number: 13006 Alex, > Hi, i'm trying to optimise our autovacuum configuration so that it > vacuums / analyzes some of our larger tables better. It has been set > to the default settings for quite some time. We never delete > anything (well not often, and not much) from the tables, so I am not > so worried about the VACUUM status, but I am wary of XID wraparound > nuking us at some point if we don't sort vacuuming out so we VACUUM > at least once every year ;) I personally don't use autovaccuum on very large databases. For DW, vacuuming is far better tied to ETL operations or a clock schedule of downtime. XID wraparound may be further away than you think. Try checking pg_controldata, which will give you the current XID, and you can calculate how long you are away from wraparound. I just tested a 200G data warehouse and figured out that we are 800 months away from wraparound, despite hourly ETL. > However not running ANALYZE for such huge > periods of time is probably impacting the statistics accuracy > somewhat, and I have seen some unusually slow queries at times. > Anyway, does anyone think we might benefit from a more aggressive > autovacuum configuration? Hmmm, good point, you could use autovacuum for ANALYZE only. Just set the VACUUM settings preposterously high (like 10x) so it never runs. Then it'll run ANALYZE only. I generally threshold 200, multiple 0.1x for analyze; that is, re-analyze after 200+10% of rows have changed. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jun 20 14:56: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 C452352814 for ; Mon, 20 Jun 2005 14:56:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06255-04 for ; Mon, 20 Jun 2005 17:56:02 +0000 (GMT) Received: from crestone.coronasolutions.com (crestone.coronasolutions.com [66.45.104.24]) by svr1.postgresql.org (Postfix) with ESMTP id 9E76F5280D for ; Mon, 20 Jun 2005 14:56:01 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by crestone.coronasolutions.com (Postfix) with ESMTP id BF88D644100 for ; Mon, 20 Jun 2005 11:55:43 -0600 (MDT) Received: from crestone.coronasolutions.com ([127.0.0.1]) by localhost (crestone.coronasolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 26697-02 for ; Mon, 20 Jun 2005 11:55:43 -0600 (MDT) Received: from [192.168.1.100] (c-67-164-255-151.hsd1.co.comcast.net [67.164.255.151]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by crestone.coronasolutions.com (Postfix) with ESMTP id DD5FD6440FF for ; Mon, 20 Jun 2005 11:55:42 -0600 (MDT) Mime-Version: 1.0 (Apple Message framework v730) Content-Transfer-Encoding: 7bit Message-Id: <0B5C29FA-E949-447E-AEFE-A806E238F1C2@drivefaster.net> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-performance@postgresql.org From: Dan Harris Subject: investigating slow queries through pg_stat_activity Date: Mon, 20 Jun 2005 11:55:59 -0600 X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at drivefaster.net 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: 200506/370 X-Sequence-Number: 13007 I've got some queries generated by my application that will, for some reason, run forever until I kill the pid. Yet, when I run the queries manually to check them out, they usually work fine. To get more information about these queries, I'm writing a utility to take snapshots of pg_stat_activity every 5 minutes. If it finds a query that runs for longer than 15 minutes, it will trap the query so I can run 'explain analyze' on it and see where the weakness is. However, the problem I have is that pg_stat_activity only returns the first n (255?) characters of the SQL as "current_query", so it gets chopped off at the end. I would very much like to find out how I can get the *entire* query that is active. Is this possible? Also, I'm sure some people will respond with "turn on query logging".. I've explored that option and the formatting of the log file and the fact that EVERY query is logged is not what I'm after for this project. The "infinite-running" queries are unpredictable and may only happen once a week. Logging 24/7 in anticipation of one of these occurrences is not something I'd like to do. Thanks, Dan Harris From pgsql-performance-owner@postgresql.org Mon Jun 20 15:46: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 4AC99528B1 for ; Mon, 20 Jun 2005 15:46:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20719-03 for ; Mon, 20 Jun 2005 18:46:06 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id 295B252871 for ; Mon, 20 Jun 2005 15:46:04 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5KIjwp3012935; Mon, 20 Jun 2005 20:45:59 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050620204307.039e9e78@pop.interactivemediafactory.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Mon, 20 Jun 2005 20:45:54 +0200 To: Dan Harris From: Jacques Caron Subject: Re: investigating slow queries through Cc: pgsql-performance@postgresql.org In-Reply-To: <0B5C29FA-E949-447E-AEFE-A806E238F1C2@drivefaster.net> References: <0B5C29FA-E949-447E-AEFE-A806E238F1C2@drivefaster.net> 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.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/371 X-Sequence-Number: 13008 Hi, At 19:55 20/06/2005, Dan Harris wrote: >Also, I'm sure some people will respond with "turn on query >logging".. I've explored that option and the formatting of the log >file and the fact that EVERY query is logged is not what I'm after >for this project. You can log just those queries that take "a little bit too much time". See log_min_duration_statement in postgresql.conf. Set it really high, and you'll only get those queries you're after. Jacques. From pgsql-performance-owner@postgresql.org Mon Jun 20 16:11: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 4171A5289B for ; Mon, 20 Jun 2005 16:11:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22395-10 for ; Mon, 20 Jun 2005 19:11: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 37725528BD for ; Mon, 20 Jun 2005 16:11:43 -0300 (ADT) 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 j5KJBi1I019957; Mon, 20 Jun 2005 15:11:44 -0400 (EDT) To: Dan Harris Cc: pgsql-performance@postgresql.org Subject: Re: investigating slow queries through pg_stat_activity In-reply-to: <0B5C29FA-E949-447E-AEFE-A806E238F1C2@drivefaster.net> References: <0B5C29FA-E949-447E-AEFE-A806E238F1C2@drivefaster.net> Comments: In-reply-to Dan Harris message dated "Mon, 20 Jun 2005 11:55:59 -0600" Date: Mon, 20 Jun 2005 15:11:44 -0400 Message-ID: <19956.1119294704@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: 200506/372 X-Sequence-Number: 13009 Dan Harris writes: > However, the problem I have is that pg_stat_activity only returns the > first n (255?) characters of the SQL as "current_query", so it gets > chopped off at the end. I would very much like to find out how I can > get the *entire* query that is active. Is this possible? I think the limit is ~1000 characters in 8.0 and later. However, you can't realistically have "unlimited" because of constraints of the stats messaging mechanism. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jun 20 17:30: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 C4DC8528CB for ; Mon, 20 Jun 2005 17:30:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42483-06 for ; Mon, 20 Jun 2005 20:30:47 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by svr1.postgresql.org (Postfix) with ESMTP id D487D528AA for ; Mon, 20 Jun 2005 17:30:45 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so893738wra for ; Mon, 20 Jun 2005 13:30:47 -0700 (PDT) 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:content-disposition:references; b=tSoACs/pv6rgd0V+nEcvavJgyBrSHQP9dGD/DG6jgCVScVQ5Y5lkZC/RxqiFZ0192LhWs3Xyxq84m5c2LoHeqjuJOBj7KvinqLh/DxInr6YCezwGlfC83Y/zBrDJ25/DaUp6+Ev1mLxR2HT6QLbraiqgjCXWfKW9KQLKlYnDHt4= Received: by 10.54.145.8 with SMTP id s8mr1175766wrd; Mon, 20 Jun 2005 13:30:40 -0700 (PDT) Received: by 10.54.96.18 with HTTP; Mon, 20 Jun 2005 13:30:38 -0700 (PDT) Message-ID: <6744b38505062013302b4f1864@mail.gmail.com> Date: Mon, 20 Jun 2005 15:30:38 -0500 From: George Essig Reply-To: George Essig To: Dan Harris Subject: Re: investigating slow queries through pg_stat_activity Cc: pgsql-performance@postgresql.org In-Reply-To: <0B5C29FA-E949-447E-AEFE-A806E238F1C2@drivefaster.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <0B5C29FA-E949-447E-AEFE-A806E238F1C2@drivefaster.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.072 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/373 X-Sequence-Number: 13010 On 6/20/05, Dan Harris wrote: > Also, I'm sure some people will respond with "turn on query > logging".. I've explored that option and the formatting of the log > file and the fact that EVERY query is logged is not what I'm after > for this project. =20 You don't have to log every query. You can set log_min_duration_statement in postgresql.conf to log only the queries that exceed a certain amount of time. From the manual at http://www.postgresql.org/docs/8.0/static/runtime-config.html: log_min_duration_statement (integer) Sets a minimum statement execution time (in milliseconds) that causes a statement to be logged. All SQL statements that run for the time specified or longer will be logged with their duration. Setting this to zero will print all queries and their durations. Minus-one (the default) disables the feature. For example, if you set it to 250 then all SQL statements that run 250ms or longer will be logged. Enabling this option can be useful in tracking down unoptimized queries in your applications. Only superusers can change this setting. George Essig From pgsql-performance-owner@postgresql.org Tue Jun 28 02:06: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 58DAB52886 for ; Tue, 21 Jun 2005 04:42:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86914-05 for ; Tue, 21 Jun 2005 07:42:30 +0000 (GMT) Received: from web8304.mail.in.yahoo.com (web8304.mail.in.yahoo.com [202.43.219.216]) by svr1.postgresql.org (Postfix) with SMTP id 643475284B for ; Tue, 21 Jun 2005 04:42:27 -0300 (ADT) Received: (qmail 39684 invoked by uid 60001); 21 Jun 2005 07:42:23 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=CQ7NkrOBgn0QL73fKUCFY6GUy7Eqqt/3QnhxjjbmBdqs1Fn9QxOcKP/20kDM88m9a2150UVKTHy2f/Ph6lmv7xZNnPCCoR8sWRRdHUjZOM13VOt+mgelECNN7OIRPb6eWtWTpbBDKGSIxa5/jPbLaKw0PPyMSdU0S3J0n+Cbmaw= ; Message-ID: <20050621074223.39682.qmail@web8304.mail.in.yahoo.com> Received: from [203.101.103.131] by web8304.mail.in.yahoo.com via HTTP; Tue, 21 Jun 2005 08:42:23 BST Date: Tue, 21 Jun 2005 08:42:23 +0100 (BST) From: Rohit Gaddi Subject: index selection by query planner To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1934434149-1119339743=:39461" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.831 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, HTML_20_30, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200506/533 X-Sequence-Number: 13170 --0-1934434149-1119339743=:39461 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, I have a table with two indices on the same column, one of which is a partial index. I would like the query planner to use the partial index whenever the query condition lies in the range of the partial index as it would yield better performance. Is there any way to enforce the ordering for the indices? How does the query planner decide which index to use when a particular query is fired? 'Explain Analyze' showed the total index being used in a situation that could be fulfiled by the partial index. Thanks, Rohit --------------------------------- How much free photo storage do you get? Store your friends n family photos for FREE with Yahoo! Photos. http://in.photos.yahoo.com --0-1934434149-1119339743=:39461 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi,
 
I have a table with two indices on the same column, one of which is a partial index. I would like the query planner to use the partial index whenever the query condition lies in the range of the partial index as it would yield better performance. Is there any way to enforce the ordering for the indices? How does the query planner decide which index to use when a particular query is fired?  'Explain Analyze' showed the total index being used in a situation that could be fulfiled by the partial index.
 
Thanks,
Rohit


How much free photo storage do you get? Store your friends n family photos for FREE with Yahoo! Photos.
http://in.photos.yahoo.com --0-1934434149-1119339743=:39461-- From pgsql-performance-owner@postgresql.org Tue Jun 28 02:06: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 2D30E5285C for ; Tue, 21 Jun 2005 04:49:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88055-10 for ; Tue, 21 Jun 2005 07:48:59 +0000 (GMT) Received: from web8306.mail.in.yahoo.com (web8306.mail.in.yahoo.com [202.43.219.218]) by svr1.postgresql.org (Postfix) with SMTP id 2E5F95283D for ; Tue, 21 Jun 2005 04:48:57 -0300 (ADT) Received: (qmail 77675 invoked by uid 60001); 21 Jun 2005 07:48:55 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=K+8rMQXCyhWfYQKhG3ayqeBRRJt0fZozX8wjLLsgZK0YXDed58c7bwCI/DYsqazXAp7FajyhmIpfwavXFSHimm2wojljhmfdkLTD0IZqKGzYo4o6takvhDoGusysT8hEErdPbFMhYtWrH0x8MMinFln2SWLkCkzo5QSvHOgtDP0= ; Message-ID: <20050621074855.77673.qmail@web8306.mail.in.yahoo.com> Received: from [203.101.103.131] by web8306.mail.in.yahoo.com via HTTP; Tue, 21 Jun 2005 08:48:50 BST Date: Tue, 21 Jun 2005 08:48:50 +0100 (BST) From: Rohit Gaddi Subject: index selection by query planner To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1461443420-1119340130=:76391" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.769 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, HTML_10_20, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200506/532 X-Sequence-Number: 13169 --0-1461443420-1119340130=:76391 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, I have a table with two indices on the same column, one of which is a partial index. I would like the query planner to use the partial index whenever the query condition lies in the range of the partial index as it would yield better performance. Is there any way to enforce the ordering for the indices? How does the query planner decide which index to use when a particular query is fired? 'Explain Analyze' showed the total index being used in a situation that could be fulfiled by the partial index. Thanks, Rohit --------------------------------- How much free photo storage do you get? Store your friends n family photos for FREE with Yahoo! Photos. http://in.photos.yahoo.com --0-1461443420-1119340130=:76391 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi,
 
I have a table with two indices on the same column, one of which is a partial index. I would like the query planner to use the partial index whenever the query condition lies in the range of the partial index as it would yield better performance. Is there any way to enforce the ordering for the indices? How does the query planner decide which index to use when a particular query is fired?  'Explain Analyze' showed the total index being used in a situation that could be fulfiled by the partial index.
 
Thanks,
Rohit


How much free photo storage do you get? Store your friends n family photos for FREE with Yahoo! Photos.
http://in.photos.yahoo.com --0-1461443420-1119340130=:76391-- From pgsql-performance-owner@postgresql.org Tue Jun 21 07:05: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 3BDE0528C3 for ; Tue, 21 Jun 2005 07:05:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17804-07 for ; Tue, 21 Jun 2005 10:04:57 +0000 (GMT) Received: from mail49.messagelabs.com (mail49.messagelabs.com [193.109.255.19]) by svr1.postgresql.org (Postfix) with SMTP id A376252886 for ; Tue, 21 Jun 2005 07:04:52 -0300 (ADT) X-VirusChecked: Checked X-Env-Sender: alexs@advfn.com X-Msg-Ref: server-7.tower-49.messagelabs.com!1119348291!19708296!1 X-StarScan-Version: 5.4.15; banners=-,-,- X-Originating-IP: [212.161.99.149] Received: (qmail 10259 invoked from network); 21 Jun 2005 10:04:51 -0000 Received: from mail.advfn.com (212.161.99.149) by server-7.tower-49.messagelabs.com with SMTP; 21 Jun 2005 10:04:51 -0000 Received: from [213.86.19.101] (helo=[192.168.0.185]) by mail.advfn.com with esmtp (Exim 4.22) id 1Dkfce-00044Z-3f; Tue, 21 Jun 2005 11:04:48 +0100 In-Reply-To: <200506201046.42062.josh@agliodbs.com> References: <200506201046.42062.josh@agliodbs.com> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <7E161634-29A0-4DBC-A303-3675D705A965@advfn.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Alex Stapleton Subject: Re: autovacuum suggestions for 500,000,000+ row tables? Date: Tue, 21 Jun 2005 11:04:45 +0100 To: Josh Berkus X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/374 X-Sequence-Number: 13011 On 20 Jun 2005, at 18:46, Josh Berkus wrote: > Alex, > > > >> Hi, i'm trying to optimise our autovacuum configuration so that it >> vacuums / analyzes some of our larger tables better. It has been set >> to the default settings for quite some time. We never delete >> anything (well not often, and not much) from the tables, so I am not >> so worried about the VACUUM status, but I am wary of XID wraparound >> nuking us at some point if we don't sort vacuuming out so we VACUUM >> at least once every year ;) >> >> > > I personally don't use autovaccuum on very large databases. For DW, > vacuuming is far better tied to ETL operations or a clock schedule of > downtime. > Downtime is something I'd rather avoid if possible. Do you think we will need to run VACUUM FULL occasionally? I'd rather not lock tables up unless I cant avoid it. We can probably squeeze an automated vacuum tied to our data inserters every now and then though. > XID wraparound may be further away than you think. Try checking > pg_controldata, which will give you the current XID, and you can > calculate > how long you are away from wraparound. I just tested a 200G data > warehouse > and figured out that we are 800 months away from wraparound, > despite hourly > ETL. > Is this an 8.0 thing? I don't have a pg_controldata from what I can see. Thats nice to hear though. > > > >> However not running ANALYZE for such huge >> periods of time is probably impacting the statistics accuracy >> somewhat, and I have seen some unusually slow queries at times. >> Anyway, does anyone think we might benefit from a more aggressive >> autovacuum configuration? >> >> > > Hmmm, good point, you could use autovacuum for ANALYZE only. Just > set the > VACUUM settings preposterously high (like 10x) so it never runs. > Then it'll > run ANALYZE only. I generally threshold 200, multiple 0.1x for > analyze; > that is, re-analyze after 200+10% of rows have changed. > I will try those settings out, that sounds good to me though. > -- > Josh Berkus > Aglio Database Solutions > San Francisco > > > From pgsql-performance-owner@postgresql.org Tue Jun 21 11:01: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 67DEB52881 for ; Tue, 21 Jun 2005 11:01:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08162-04 for ; Tue, 21 Jun 2005 14:01:26 +0000 (GMT) Received: from mail-relay1.tagaudit.com (unknown [69.64.214.4]) by svr1.postgresql.org (Postfix) with ESMTP id 09644528D0 for ; Tue, 21 Jun 2005 11:01:25 -0300 (ADT) Received: from mail-hub.tagaudit.com (dns2.tagaudit.com [192.168.3.32]) by mail-relay1.tagaudit.com (Postfix) with ESMTP id 65D08200000FB for ; Tue, 21 Jun 2005 10:01:29 -0400 (EDT) Received: by mail-hub.tagaudit.com (Postfix, from userid 8) id 5B43321FEF; Tue, 21 Jun 2005 10:01:29 -0400 (EDT) Received: from xeon400.tagaudit.com (xeon400.tagaudit.com [192.168.3.17]) by mail-hub.tagaudit.com (Postfix) with ESMTP id DFBDA21FF1 for ; Tue, 21 Jun 2005 10:01:28 -0400 (EDT) Received: by vpn.tagaudit.com with Internet Mail Service (5.5.2656.59) id ; Tue, 21 Jun 2005 10:01:28 -0400 Message-ID: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.com> From: Amit V Shah To: "'pgsql-performance@postgresql.org'" Subject: Do Views execute underlying query everytime ?? Date: Tue, 21 Jun 2005 10:01:21 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.35 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/375 X-Sequence-Number: 13012 Hi all, I have like a repository table with is very very huge with atleast a few hundreds of millions, may be over that. The information is stored in form of rows in these tables. I need to make that information wide based on some grouping and display them as columns on the screen. I am thinking of having a solution where I create views for each screen, which are just read only. However, I donot know if the query that creates the view is executed everytime I select something from the view. Because if that is the case, then I think my queries will again be slow. But if that is the way views work, then what would be the point in creating them .. Any suggestions, helps -- (Please pardon if this question should not be on performance forum) Thanks, Amit From pgsql-performance-owner@postgresql.org Tue Jun 21 11:34: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 9FB9B52812 for ; Tue, 21 Jun 2005 11:34:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15233-06 for ; Tue, 21 Jun 2005 14:33:56 +0000 (GMT) Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56]) by svr1.postgresql.org (Postfix) with ESMTP id 594C45290B for ; Tue, 21 Jun 2005 11:33:54 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by adicia.telenet-ops.be (Postfix) with SMTP id 247AC440DE for ; Tue, 21 Jun 2005 16:33:58 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by adicia.telenet-ops.be (Postfix) with ESMTP id 92F274422C for ; Tue, 21 Jun 2005 16:33:57 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: Content-Type: multipart/mixed; boundary=Apple-Mail-116--676684764 From: Yves Vindevogel Subject: Limit clause not using index Date: Tue, 21 Jun 2005 16:33:55 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/376 X-Sequence-Number: 13013 --Apple-Mail-116--676684764 Content-Type: multipart/alternative; boundary=Apple-Mail-117--676684764 --Apple-Mail-117--676684764 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Hi, I have a very simple query on a big table. When I issue a "limit" =20 and/or "offset" clause, the query is not using the index. Can anyone explain me this ? rvponp=3D# explain select * from tblprintjobs order by loginuser, =20 desceventdate, desceventtime offset 25 limit 25 ; QUERY PLAN ------------------------------------------------------------------------=20= ----------- Limit (cost=3D349860.62..349860.68 rows=3D25 width=3D206) -> Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) Sort Key: loginuser, desceventdate, desceventtime -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 = rows=3D622236 =20 width=3D206) (4 rows) rvponp=3D# explain select * from tblprintjobs order by loginuser, =20 desceventdate, desceventtime ; QUERY PLAN ------------------------------------------------------------------------=20= ----- Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) Sort Key: loginuser, desceventdate, desceventtime -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 =20= width=3D206) (3 rows) Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-117--676684764 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Hi, I have a very simple query on a big table. When I issue a "limit" and/or "offset" clause, the query is not using the index. Can anyone explain me this ? rvponp=3D# explain select * from tblprintjobs order by loginuser, desceventdate, desceventtime offset 25 limit 25 ; QUERY PLAN = =20 = --------------------------------------------------------------------------= --------- Limit (cost=3D349860.62..349860.68 rows=3D25 width=3D206) -> Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) Sort Key: loginuser, desceventdate, desceventtime -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 width=3D206) (4 rows) rvponp=3D# explain select * from tblprintjobs order by loginuser, desceventdate, desceventtime ; QUERY PLAN = =20 = --------------------------------------------------------------------------= --- Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) Sort Key: loginuser, desceventdate, desceventtime -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 width=3D206) (3 rows) Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-117--676684764-- --Apple-Mail-116--676684764 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tWO/+FjlKVWtfijTNRBsvDbhrdP3NUAwY38KFfkc0PuNjRWLLz8ytiTUVdVlnjlA2 MWPAWRAAM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7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-116--676684764 Content-Type: multipart/alternative; boundary=Apple-Mail-118--676684763 --Apple-Mail-118--676684763 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-118--676684763 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-118--676684763-- --Apple-Mail-116--676684764-- From pgsql-performance-owner@postgresql.org Tue Jun 21 11:40: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 80363528C7 for ; Tue, 21 Jun 2005 11:40:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16834-07 for ; Tue, 21 Jun 2005 14:40:33 +0000 (GMT) Received: from presinet-main.presinet.com (presinet.com [209.53.156.1]) by svr1.postgresql.org (Postfix) with ESMTP id 83AF6528B7 for ; Tue, 21 Jun 2005 11:40:30 -0300 (ADT) 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 MJ798NMT; Tue, 21 Jun 2005 07:36:42 -0700 Message-ID: <42B826E2.5080802@PresiNET.com> Date: Tue, 21 Jun 2005 07:40:34 -0700 From: Bricklen Anderson User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Limit clause not using index References: In-Reply-To: X-Enigmail-Version: 0.91.0.0 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.016 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/377 X-Sequence-Number: 13014 Yves Vindevogel wrote: > Hi, > > rvponp=# explain select * from tblprintjobs order by loginuser, > desceventdate, desceventtime offset 25 limit 25 ; > > I have a very simple query on a big table. When I issue a "limit" > and/or "offset" clause, the query is not using the index. > Can anyone explain me this ? Do you have an index on (loginuser,desceventdate,desceventtime)? -- _______________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. _______________________________ From pgsql-performance-owner@postgresql.org Tue Jun 21 11: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 665C4528BB for ; Tue, 21 Jun 2005 11:42:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20273-02 for ; Tue, 21 Jun 2005 14:42:41 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id EBFE7528B7 for ; Tue, 21 Jun 2005 11:42:39 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050621144240m9100nhjfhe>; Tue, 21 Jun 2005 14:42:40 +0000 Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id ABA1955FB6; Tue, 21 Jun 2005 09:42:39 -0500 (CDT) Message-ID: <42B8275C.8040300@arbash-meinel.com> Date: Tue, 21 Jun 2005 09:42:36 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Limit clause not using index References: In-Reply-To: X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig28E9E8563DA11CE837DE20EA" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.031 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/378 X-Sequence-Number: 13015 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig28E9E8563DA11CE837DE20EA Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Yves Vindevogel wrote: > Hi, > > I have a very simple query on a big table. When I issue a "limit"=20 > and/or "offset" clause, the query is not using the index. > Can anyone explain me this ? You didn't give enough information. What does you index look like that=20 you are expecting it to use? Generally, you want to have matching columns. So you would want CREATE INDEX blah ON tblprintjobs(loginuser, desceventdate, desceventtime= ); Next, you should post EXPLAIN ANALYZE instead of regular explain, so we=20 can have an idea if the planner is actually making correct estimations. John =3D:-> > > rvponp=3D# explain select * from tblprintjobs order by loginuser,=20 > desceventdate, desceventtime offset 25 limit 25 ; > QUERY PLAN > -----------------------------------------------------------------------= ------------=20 > > Limit (cost=3D349860.62..349860.68 rows=3D25 width=3D206) > -> Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) > Sort Key: loginuser, desceventdate, desceventtime > -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 width=3D= 206) > (4 rows) > > rvponp=3D# explain select * from tblprintjobs order by loginuser,=20 > desceventdate, desceventtime ; > QUERY PLAN > -----------------------------------------------------------------------= ------=20 > > Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) > Sort Key: loginuser, desceventdate, desceventtime > -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 width=3D= 206) > (3 rows) > > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > *Yves Vindevogel* > *Implements* --------------enig28E9E8563DA11CE837DE20EA 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCuCdfJdeBCYSNAAMRArOGAJ47wC9pDp+ZHjj9CsP69UQVCCabHgCfVz5J Pstlzi8Xqe0keB+sTv9lAgk= =Qudp -----END PGP SIGNATURE----- --------------enig28E9E8563DA11CE837DE20EA-- From pgsql-performance-owner@postgresql.org Tue Jun 21 11:43: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 0BBB252939 for ; Tue, 21 Jun 2005 11:43:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15414-09 for ; Tue, 21 Jun 2005 14:42:56 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id AA10B52806 for ; Tue, 21 Jun 2005 11:42:55 -0300 (ADT) 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 j5LEgrrp003416; Tue, 21 Jun 2005 10:42:53 -0400 (EDT) To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Limit clause not using index In-reply-to: References: Comments: In-reply-to Yves Vindevogel message dated "Tue, 21 Jun 2005 16:33:55 +0200" Date: Tue, 21 Jun 2005 10:42:53 -0400 Message-ID: <3415.1119364973@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: 200506/379 X-Sequence-Number: 13016 Yves Vindevogel writes: > Can anyone explain me this ? > rvponp=# explain select * from tblprintjobs order by loginuser, > desceventdate, desceventtime offset 25 limit 25 ; > QUERY PLAN > ------------------------------------------------------------------------ > ----------- > Limit (cost=349860.62..349860.68 rows=25 width=206) > -> Sort (cost=349860.56..351416.15 rows=622236 width=206) > Sort Key: loginuser, desceventdate, desceventtime > -> Seq Scan on tblprintjobs (cost=0.00..25589.36 rows=622236 width=206) > (4 rows) Do you have an index matching that sort key? I'd certainly expect the above to use it if it were there. For the full table case it's not so clear --- an indexscan isn't always better. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 21 11:45: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 0CCA352812 for ; Tue, 21 Jun 2005 11:45:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 22450-01 for ; Tue, 21 Jun 2005 14:45:17 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id 9B1E552949 for ; Tue, 21 Jun 2005 11:45:16 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so1297305wra for ; Tue, 21 Jun 2005 07:45:21 -0700 (PDT) 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:content-disposition:references; b=GJc0byNVMwYUptgwu7joXnzwqTYDBwPD6YgC3mZ2o3t3+GAXl8SSjLVC633Trh1pSkg9h5szRKLzqYdpdJeMw0nBAkgK8ldhsiQskhParXitdY0YRw/YLCf6kDyKDk5+XWqrAVGrOpStykcDdxzo/RkSzexfvQ/WzvOAqEqBnuQ= Received: by 10.54.141.13 with SMTP id o13mr1672627wrd; Tue, 21 Jun 2005 07:45:21 -0700 (PDT) Received: by 10.54.22.15 with HTTP; Tue, 21 Jun 2005 07:45:21 -0700 (PDT) Message-ID: Date: Tue, 21 Jun 2005 09:45:21 -0500 From: Matthew Nuzum Reply-To: newz@bearfruit.org To: Amit V Shah Subject: Re: Do Views execute underlying query everytime ?? Cc: "pgsql-performance@postgresql.org" In-Reply-To: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.096 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/380 X-Sequence-Number: 13017 On 6/21/05, Amit V Shah wrote: > Hi all, ... > I am thinking of having a solution where I create views for each screen, > which are just read only. >=20 > However, I donot know if the query that creates the view is executed > everytime I select something from the view. Because if that is the case, > then I think my queries will again be slow. But if that is the way views > work, then what would be the point in creating them .. >=20 > Any suggestions, helps -- They do get executed every time. I have a similar issue, but my data does not change very frequently, so instead of using a view, I create lookup tables to hold the data. So once a day I do something like this: drop lookup_table_1; create table lookup_table_1 as SELECT ...; In my case, rows are not deleted or updated, so I don't actually do a "drop table..." I merely add new records to the existing table, but if your data changes, the drop table technique can be faster than doing a delete or update. --=20 Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Tue Jun 21 11: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 17E5B5282E for ; Tue, 21 Jun 2005 11:50:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20273-06 for ; Tue, 21 Jun 2005 14:50:28 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 8C4AB52812 for ; Tue, 21 Jun 2005 11:50:23 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id B42F740C18C; Tue, 21 Jun 2005 15:50:16 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id D577715EDB; Tue, 21 Jun 2005 15:48:42 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 00843-06; Tue, 21 Jun 2005 15:48:40 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 16FDC15ED6; Tue, 21 Jun 2005 15:48:40 +0100 (BST) Message-ID: <42B828C7.8040402@archonet.com> Date: Tue, 21 Jun 2005 15:48:39 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Amit V Shah Cc: "'pgsql-performance@postgresql.org'" Subject: Re: Do Views execute underlying query everytime ?? References: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.com> In-Reply-To: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.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.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/382 X-Sequence-Number: 13019 Amit V Shah wrote: > Hi all, > > I have like a repository table with is very very huge with atleast a few > hundreds of millions, may be over that. The information is stored in form of > rows in these tables. I need to make that information wide based on some > grouping and display them as columns on the screen. > > I am thinking of having a solution where I create views for each screen, > which are just read only. > > However, I donot know if the query that creates the view is executed > everytime I select something from the view. Because if that is the case, > then I think my queries will again be slow. But if that is the way views > work, then what would be the point in creating them .. That's exactly how they work. You'd still want them because they let you simplify access control (user A can only see some rows, user B can see all rows) or just make your queries simpler. Sounds like you want what is known as a "materialised view" which is basically a summary table that is kept up to date by triggers. You query the table instead of actually recalculating every time. Perhaps google for "postgresql materialized view" (you might want a "z" or "s" in materialised). -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Tue Jun 21 11:49: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 857F052881 for ; Tue, 21 Jun 2005 11:49:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18800-09 for ; Tue, 21 Jun 2005 14:49:29 +0000 (GMT) Received: from mail-relay1.tagaudit.com (unknown [69.64.214.4]) by svr1.postgresql.org (Postfix) with ESMTP id D10385283A for ; Tue, 21 Jun 2005 11:49:25 -0300 (ADT) Received: from mail-hub.tagaudit.com (dns2.tagaudit.com [192.168.3.32]) by mail-relay1.tagaudit.com (Postfix) with ESMTP id F39DA200000B8 for ; Tue, 21 Jun 2005 10:49:30 -0400 (EDT) Received: by mail-hub.tagaudit.com (Postfix, from userid 8) id E5A6022009; Tue, 21 Jun 2005 10:49:30 -0400 (EDT) Received: from xeon400.tagaudit.com (xeon400.tagaudit.com [192.168.3.17]) by mail-hub.tagaudit.com (Postfix) with ESMTP id C4CAB11362; Tue, 21 Jun 2005 10:49:30 -0400 (EDT) Received: by vpn.tagaudit.com with Internet Mail Service (5.5.2656.59) id ; Tue, 21 Jun 2005 10:49:30 -0400 Message-ID: <0C072E7CC947D511AC9600A0CC7341200256CF52@vpn.tagaudit.com> From: Amit V Shah To: "'newz@bearfruit.org'" Cc: pgsql-performance@postgresql.org Subject: Re: Do Views execute underlying query everytime ?? Date: Tue, 21 Jun 2005 10:49:28 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.35 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/381 X-Sequence-Number: 13018 After I sent out this email, I found this article from google http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html Looks like we can control as to when the views refresh... I am still kind of confused, and would appreciate help !! The create/drop table does sound a solution that can work, but the thing is I want to get manual intervention out, and besides, my work flow is very complex so this might not be an option for me :-( Thanks, Amit -----Original Message----- From: Matthew Nuzum [mailto:mattnuzum@gmail.com] Sent: Tuesday, June 21, 2005 10:45 AM To: Amit V Shah Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Do Views execute underlying query everytime ?? On 6/21/05, Amit V Shah wrote: > Hi all, ... > I am thinking of having a solution where I create views for each screen, > which are just read only. > > However, I donot know if the query that creates the view is executed > everytime I select something from the view. Because if that is the case, > then I think my queries will again be slow. But if that is the way views > work, then what would be the point in creating them .. > > Any suggestions, helps -- They do get executed every time. I have a similar issue, but my data does not change very frequently, so instead of using a view, I create lookup tables to hold the data. So once a day I do something like this: drop lookup_table_1; create table lookup_table_1 as SELECT ...; In my case, rows are not deleted or updated, so I don't actually do a "drop table..." I merely add new records to the existing table, but if your data changes, the drop table technique can be faster than doing a delete or update. -- Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Tue Jun 21 11:58: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 C61A752886 for ; Tue, 21 Jun 2005 11:58:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25212-06 for ; Tue, 21 Jun 2005 14:58:03 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id E273552849 for ; Tue, 21 Jun 2005 11:57:59 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id 7D18A38134 for ; Tue, 21 Jun 2005 16:57:54 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id BDD1838111 for ; Tue, 21 Jun 2005 16:57:53 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <3415.1119364973@sss.pgh.pa.us> References: <3415.1119364973@sss.pgh.pa.us> Content-Type: multipart/mixed; boundary=Apple-Mail-126--675248734 Message-Id: <9ac61d6f11f3a4305ffe3ca81e3acce8@implements.be> From: Yves Vindevogel Subject: Re: Limit clause not using index Date: Tue, 21 Jun 2005 16:57:51 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/383 X-Sequence-Number: 13020 --Apple-Mail-126--675248734 Content-Type: multipart/alternative; boundary=Apple-Mail-127--675248733 --Apple-Mail-127--675248733 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed These are my indexes create index ixprintjobsapplicationtype on tblPrintjobs =20 (applicationtype); create index ixprintjobsdesceventdate on tblPrintjobs = (desceventdate); create index ixprintjobsdesceventtime on tblPrintjobs = (desceventtime); create index ixprintjobsdescpages on tblPrintjobs (descpages); create index ixprintjobsdocumentname on tblPrintjobs = (documentname) ; create index ixprintjobseventcomputer on tblPrintjobs = (eventcomputer); create index ixprintjobseventdate on tblPrintjobs (eventdate); create index ixprintjobseventtime on tblPrintjobs (eventtime); create index ixprintjobseventuser on tblPrintjobs (eventuser); create index ixprintjobshostname on tblPrintjobs (hostname) ; create index ixprintjobsipaddress on tblPrintjobs (ipaddress) ; create index ixprintjobsloginuser on tblPrintjobs (loginuser) ; create index ixprintjobspages on tblPrintjobs (pages) ; create index ixprintjobsprintport on tblPrintjobs (printport) ; create index ixprintjobsprintqueue on tblPrintjobs (printqueue) = ; create index ixprintjobsrecordnumber on tblPrintjobs = (recordnumber) ; create index ixprintjobssize on tblPrintjobs (size) ; create index ixprintjobsusertype on tblPrintjobs (usertype) ; create index ixPrintjobsDescpagesDocumentname on tblPrintjobs =20= (descpages, documentname) ; create index = ixPrintjobsHostnamePrintqueueDesceventdateDesceventtime =20 on tblPrintjobs (hostname, printqueue, desceventdate, desceventtime) ; create index ixPrintjobsLoginDescEventdateDesceventtime on =20 tblPrintjobs (loginuser, desceventdate, desceventtime) ; On 21 Jun 2005, at 16:42, Tom Lane wrote: > Yves Vindevogel writes: >> Can anyone explain me this ? > >> rvponp=3D# explain select * from tblprintjobs order by loginuser, >> desceventdate, desceventtime offset 25 limit 25 ; >> QUERY PLAN >> = ----------------------------------------------------------------------=20= >> -- >> ----------- >> Limit (cost=3D349860.62..349860.68 rows=3D25 width=3D206) >> -> Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) >> Sort Key: loginuser, desceventdate, desceventtime >> -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 =20 >> rows=3D622236 width=3D206) >> (4 rows) > > > Do you have an index matching that sort key? I'd certainly expect the > above to use it if it were there. For the full table case it's not so > clear --- an indexscan isn't always better. > > regards, tom lane > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-127--675248733 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 These are my indexes create index ixprintjobsapplicationtype on tblPrintjobs (applicationtype); create index ixprintjobsdesceventdate on tblPrintjobs = (desceventdate); create index ixprintjobsdesceventtime on tblPrintjobs = (desceventtime); create index ixprintjobsdescpages on tblPrintjobs (descpages); =20= create index ixprintjobsdocumentname on tblPrintjobs = (documentname) ; =20 create index ixprintjobseventcomputer on tblPrintjobs (eventcomputer);=20 create index ixprintjobseventdate on tblPrintjobs (eventdate); = =20 create index ixprintjobseventtime on tblPrintjobs (eventtime); =20= create index ixprintjobseventuser on tblPrintjobs (eventuser); =20= create index ixprintjobshostname on tblPrintjobs (hostname) ; = =20 create index ixprintjobsipaddress on tblPrintjobs (ipaddress) ; create index ixprintjobsloginuser on tblPrintjobs (loginuser) ; = =20 create index ixprintjobspages on tblPrintjobs (pages) ; =20 create index ixprintjobsprintport on tblPrintjobs (printport) ; = =20 create index ixprintjobsprintqueue on tblPrintjobs (printqueue) = ; =20 create index ixprintjobsrecordnumber on tblPrintjobs = (recordnumber) ; =20 create index ixprintjobssize on tblPrintjobs (size) ; =20 create index ixprintjobsusertype on tblPrintjobs (usertype) ; =20= create index ixPrintjobsDescpagesDocumentname on tblPrintjobs (descpages, documentname) ; create index = ixPrintjobsHostnamePrintqueueDesceventdateDesceventtime on tblPrintjobs (hostname, printqueue, desceventdate, desceventtime) ; create index ixPrintjobsLoginDescEventdateDesceventtime on tblPrintjobs (loginuser, desceventdate, desceventtime) ; On 21 Jun 2005, at 16:42, Tom Lane wrote: Yves Vindevogel < writes: Can anyone explain me this ? rvponp=3D# explain select * from tblprintjobs order by loginuser, =20 desceventdate, desceventtime offset 25 limit 25 ; QUERY PLAN ------------------------------------------------------------------------=20= ----------- Limit (cost=3D349860.62..349860.68 rows=3D25 width=3D206) -> Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) Sort Key: loginuser, desceventdate, desceventtime -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 width=3D206) (4 rows) Do you have an index matching that sort key? I'd certainly expect the above to use it if it were there. For the full table case it's not so clear --- an indexscan isn't always better. regards, tom lane Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-127--675248733-- --Apple-Mail-126--675248734 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvW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IsIOCiCJb2CQB0D+H+FEE0LoEYEGTOCgCGEKH/2uMrGfI8GEF7RyIWHwOoH+CEBptU EaEITOFCEyLOF0FoJr16aUDpb9fbH+GAF0RSz2KgCABjdACSB4ED3V3YH+C8CjbCFAEwLP006EG8 G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-126--675248734 Content-Type: multipart/alternative; boundary=Apple-Mail-128--675248732 --Apple-Mail-128--675248732 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-128--675248732 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-128--675248732-- --Apple-Mail-126--675248734-- From pgsql-performance-owner@postgresql.org Tue Jun 21 12:00: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 7CFAA52806 for ; Tue, 21 Jun 2005 12:00:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23035-09 for ; Tue, 21 Jun 2005 15:00:13 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 4D6B5528BB for ; Tue, 21 Jun 2005 12:00:12 -0300 (ADT) Received: (qmail 10342 invoked from network); 21 Jun 2005 17:00:26 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 21 Jun 2005 17:00:26 +0200 Date: Tue, 21 Jun 2005 17:00:10 +0200 To: "Amit V Shah" , "'pgsql-performance@postgresql.org'" Subject: Re: Do Views execute underlying query everytime ?? References: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.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: <0C072E7CC947D511AC9600A0CC7341200256CF51@vpn.tagaudit.com> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/384 X-Sequence-Number: 13021 > However, I donot know if the query that creates the view is executed > everytime I select something from the view. Because if that is the case, > then I think my queries will again be slow. But if that is the way views > work, then what would be the point in creating them .. Views are more for when you have a query which keeps coming a zillion time in your application like : SELECT p.*, pd.* FROM products p, products_names pd WHERE p.id=pd.id AND pd.language=... You create a view like : CREATE VIEW products_with_name AS SELECT p.*, pd.* FROM products p, products_names pd WHERE p.id=pd.id And then you : SELECT * FROM products_with_name WHERE id=... AND language=... It saves a lot of headache and typing over and over again the same thing, and you can tell your ORM library to use them, too. But for your application, they're useless, You should create a "materialized view"... which is just a table and update it from a CRON job. You can still use a view to fill your table, and as a way to hold your query, so the cron job doesn't have to issue real queries, just filling tables from views : CREATE VIEW cached_stuff_view AS ... And once in while : BEGIN; DROP TABLE cached_stuff; CREATE TABLE cached_stuff AS SELECT * FROM cached_stuff_view; CREATE INDEX ... ON cached_stuff( ... ) COMMIT; ANALYZE cached_stuff; Or : BEGIN; TRUNCATE cached_stuff; INSERT INTO cached_stuff SELECT * FROM cached_stuff_view; COMMIT; ANALYZE cached_stuff; If you update your entire table it's faster to just junk it or truncate it then recreate it, but maybe you'd prefer TRUNCATE which saves you from having to re-create of indexes... but it'll be faster if you drop the indexes and re-create them afterwards anyway instead of them being updated for each row inserted. So I'd say DROP TABLE. From pgsql-performance-owner@postgresql.org Tue Jun 21 12:01: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 BFE5A52886 for ; Tue, 21 Jun 2005 12:01:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26974-06 for ; Tue, 21 Jun 2005 15:01:18 +0000 (GMT) Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) by svr1.postgresql.org (Postfix) with ESMTP id AFCCB528B7 for ; Tue, 21 Jun 2005 12:01:16 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP id <20050621150114m92008icd1e>; Tue, 21 Jun 2005 15:01:14 +0000 Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 7598C55FB6; Tue, 21 Jun 2005 10:01:13 -0500 (CDT) Message-ID: <42B82BB9.8030300@arbash-meinel.com> Date: Tue, 21 Jun 2005 10:01:13 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Amit V Shah Cc: "'newz@bearfruit.org'" , pgsql-performance@postgresql.org Subject: Re: Do Views execute underlying query everytime ?? References: <0C072E7CC947D511AC9600A0CC7341200256CF52@vpn.tagaudit.com> In-Reply-To: <0C072E7CC947D511AC9600A0CC7341200256CF52@vpn.tagaudit.com> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig1E626FEEF2121DE541C36B1C" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.033 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/385 X-Sequence-Number: 13022 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig1E626FEEF2121DE541C36B1C Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Amit V Shah wrote: >After I sent out this email, I found this article from google > >http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html > >Looks like we can control as to when the views refresh... I am still kind of >confused, and would appreciate help !! > >The create/drop table does sound a solution that can work, but the thing is >I want to get manual intervention out, and besides, my work flow is very >complex so this might not be an option for me :-( > >Thanks, >Amit > Just to make it clear, a view is not the same as a materialized view. A view is just a set of rules to the planner so that it can simplify interactions with the database. A materialized view is a query which has been saved into a table. To set it up properly, really depends on what your needs are. 1. How much time can elapse between an update to the system, and an update to the materialized views? 2. How many updates / (sec, min, hour, month) do you expect. Is insert performance critical, or secondary. For instance, if you get a lot of updates, but you can have a 1 hour lag between the time a new row is inserted and the view is updated, you can just create a cron job that runs every hour to regenerate the materialized view. If you don't get many updates, but you need them to show up right away, then you can add triggers to the affected tables, such that inserting/updating to a specific table causes an update to the materialized view. There are quite a few potential tradeoffs. Rather than doing a materialized view, you could just improve your filters. If you are doing a query to show people the results, you generally have some sort of upper bound on how much data you can display. Humans don't like reading more than 100 or 1000 rows. So create your normal query, and just take on a LIMIT 100 at the end. If you structure your query properly, and have appropriate indexes, you should be able to make the LIMIT count, and allow you to save a lot of overhead of generating rows that you don't use. I would probably start by posting the queries you are currently using, along with an EXPLAIN ANALYZE, and a description of what you actually need from the query. Then this list can be quite helpful in restructuring your query to make it faster. John =:-> --------------enig1E626FEEF2121DE541C36B1C 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCuCu5JdeBCYSNAAMRAtbMAJ9MsgkcLLiAacWYjlWnT356mVmvcQCgocRv N1bGrwwkpZ/+DQ799UUxnJA= =86jf -----END PGP SIGNATURE----- --------------enig1E626FEEF2121DE541C36B1C-- From pgsql-performance-owner@postgresql.org Tue Jun 21 12:05: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 CDCE952812 for ; Tue, 21 Jun 2005 12:05:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30113-04 for ; Tue, 21 Jun 2005 15:05:21 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by svr1.postgresql.org (Postfix) with ESMTP id 4F7405280D for ; Tue, 21 Jun 2005 12:05:18 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so479104wri for ; Tue, 21 Jun 2005 08:05:18 -0700 (PDT) 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:content-disposition:references; b=KdKc5F8FMHhb6uvE4mPdXf6NuCA302lvIMoDoARoSTdVI+UVmpprVGoTaEt6cP14UvdWxToy/vOY1ffaF/DU/0RGeyCxJ0NpqO+55WxjK2dab4eKOFLcmMHLDw6ATTYXl/bq67lEiCbFodYKRN1hosTi1V0STqs2o85Ka0Ok+9o= Received: by 10.54.25.5 with SMTP id 5mr3232176wry; Tue, 21 Jun 2005 08:05:18 -0700 (PDT) Received: by 10.54.46.46 with HTTP; Tue, 21 Jun 2005 08:05:17 -0700 (PDT) Message-ID: <65569526050621080553350f62@mail.gmail.com> Date: Tue, 21 Jun 2005 08:05:17 -0700 From: Jone C Reply-To: Jone C To: pgsql-performance@postgresql.org Subject: Re: slow growing table In-Reply-To: <20050606171253.GA1655@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6556952605060609485c622403@mail.gmail.com> <20050606170037.GA1177@uio.no> <20050606171253.GA1655@uio.no> 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: 200506/386 X-Sequence-Number: 13023 > On second thought... Does a VACUUM FULL help? If so, you might want to > increase your FSM settings. Thank you for the reply, sorry for delay I was on holiday. I tried that it had no effect. I benchmarked 2x before, peformed VACUUM FULL on the table in question post inserts, then benchmarked 2x after. Same results... Should I try your suggestion on deleting the indexes? This table needs to be accessible for reads at all times however though... thank you kindly On 6/6/05, Steinar H. Gunderson wrote: > On Mon, Jun 06, 2005 at 07:00:37PM +0200, Steinar H. Gunderson wrote: > > You might have a problem with index bloat. Could you try REINDEXing the > > indexes on the table and see if that makes a difference? >=20 >=20 > /* Steinar */ > --=20 > Homepage: http://www.sesse.net/ >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From pgsql-performance-owner@postgresql.org Tue Jun 21 12:08: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 B722A5292B for ; Tue, 21 Jun 2005 12:08:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30172-04 for ; Tue, 21 Jun 2005 15:07:57 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id E10D35290B for ; Tue, 21 Jun 2005 12:07:56 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id 146A43802A for ; Tue, 21 Jun 2005 17:07:56 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id 3AEB8381D5 for ; Tue, 21 Jun 2005 17:07:55 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <42B8275C.8040300@arbash-meinel.com> References: <42B8275C.8040300@arbash-meinel.com> Content-Type: multipart/mixed; boundary=Apple-Mail-129--674646421 Message-Id: <7e514564b9a159480857de53cc1764fd@implements.be> From: Yves Vindevogel Subject: Re: Limit clause not using index Date: Tue, 21 Jun 2005 17:07:54 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/387 X-Sequence-Number: 13024 --Apple-Mail-129--674646421 Content-Type: multipart/alternative; boundary=Apple-Mail-130--674646421 --Apple-Mail-130--674646421 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed rvponp=3D# explain analyze select * from tblPrintjobs order by = loginuser, =20 desceventdate, desceventtime ; QUERY PLAN ------------------------------------------------------------------------=20= -------------------------------------------------------- Sort (cost=3D345699.06..347256.49 rows=3D622972 width=3D203) (actual =20= time=3D259438.952..268885.586 rows=3D622972 loops=3D1) Sort Key: loginuser, desceventdate, desceventtime -> Seq Scan on tblprintjobs (cost=3D0.00..25596.72 rows=3D622972 =20= width=3D203) (actual time=3D21.155..8713.810 rows=3D622972 loops=3D1) Total runtime: 271583.422 ms (4 rows) On 21 Jun 2005, at 16:42, John A Meinel wrote: > Yves Vindevogel wrote: > >> Hi, >> >> I have a very simple query on a big table. When I issue a "limit" =20 >> and/or "offset" clause, the query is not using the index. >> Can anyone explain me this ? > > You didn't give enough information. What does you index look like that = =20 > you are expecting it to use? > Generally, you want to have matching columns. So you would want > CREATE INDEX blah ON tblprintjobs(loginuser, desceventdate, =20 > desceventtime); > > Next, you should post EXPLAIN ANALYZE instead of regular explain, so =20= > we can have an idea if the planner is actually making correct =20 > estimations. > > John > =3D:-> > >> >> rvponp=3D# explain select * from tblprintjobs order by loginuser, =20 >> desceventdate, desceventtime offset 25 limit 25 ; >> QUERY PLAN >> = ----------------------------------------------------------------------=20= >> ------------- >> Limit (cost=3D349860.62..349860.68 rows=3D25 width=3D206) >> -> Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) >> Sort Key: loginuser, desceventdate, desceventtime >> -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 =20 >> width=3D206) >> (4 rows) >> >> rvponp=3D# explain select * from tblprintjobs order by loginuser, =20 >> desceventdate, desceventtime ; >> QUERY PLAN >> = ----------------------------------------------------------------------=20= >> ------- >> Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) >> Sort Key: loginuser, desceventdate, desceventtime >> -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 =20 >> width=3D206) >> (3 rows) >> >> Met vriendelijke groeten, >> Bien =E0 vous, >> Kind regards, >> >> *Yves Vindevogel* >> *Implements* > > > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-130--674646421 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 rvponp=3D# explain analyze select * from tblPrintjobs order by loginuser, desceventdate, desceventtime ;=20 QUERY PLAN = =20 = --------------------------------------------------------------------------= ------------------------------------------------------ Sort (cost=3D345699.06..347256.49 rows=3D622972 width=3D203) (actual time=3D259438.952..268885.586 rows=3D622972 loops=3D1) Sort Key: loginuser, desceventdate, desceventtime -> Seq Scan on tblprintjobs (cost=3D0.00..25596.72 rows=3D622972 width=3D203) (actual time=3D21.155..8713.810 rows=3D622972 loops=3D1) Total runtime: 271583.422 ms (4 rows) On 21 Jun 2005, at 16:42, John A Meinel wrote: Yves Vindevogel wrote: Hi, I have a very simple query on a big table. When I issue a "limit" and/or "offset" clause, the query is not using the index. Can anyone explain me this ? You didn't give enough information. What does you index look like that you are expecting it to use? Generally, you want to have matching columns. So you would want CREATE INDEX blah ON tblprintjobs(loginuser, desceventdate, desceventtime); Next, you should post EXPLAIN ANALYZE instead of regular explain, so we can have an idea if the planner is actually making correct estimations. John =3D:-> rvponp=3D# explain select * from tblprintjobs order by loginuser, desceventdate, desceventtime offset 25 limit 25 ; QUERY PLAN = --------------------------------------------------------------------------= ---------=20 Limit (cost=3D349860.62..349860.68 rows=3D25 width=3D206) -> Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) Sort Key: loginuser, desceventdate, desceventtime -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 = width=3D206) (4 rows) rvponp=3D# explain select * from tblprintjobs order by loginuser, desceventdate, desceventtime ; QUERY PLAN = --------------------------------------------------------------------------= ---=20 Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) Sort Key: loginuser, desceventdate, desceventtime -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 = width=3D206) (3 rows) Met vriendelijke groeten, Bien =E0 vous, Kind regards, *Yves Vindevogel* *Implements* Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-130--674646421-- --Apple-Mail-129--674646421 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F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CFAEwLP006EG8 G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-129--674646421 Content-Type: multipart/alternative; boundary=Apple-Mail-131--674646419 --Apple-Mail-131--674646419 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-131--674646419 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-131--674646419-- --Apple-Mail-129--674646421-- From pgsql-performance-owner@postgresql.org Tue Jun 21 12:10: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 400D8528B7 for ; Tue, 21 Jun 2005 12:10:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28817-06 for ; Tue, 21 Jun 2005 15:10:30 +0000 (GMT) Received: from poros.telenet-ops.be (poros.telenet-ops.be [195.130.132.44]) by svr1.postgresql.org (Postfix) with ESMTP id 7051B52886 for ; Tue, 21 Jun 2005 12:10:26 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by poros.telenet-ops.be (Postfix) with SMTP id 907023BC0F3 for ; Tue, 21 Jun 2005 17:10:25 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by poros.telenet-ops.be (Postfix) with ESMTP id C3D1C3BC143 for ; Tue, 21 Jun 2005 17:10:24 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <9ac61d6f11f3a4305ffe3ca81e3acce8@implements.be> References: <3415.1119364973@sss.pgh.pa.us> <9ac61d6f11f3a4305ffe3ca81e3acce8@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-132--674496785 Message-Id: <163f181d17f10b89bf136ab9a5a7a81c@implements.be> From: Yves Vindevogel Subject: Re: Limit clause not using index Date: Tue, 21 Jun 2005 17:10:23 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/388 X-Sequence-Number: 13025 --Apple-Mail-132--674496785 Content-Type: multipart/alternative; boundary=Apple-Mail-133--674496784 --Apple-Mail-133--674496784 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Nevermind guys .... There's an error in a function that is creating these indexes. The function never completed succesfully so the index is not there Very sorry about this !! On 21 Jun 2005, at 16:57, Yves Vindevogel wrote: > These are my indexes > > create index ixprintjobsapplicationtype on tblPrintjobs =20 > (applicationtype); > create index ixprintjobsdesceventdate on tblPrintjobs = (desceventdate); > create index ixprintjobsdesceventtime on tblPrintjobs = (desceventtime); > create index ixprintjobsdescpages on tblPrintjobs (descpages); > create index ixprintjobsdocumentname on tblPrintjobs = (documentname) ; > create index ixprintjobseventcomputer on tblPrintjobs = (eventcomputer); > create index ixprintjobseventdate on tblPrintjobs (eventdate); > create index ixprintjobseventtime on tblPrintjobs (eventtime); > create index ixprintjobseventuser on tblPrintjobs (eventuser); > create index ixprintjobshostname on tblPrintjobs (hostname) ; > create index ixprintjobsipaddress on tblPrintjobs (ipaddress) ; > create index ixprintjobsloginuser on tblPrintjobs (loginuser) ; > create index ixprintjobspages on tblPrintjobs (pages) ; > create index ixprintjobsprintport on tblPrintjobs (printport) ; > create index ixprintjobsprintqueue on tblPrintjobs (printqueue) = ; > create index ixprintjobsrecordnumber on tblPrintjobs = (recordnumber) ; > create index ixprintjobssize on tblPrintjobs (size) ; > create index ixprintjobsusertype on tblPrintjobs (usertype) ; > create index ixPrintjobsDescpagesDocumentname on tblPrintjobs =20= > (descpages, documentname) ; > create index = ixPrintjobsHostnamePrintqueueDesceventdateDesceventtime =20 > on tblPrintjobs (hostname, printqueue, desceventdate, desceventtime) ; > create index ixPrintjobsLoginDescEventdateDesceventtime on =20 > tblPrintjobs (loginuser, desceventdate, desceventtime) ; > > > On 21 Jun 2005, at 16:42, Tom Lane wrote: > >> Yves Vindevogel writes: >>> Can anyone explain me this ? >> >>> rvponp=3D# explain select * from tblprintjobs order by loginuser, >>> desceventdate, desceventtime offset 25 limit 25 ; >>> QUERY PLAN >>> = ---------------------------------------------------------------------=20 >>> --- >>> ----------- >>> Limit (cost=3D349860.62..349860.68 rows=3D25 width=3D206) >>> -> Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) >>> Sort Key: loginuser, desceventdate, desceventtime >>> -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 =20 >>> rows=3D622236 width=3D206) >>> (4 rows) >> >> >> Do you have an index matching that sort key? I'd certainly expect = the >> above to use it if it were there. For the full table case it's not = so >> clear --- an indexscan isn't always better. >> >> regards, tom lane >> >> > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > Yves Vindevogel > Implements > > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. = =20 > Then you win. > Mahatma Ghandi. > > ---------------------------(end of =20 > broadcast)--------------------------- > TIP 8: explain analyze is your friend > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-133--674496784 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Nevermind guys .... There's an error in a function that is creating these indexes. The function never completed succesfully so the index is not there Very sorry about this !! On 21 Jun 2005, at 16:57, Yves Vindevogel wrote: These are my indexes create index ixprintjobsapplicationtype on tblPrintjobs (applicationtype); create index ixprintjobsdesceventdate on tblPrintjobs = (desceventdate); create index ixprintjobsdesceventtime on tblPrintjobs = (desceventtime); create index ixprintjobsdescpages on tblPrintjobs (descpages); =20= create index ixprintjobsdocumentname on tblPrintjobs = (documentname) ; =20 create index ixprintjobseventcomputer on tblPrintjobs (eventcomputer);=20 create index ixprintjobseventdate on tblPrintjobs (eventdate); = =20 create index ixprintjobseventtime on tblPrintjobs (eventtime); =20= create index ixprintjobseventuser on tblPrintjobs (eventuser); =20= create index ixprintjobshostname on tblPrintjobs (hostname) ; = =20 create index ixprintjobsipaddress on tblPrintjobs (ipaddress) ; create index ixprintjobsloginuser on tblPrintjobs (loginuser) ; = =20 create index ixprintjobspages on tblPrintjobs (pages) ; =20 create index ixprintjobsprintport on tblPrintjobs (printport) ; = =20 create index ixprintjobsprintqueue on tblPrintjobs (printqueue) = ; =20 create index ixprintjobsrecordnumber on tblPrintjobs = (recordnumber) ; =20 create index ixprintjobssize on tblPrintjobs (size) ; =20 create index ixprintjobsusertype on tblPrintjobs (usertype) ; =20= create index ixPrintjobsDescpagesDocumentname on tblPrintjobs (descpages, documentname) ; create index = ixPrintjobsHostnamePrintqueueDesceventdateDesceventtime on tblPrintjobs (hostname, printqueue, desceventdate, desceventtime) ; create index ixPrintjobsLoginDescEventdateDesceventtime on tblPrintjobs (loginuser, desceventdate, desceventtime) ; On 21 Jun 2005, at 16:42, Tom Lane wrote: Yves Vindevogel < writes: Can anyone explain me this ? rvponp=3D# explain select * from tblprintjobs order by loginuser, =20 desceventdate, desceventtime offset 25 limit 25 ; QUERY PLAN ------------------------------------------------------------------------=20= ----------- Limit (cost=3D349860.62..349860.68 rows=3D25 width=3D206) -> Sort (cost=3D349860.56..351416.15 rows=3D622236 width=3D206) Sort Key: loginuser, desceventdate, desceventtime -> Seq Scan on tblprintjobs (cost=3D0.00..25589.36 rows=3D622236 width=3D206) (4 rows) Do you have an index matching that sort key? I'd certainly expect the above to use it if it were there. For the full table case it's not so clear --- an indexscan isn't always better. regards, tom lane Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements < Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma Ghandi. ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-133--674496784-- --Apple-Mail-132--674496785 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsO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HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-132--674496785 Content-Type: multipart/alternative; boundary=Apple-Mail-134--674496783 --Apple-Mail-134--674496783 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-134--674496783 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-134--674496783-- --Apple-Mail-132--674496785-- From pgsql-performance-owner@postgresql.org Tue Jun 21 12:14: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 0ADF852849 for ; Tue, 21 Jun 2005 12:14:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28620-09 for ; Tue, 21 Jun 2005 15:14:30 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id 509B3528BB for ; Tue, 21 Jun 2005 12:14:29 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050621151429m9100nh2uoe>; Tue, 21 Jun 2005 15:14:29 +0000 Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 218EB55FB6; Tue, 21 Jun 2005 10:14:26 -0500 (CDT) Message-ID: <42B82ED0.1010009@arbash-meinel.com> Date: Tue, 21 Jun 2005 10:14:24 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Limit clause not using index References: <42B8275C.8040300@arbash-meinel.com> <7e514564b9a159480857de53cc1764fd@implements.be> In-Reply-To: <7e514564b9a159480857de53cc1764fd@implements.be> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigFC724075688C16CC1C852EB9" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/389 X-Sequence-Number: 13026 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigFC724075688C16CC1C852EB9 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Yves Vindevogel wrote: > rvponp=# explain analyze select * from tblPrintjobs order by > loginuser, desceventdate, desceventtime ; > QUERY PLAN > -------------------------------------------------------------------------------------------------------------------------------- > > Sort (cost=345699.06..347256.49 rows=622972 width=203) (actual > time=259438.952..268885.586 rows=622972 loops=1) > Sort Key: loginuser, desceventdate, desceventtime > -> Seq Scan on tblprintjobs (cost=0.00..25596.72 rows=622972 > width=203) (actual time=21.155..8713.810 rows=622972 loops=1) > Total runtime: 271583.422 ms > (4 rows) Can you post it with the limit? I realize the query takes a long time, but that is the more important query to look at. Also, just as a test, if you can, try dropping most of the indexes except for the important one. It might be that the planner is having a hard time because there are too many permutations to try. I believe if you drop the indexes inside a transaction, they will still be there for other queries, and if you rollback instead of commit, you won't lose anything. BEGIN; DROP INDEX ... EXPLAIN ANALYZE SELECT *... ROLLBACK; John =:-> --------------enigFC724075688C16CC1C852EB9 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCuC7QJdeBCYSNAAMRAqhPAJ96D2JK9uRlEzObVbGd3n3Tttoh6gCdFICG jsuBrmMCNswfIgrBo9rcfR8= =tiqi -----END PGP SIGNATURE----- --------------enigFC724075688C16CC1C852EB9-- From pgsql-performance-owner@postgresql.org Tue Jun 21 12:18: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 2FF505290B for ; Tue, 21 Jun 2005 12:17:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33037-01 for ; Tue, 21 Jun 2005 15:17:54 +0000 (GMT) Received: from poros.telenet-ops.be (poros.telenet-ops.be [195.130.132.44]) by svr1.postgresql.org (Postfix) with ESMTP id 5DF465293C for ; Tue, 21 Jun 2005 12:17:53 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by poros.telenet-ops.be (Postfix) with SMTP id 7E2A03BC03C for ; Tue, 21 Jun 2005 17:17:52 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by poros.telenet-ops.be (Postfix) with ESMTP id 0E27D3BC04F for ; Tue, 21 Jun 2005 17:17:52 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: <098952ec5af9b040acb9b6b5af743abd@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-135--674049422 From: Yves Vindevogel Subject: Another question on indexes (drop and recreate) Date: Tue, 21 Jun 2005 17:17:51 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/390 X-Sequence-Number: 13027 --Apple-Mail-135--674049422 Content-Type: multipart/alternative; boundary=Apple-Mail-136--674049421 --Apple-Mail-136--674049421 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi, I have another question regarding indexes. I have a table with a lot of indexes on it. Those are needed to=20 perform my searches. Once a day, a bunch of records is inserted in my table. Say, my table has 1.000.000 records and I add 10.000 records (1% new) What would be faster. 1) Dropping my indexes and recreating them after the inserts 2) Just inserting it and have PG manage the indexes Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-136--674049421 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Hi, I have another question regarding indexes. I have a table with a lot of indexes on it. Those are needed to perform my searches. Once a day, a bunch of records is inserted in my table.=20 Say, my table has 1.000.000 records and I add 10.000 records (1% new) What would be faster. 1) Dropping my indexes and recreating them after the inserts 2) Just inserting it and have PG manage the indexes Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-136--674049421-- --Apple-Mail-135--674049422 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tW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10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-135--674049422 Content-Type: multipart/alternative; boundary=Apple-Mail-137--674049420 --Apple-Mail-137--674049420 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-137--674049420 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-137--674049420-- --Apple-Mail-135--674049422-- From pgsql-performance-owner@postgresql.org Tue Jun 21 12:19: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 089325292A for ; Tue, 21 Jun 2005 12:19:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31059-06 for ; Tue, 21 Jun 2005 15:19:51 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id 02C8D528D0 for ; Tue, 21 Jun 2005 12:19:50 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050621151950m9100ngocve>; Tue, 21 Jun 2005 15:19:50 +0000 Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 5B24555FB6; Tue, 21 Jun 2005 10:19:49 -0500 (CDT) Message-ID: <42B83015.7060708@arbash-meinel.com> Date: Tue, 21 Jun 2005 10:19:49 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jone C Cc: pgsql-performance@postgresql.org Subject: Re: slow growing table References: <6556952605060609485c622403@mail.gmail.com> <20050606170037.GA1177@uio.no> <20050606171253.GA1655@uio.no> <65569526050621080553350f62@mail.gmail.com> In-Reply-To: <65569526050621080553350f62@mail.gmail.com> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig633606F0933A7E320962B1E4" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.035 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/391 X-Sequence-Number: 13028 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig633606F0933A7E320962B1E4 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jone C wrote: >>On second thought... Does a VACUUM FULL help? If so, you might want to >>increase your FSM settings. >> >> > >Thank you for the reply, sorry for delay I was on holiday. > >I tried that it had no effect. I benchmarked 2x before, peformed >VACUUM FULL on the table in question post inserts, then benchmarked 2x >after. Same results... > >Should I try your suggestion on deleting the indexes? This table needs >to be accessible for reads at all times however though... > >thank you kindly > > I believe dropping an index inside a transaction is only visible to that transaction. (Can someone back me up on this?) Which means if you did: BEGIN; DROP INDEX ; CREATE INDEX ON ; COMMIT; The only problem is that if you are using a unique or primary key index, a foreign key which is referencing that index would have to be dropped and re-created as well. So you could have a pretty major cascade effect. A better thing to do if your table only has one (or at least only a few) indexes, would be to CLUSTER, which is effectively a VACUUM FULL + a REINDEX (plus sorting the rows so that they are in index order). It holds a full lock on the table, and takes a while, but when you are done, things are cleaned up quite a bit. You might also try just a REINDEX on the indexes in question, but this also holds a full lock on the table. (My DROP + CREATE might also as well, I'm not really sure, I just think of it as a way to recreate without losing it for other transactions) John =:-> --------------enig633606F0933A7E320962B1E4 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCuDAVJdeBCYSNAAMRAlzCAKCbu2YaappfY1/Nfuq9h+wCDyE9dwCfb9FI B0ZPEUSyZPHLibLTSoUodTE= =Vtuf -----END PGP SIGNATURE----- --------------enig633606F0933A7E320962B1E4-- From pgsql-performance-owner@postgresql.org Tue Jun 21 12:22: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 198D152800 for ; Tue, 21 Jun 2005 12:22:35 -0300 (ADT) Received: 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, 21 Jun 2005 15:22:29 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id E089B528D0 for ; Tue, 21 Jun 2005 12:22:28 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050621152228m9100nhn7oe>; Tue, 21 Jun 2005 15:22:28 +0000 Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id A683B55FB6; Tue, 21 Jun 2005 10:22:27 -0500 (CDT) Message-ID: <42B830B3.6060902@arbash-meinel.com> Date: Tue, 21 Jun 2005 10:22:27 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Another question on indexes (drop and recreate) References: <098952ec5af9b040acb9b6b5af743abd@implements.be> In-Reply-To: <098952ec5af9b040acb9b6b5af743abd@implements.be> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig928D5216072CC4115B9F5CB9" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.035 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/392 X-Sequence-Number: 13029 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig928D5216072CC4115B9F5CB9 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Yves Vindevogel wrote: > Hi, > > I have another question regarding indexes. > > I have a table with a lot of indexes on it. Those are needed to=20 > perform my searches. > Once a day, a bunch of records is inserted in my table. > > Say, my table has 1.000.000 records and I add 10.000 records (1% new) > What would be faster. > > 1) Dropping my indexes and recreating them after the inserts > 2) Just inserting it and have PG manage the indexes > > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > *Yves Vindevogel* > *Implements* I'm guessing for 1% new that (2) would be faster. John =3D:-> --------------enig928D5216072CC4115B9F5CB9 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCuDCzJdeBCYSNAAMRAprWAJ4g9RSvBE1It6Vn1sFCL1XMwGcv9gCglDDi GPXqYmu+uF46/Aj0QwoX+bE= =1C20 -----END PGP SIGNATURE----- --------------enig928D5216072CC4115B9F5CB9-- From pgsql-performance-owner@postgresql.org Tue Jun 21 12:33: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 705705282B for ; Tue, 21 Jun 2005 12:28:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34790-03 for ; Tue, 21 Jun 2005 15:28:24 +0000 (GMT) Received: from poros.telenet-ops.be (poros.telenet-ops.be [195.130.132.44]) by svr1.postgresql.org (Postfix) with ESMTP id 6F83752812 for ; Tue, 21 Jun 2005 12:28:22 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by poros.telenet-ops.be (Postfix) with SMTP id 1FA6D3BC03D for ; Tue, 21 Jun 2005 17:28:22 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by poros.telenet-ops.be (Postfix) with ESMTP id 95BA23BC18B for ; Tue, 21 Jun 2005 17:28:21 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <42B830B3.6060902@arbash-meinel.com> References: <098952ec5af9b040acb9b6b5af743abd@implements.be> <42B830B3.6060902@arbash-meinel.com> Content-Type: multipart/mixed; boundary=Apple-Mail-138--673420361 Message-Id: <821370985653dc1f4166ca634f642ce2@implements.be> From: Yves Vindevogel Subject: Re: Another question on indexes (drop and recreate) Date: Tue, 21 Jun 2005 17:28:20 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/394 X-Sequence-Number: 13031 --Apple-Mail-138--673420361 Content-Type: multipart/alternative; boundary=Apple-Mail-139--673420360 --Apple-Mail-139--673420360 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed And, after let's say a week, would that index still be optimal or would=20= it be a good idea to drop it in the weekend and recreate it. On 21 Jun 2005, at 17:22, John A Meinel wrote: > Yves Vindevogel wrote: > >> Hi, >> >> I have another question regarding indexes. >> >> I have a table with a lot of indexes on it. Those are needed to=20 >> perform my searches. >> Once a day, a bunch of records is inserted in my table. >> >> Say, my table has 1.000.000 records and I add 10.000 records (1% new) >> What would be faster. >> >> 1) Dropping my indexes and recreating them after the inserts >> 2) Just inserting it and have PG manage the indexes >> >> Met vriendelijke groeten, >> Bien =E0 vous, >> Kind regards, >> >> *Yves Vindevogel* >> *Implements* > > > I'm guessing for 1% new that (2) would be faster. > John > =3D:-> > > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-139--673420360 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 And, after let's say a week, would that index still be optimal or would it be a good idea to drop it in the weekend and recreate it. On 21 Jun 2005, at 17:22, John A Meinel wrote: Yves Vindevogel wrote: Hi, I have another question regarding indexes. I have a table with a lot of indexes on it. Those are needed to perform my searches. Once a day, a bunch of records is inserted in my table. Say, my table has 1.000.000 records and I add 10.000 records (1% new) What would be faster. 1) Dropping my indexes and recreating them after the inserts 2) Just inserting it and have PG manage the indexes Met vriendelijke groeten, Bien =E0 vous, Kind regards, *Yves Vindevogel* *Implements* I'm guessing for 1% new that (2) would be faster. John =3D:-> Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-139--673420360-- --Apple-Mail-138--673420361 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9Q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D4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-138--673420361 Content-Type: multipart/alternative; boundary=Apple-Mail-140--673420350 --Apple-Mail-140--673420350 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-140--673420350 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-140--673420350-- --Apple-Mail-138--673420361-- From pgsql-performance-owner@postgresql.org Tue Jun 21 12:31: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 110185284D for ; Tue, 21 Jun 2005 12:31:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33192-07 for ; Tue, 21 Jun 2005 15:30:56 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7460B5281C for ; Tue, 21 Jun 2005 12:30:56 -0300 (ADT) 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 j5LFUsEI011564; Tue, 21 Jun 2005 11:30:54 -0400 (EDT) To: Yves Vindevogel Cc: pgsql-performance@postgreSQL.org Subject: Re: Limit clause not using index In-reply-to: <280411ebdb3e2bf1d822b8608fcfc7f7@implements.be> References: <3415.1119364973@sss.pgh.pa.us> <280411ebdb3e2bf1d822b8608fcfc7f7@implements.be> Comments: In-reply-to Yves Vindevogel message dated "Tue, 21 Jun 2005 16:57:28 +0200" Date: Tue, 21 Jun 2005 11:30:54 -0400 Message-ID: <11563.1119367854@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: 200506/393 X-Sequence-Number: 13030 Yves Vindevogel writes: > create index ixPrintjobsLoginDescEventdateDesceventtime on > tblPrintjobs (loginuser, desceventdate, desceventtime) ; Hmm, that certainly looks like it should match the query. What happens to the EXPLAIN output if you do "set enable_sort = false"? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 21 12:47: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 B88AC5282B for ; Tue, 21 Jun 2005 12:47:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36163-10 for ; Tue, 21 Jun 2005 15:47:02 +0000 (GMT) Received: from mail-relay1.tagaudit.com (unknown [69.64.214.4]) by svr1.postgresql.org (Postfix) with ESMTP id 596BC5280D for ; Tue, 21 Jun 2005 12:47:01 -0300 (ADT) Received: from mail-hub.tagaudit.com (dns2.tagaudit.com [192.168.3.32]) by mail-relay1.tagaudit.com (Postfix) with ESMTP id 605A4200000F5 for ; Tue, 21 Jun 2005 11:47:01 -0400 (EDT) Received: by mail-hub.tagaudit.com (Postfix, from userid 8) id 50E5C22011; Tue, 21 Jun 2005 11:47:01 -0400 (EDT) Received: from xeon400.tagaudit.com (vpn.tagaudit.com [192.168.3.17]) by mail-hub.tagaudit.com (Postfix) with ESMTP id 16BE811362; Tue, 21 Jun 2005 11:47:01 -0400 (EDT) Received: by vpn.tagaudit.com with Internet Mail Service (5.5.2656.59) id ; Tue, 21 Jun 2005 11:47:00 -0400 Message-ID: <0C072E7CC947D511AC9600A0CC7341200256CF53@vpn.tagaudit.com> From: Amit V Shah To: 'John A Meinel' Cc: "'newz@bearfruit.org'" , pgsql-performance@postgresql.org Subject: Re: Do Views execute underlying query everytime ?? Date: Tue, 21 Jun 2005 11:46:59 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.35 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200506/395 X-Sequence-Number: 13032 First of all, thanks to everyone for helping me ! Looks like materialized views will be my answer. Let me explain my situation a little better. The repository table looks like this - create table repository (statName varchar(45), statValue varchar(45), metaData varchar(45)); MetaData is a foreign key to other tables. The screens show something like following - Screen 1 - Stat1 Stat2 Stat3 Value Value Value Value Value Value Screen 2 - Stat3 Stat1 Stat5 Value Value Value Value Value Value etc. etc. The data is grouped based on metaData. Updates will only occur nightly and can be controlled. But selects occur 9-5. One of the compelling reasons I feel is that to create such tables out of repository tables, the query would be very complicated. If I have a materialized view, I think the information will be "cached". Another concern I have is load. If I have lot of simultaneous users creating such "wide tables" out of one "long table", that would generate substantial load on the servers. ?? I like the materialized view solution better than having other tables for each screen. (Would be nice if someone can comment on that) So that is my situation. Again, thanks everyone for helping Amit -----Original Message----- From: John A Meinel [mailto:john@arbash-meinel.com] Sent: Tuesday, June 21, 2005 11:01 AM To: Amit V Shah Cc: 'newz@bearfruit.org'; pgsql-performance@postgresql.org Subject: Re: [PERFORM] Do Views execute underlying query everytime ?? Amit V Shah wrote: >After I sent out this email, I found this article from google > >http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html > >Looks like we can control as to when the views refresh... I am still kind of >confused, and would appreciate help !! > >The create/drop table does sound a solution that can work, but the thing is >I want to get manual intervention out, and besides, my work flow is very >complex so this might not be an option for me :-( > >Thanks, >Amit > Just to make it clear, a view is not the same as a materialized view. A view is just a set of rules to the planner so that it can simplify interactions with the database. A materialized view is a query which has been saved into a table. To set it up properly, really depends on what your needs are. 1. How much time can elapse between an update to the system, and an update to the materialized views? 2. How many updates / (sec, min, hour, month) do you expect. Is insert performance critical, or secondary. For instance, if you get a lot of updates, but you can have a 1 hour lag between the time a new row is inserted and the view is updated, you can just create a cron job that runs every hour to regenerate the materialized view. If you don't get many updates, but you need them to show up right away, then you can add triggers to the affected tables, such that inserting/updating to a specific table causes an update to the materialized view. There are quite a few potential tradeoffs. Rather than doing a materialized view, you could just improve your filters. If you are doing a query to show people the results, you generally have some sort of upper bound on how much data you can display. Humans don't like reading more than 100 or 1000 rows. So create your normal query, and just take on a LIMIT 100 at the end. If you structure your query properly, and have appropriate indexes, you should be able to make the LIMIT count, and allow you to save a lot of overhead of generating rows that you don't use. I would probably start by posting the queries you are currently using, along with an EXPLAIN ANALYZE, and a description of what you actually need from the query. Then this list can be quite helpful in restructuring your query to make it faster. John =:-> From pgsql-performance-owner@postgresql.org Tue Jun 21 12:49: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 7011C528B4 for ; Tue, 21 Jun 2005 12:49:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39984-01 for ; Tue, 21 Jun 2005 15:49:31 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id C94405289B for ; Tue, 21 Jun 2005 12:49:30 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050621154929m9100nhsk9e>; Tue, 21 Jun 2005 15:49:29 +0000 Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id ED5F755FB6; Tue, 21 Jun 2005 10:49:28 -0500 (CDT) Message-ID: <42B83708.2050706@arbash-meinel.com> Date: Tue, 21 Jun 2005 10:49:28 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Another question on indexes (drop and recreate) References: <098952ec5af9b040acb9b6b5af743abd@implements.be> <42B830B3.6060902@arbash-meinel.com> <821370985653dc1f4166ca634f642ce2@implements.be> In-Reply-To: <821370985653dc1f4166ca634f642ce2@implements.be> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigDC9B690B7209D4F383B957EE" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/396 X-Sequence-Number: 13033 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDC9B690B7209D4F383B957EE Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Yves Vindevogel wrote: > And, after let's say a week, would that index still be optimal or > would it be a good idea to drop it in the weekend and recreate it. It depends a little bit on the postgres version you are using. If you are only ever adding to the table, and you are not updating it or deleting from it, I think the index is always optimal. Once you start deleting from it there are a few cases where older versions would not properly re-use the empty entries, requiring a REINDEX. (Deleting low numbers and always adding high numbers was one of the cases) However, I believe that as long as you vacuum often enough, so that the system knows where the unused entries are, you don't ever have to drop and re-create the index. John =:-> --------------enigDC9B690B7209D4F383B957EE 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCuDcIJdeBCYSNAAMRAvYLAKC9HjuwOubPauAe3173lo55TrOtCQCfc9Pe PD/Kqw6CxdGoukglvyvG1pU= =xRWH -----END PGP SIGNATURE----- --------------enigDC9B690B7209D4F383B957EE-- From pgsql-performance-owner@postgresql.org Tue Jun 21 13:05: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 60B4E52800 for ; Tue, 21 Jun 2005 13:05:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42714-03 for ; Tue, 21 Jun 2005 16:04:57 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 895895282B for ; Tue, 21 Jun 2005 13:04:55 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 386CF30959; Tue, 21 Jun 2005 18:05:58 +0200 (MET DST) From: William Yu X-Newsgroups: pgsql.performance Subject: Trying to figure out pgbench Date: Tue, 21 Jun 2005 09:04:48 -0700 Organization: Hub.Org Networking Services Lines: 10 Message-ID: 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 To: pgsql-performance@postgresql.org 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: 200506/397 X-Sequence-Number: 13034 My Dual Core Opteron server came in last week. I tried to do some benchmarks with pgbench to get some numbers on the difference between 1x1 -> 2x1 -> 2x2 but no matter what I did, I kept getting the same TPS on all systems. Any hints on what the pgbench parameters I should be using? In terms of production use, it definitely can handle more load. Previously, Apache/Perl had to run on a separate server to avoid a ~50% penalty. Now, the numbers are +15% performance even with Apache/Perl running on the same box as PostgreSQL. How much more load of course is what I'd like to quantify. From pgsql-performance-owner@postgresql.org Tue Jun 21 13:12: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 9197A5290B for ; Tue, 21 Jun 2005 13:12:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45137-06 for ; Tue, 21 Jun 2005 16:12:14 +0000 (GMT) Received: from imail01.arbinet.com (imail.arbinet.com [64.74.47.121]) by svr1.postgresql.org (Postfix) with ESMTP id 742245285C for ; Tue, 21 Jun 2005 13:12:13 -0300 (ADT) Received: from imail01.arbinet.com (localhost [127.0.0.1]) by imail01.arbinet.com (8.12.10/8.12.2) with ESMTP id j5LFM6AI010988 for ; Tue, 21 Jun 2005 15:22:14 GMT Received: from vamail01.TheXchange.com (mailbox.arbinet.com [64.74.47.120]) by imail01.arbinet.com (8.12.2/8.12.2) with SMTP id j5LFM3w5010969; Tue, 21 Jun 2005 15:22:05 GMT X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.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: Trying to figure out pgbench Date: Tue, 21 Jun 2005 16:11:37 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Trying to figure out pgbench Thread-Index: AcV2e2nuDPnZfX7OQq2sfc174spebwAAEx6g From: "Mohan, Ross" To: X-Spam-Details: Hits=-104.9, Required=2, Tests=BAYES_00,USER_IN_WHITELIST X-Scanned-By: MIMEDefang 2.39 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.108 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/399 X-Sequence-Number: 13036 I had a similar experience.=20 regardless of scaling, etc, I got same results. almost like flags are not active.=20 did pgbench -I template1 and pgbench -c 10 -t 50 -v -d 1=20 and played around from there.... This is on IBM pSeries, AIX5.3, PG8.0.2 -----Original Message----- From: pgsql-performance-owner@postgresql.org = [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of William Yu Sent: Tuesday, June 21, 2005 12:05 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] Trying to figure out pgbench My Dual Core Opteron server came in last week. I tried to do some=20 benchmarks with pgbench to get some numbers on the difference between=20 1x1 -> 2x1 -> 2x2 but no matter what I did, I kept getting the same TPS=20 on all systems. Any hints on what the pgbench parameters I should be = using? In terms of production use, it definitely can handle more load.=20 Previously, Apache/Perl had to run on a separate server to avoid a ~50%=20 penalty. Now, the numbers are +15% performance even with Apache/Perl=20 running on the same box as PostgreSQL. How much more load of course is=20 what I'd like to quantify. ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match From pgsql-performance-owner@postgresql.org Tue Jun 21 13: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 576C7528B2 for ; Tue, 21 Jun 2005 13:09:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43076-04 for ; Tue, 21 Jun 2005 16:09:29 +0000 (GMT) Received: from smtp1.beanfield.net (smtp1.beanfield.com [66.207.192.6]) by svr1.postgresql.org (Postfix) with ESMTP id D42315283A for ; Tue, 21 Jun 2005 13:09:24 -0300 (ADT) Received: from [127.0.0.1] (66-207-218-34.beanfield.net [66.207.218.34]) by smtp1.beanfield.net (8.13.4/8.12.11) with ESMTP id j5LG98gN072431 for ; Tue, 21 Jun 2005 12:09:10 -0400 (EDT) (envelope-from donv@webimpact.com) Message-ID: <42B83C72.2000206@webimpact.com> Date: Tue, 21 Jun 2005 12:12:34 -0400 From: Don Vaillancourt Reply-To: donv@web-impact.com Organization: Web Impact Inc. User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: unsubscribe Content-Type: multipart/alternative; boundary="------------000604060106080204050108" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.284 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, HTML_MESSAGE, HTML_TAG_EXIST_TBODY X-Spam-Level: X-Archive-Number: 200506/398 X-Sequence-Number: 13035 This is a multi-part message in MIME format. --------------000604060106080204050108 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit -- Don Vaillancourt Director of Software Development WEB IMPACT INC. phone: 416-815-2000 ext. 245 fax: 416-815-2001 email: donv@web-impact.com web: http://www.web-impact.com address: http://www.mapquest.ca Web Impact Inc. This email message is intended only for the addressee(s) and contains information that may be confidential and/or copyright. If you are not the intended recipient please notify the sender by reply email and immediately delete this email. Use, disclosure or reproduction of this email by anyone other than the intended recipient(s) is strictly prohibited. No representation is made that this email or any attachments are free of viruses. Virus scanning is recommended and is the responsibility of the recipient. --------------000604060106080204050108 Content-Type: multipart/related; boundary="------------000004080503070007040500" --------------000004080503070007040500 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
--
Don Vaillancourt
Director of Software Development
WEB IMPACT INC.
phone: 416-815-2000 ext. 245
fax: 416-815-2001
email: donv@web-impact.com
web: http://www.web-impact.com
address: http://www.mapquest.ca
Web Impact Inc.
This email message is intended only for the addressee(s) and contains information that may be confidential and/or copyright.

If you are not the intended recipient please notify the sender by reply email and immediately delete this email.

Use, disclosure or reproduction of this email by anyone other than the intended recipient(s) is strictly prohibited. No representation is made that this email or any attachments are free of viruses. Virus scanning is recommended and is the responsibility of the recipient.
--------------000004080503070007040500 Content-Type: image/gif; name="logo_webimpact.gif" Content-Transfer-Encoding: base64 Content-ID: Content-Disposition: inline; filename="logo_webimpact.gif" R0lGODlhmgAYAOYAAOXl5crJyry6u316e/ns6sdLN/v08uOkmsxaR5WTlO7t7sLBwffl4tZ5 amViYvz8/NmFd9HQ0dFsXN7e3vLy8uq9tYSCgz05Ourq6kxJSl1aW/r6+kVBQuPi4vTc2Oex qcE4IXVyc96VivPZ1aalpeWqoa6srZqYmfX09SUhIm5rbJ6dndbV1c3MzPb29tnY2fHSzfj4 +DUxMi0pKo+Njfbh3pyamkhFRvLW0bGwsP7+/sXExPDOyKSiolRRUmBdXu/v74qHiDk1NuzC vCklJuCbkIeFhc9jUjAsLcVDLnh1doB+f7e2tv39/clQPEA9Pfrw7pCOjqqoqKKgoVhVVmhl Zvz7/NTT00tHSNPS0vb19aGfoGNgYamnqMjHx4yKi7i3t9LR0lJPUI2LjNzb2+jn5+Df4JGP kLSzsysnKPjp56Cen6imp1FOTpiWlqyrq9jX2JmXmP76+v339js4OLCur8vK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BUQ0kH/Cvpy uW0kO2iYgBAQhhvbH1slq64NVqSs8qlWcIDHADArwQUeQhCM6yA6cLCprinUm11qQkH5xxLo LBtCFoMUgYABIjTAgAgIEGJGCgSauDEkKJT0RxNiqBBnBiax80QMhOCoY9WC7CEDERHcLAgK RHj9xwR+LDFIUnJTQMRlfzTFBABlUEDTIHIgUMEBTiDQgAdJqIHVH2UgMbbGKEqyBBIu0J0D IWcgQcELfkRRSGABHiJnISvU7fYfHaguiAoyyJJAsYK4QId+diGiRgE1SFDCB+MVwMABwmzA wQygWF15JHkt0AUStwoSLhgkCDd6cWcbckUKO4dyp8DpEmfj/wZP+AAkqBQeqx0iUCSBAwQS QAFFA+M5IYcgh/6mPCX8ydxvnFhQAReoYAjSZa8Q/+reIe41CGLVYRAPEIMMNpADP1RlED+Y gSwKVQgcMEACEKhBAZyQuPk1YBB6SAEHBgcJTE2CNykQ2iDOkIIU2Oh6pTPE6YTkhwGsrgfr GwRnTNAHOqDnDyromfouNIgGFIEHFFPDAT4AhSIkgQEfwIoOVEAdbS0vEi0ikSEiwJUXFPBq OtwRIR7wA3GtbivJG9UFhOCHv/TDDy1Y4iFKAILhgUACHyhBHpwwggokAQqCwIB1xkC2Q3iB DYZwoSS0QIdcAVAMhwjMABbAyU4G4P8/NuHAC0Z5BQF0RwlA8p6CHJAGefyBDX7Ag4wGMbtx cXAQQyCABJzgARg0IA8SKIIaPkAxBsxBEGYoiw+YgAFsAMELTQlBJNEYiQGErxAW+IIj5WUO ddSEDvKCBwsR0ToCfkoGMkDQIGIgAwtM044h8IMXCmGAAkBASkk4AA5qUAMeNKAAFfAAAsgj CCAsYTpU+4EPpuMHLoTBEL7KYSSuYKlCXAFphiiDDTbKURucQAqDa0JcTnACG3RhB9FTBAVW cMENbKEOIhmEG9pWCACcgKY7sMG3BjGHEYygGL30gBoIUAMPYIWox+xFAqqQgSfcgAtBwKhH 4mCyTFj1qlgMzapWt8rVrnoVE4EAADs= --------------000004080503070007040500-- --------------000604060106080204050108-- From pgsql-performance-owner@postgresql.org Tue Jun 21 13:44: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 E808D52828 for ; Tue, 21 Jun 2005 13:44:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52218-01 for ; Tue, 21 Jun 2005 16:44:02 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id F15295292B for ; Tue, 21 Jun 2005 13:44:01 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id 436083807D for ; Tue, 21 Jun 2005 18:44:01 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id 68BAA3820E for ; Tue, 21 Jun 2005 18:44:00 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <42B83708.2050706@arbash-meinel.com> References: <098952ec5af9b040acb9b6b5af743abd@implements.be> <42B830B3.6060902@arbash-meinel.com> <821370985653dc1f4166ca634f642ce2@implements.be> <42B83708.2050706@arbash-meinel.com> Content-Type: multipart/mixed; boundary=Apple-Mail-141--668882002 Message-Id: <09f30bc29a91c94eecaf7f70aa0c8399@implements.be> From: Yves Vindevogel Subject: Re: Another question on indexes (drop and recreate) Date: Tue, 21 Jun 2005 18:43:58 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/400 X-Sequence-Number: 13037 --Apple-Mail-141--668882002 Content-Type: multipart/alternative; boundary=Apple-Mail-142--668882002 --Apple-Mail-142--668882002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed I only add records, and most of the values are "random" Except the columns for dates, .... On 21 Jun 2005, at 17:49, John A Meinel wrote: > Yves Vindevogel wrote: > >> And, after let's say a week, would that index still be optimal or >> would it be a good idea to drop it in the weekend and recreate it. > > > It depends a little bit on the postgres version you are using. If you > are only ever adding to the table, and you are not updating it or > deleting from it, I think the index is always optimal. > Once you start deleting from it there are a few cases where older > versions would not properly re-use the empty entries, requiring a > REINDEX. (Deleting low numbers and always adding high numbers was one=20= > of > the cases) > > However, I believe that as long as you vacuum often enough, so that = the > system knows where the unused entries are, you don't ever have to drop > and re-create the index. > > John > =3D:-> > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-142--668882002 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 I only add records, and most of the values are "random" Except the columns for dates, .... On 21 Jun 2005, at 17:49, John A Meinel wrote: Yves Vindevogel wrote: And, after let's say a week, would that index still be optimal or would it be a good idea to drop it in the weekend and recreate it. It depends a little bit on the postgres version you are using. If you are only ever adding to the table, and you are not updating it or deleting from it, I think the index is always optimal. Once you start deleting from it there are a few cases where older versions would not properly re-use the empty entries, requiring a REINDEX. (Deleting low numbers and always adding high numbers was one of the cases) However, I believe that as long as you vacuum often enough, so that the system knows where the unused entries are, you don't ever have to drop and re-create the index. John =3D:-> Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-142--668882002-- --Apple-Mail-141--668882002 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho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AAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-141--668882002 Content-Type: multipart/alternative; boundary=Apple-Mail-143--668882001 --Apple-Mail-143--668882001 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-143--668882001 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-143--668882001-- --Apple-Mail-141--668882002-- From pgsql-performance-owner@postgresql.org Tue Jun 21 13:55: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 2C5D152812 for ; Tue, 21 Jun 2005 13:55:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51210-09 for ; Tue, 21 Jun 2005 16:54:59 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id 8694D52871 for ; Tue, 21 Jun 2005 13:54:58 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050621165458m9100nh2l3e>; Tue, 21 Jun 2005 16:54:58 +0000 Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 1F18C55FB6; Tue, 21 Jun 2005 11:54:56 -0500 (CDT) Message-ID: <42B8465F.1020506@arbash-meinel.com> Date: Tue, 21 Jun 2005 11:54:55 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yves Vindevogel Cc: pgsql-performance@postgresql.org Subject: Re: Another question on indexes (drop and recreate) References: <098952ec5af9b040acb9b6b5af743abd@implements.be> <42B830B3.6060902@arbash-meinel.com> <821370985653dc1f4166ca634f642ce2@implements.be> <42B83708.2050706@arbash-meinel.com> <09f30bc29a91c94eecaf7f70aa0c8399@implements.be> In-Reply-To: <09f30bc29a91c94eecaf7f70aa0c8399@implements.be> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigF80CC9D3606B2887161602A5" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/401 X-Sequence-Number: 13038 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF80CC9D3606B2887161602A5 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Yves Vindevogel wrote: > I only add records, and most of the values are "random" > Except the columns for dates, .... I doubt that you would need to recreate indexes. That really only needs to be done in pathological cases, most of which have been fixed in the latest postgres. If you are only inserting (never updating or deleting), the index can never bloat, since you are only adding new stuff. (You cannot get dead items to bloat your index if you never delete anything.) John =:-> --------------enigF80CC9D3606B2887161602A5 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCuEZfJdeBCYSNAAMRAoZ0AJkBFSl9uz+Pihz9fnsDxEMz7Hdf9wCgwaBu 1tdTKjcPOJeSJS0nSCeNrJY= =iOQm -----END PGP SIGNATURE----- --------------enigF80CC9D3606B2887161602A5-- From pgsql-performance-owner@postgresql.org Tue Jun 21 13:59: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 D384952839 for ; Tue, 21 Jun 2005 13:59:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53278-07 for ; Tue, 21 Jun 2005 16:59:52 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 7ABC05282B for ; Tue, 21 Jun 2005 13:59:50 -0300 (ADT) Received: (qmail 16345 invoked from network); 21 Jun 2005 19:00:05 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 21 Jun 2005 19:00:05 +0200 Date: Tue, 21 Jun 2005 18:59:48 +0200 To: "Amit V Shah" , "'John A Meinel'" Subject: Re: Do Views execute underlying query everytime ?? Cc: "'newz@bearfruit.org'" , pgsql-performance@postgresql.org References: <0C072E7CC947D511AC9600A0CC7341200256CF53@vpn.tagaudit.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: <0C072E7CC947D511AC9600A0CC7341200256CF53@vpn.tagaudit.com> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/402 X-Sequence-Number: 13039 From what you say I understand that you have a huge table like this : ( name, value, id ) And you want to make statistics on (value) according to (name,id). *************************************************** First of all a "materialized view" doen't exist in postgres, it's just a word to name "a table automatically updated by triggers". An example would be like this : table orders (order_id, ...) table ordered_products (order_id, product_id, quantity, ...) If you want to optimize the slow request : "SELECT product_id, sum(quantity) as total_quantity_ordered FROM ordered_products GROUP BY product_id" You would create a cache table like this : table ordered_products_cache (product_id, quantity) And add triggers ON UPDATE/INSERT/DELETE on table ordered_products to update ordered_products_cache accordingly. Of course in this case everytime someone touches ordered_products, an update is issued to ordered_products_cache. *************************************************** In your case I don't think that is the solution, because you do big updates. With triggers this would mean issuing one update of your materialized view per row in your big update. This could be slow. In this case you might want to update the cache table in one request rather than doing an awful lot of updates. So you have two solutions : 1- Junk it all and rebuild it from scratch (this can be faster than it seems) 2- Put the rows to be added in a temporary table, update the cache table considering the difference between this temporary table and your big table, then insert the rows in the big table. This is the fastest solution but it requires a bit more coding (not THAT much though). *************************************************** As for the structure of your cache table, you want : Screen 1 - Stat1 Stat2 Stat3 Value Value Value Value Value Value Screen 2 - Stat3 Stat1 Stat5 Value Value Value Value Value Value You have several lines, so what is that ? is it grouped by date ? I'll presume it is. So your screens basically show a subset of : SELECT date, name, sum(value) FROM table GROUP BY name, date This is what you should put in your summary table. Then index it on (date,name) and build your screens with : SELECT * FROM summary WHERE (date BETWEEN .. AND ..) AND name IN (Stat3, Stat1, Stat5) That should be pretty easy ; you get a list of (name,date,value) that you just have to format accordingly on your screen. From pgsql-performance-owner@postgresql.org Tue Jun 21 14:11: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 D847052812 for ; Tue, 21 Jun 2005 14:11:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57604-04 for ; Tue, 21 Jun 2005 17:11:47 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id E942052833 for ; Tue, 21 Jun 2005 14:11:41 -0300 (ADT) 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 7512446; Tue, 21 Jun 2005 10:13:48 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Alex Stapleton Subject: Re: autovacuum suggestions for 500,000,000+ row tables? Date: Tue, 21 Jun 2005 10:13:40 -0700 User-Agent: KMail/1.8 Cc: pgsql-performance@postgresql.org References: <200506201046.42062.josh@agliodbs.com> <7E161634-29A0-4DBC-A303-3675D705A965@advfn.com> In-Reply-To: <7E161634-29A0-4DBC-A303-3675D705A965@advfn.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506211013.40993.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/403 X-Sequence-Number: 13040 Alex, > Downtime is something I'd rather avoid if possible. Do you think we > will need to run VACUUM FULL occasionally? I'd rather not lock tables > up unless I cant avoid it. We can probably squeeze an automated > vacuum tied to our data inserters every now and then though. As long as your update/deletes are less than 10% of the table for all time, you should never have to vacuum, pending XID wraparound. > Is this an 8.0 thing? I don't have a pg_controldata from what I can > see. Thats nice to hear though. 'fraid so, yes. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jun 21 14: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 A76A7528C3 for ; Tue, 21 Jun 2005 14:58:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67134-07 for ; Tue, 21 Jun 2005 17:58:21 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by svr1.postgresql.org (Postfix) with ESMTP id 22D9E528B4 for ; Tue, 21 Jun 2005 14:58:20 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so638552wri for ; Tue, 21 Jun 2005 10:58:21 -0700 (PDT) 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:content-disposition:references; b=SMBZRO+yrXiuVXHILeRwA1P0lqfxckkDiqbIrSinkSBATGbpBG4OZq0pVS9RbxmwYbfprnKdLASkmQhHWwr0I7kNPf+neBL4FjJ86Qe7NH/dDnVwR/KHvID8PvimsU1UomJHjsxJZ4M0MqXAXiiy/dQT9Z11RnftnJyeJQQf3gU= Received: by 10.54.76.12 with SMTP id y12mr420661wra; Tue, 21 Jun 2005 10:57:17 -0700 (PDT) Received: by 10.54.22.15 with HTTP; Tue, 21 Jun 2005 10:57:17 -0700 (PDT) Message-ID: Date: Tue, 21 Jun 2005 12:57:17 -0500 From: Matthew Nuzum Reply-To: newz@bearfruit.org To: Amit V Shah Subject: Re: Do Views execute underlying query everytime ?? Cc: John A Meinel , pgsql-performance@postgresql.org, PFC In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <0C072E7CC947D511AC9600A0CC7341200256CF53@vpn.tagaudit.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.086 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/404 X-Sequence-Number: 13041 On 6/21/05, PFC wrote: ... > In your case I don't think that is the solution, because you do big > updates. With triggers this would mean issuing one update of your > materialized view per row in your big update. This could be slow. >=20 > In this case you might want to update the cache table in one request > rather than doing an awful lot of updates. >=20 > So you have two solutions : >=20 > 1- Junk it all and rebuild it from scratch (this can be faster than it > seems) > 2- Put the rows to be added in a temporary table, update the cache table > considering the difference between this temporary table and your big > table, then insert the rows in the big table. >=20 > This is the fastest solution but it requires a bit more coding (not THAT > much though). >=20 Amit, I understand your desire to not need any manual intervention... I don't know what OS you use, but here are two practical techniques you can use to achieve the above solution suggested by PFC: a: If you are on a Unix like OS such as Linux of Free BSD you have the beautiful cron program that will run commands nightly. b: If you are on Windows you have to do something else. The simplest solution I've found is called "pycron" (easily locatable by google) and is a service that emulates Unix cron on windows (bypassing a lot of the windows scheduler hassle). Now, using either of those solutions, let's say at 6:00 am you want to do your batch query. 1. Put the queries you want into a text file EXACTLY as you would type them using psql and save the text file. For example, the file may be named "create_mat_view.txt". 2. Test them by doing this from a command prompt: psql dbname < create_mat_view.txt 3. Create a cron entry to run the command once a day, it might look like th= is: 0 6 * * * /usr/bin/psql dbname < /home/admin/create_mat_view.txt or maybe like this: 0 6 * * * "C:\Program Files\PostgreSQL\8.0\psql.exe" dbname < "C:\create_mat_view.txt" I hope this helps, --=20 Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Tue Jun 21 15:22: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 5796152839 for ; Tue, 21 Jun 2005 15:22:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68998-09 for ; Tue, 21 Jun 2005 18:22:25 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 6A8B75282B for ; Tue, 21 Jun 2005 15:22:24 -0300 (ADT) 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 7512799; Tue, 21 Jun 2005 11:24:32 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Configurator project launched Date: Tue, 21 Jun 2005 11:24:25 -0700 User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200506211124.25796.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/405 X-Sequence-Number: 13042 Folks, OK, I've checked in my first code module and the configurator project is officially launched. Come join us at www.pgfoundry.org/projects/configurator Further communications will be on the Configurator mailing list only. from the spec: What is the Configurator, and Why do We Need It? ------------------------------------------------- The Configurator is a set of Perl scripts and modules which allow users and installation programs to write a reasonable postgresql.conf for PostgreSQL performance based on the answers to some relatively simple questions. Its purpose is to provide an option between the poor-performing default configuration, and the in-depth knowledge required for hand-tuning. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jun 28 02:08: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 3FE7A52847 for ; Tue, 21 Jun 2005 15:34:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73982-03 for ; Tue, 21 Jun 2005 18:33:53 +0000 (GMT) Received: from server7.itpays.net (server7.itpays.net [212.62.246.7]) by svr1.postgresql.org (Postfix) with SMTP id CE02D52835 for ; Tue, 21 Jun 2005 15:33:49 -0300 (ADT) Received: (qmail 29568 invoked from network); 21 Jun 2005 16:34:06 -0000 Received: from smtp-auth.itpays.net (HELO webmail.itpays.no) (212.62.246.30) by 0 with SMTP; 21 Jun 2005 16:34:06 -0000 Received: from mail.jwid.mil.no ([193.213.27.25]) (SquirrelMail authenticated user kjelle@bingon.no) by webmail.s7.itpays.net with HTTP; Tue, 21 Jun 2005 20:33:58 +0200 (CEST) Message-ID: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net> Date: Tue, 21 Jun 2005 20:33:58 +0200 (CEST) Subject: Too slow querying a table of 15 million records From: kjelle@bingon.no To: pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.4 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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: 200506/534 X-Sequence-Number: 13171 Hello! I use FreeBSD 4.11 with PostGreSQL 7.3.8. I got a huge database with roughly 15 million records. There is just one table, with a time field, a few ints and a few strings. table test fields time (timestamp), source (string), destination (string), p1 (int), p2 (int) I have run VACUUM ANALYZE ; I have created indexes on every field, but for some reason my postgre server wants to use a seqscan, even tho i know a indexed scan would be much faster. create index test_time_idx on test (time) ; create index test_source_idx on test (source) ; create index test_destination_idx on test (destination) ; create index test_p1_idx on test (p1) ; create index test_p2_idx on test (p2) ; What is really strange, is that when i query a count(*) on one of the int fields (p1), which has a very low count, postgre uses seqscan. In another count on the same int field (p1), i know he is giving about 2.2 million hits, but then he suddenly uses seqscan, instead of a indexed one. Isn't the whole idea of indexing to increase performance in large queries.. To make sort of a phonebook for the values, to make it faster to look up what ever you need... This just seems opposite.. Here is a EXPLAIN of my query database=> explain select date_trunc('hour', time),count(*) as total from test where p1=53 and time > now() - interval '24 hours' group by date_trunc order by date_trunc ; QUERY PLAN ------------------------------------------------------------------------------------------ Aggregate (cost=727622.61..733143.23 rows=73608 width=8) -> Group (cost=727622.61..731303.02 rows=736083 width=8) -> Sort (cost=727622.61..729462.81 rows=736083 width=8) Sort Key: date_trunc('hour'::text, "time") -> Seq Scan on test (cost=0.00..631133.12 rows=736083 width=8) Filter: ((p1 = 53) AND ("time" > (now() - '1 day'::interval))) (6 rows) database=> drop INDEX test_ test_source_idx test_destination_idx test_p1_idx test_p2_idx test_time_idx After all this, i tried to set enable_seqscan to off and enable_nestedloops to on. This didnt help much either. The time to run the query is still in minutes. My results are the number of elements for each hour, and it gives about 1000-2000 hits per hour. I have read somewhere, about PostGreSQL, that it can easily handle 100-200million records. And with the right tuned system, have a great performance.. I would like to learn how :) I also found an article on a page (http://techdocs.postgresql.org/techdocs/pgsqladventuresep3.php): Tip #11: Don't bother indexing columns with huge numbers of records and a small range of values, such as BOOLEAN columns. This tip, regretfully, is perhaps the only tip where I cannot provide a good, real-world example from my work. So I'll give you a hypothetical situation instead: Imagine that you have a database table with a list of every establishment vending ice cream in the US. A simple example might look like: Where there were almost 1 million rows, but due to simplistic data entry, only three possible values for type (1-SUPERMARKET, 2-BOUTIQUE, and 3-OTHER) which are relatively evenly distributed. In this hypothetical situation, you might find (with testing using EXPLAIN) that an index on type is ignored and the parser uses a "seq scan" (or table scan) instead. This is because a table scan can actually be faster than an index scan in this situation. Thus, any index on type should be dropped. Certainly, the boolean column (active) requires no indexing as it has only two possible values and no index will be faster than a table scan. Then I ask, what is useful with indexing, when I can't use it on a VERY large database? It is on my 15 million record database it takes for ever to do seqscans over and over again... This is probably why, as i mentioned earlier, the reason (read the quote) why he chooses a full scan and not a indexed one... So what do I do? :confused: I'v used SQL for years, but never in such a big scale. Thus, not having to learn how to deal with large number of records. Usually a maximum of 1000 records. Now, with millions, I need to learn a way to make my sucky queries better. Im trying to learn more about tuning my system, makeing better queries and such. I'v found some documents on the Internet, but far from the best. Feedback most appreciated! Regards, a learning PostGreSQL user From pgsql-performance-owner@postgresql.org Tue Jun 21 16:10: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 EF8FD52849 for ; Tue, 21 Jun 2005 16:10:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82841-07 for ; Tue, 21 Jun 2005 19:10:24 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by svr1.postgresql.org (Postfix) with ESMTP id 0FDD652952 for ; Tue, 21 Jun 2005 16:10:18 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 36so1722679wra for ; Tue, 21 Jun 2005 12:10:19 -0700 (PDT) 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; b=upUHFBdQo3O1XSLFnek3MhqNHhigkVh1k7gRUwpso7bFhCn30lLTYLwttYgo3W4p0pie3bY+xHQ++fYf5zU/wMAcBn66c1kUNeXn5XXutuolZswdOu2rwSbKfLar9cmT/cYQh5DVDcBTAS1MHsYAFhQA16SpSeaXkCZqyI67JaA= Received: by 10.54.53.25 with SMTP id b25mr3368364wra; Tue, 21 Jun 2005 12:09:49 -0700 (PDT) Received: by 10.54.104.3 with HTTP; Tue, 21 Jun 2005 12:09:48 -0700 (PDT) Message-ID: Date: Tue, 21 Jun 2005 21:09:48 +0200 From: Kjell Tore Fossbakk Reply-To: Kjell Tore Fossbakk To: pgsql-performance@postgresql.org Subject: Querying 19million records very slowly Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3018_21547389.1119380988566" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.781 tagged_above=0 required=5 tests=AWL, HTML_20_30, HTML_MESSAGE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/406 X-Sequence-Number: 13043 ------=_Part_3018_21547389.1119380988566 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello! I use FreeBSD 4.11 with PostGreSQL 7.3.8. I got a huge database with roughly 19 million records. There is just one table, with a time field, a few ints and a few strings. table test fields time (timestamp), source (string), destination (string), p1 (int), p2 (int) I have run VACUUM ANALYZE ; I have created indexes on every field, but for some reason my postgre server wants to use a seqscan, even tho i know a indexed scan would be much faster. create index test_time_idx on test (time) ; create index test_source_idx on test (source) ; create index test_destination_idx on test (destination) ; create index test_p1_idx on test (p1) ; create index test_p2_idx on test (p2) ; What is really strange, is that when i query a count(*) on one of the int fields (p1), which has a very low count, postgre uses seqscan. In another count on the same int field (p1), i know he is giving about 2.2 million hits, but then he suddenly uses seqscan, instead of a indexed one. Isn't the whole idea of indexing to increase performance in large queries.. To make sort of a phonebook for the values, to make it faster to look up what ever you need... This just seems opposite.. Here is a EXPLAIN of my query database=3D> explain select date_trunc('hour', time),count(*) as total from test where p1=3D53 and time > now() - interval '24 hours' group by date_trunc order by date_trunc ; QUERY PLAN ---------------------------------------------------------------------------= --------------- Aggregate (cost=3D727622.61..733143.23 rows=3D73608 width=3D8) -> Group (cost=3D727622.61..731303.02 rows=3D736083 width=3D8) -> Sort (cost=3D727622.61..729462.81 rows=3D736083 width=3D8) Sort Key: date_trunc('hour'::text, "time") -> Seq Scan on test (cost=3D0.00..631133.12 rows=3D736083 width=3D8) Filter: ((p1 =3D 53) AND ("time" > (now() - '1 day'::interval))) (6 rows) database=3D> drop INDEX test_ test_source_idx test_destination_idx test_p1_idx=20 test_p2_idx test_time_idx After all this, i tried to set enable_seqscan to off and enable_nestedloops to on. This didnt help much either. The time to run the query is still in minutes. My results are the number of elements for each hour, and it gives about 1000-2000 hits per hour. I have read somewhere, about PostGreSQL, that it can easily handle 100-200million records. And with the right tuned system, have a great performance.. I would like to learn how :) I also found an article on a page (http://techdocs.postgresql.org/techdocs/pgsqladventuresep3.php): Tip #11: Don't bother indexing columns with huge numbers of records and a small range of values, such as BOOLEAN columns. This tip, regretfully, is perhaps the only tip where I cannot provide a good, real-world example from my work. So I'll give you a hypothetical situation instead: Imagine that you have a database table with a list of every establishment vending ice cream in the US. A simple example might look like: Where there were almost 1 million rows, but due to simplistic data entry, only three possible values for type (1-SUPERMARKET, 2-BOUTIQUE, and 3-OTHER) which are relatively evenly distributed. In this hypothetical situation, you might find (with testing using EXPLAIN) that an index on type is ignored and the parser uses a "seq scan" (or table scan) instead.= =20 This is because a table scan can actually be faster than an index scan in this situation. Thus, any index on type should be dropped. Certainly, the boolean column (active) requires no indexing as it has only two possible values and no index will be faster than a table scan. Then I ask, what is useful with indexing, when I can't use it on a VERY large database? It is on my 15 million record database it takes for ever to do seqscans over and over again... This is probably why, as i mentioned earlier, the reason (read the quote) why he chooses a full scan and not a indexed one... So what do I do? :confused: I'v used SQL for years, but never in such a big scale. Thus, not having to learn how to deal with large number of records. Usually a maximum of 1000 records. Now, with millions, I need to learn a way to make my sucky queries better. Im trying to learn more about tuning my system, makeing better queries and such. I'v found some documents on the Internet, but far from the best. Feedback most appreciated! Regards, a learning PostGreSQL user ------=_Part_3018_21547389.1119380988566 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello!

I use FreeBSD 4.11 with PostGreSQL 7.3.8.

I got a huge= database with roughly 19 million records. There is just one
table, with= a time field, a few ints and a few strings.


table test
field= s time (timestamp), source (string), destination (string), p1 (int),
p2 (int)


I have run VACUUM ANALYZE ;

I have created i= ndexes on every field, but for some reason my postgre
server wants to us= e a seqscan, even tho i know a indexed scan would be
much faster.


create index test_time_idx on test (time) ;
create index test_so= urce_idx on test (source) ;
create index test_destination_idx on test (d= estination) ;
create index test_p1_idx on test (p1) ;
create index te= st_p2_idx on test (p2) ;



What is really strange, is that when i query a count(*) on = one of the int
fields (p1), which has a very low count, postgre uses seq= scan. In another
count on the same int field (p1), i know he is giving a= bout=20 2.2 million
hits, but then he suddenly uses seqscan, instead of a indexe= d one. Isn't
the whole idea of indexing to increase performance in large= queries.. To
make sort of a phonebook for the values, to make it faster= to look up what
ever you need... This just seems opposite..

Here is a EXPLAIN of= my query

database=3D> explain select date_trunc('hour', time),co= unt(*) as total from
test where p1=3D53 and time > now() - interval '= 24 hours' group by
date_trunc order by date_trunc ;
      = ;            &n= bsp;            = ;         QUERY PLAN
-----------= ---------------------------------------------------------------------------= ----
Aggregate  (cost=3D727622.61..733143.23 rows=3D73608 width=3D8)
   ->  Group  (cost=3D72= 7622.61..731303.02 rows=3D736083 width=3D8)
    &nbs= p;    ->  Sort  (cost=3D727622.61..729462.81 ro= ws=3D736083 width=3D8)
        &= nbsp;      Sort Key: date_trunc('hour'::text, &quo= t;time")
            = ;   ->  Seq Scan on test  (cost=3D0.00..631133.12 ro= ws=3D736083
width=3D8)
       &nbs= p;             = Filter: ((p1 =3D 53) AND ("time" > (now() - '1
day'::interv= al)))
(6 rows)




database=3D> drop INDEX test_<TABULATOR>
test_source_idx &= nbsp;       test_destination_idx  &= nbsp;     test_p1_idx     &nbs= p; 
test_p2_idx       test_time_idx<= br>

After all this, i tried to set enable_seqscan to off and
enable_nestedloops to on. This didnt help much either. The time to run = the
query is still in minutes. My results are the number of elements for= each
hour, and it gives about 1000-2000 hits per hour. I have read some= where,
about PostGreSQL, that it can easily handle 100-200million records. And=
with the right tuned system, have a great performance.. I would like to=
learn how :)

I also found an article on a page
( http://techdocs.postgresql.org/techdocs/pgsqladventuresep3.php):
Tip= #11:  Don't bother indexing columns with huge numbers of records and = a
small range of values, such as BOOLEAN columns.

This tip, regre= tfully, is perhaps the only tip where I cannot provide a
good, real-world example from my work.  So I'll give you a hypothe= tical
situation instead:

Imagine that you have a database table w= ith a list of every establishment
vending ice cream in the US.  A s= imple example might look like:

Where there were almost 1 million rows, but due to simplistic data = entry,
only three possible values for type (1-SUPERMARKET, 2-BOUTIQUE, a= nd
3-OTHER) which are relatively evenly distributed.  In this hypot= hetical
situation, you might find (with testing using EXPLAIN) that an index on=
type is ignored and the parser uses a "seq scan" (or table sc= an) instead.
This is because a table scan can actually be faster than a= n index scan in
this situation.  Thus, any index on type should be dropped.
Certainly, the boolean column (active) requires no indexing as it has only=
two possible values and no index will be faster than a table scan.
<= br>
Then I ask, what is useful with indexing, when I can't use it on a VERY=
large database? It is on my 15 million record database it takes for eve= r
to do seqscans over and over again... This is probably why, as i menti= oned
earlier, the reason (read the quote) why he chooses a full scan and not= a
indexed one...

So what do I do? :confused:

I'v used SQL= for years, but never in such a big scale. Thus, not having to
learn how= to deal with large number of records. Usually a maximum of 1000
records. Now, with millions, I need to learn a way to make my sucky
= queries better.

Im trying to learn more about tuning my system, make= ing better queries and
such. I'v found some documents on the Internet, b= ut far from the best.

Feedback most appreciated!

Regards,
a learning PostGreSQL= user

------=_Part_3018_21547389.1119380988566-- From pgsql-performance-owner@postgresql.org Tue Jun 21 16:31: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 7403B528C7 for ; Tue, 21 Jun 2005 16:31:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84799-09 for ; Tue, 21 Jun 2005 19:30:51 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id 85716528BD for ; Tue, 21 Jun 2005 16:30:49 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id F255E38286 for ; Tue, 21 Jun 2005 21:30:50 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id 125D0382A2 for ; Tue, 21 Jun 2005 21:30:50 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <42B8465F.1020506@arbash-meinel.com> References: <098952ec5af9b040acb9b6b5af743abd@implements.be> <42B830B3.6060902@arbash-meinel.com> <821370985653dc1f4166ca634f642ce2@implements.be> <42B83708.2050706@arbash-meinel.com> <09f30bc29a91c94eecaf7f70aa0c8399@implements.be> <42B8465F.1020506@arbash-meinel.com> Content-Type: multipart/mixed; boundary=Apple-Mail-155--658870314 Message-Id: <3ac5308f2b422062e26c7eae705121a9@implements.be> From: Yves Vindevogel Subject: Re: Another question on indexes (drop and recreate) Date: Tue, 21 Jun 2005 21:30:50 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/407 X-Sequence-Number: 13044 --Apple-Mail-155--658870314 Content-Type: multipart/alternative; boundary=Apple-Mail-156--658870314 --Apple-Mail-156--658870314 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Ok, tnx !! On 21 Jun 2005, at 18:54, John A Meinel wrote: > Yves Vindevogel wrote: > >> I only add records, and most of the values are "random" >> Except the columns for dates, .... > > I doubt that you would need to recreate indexes. That really only = needs > to be done in pathological cases, most of which have been fixed in the > latest postgres. > > If you are only inserting (never updating or deleting), the index can > never bloat, since you are only adding new stuff. > (You cannot get dead items to bloat your index if you never delete > anything.) > > John > =3D:-> > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-156--658870314 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Ok, tnx !! On 21 Jun 2005, at 18:54, John A Meinel wrote: Yves Vindevogel wrote: I only add records, and most of the values are "random" Except the columns for dates, .... I doubt that you would need to recreate indexes. That really only needs to be done in pathological cases, most of which have been fixed in the latest postgres. If you are only inserting (never updating or deleting), the index can never bloat, since you are only adding new stuff. (You cannot get dead items to bloat your index if you never delete anything.) John =3D:-> Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-156--658870314-- --Apple-Mail-155--658870314 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsSlWZpxH+ahzsOaBzvCe7qoMpKlUghd1n2f5oHId5/lQaJ0n+RBf3GLpUGwf4iksrg0FVF ICzlXT9QBB0tWO/+FjlKVWtfijTNRBsvDbhrdP3NUAwY38KFfkc0PuNjRWLLz8ytiT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+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-155--658870314 Content-Type: multipart/alternative; boundary=Apple-Mail-157--658870312 --Apple-Mail-157--658870312 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-157--658870312 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-157--658870312-- --Apple-Mail-155--658870314-- From pgsql-performance-owner@postgresql.org Tue Jun 21 16:46: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 6557252849 for ; Tue, 21 Jun 2005 16:46:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87998-08 for ; Tue, 21 Jun 2005 19:46:47 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by svr1.postgresql.org (Postfix) with ESMTP id 8386E52847 for ; Tue, 21 Jun 2005 16:46:46 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 37so231928wra for ; Tue, 21 Jun 2005 12:46:48 -0700 (PDT) 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; b=tO9voMqeQkKm1E1BD8U/fUwnzd6O+SCLuip2Y/D+Ll3zdEAtNOmZSLGrce9XSJSq8+xr3KRqijTSTJtzYxkGMnlnkWI8pSJxuLNS02WdhF4aLsEHQpyVftSffvrCbUf36aJaFAJy1+FVT3m1CAaSuDpp6pmrdOsQBCnpeqXbblg= Received: by 10.54.2.42 with SMTP id 42mr3392770wrb; Tue, 21 Jun 2005 12:46:04 -0700 (PDT) Received: by 10.54.150.13 with HTTP; Tue, 21 Jun 2005 12:46:03 -0700 (PDT) Message-ID: <1efd553a05062112462c30e9ff@mail.gmail.com> Date: Tue, 21 Jun 2005 15:46:03 -0400 From: Oliver Crosby Reply-To: Oliver Crosby To: pgsql-performance@postgresql.org Subject: Prepared statements vs. Stored Procedures Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1417_11666427.1119383163975" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.32 tagged_above=0 required=5 tests=HTML_10_20, HTML_MESSAGE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/409 X-Sequence-Number: 13046 ------=_Part_1417_11666427.1119383163975 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I'm hoping someone can offer some advice here. I have a large perl script that employs prepared statements to do all its= =20 queries. I'm looking at using stored procedures to improve performance time= s=20 for the script. Would making a stored procedure to replace each prepared=20 statement be worthwhile? If not, when could I use stored procedures to=20 improve performance? Thanks in advance. ------=_Part_1417_11666427.1119383163975 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
I'm hoping someone can offer some advice here.
 
I have a large perl script that employs prepared statements to do all = its queries. I'm looking at using stored procedures to improve performance = times for the script. Would making a stored procedure to replace each prepa= red statement be worthwhile? If not, when could I use stored procedures to = improve performance?
 
Thanks in advance.
------=_Part_1417_11666427.1119383163975-- From pgsql-performance-owner@postgresql.org Tue Jun 21 16:45: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 658DE52849 for ; Tue, 21 Jun 2005 16:45:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89992-07 for ; Tue, 21 Jun 2005 19:45:15 +0000 (GMT) Received: from lynet.oppetid.no (oppetid.no [80.65.51.2]) by svr1.postgresql.org (Postfix) with ESMTP id CF2C952847 for ; Tue, 21 Jun 2005 16:45:14 -0300 (ADT) Received: by lynet.oppetid.no (Postfix, from userid 1019) id 9E56C11A2E7; Tue, 21 Jun 2005 21:46:39 +0200 (CEST) Date: Tue, 21 Jun 2005 21:46:39 +0200 From: Tobias Brox To: John A Meinel Cc: Yves Vindevogel , pgsql-performance@postgresql.org Subject: Re: Limit clause not using index Message-ID: <20050621194639.GG22746@oppetid.no> References: <42B8275C.8040300@arbash-meinel.com> <7e514564b9a159480857de53cc1764fd@implements.be> <42B82ED0.1010009@arbash-meinel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42B82ED0.1010009@arbash-meinel.com> Organization: Group Nordicbet User-Agent: Mutt/1.5.9i 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: 200506/408 X-Sequence-Number: 13045 [John A Meinel - Tue at 10:14:24AM -0500] > I believe if you drop the indexes inside a transaction, they will still > be there for other queries, and if you rollback instead of commit, you > won't lose anything. Has anyone tested this? (sorry, I only have the production database to play with at the moment, and I don't think I should play with it ;-) -- Tobias Brox, Beijing From pgsql-performance-owner@postgresql.org Tue Jun 21 16: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 7004552835 for ; Tue, 21 Jun 2005 16:59:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92212-05 for ; Tue, 21 Jun 2005 19:59:41 +0000 (GMT) Received: from mail.refractions.net (mail.refractions.net [24.68.236.214]) by svr1.postgresql.org (Postfix) with ESMTP id 1BE3F52839 for ; Tue, 21 Jun 2005 16:59:40 -0300 (ADT) Received: from lion.animals (lion [192.168.50.200]) by mail.refractions.net (Postfix) with ESMTP id 78F57122C32D; Tue, 21 Jun 2005 13:10:45 -0700 (PDT) Received: by lion.animals (Postfix, from userid 88) id C5DB2E3C1; Tue, 21 Jun 2005 12:59:38 -0700 (PDT) Received: from [192.168.50.11] (unknown [192.168.50.11]) by lion.animals (Postfix) with ESMTP id 1BB61E3BB; Tue, 21 Jun 2005 12:59:36 -0700 (PDT) Message-ID: <42B8719A.6040809@refractions.net> Date: Tue, 21 Jun 2005 12:59:22 -0700 From: Paul Ramsey User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kjell Tore Fossbakk Cc: pgsql-performance@postgresql.org Subject: Re: Querying 19million records very slowly References: 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.07 tagged_above=0 required=5 tests=DNS_FROM_AHBL_RHSBL X-Spam-Level: X-Archive-Number: 200506/410 X-Sequence-Number: 13047 Some tips: - EXPLAIN ANALYZE provides a more useful analysis of a slow query, because it gives both the estimate and actual times/rows for each step in the plan. - The documentation is right: rows with little variation are pretty useless to index. Indexing is about "selectivity", reducing the amount of stuff the database has to read off the the disk. - You only have two things in your WHERE clause, so that is where the most important indexes reside. How many of your rows have p1=53? How many of your rows have happened in the last day? If your answer is "a lot" then the indexes are not going to help: PostgreSQL will be more efficient scanning every tuple than it will be jumping around the index structure for a large number of tuples. - If neither time nor p1 are particularly selective individually, but they are selective when taken together, try a multi-key index on them both. Paul Kjell Tore Fossbakk wrote: > Hello! > > I use FreeBSD 4.11 with PostGreSQL 7.3.8. > > I got a huge database with roughly 19 million records. There is just one > table, with a time field, a few ints and a few strings. > > > table test > fields time (timestamp), source (string), destination (string), p1 (int), > p2 (int) > > > I have run VACUUM ANALYZE ; > > I have created indexes on every field, but for some reason my postgre > server wants to use a seqscan, even tho i know a indexed scan would be > much faster. > > > create index test_time_idx on test (time) ; > create index test_source_idx on test (source) ; > create index test_destination_idx on test (destination) ; > create index test_p1_idx on test (p1) ; > create index test_p2_idx on test (p2) ; > > > > What is really strange, is that when i query a count(*) on one of the int > fields (p1), which has a very low count, postgre uses seqscan. In another > count on the same int field (p1), i know he is giving about 2.2 million > hits, but then he suddenly uses seqscan, instead of a indexed one. Isn't > the whole idea of indexing to increase performance in large queries.. To > make sort of a phonebook for the values, to make it faster to look up what > ever you need... This just seems opposite.. > > Here is a EXPLAIN of my query > > database=> explain select date_trunc('hour', time),count(*) as total from > test where p1=53 and time > now() - interval '24 hours' group by > date_trunc order by date_trunc ; > QUERY PLAN > ------------------------------------------------------------------------------------------ > Aggregate (cost=727622.61..733143.23 rows=73608 width=8) > -> Group (cost=727622.61..731303.02 rows=736083 width=8) > -> Sort (cost=727622.61..729462.81 rows=736083 width=8) > Sort Key: date_trunc('hour'::text, "time") > -> Seq Scan on test (cost=0.00..631133.12 rows=736083 > width=8) > Filter: ((p1 = 53) AND ("time" > (now() - '1 > day'::interval))) > (6 rows) > > > > > database=> drop INDEX test_ > test_source_idx test_destination_idx test_p1_idx > test_p2_idx test_time_idx > > > After all this, i tried to set enable_seqscan to off and > enable_nestedloops to on. This didnt help much either. The time to run the > query is still in minutes. My results are the number of elements for each > hour, and it gives about 1000-2000 hits per hour. I have read somewhere, > about PostGreSQL, that it can easily handle 100-200million records. And > with the right tuned system, have a great performance.. I would like to > learn how :) > > I also found an article on a page > ( http://techdocs.postgresql.org/techdocs/pgsqladventuresep3.php): > Tip #11: Don't bother indexing columns with huge numbers of records and a > small range of values, such as BOOLEAN columns. > > This tip, regretfully, is perhaps the only tip where I cannot provide a > good, real-world example from my work. So I'll give you a hypothetical > situation instead: > > Imagine that you have a database table with a list of every establishment > vending ice cream in the US. A simple example might look like: > > Where there were almost 1 million rows, but due to simplistic data entry, > only three possible values for type (1-SUPERMARKET, 2-BOUTIQUE, and > 3-OTHER) which are relatively evenly distributed. In this hypothetical > situation, you might find (with testing using EXPLAIN) that an index on > type is ignored and the parser uses a "seq scan" (or table scan) instead. > This is because a table scan can actually be faster than an index scan in > this situation. Thus, any index on type should be dropped. > > Certainly, the boolean column (active) requires no indexing as it has only > two possible values and no index will be faster than a table scan. > > > Then I ask, what is useful with indexing, when I can't use it on a VERY > large database? It is on my 15 million record database it takes for ever > to do seqscans over and over again... This is probably why, as i mentioned > earlier, the reason (read the quote) why he chooses a full scan and not a > indexed one... > > So what do I do? :confused: > > I'v used SQL for years, but never in such a big scale. Thus, not having to > learn how to deal with large number of records. Usually a maximum of 1000 > records. Now, with millions, I need to learn a way to make my sucky > queries better. > > Im trying to learn more about tuning my system, makeing better queries and > such. I'v found some documents on the Internet, but far from the best. > > Feedback most appreciated! > > Regards, > a learning PostGreSQL user > From pgsql-performance-owner@postgresql.org Tue Jun 21 17:39: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 A8FDD52822 for ; Tue, 21 Jun 2005 17:39:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02247-06 for ; Tue, 21 Jun 2005 20:39:33 +0000 (GMT) Received: from lynet.oppetid.no (oppetid.no [80.65.51.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8E41152835 for ; Tue, 21 Jun 2005 17:39:32 -0300 (ADT) Received: by lynet.oppetid.no (Postfix, from userid 1019) id C32B011A354; Tue, 21 Jun 2005 22:40:57 +0200 (CEST) Date: Tue, 21 Jun 2005 22:40:57 +0200 From: Tobias Brox To: Oliver Crosby Cc: pgsql-performance@postgresql.org Subject: Re: Prepared statements vs. Stored Procedures Message-ID: <20050621204057.GI22746@oppetid.no> References: <1efd553a05062112462c30e9ff@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1efd553a05062112462c30e9ff@mail.gmail.com> Organization: Group Nordicbet User-Agent: Mutt/1.5.9i 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: 200506/411 X-Sequence-Number: 13048 [Oliver Crosby - Tue at 03:46:03PM -0400] > I'm hoping someone can offer some advice here. > I have a large perl script that employs prepared statements to do all its > queries. I'm looking at using stored procedures to improve performance times > for the script. Would making a stored procedure to replace each prepared > statement be worthwhile? If not, when could I use stored procedures to > improve performance? > Thanks in advance. My gut feeling says that if you are only doing read-operations there are none or almost none benefits with stored procedures. One argument we used for not looking much into stored procedures, was that we expect the database to become the bottleneck if we get too much activity. At the application side, we can always expand by adding more boxes, but the database, beeing the hub of the system, cannot easily be expanded (we can tweak and tune and upgrade the whole box, and eventually at some point we believe we will need to put old data at a separate database, and also make a replica for heavy report queries) If you have loads of data going from the database to the application, a little bit of light processing done on the data, and then data going back to the database server, then I guess stored procedures would be better. From pgsql-performance-owner@postgresql.org Tue Jun 21 18: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 7C66A52835 for ; Tue, 21 Jun 2005 18:08:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06836-07 for ; Tue, 21 Jun 2005 21:08:46 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id ED5B9528BD for ; Tue, 21 Jun 2005 18:08:42 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j5LL8KqO075854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 21 Jun 2005 15:08:24 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j5LL8KYd082923; Tue, 21 Jun 2005 15:08:20 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j5LL8JKE082922; Tue, 21 Jun 2005 15:08:19 -0600 (MDT) (envelope-from mfuhr) Date: Tue, 21 Jun 2005 15:08:19 -0600 From: Michael Fuhr To: Tobias Brox Cc: John A Meinel , Yves Vindevogel , pgsql-performance@postgresql.org Subject: Re: Limit clause not using index Message-ID: <20050621210819.GA82792@winnie.fuhr.org> References: <42B8275C.8040300@arbash-meinel.com> <7e514564b9a159480857de53cc1764fd@implements.be> <42B82ED0.1010009@arbash-meinel.com> <20050621194639.GG22746@oppetid.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050621194639.GG22746@oppetid.no> 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: 200506/412 X-Sequence-Number: 13049 On Tue, Jun 21, 2005 at 09:46:39PM +0200, Tobias Brox wrote: > [John A Meinel - Tue at 10:14:24AM -0500] > > I believe if you drop the indexes inside a transaction, they will still > > be there for other queries, and if you rollback instead of commit, you > > won't lose anything. > > Has anyone tested this? Observations from tests with 8.0.3: DROP INDEX acquires an AccessExclusiveLock on the table and on the index. This will cause the transaction executing the DROP INDEX to block until no other transaction holds any kind of lock on either, and once the locks are acquired, no other transaction will be able to access the table or the index until the transaction doing the DROP INDEX commits or rolls back. Rolling back leaves the index in place. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Wed Jun 22 13:17: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 9402452825 for ; Wed, 22 Jun 2005 13:17:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57053-06 for ; Wed, 22 Jun 2005 16:17:25 +0000 (GMT) Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) by svr1.postgresql.org (Postfix) with ESMTP id C8484528C7 for ; Wed, 22 Jun 2005 13:17:23 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Wed, 22 Jun 2005 11:16:04 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Date: Tue, 21 Jun 2005 16:11:40 -0500 From: "Kevin Grittner" To: , Cc: , Subject: Re: Limit clause not using index Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.022 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/438 X-Sequence-Number: 13075 I just tried this on 8.0.3. A query which runs very fast through an index on a 25 million row table blocked when I dropped the index within a database transaction. As soon as I rolled back the database transactiton, the query completed, the index appears fine, and the query runs fast, as usual. So, it looks like this is right except for the assertion that the index is still available for other queries. -Kevin >>> Tobias Brox 06/21/05 2:46 PM >>> [John A Meinel - Tue at 10:14:24AM -0500] > I believe if you drop the indexes inside a transaction, they will still > be there for other queries, and if you rollback instead of commit, you > won't lose anything. Has anyone tested this? (sorry, I only have the production database to play with at the moment, and I don't think I should play with it ;-) -- Tobias Brox, Beijing ---------------------------(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 Tue Jun 21 18:20: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 0D4FF528A8 for ; Tue, 21 Jun 2005 18:20:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11128-02 for ; Tue, 21 Jun 2005 21:20: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 3464852822 for ; Tue, 21 Jun 2005 18:20:19 -0300 (ADT) 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 j5LLK7hg017469; Tue, 21 Jun 2005 17:20:07 -0400 (EDT) To: Tobias Brox Cc: John A Meinel , Yves Vindevogel , pgsql-performance@postgresql.org Subject: Re: Limit clause not using index In-reply-to: <20050621194639.GG22746@oppetid.no> References: <42B8275C.8040300@arbash-meinel.com> <7e514564b9a159480857de53cc1764fd@implements.be> <42B82ED0.1010009@arbash-meinel.com> <20050621194639.GG22746@oppetid.no> Comments: In-reply-to Tobias Brox message dated "Tue, 21 Jun 2005 21:46:39 +0200" Date: Tue, 21 Jun 2005 17:20:07 -0400 Message-ID: <17468.1119388807@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: 200506/413 X-Sequence-Number: 13050 Tobias Brox writes: > [John A Meinel - Tue at 10:14:24AM -0500] >> I believe if you drop the indexes inside a transaction, they will still >> be there for other queries, and if you rollback instead of commit, you >> won't lose anything. > Has anyone tested this? Certainly. Bear in mind though that DROP INDEX will acquire exclusive lock on the index's table, so until you roll back, no other transaction will be able to touch the table at all. So the whole thing may be a nonstarter in a production database anyway :-(. You can probably get away with BEGIN; DROP INDEX ... EXPLAIN ... ROLLBACK; if you fire it from a script rather than by hand --- but EXPLAIN ANALYZE might be a bad idea ... regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 21 18:33: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 E2168528A8 for ; Tue, 21 Jun 2005 18:33:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 16787-01 for ; Tue, 21 Jun 2005 21:33:30 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id B7224528C7 for ; Tue, 21 Jun 2005 18:33:28 -0300 (ADT) Received: (qmail 29170 invoked from network); 21 Jun 2005 23:33:46 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 21 Jun 2005 23:33:46 +0200 To: "Paul Ramsey" , "Kjell Tore Fossbakk" Cc: pgsql-performance@postgresql.org Subject: Re: Querying 19million records very slowly References: <42B8719A.6040809@refractions.net> 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: Tue, 21 Jun 2005 23:33:30 +0200 In-Reply-To: <42B8719A.6040809@refractions.net> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/414 X-Sequence-Number: 13051 use CURRENT_TIME which is a constant instead of now() which is not considered constant... (I think) From pgsql-performance-owner@postgresql.org Tue Jun 21 18:54: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 288205282E for ; Tue, 21 Jun 2005 18:54:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24821-02 for ; Tue, 21 Jun 2005 21:54:02 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 734F4528F3 for ; Tue, 21 Jun 2005 18:53:58 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 5E9FC30959; Tue, 21 Jun 2005 23:55:06 +0200 (MET DST) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Trying to figure out pgbench Date: Tue, 21 Jun 2005 14:53:52 -0700 Organization: Hub.Org Networking Services Lines: 52 Message-ID: References: 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.2 (X11/20050317) X-Accept-Language: en-us, en In-Reply-To: To: pgsql-performance@postgresql.org 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: 200506/415 X-Sequence-Number: 13052 I wonder if the -c parameter is truly submitting everything in parallel. Having 2 telnet sessions up -- 1 doing -c 1 and another doing -c 100 -- I don't see much different in the display speed messages. Perhaps it's an issue with the telnet console display limiting the command speed. I thought about piping the output to /dev/null but then the final TPS results are also piped there. I can try piping output to a file on a ramdisk maybe. Mohan, Ross wrote: > I had a similar experience. > > regardless of scaling, etc, I got same results. almost like flags > are not active. > > did > > pgbench -I template1 > and > pgbench -c 10 -t 50 -v -d 1 > > and played around from there.... > > This is on IBM pSeries, AIX5.3, PG8.0.2 > > -----Original Message----- > From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of William Yu > Sent: Tuesday, June 21, 2005 12:05 PM > To: pgsql-performance@postgresql.org > Subject: [PERFORM] Trying to figure out pgbench > > > My Dual Core Opteron server came in last week. I tried to do some > benchmarks with pgbench to get some numbers on the difference between > 1x1 -> 2x1 -> 2x2 but no matter what I did, I kept getting the same TPS > on all systems. Any hints on what the pgbench parameters I should be using? > > In terms of production use, it definitely can handle more load. > Previously, Apache/Perl had to run on a separate server to avoid a ~50% > penalty. Now, the numbers are +15% performance even with Apache/Perl > running on the same box as PostgreSQL. How much more load of course is > what I'd like to quantify. > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From pgsql-performance-owner@postgresql.org Tue Jun 21 19: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 E98AF5284D for ; Tue, 21 Jun 2005 19:08:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26314-04 for ; Tue, 21 Jun 2005 22:08:50 +0000 (GMT) Received: from smtp-out6.blueyonder.co.uk (smtp-out6.blueyonder.co.uk [195.188.213.9]) by svr1.postgresql.org (Postfix) with ESMTP id 78A4E5282B for ; Tue, 21 Jun 2005 19:08:46 -0300 (ADT) Received: from [192.168.1.10] ([82.43.93.192]) by smtp-out6.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.6713); Tue, 21 Jun 2005 23:09:26 +0100 In-Reply-To: <200506211013.40993.josh@agliodbs.com> References: <200506201046.42062.josh@agliodbs.com> <7E161634-29A0-4DBC-A303-3675D705A965@advfn.com> <200506211013.40993.josh@agliodbs.com> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <20023F5A-4C74-41C8-8F46-0E16A45872AF@advfn.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Alex Stapleton Subject: Re: autovacuum suggestions for 500,000,000+ row tables? Date: Tue, 21 Jun 2005 23:08:43 +0100 To: josh@agliodbs.com X-Mailer: Apple Mail (2.730) X-OriginalArrivalTime: 21 Jun 2005 22:09:26.0967 (UTC) FILETIME=[E396FC70:01C576AD] 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: 200506/416 X-Sequence-Number: 13053 On 21 Jun 2005, at 18:13, Josh Berkus wrote: > Alex, > > >> Downtime is something I'd rather avoid if possible. Do you think we >> will need to run VACUUM FULL occasionally? I'd rather not lock tables >> up unless I cant avoid it. We can probably squeeze an automated >> vacuum tied to our data inserters every now and then though. >> > > As long as your update/deletes are less than 10% of the table for > all time, > you should never have to vacuum, pending XID wraparound. > Hmm, I guess as we have hundreds of millions of rows, and when we do delete things, it's only a few thousand, and rarely. VACUUMing shouldn't need to happen too often. Thats good. Thanks a lot for the advice. >> Is this an 8.0 thing? I don't have a pg_controldata from what I can >> see. Thats nice to hear though. >> > > 'fraid so, yes. Bloody Debian stable. I might have to experiment with building from source or using alien on debian to convert the rpms. Fun. Oh well. > -- > --Josh > > Josh Berkus > Aglio Database Solutions > San Francisco > > ---------------------------(end of > broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to > majordomo@postgresql.org > > From pgsql-performance-owner@postgresql.org Tue Jun 21 19: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 313575288B for ; Tue, 21 Jun 2005 19:23:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29731-01 for ; Tue, 21 Jun 2005 22:23:02 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id D9CEE528D5 for ; Tue, 21 Jun 2005 19:23:00 -0300 (ADT) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1Dkr92-0000nA-OJ for pgsql-performance@postgresql.org; Wed, 22 Jun 2005 00:23:02 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1Dkr92-0004sB-00 for ; Wed, 22 Jun 2005 00:23:00 +0200 Date: Wed, 22 Jun 2005 00:23:00 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: autovacuum suggestions for 500,000,000+ row tables? Message-ID: <20050621222300.GA18626@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <200506201046.42062.josh@agliodbs.com> <7E161634-29A0-4DBC-A303-3675D705A965@advfn.com> <200506211013.40993.josh@agliodbs.com> <20023F5A-4C74-41C8-8F46-0E16A45872AF@advfn.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20023F5A-4C74-41C8-8F46-0E16A45872AF@advfn.com> X-Operating-System: Linux 2.6.11.8 on a i686 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.9i 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: 200506/417 X-Sequence-Number: 13054 On Tue, Jun 21, 2005 at 11:08:43PM +0100, Alex Stapleton wrote: > Bloody Debian stable. I might have to experiment with building from > source or using alien on debian to convert the rpms. Fun. Oh well. Or just pull in postgresql-8.0 from unstable; sid is close enough to sarge for it to work quite well in practice, AFAIK. You'll lose the security support, though, but you will with building from source or using alien anyhow :-) /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Tue Jun 21 20:12: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 49A9C5288B for ; Tue, 21 Jun 2005 20:12:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38756-03 for ; Tue, 21 Jun 2005 23:12:04 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 4F4115283D for ; Tue, 21 Jun 2005 20:12:03 -0300 (ADT) 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 7513995; Tue, 21 Jun 2005 16:14:13 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Greg Sabino Mullane" , pgsql-performance@postgresql.org Subject: Re: Configurator project launched Date: Tue, 21 Jun 2005 16:14:05 -0700 User-Agent: KMail/1.8 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506211614.05644.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/418 X-Sequence-Number: 13055 Greg, > Not sure how far along you are, but I've been writing some really nifty > extensions to DBD::Pg that allow easy querying of all the current > run-time settings. Could be very useful to this project, seems to me. If > you're interested in possibly using it, let me know, I can bump it up on > my todo list. Um, can't we just get that from pg_settings? Anyway, I'll be deriving settings from the .conf file, since most of the time the Configurator will be run on a new installation. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jun 21 20: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 057A052942 for ; Tue, 21 Jun 2005 20:30:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39120-09 for ; Tue, 21 Jun 2005 23:30:46 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id A399852913 for ; Tue, 21 Jun 2005 20:30:45 -0300 (ADT) Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j5LNUluI024909; Tue, 21 Jun 2005 16:30:47 -0700 Message-ID: <42B8A327.8060908@commandprompt.com> Date: Tue, 21 Jun 2005 16:30:47 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: josh@agliodbs.com Cc: Greg Sabino Mullane , pgsql-performance@postgresql.org Subject: Re: Configurator project launched References: <200506211614.05644.josh@agliodbs.com> In-Reply-To: <200506211614.05644.josh@agliodbs.com> 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.015 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/419 X-Sequence-Number: 13056 Josh Berkus wrote: > Greg, > > >>Not sure how far along you are, but I've been writing some really nifty >>extensions to DBD::Pg that allow easy querying of all the current >>run-time settings. Could be very useful to this project, seems to me. If >>you're interested in possibly using it, let me know, I can bump it up on >>my todo list. > > > Um, can't we just get that from pg_settings? > > Anyway, I'll be deriving settings from the .conf file, since most of the > time the Configurator will be run on a new installation. Aren't most of the settings all kept in the SHOW variables anyway? Sincerely, Joshua D. Drake > -- Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 PostgreSQL Replication, Consulting, Custom Programming, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ From pgsql-performance-owner@postgresql.org Tue Jun 21 21:50: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 A55BE5282B for ; Tue, 21 Jun 2005 21:50:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56815-10 for ; Wed, 22 Jun 2005 00:50:41 +0000 (GMT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id 310465288E for ; Tue, 21 Jun 2005 21:50:40 -0300 (ADT) Received: (qmail 16953 invoked from network); 22 Jun 2005 00:50:44 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 22 Jun 2005 00:50:44 -0000 From: "Greg Sabino Mullane" To: pgsql-performance@postgresql.org Subject: Re: Configurator project launched X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <42B8A327.8060908@commandprompt.com> Date: Wed, 22 Jun 2005 00:50:44 -0000 X-Mailer: JoyMail 1.48 Message-ID: <17c492d2af42972995595f73c426f2aa@biglumber.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.122 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/420 X-Sequence-Number: 13057 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >> Um, can't we just get that from pg_settings? >> >> Anyway, I'll be deriving settings from the .conf file, since most of the >> time the Configurator will be run on a new installation. > > Aren't most of the settings all kept in the SHOW variables anyway? As I said, it may not be applicable to this project, but thought I would offer. One gotcha the module makes transparent is that in older versions of PG, the variables are returned in a different way (via RAISE). My module will allow you to get the configuration for any connected database, for any configuration file, and the defaults for any known version, and do quick comparisons between them all. So you could use it to see what has changed between a particular server and its conf file, or the differences between two conf files, or the differences between two databases, or even show what has changed in the default conf file from 7.4.7 and 8.0.1. It will also allow you to rewrite the conf files in a standard way. I'm hoping to roll this into 1.44 or 1.45 or DBD::Pg. - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200506212046 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFCuLWDvJuQZxSWSsgRAjUVAJ42oeveZBuutFo1G3Cs/3dRZWjKggCfS1Yf Tv5RWiG9s8Ucv/t/2HZ4/R8= =1eap -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Wed Jun 22 00:55: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 C53655288B for ; Wed, 22 Jun 2005 00:55:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01143-04 for ; Wed, 22 Jun 2005 03:55:16 +0000 (GMT) Received: from exobox.exoweb.net (unknown [221.122.43.98]) by svr1.postgresql.org (Postfix) with SMTP id D4EFC5293C for ; Wed, 22 Jun 2005 00:55:07 -0300 (ADT) Received: (qmail 15323 invoked from network); 22 Jun 2005 03:54:56 -0000 Received: from exo185.exoweb.net (HELO tobias.nordicbet.invalid) (192.168.0.185) by 0 with SMTP; 22 Jun 2005 03:54:56 -0000 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id 69DB4E0CE0; Wed, 22 Jun 2005 11:54:56 +0800 (CST) Date: Wed, 22 Jun 2005 11:54:55 +0800 From: Tobias Brox To: Tom Lane Cc: Tobias Brox , John A Meinel , Yves Vindevogel , pgsql-performance@postgresql.org Subject: Re: Limit clause not using index Message-ID: <20050622035455.GP7839@tobias> References: <42B8275C.8040300@arbash-meinel.com> <7e514564b9a159480857de53cc1764fd@implements.be> <42B82ED0.1010009@arbash-meinel.com> <20050621194639.GG22746@oppetid.no> <17468.1119388807@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17468.1119388807@sss.pgh.pa.us> Organization: Group Nordicbet 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: 200506/421 X-Sequence-Number: 13058 [Tom Lane - Tue at 05:20:07PM -0400] > > Certainly. Bear in mind though that DROP INDEX will acquire exclusive > lock on the index's table, so until you roll back, no other transaction > will be able to touch the table at all. So the whole thing may be a > nonstarter in a production database anyway :-(. That's what I was afraid of. I was running psql at the production DB without starting a transaction (bad habit, I know) and tried to drop an index there, but I had to cancel the transaction, it took forever and in the same time blocking all the revenue-generating activity. -- Tobias Brox, +86-13521622905 Nordicbet, IT dept From pgsql-performance-owner@postgresql.org Tue Jun 28 02:20: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 0ABA652833 for ; Wed, 22 Jun 2005 03:12:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28711-06 for ; Wed, 22 Jun 2005 06:12:35 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) by svr1.postgresql.org (Postfix) with ESMTP id 9C8BC52812 for ; Wed, 22 Jun 2005 03:12:34 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so112945wri for ; Tue, 21 Jun 2005 23:12:35 -0700 (PDT) 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:content-disposition; b=TuhmPl1+FSSrD/dzSB1zJUqQPsJ/kdZOZtDTWS5HmKezcpyQ5rdNdwJF7EiHQDCbzlbhen2SF1BsrBeCbn/UHJsO/VbOFeUGLwWzVmg/VAQx/48guuc2+yqQCWBV3eHcQJygUzIoWCznG5cCg3Vz6Nq3CjjGkNASNf5qWQTJFTY= Received: by 10.54.101.10 with SMTP id y10mr256420wrb; Tue, 21 Jun 2005 23:12:34 -0700 (PDT) Received: by 10.54.15.33 with HTTP; Tue, 21 Jun 2005 23:12:34 -0700 (PDT) Message-ID: <84d3067d0506212312775b3fa3@mail.gmail.com> Date: Wed, 22 Jun 2005 18:12:34 +1200 From: Colin Taylor Reply-To: Colin Taylor To: pgsql-performance@postgresql.org Subject: slow simple update? Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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: 200506/535 X-Sequence-Number: 13172 Hi there, I'm doing an update of ~30,000 rows and she takes about 15mins on pretty good hardware, even just after a vacuum analyze. I was hoping some kind soul could offer some performance advice. Do I just have too many indexes? Or am I missing some trick with the nulls? MY QUERY =3D=3D=3D=3D=3D=3D=3D=3D update bob.product_price set thru_date =3D '2005-06-22 22:08:49.957' where thru_date is null; MY TABLE =3D=3D=3D=3D=3D=3D=3D=3D=3D Table "bob.product_price" Column | Type | Modifiers=20 -----------------------------+--------------------------+----------- product_id | character varying(20) | not null product_price_type_id | character varying(20) | not null currency_uom_id | character varying(20) | not null product_store_id | character varying(20) | not null from_date | timestamp with time zone | not null thru_date | timestamp with time zone |=20 price | numeric(18,2) |=20 created_date | timestamp with time zone |=20 created_by_user_login | character varying(255) |=20 last_modified_date | timestamp with time zone |=20 last_modified_by_user_login | character varying(255) |=20 last_updated_stamp | timestamp with time zone |=20 last_updated_tx_stamp | timestamp with time zone |=20 created_stamp | timestamp with time zone |=20 created_tx_stamp | timestamp with time zone |=20 Indexes: --------- pk_product_price primary key btree (product_id, product_price_type_id, currency_uom_id, product_store_id, from_date), prdct_prc_txcrts btree (created_tx_stamp), prdct_prc_txstmp btree (last_updated_tx_stamp), prod_price_cbul btree (created_by_user_login), prod_price_cuom btree (currency_uom_id), prod_price_lmbul btree (last_modified_by_user_login), prod_price_prod btree (product_id), prod_price_pst btree (product_store_id), prod_price_type btree (product_price_type_id) Foreign Key constraints:=20 ------------------------- prod_price_prod FOREIGN KEY (product_id) REFERENCES bob.product(product_id)= =20 ON UPDATE NO ACTION ON DELETE NO ACTION, prod_price_type FOREIGN KEY (product_price_type_id) REFERENCES bob.product_price_type(product_price_type_id) ON UPDATE NO ACTION ON DELETE NO ACTION, prod_price_cuom FOREIGN KEY (currency_uom_id) REFERENCES bob.uom(uom_id)=20 ON UPDATE NO ACTION ON DELETE NO ACTION, prod_price_pst FOREIGN KEY (product_store_id) REFERENCES bob.product_store(product_store_id) ON UPDATE NO ACTION ON DELETE NO ACTION, prod_price_cbul FOREIGN KEY (created_by_user_login) REFERENCES bob.user_login(user_login_id) ON UPDATE NO ACTION ON DELETE NO ACTION, prod_price_lmbul FOREIGN KEY (last_modified_by_user_login) REFERENCES bob.user_login(user_login_id) ON UPDATE NO ACTION ON DELETE NO ACTION From pgsql-performance-owner@postgresql.org Wed Jun 22 04:26: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 51DBB52800 for ; Wed, 22 Jun 2005 04:26:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41861-05 for ; Wed, 22 Jun 2005 07:25:56 +0000 (GMT) Received: from www.aldratech.com (www.aldratech.com [193.226.161.42]) by svr1.postgresql.org (Postfix) with ESMTP id EB91C52838 for ; Wed, 22 Jun 2005 04:25:55 -0300 (ADT) Received: by www.aldratech.com (Postfix, from userid 48) id F1461123D8F; Wed, 22 Jun 2005 10:24:15 +0300 (EEST) Received: from 193.138.218.24 (SquirrelMail authenticated user radu.popescu) by www.aldratech.com with HTTP; Wed, 22 Jun 2005 10:24:15 +0300 (EEST) Message-ID: <52490.193.138.218.24.1119425055.squirrel@www.aldratech.com> In-Reply-To: <1efd553a05062112462c30e9ff@mail.gmail.com> References: <1efd553a05062112462c30e9ff@mail.gmail.com> Date: Wed, 22 Jun 2005 10:24:15 +0300 (EEST) Subject: Re: Prepared statements vs. Stored Procedures From: "Radu-Adrian Popescu" To: pgsql-performance@postgresql.org Reply-To: radu.popescu@aldratech.com User-Agent: SquirrelMail/1.4.4-1.FC3 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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: 200506/422 X-Sequence-Number: 13059 > I'm hoping someone can offer some advice here. > I have a large perl script that employs prepared statements to do all its > queries. I'm looking at using stored procedures to improve performance > times > for the script. Would making a stored procedure to replace each prepared > statement be worthwhile? If not, when could I use stored procedures to > improve performance? > Thanks in advance. > You'll definitely gain some performance if you manage to group several operations that are executed in a sequence - into a stored procedure. The principle here is that you'd be reducing the number of round-trips to the database server. As an example assume you start a transaction, lock several rows in different tables for update (thereof), update fields and then commit. If this is done in a sequencial manner - whether this is perl or java/jdbc or libpq - you'll require several round-trips to the server and also fetch several bits and pieces to the application. If this can be rewritten as a stored procedure that receives the data/parameters it needs in order to complete its work and does the whole thing in one go you'll definitely see an improvement as ther will be a single call to the database and you'll move (much) less data between the server and the application. On the other hand if you're mostly fetching data I doubt you'll be able to gain anything from changing to stored procedures. I believe a good rule of thumb is this: change data, several related operations, very simple processing involved -> stored procedure. Read data as in a reporting scenario -> prepared statements. Obviously if you're reading data in several steps and then aggregate it in the application then perhaps you need to make better use of SQL :) I hope this helps, Regards, -- Radu-Adrian Popescu CSA, DBA, Developer Aldrapay MD Aldratech Ltd. +40213212243 From pgsql-performance-owner@postgresql.org Wed Jun 22 04:45: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 E53FC528D9 for ; Wed, 22 Jun 2005 04:45:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47698-05 for ; Wed, 22 Jun 2005 07:45:22 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) by svr1.postgresql.org (Postfix) with ESMTP id A9CEA528A8 for ; Wed, 22 Jun 2005 04:45:20 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so166457wra for ; Wed, 22 Jun 2005 00:45:22 -0700 (PDT) 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:content-disposition:references; b=XIa3IVnYhFiQA/L6BZq/4i4DBfnsKT4GOU/1o4E8poCwbTcOqYBPPbJ9+8XQQLX9VDQN00o3NvVbfsAVnPfCoElc7gS8caUy5gUH52yOnb0esfOKfbQwTgGCKAmC8hxTSKRWMYbSKwy1Vk3TfbmFOzxjO9z9P6CbdglJGqvgWMg= Received: by 10.54.2.26 with SMTP id 26mr293319wrb; Wed, 22 Jun 2005 00:45:22 -0700 (PDT) Received: by 10.54.104.3 with HTTP; Wed, 22 Jun 2005 00:45:22 -0700 (PDT) Message-ID: Date: Wed, 22 Jun 2005 09:45:22 +0200 From: Kjell Tore Fossbakk Reply-To: Kjell Tore Fossbakk To: PFC Subject: Re: Querying 19million records very slowly Cc: Paul Ramsey , pgsql-performance@postgresql.org In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <42B8719A.6040809@refractions.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.361 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/423 X-Sequence-Number: 13060 database=3D> set enable_seqscan to on; SET Time: 0.34 ms database=3D> explain analyze select count(*) from test where p1=3D53; QUERY PLAN ---------------------------------------------------------------------------= -------------------------------------------- Aggregate (cost=3D522824.50..522824.50 rows=3D1 width=3D0) (actual time=3D56380.72..56380.72 rows=3D1 loops=3D1) -> Seq Scan on test (cost=3D0.00..517383.30 rows=3D2176479 width=3D0) (actual time=3D9.61..47677.48 rows=3D2220746 loops=3D1) Filter: (p1 =3D 53) Total runtime: 56380.79 msec (4 rows) Time: 56381.40 ms database=3D> explain analyze select count(*) from test where p1=3D53 and time > now() - interval '24 hours' ; QUERY PLAN ---------------------------------------------------------------------------= --------------------------------------------- Aggregate (cost=3D661969.01..661969.01 rows=3D1 width=3D0) (actual time=3D45787.02..45787.02 rows=3D1 loops=3D1) -> Seq Scan on test (cost=3D0.00..660155.28 rows=3D725493 width=3D0) (actual time=3D37799.32..45613.58 rows=3D42424 loops=3D1) Filter: ((p1 =3D 53) AND ("time" > (now() - '1 day'::interval))) Total runtime: 45787.09 msec (4 rows) Time: 45787.79 ms database=3D> explain analyze select date_trunc('hour', time),count(*) as total from test where p1=3D53 and time>now()-interval '24 hours' group by date_trunc order by date_trunc; QUERY PLAN ---------------------------------------------------------------------------= --------------------------------------------------------- Aggregate (cost=3D755116.97..760558.17 rows=3D72549 width=3D8) (actual time=3D46040.63..46717.61 rows=3D23 loops=3D1) -> Group (cost=3D755116.97..758744.44 rows=3D725493 width=3D8) (actual time=3D46022.06..46548.84 rows=3D42407 loops=3D1) -> Sort (cost=3D755116.97..756930.70 rows=3D725493 width=3D8) (actual time=3D46022.04..46198.94 rows=3D42407 loops=3D1) Sort Key: date_trunc('hour'::text, "time") -> Seq Scan on test (cost=3D0.00..660155.28 rows=3D725493 width=3D8) (actual time=3D37784.91..45690.88 rows=3D42407 loops=3D1) Filter: ((p1 =3D 53) AND ("time" > (now() - '1 day'::interval))) Total runtime: 46718.43 msec (7 rows) Time: 46719.44 ms database=3D> create index test_time_p1_idx on test(time,p1) ; CREATE INDEX Time: 178926.02 ms database=3D> vacuum analyze test ; VACUUM Time: 73058.33 ms database=3D> \d test Table "public.test" Column | Type | Modifiers -------------+--------------------------+----------- time | timestamp with time zone | source | inet | destination | inet | p1 | integer | p2 | integer | database=3D> \di public | test_time_idx | index | database | test public | test_source_idx | index | database | test public | test_destination_idx | index | database | test public | test_p1_idx | index | database | test public | test_p2_idx | index | database | test public | test_time_p1_idx | index | database | test database=3D> set enable_seqscan to off ; SET Time: 0.28 ms database=3D> explain analyze select date_trunc('hour', time),count(*) as total from test where p1=3D53 and time>now()-interval '24 hours' group by date_trunc order by date_trunc; Aggregate (cost=3D2315252.66..2320767.17 rows=3D73527 width=3D8) (actual time=3D2081.15..2720.44 rows=3D23 loops=3D1) -> Group (cost=3D2315252.66..2318929.00 rows=3D735268 width=3D8) (actual time=3D2079.76..2564.22 rows=3D41366 loops=3D1) -> Sort (cost=3D2315252.66..2317090.83 rows=3D735268 width=3D8) (actual time=3D2079.74..2243.32 rows=3D41366 loops=3D1) Sort Key: date_trunc('hour'::text, "time") -> Index Scan using test_time_p1_idx on test=20 (cost=3D0.00..2218878.46 rows=3D735268 width=3D8) (actual time=3D29.50..1774.52 rows=3D41366 loops=3D1) Index Cond: (("time" > (now() - '1 day'::interval)) AND (p1 =3D 53)) Total runtime: 2735.42 msec Time: 2736.48 ms database=3D> explain analyze select date_trunc('hour', time),count(*) as total from test where p1=3D80 and time>now()-interval '24 hours' group by date_trunc order by date_trunc; Aggregate (cost=3D1071732.15..1074305.59 rows=3D34313 width=3D8) (actual time=3D6353.93..7321.99 rows=3D22 loops=3D1) -> Group (cost=3D1071732.15..1073447.77 rows=3D343125 width=3D8) (actual time=3D6323.76..7078.10 rows=3D64267 loops=3D1) -> Sort (cost=3D1071732.15..1072589.96 rows=3D343125 width=3D8) (actual time=3D6323.75..6579.42 rows=3D64267 loops=3D1) Sort Key: date_trunc('hour'::text, "time") -> Index Scan using test_time_p1_idx on test=20 (cost=3D0.00..1035479.58 rows=3D343125 width=3D8) (actual time=3D0.20..5858= .67 rows=3D64267 loops=3D1) Index Cond: (("time" > (now() - '1 day'::interval)) AND (p1 =3D 80)) Total runtime: 7322.82 msec Time: 7323.90 ms database=3D> explain analyze select date_trunc('hour', time),count(*) as total from test where p1=3D139 and time>now()-interval '24 hours' group by date_trunc order by date_trunc; Aggregate (cost=3D701562.34..703250.12 rows=3D22504 width=3D8) (actual time=3D2448.41..3033.80 rows=3D22 loops=3D1) -> Group (cost=3D701562.34..702687.53 rows=3D225037 width=3D8) (actual time=3D2417.39..2884.25 rows=3D36637 loops=3D1) -> Sort (cost=3D701562.34..702124.94 rows=3D225037 width=3D8) (actual time=3D2417.38..2574.19 rows=3D36637 loops=3D1) Sort Key: date_trunc('hour'::text, "time") -> Index Scan using test_time_p1_idx on test=20 (cost=3D0.00..679115.34 rows=3D225037 width=3D8) (actual time=3D8.47..2156.= 18 rows=3D36637 loops=3D1) Index Cond: (("time" > (now() - '1 day'::interval)) AND (p1 =3D 139)) Total runtime: 3034.57 msec Time: 3035.70 ms Now, this query gives me all the hours in a day, with the count of all p1=3D53 for each hour. Pg uses 46.7 seconds to run with seqscan, while 2.7 seconds indexing on (time,p1). I think I turned "set enable_seqscan to on;" again, and then the planner used seqscan, and not index. - Why does Pg not see the benefits of using index? - and how can i tune the optimisation fields in postgresql.conf to help him= ? So now my PG uses a reasonable amout of time on these queries (with enable_seqscan turned off) The next place which seems to slow my queries, is probably my connection to PHP. I got a bash script running in cron on my server (freebsd 4.11), which runs php on a php file. To force PG to not use seqscans, I have modifies the postgresql.conf: .. enable_seqscan =3D false enable_indexscan =3D true .. effective_cache_size =3D 10000 random_page_cost =3D 2 .. I save the file, type 'pg_crl reload' then enter 'psql database'. database=3D> show enable_seqscan ; enable_seqscan ---------------- on (1 row) argus=3D> show effective_cache_size ; effective_cache_size ---------------------- 1000 (1 row) I have used the manual pages on postgresql, postmaster, and so on, but I cant find anywhere to specify which config file Pg is to use. I'm not entirely sure if he uses the one im editing (/usr/local/etc/postgresql.conf). Any hints, tips or help is most appreciated! Kjell Tore. On 6/21/05, PFC wrote: >=20 > use CURRENT_TIME which is a constant instead of now() which is not =20 > considered constant... (I think) > From pgsql-performance-owner@postgresql.org Wed Jun 22 05:04: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 48F5852812 for ; Wed, 22 Jun 2005 05:04:07 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52036-03 for ; Wed, 22 Jun 2005 08:04:05 +0000 (GMT) Received: from exobox.exoweb.net (unknown [221.122.43.98]) by svr1.postgresql.org (Postfix) with SMTP id 4563E5285C for ; Wed, 22 Jun 2005 05:03:58 -0300 (ADT) Received: (qmail 24633 invoked from network); 22 Jun 2005 08:03:57 -0000 Received: from exo185.exoweb.net (HELO tobias.nordicbet.invalid) (192.168.0.185) by 0 with SMTP; 22 Jun 2005 08:03:57 -0000 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id 828EAE0D07; Wed, 22 Jun 2005 16:03:57 +0800 (CST) Date: Wed, 22 Jun 2005 16:03:57 +0800 From: Tobias Brox To: Kjell Tore Fossbakk Cc: pgsql-performance@postgresql.org Subject: Re: Querying 19million records very slowly Message-ID: <20050622080357.GW7839@tobias> References: <42B8719A.6040809@refractions.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Group Nordicbet 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: 200506/424 X-Sequence-Number: 13061 [Kjell Tore Fossbakk - Wed at 09:45:22AM +0200] > database=> explain analyze select count(*) from test where p1=53 and > time > now() - interval '24 hours' ; Sorry to say that I have not followed the entire thread neither read the entire email I'm replying to, but I have a quick hint on this one (ref my earlier thread about timestamp indices) - the postgresql planner will generally behave smarter when using a fixed timestamp (typically generated by the app server) than logics based on now(). One of my colleagues also claimed that he found the usage of localtimestamp faster than now(). -- Tobias Brox, +86-13521622905 Nordicbet, IT dept From pgsql-performance-owner@postgresql.org Wed Jun 22 05:18: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 9035452800 for ; Wed, 22 Jun 2005 05:18:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52373-08 for ; Wed, 22 Jun 2005 08:18:30 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) by svr1.postgresql.org (Postfix) with ESMTP id CA5BA5285C for ; Wed, 22 Jun 2005 05:18:29 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so176818wra for ; Wed, 22 Jun 2005 01:18:31 -0700 (PDT) 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:content-disposition:references; b=dmxI9H3rfugbVt21J1625vrAnVbhj90hJTMtGmzXAi/y8WCGAprfuN5veX6baZPWjmAgvJ9J5jPUeDU6NJS1DDOvHzK1kM8RilKJomrrUYdvZcYxSHRpgAKRyZMK0BM0ycK0gqzue+5VuYVCODUQ8rrBjEUVsqHE11sRP0+pi4k= Received: by 10.54.29.41 with SMTP id c41mr304479wrc; Wed, 22 Jun 2005 01:18:30 -0700 (PDT) Received: by 10.54.104.3 with HTTP; Wed, 22 Jun 2005 01:18:30 -0700 (PDT) Message-ID: Date: Wed, 22 Jun 2005 10:18:30 +0200 From: Kjell Tore Fossbakk Reply-To: Kjell Tore Fossbakk To: Tobias Brox Subject: Re: Querying 19million records very slowly Cc: pgsql-performance@postgresql.org In-Reply-To: <20050622080357.GW7839@tobias> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <42B8719A.6040809@refractions.net> <20050622080357.GW7839@tobias> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.226 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/425 X-Sequence-Number: 13062 Appreciate your time, Mr Brox. I'll test the use of current_timestamp, rather than now(). I am not sure if Pg can do a match between a fixed timestamp and a datetime? time > current_timestamp - interval '24 hours', when time is yyyy-mm-dd hh-mm-ss+02, like 2005-06-22 16:00:00+02. If Pg cant do it, and current_time is faster, i could possibly convert the time field in my database to timestamp, and insert all rows as timestamp rather than a timedate. But that is some script to work over 19 mill rows, so I need to know if that will give me any more speed.. Kjell Tore. On 6/22/05, Tobias Brox wrote: > [Kjell Tore Fossbakk - Wed at 09:45:22AM +0200] > > database=3D> explain analyze select count(*) from test where p1=3D53 an= d > > time > now() - interval '24 hours' ; >=20 > Sorry to say that I have not followed the entire thread neither read the > entire email I'm replying to, but I have a quick hint on this one (ref my > earlier thread about timestamp indices) - the postgresql planner will > generally behave smarter when using a fixed timestamp (typically generate= d > by the app server) than logics based on now(). >=20 > One of my colleagues also claimed that he found the usage of > localtimestamp faster than now(). >=20 > --=20 > Tobias Brox, +86-13521622905 > Nordicbet, IT dept > From pgsql-performance-owner@postgresql.org Wed Jun 22 05:31: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 035A152812 for ; Wed, 22 Jun 2005 05:31:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56188-08 for ; Wed, 22 Jun 2005 08:31:09 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by svr1.postgresql.org (Postfix) with ESMTP id 122FF52835 for ; Wed, 22 Jun 2005 05:31:08 -0300 (ADT) Received: from p548F2A32.dip0.t-ipconnect.de [84.143.42.50] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de with ESMTP (Nemesis), id 0ML2Dk-1Dl0dJ2hV8-0000rc; Wed, 22 Jun 2005 10:30:53 +0200 Received: from pse1 ([192.168.0.3]) by pse.dyndns.org with esmtp (Exim 4.44) id 1Dl0dI-0002JZ-9A; Wed, 22 Jun 2005 10:30:52 +0200 Message-ID: <42B921BB.3000705@pse-consulting.de> Date: Wed, 22 Jun 2005 08:30:51 +0000 From: Andreas Pflug User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Greg Sabino Mullane Cc: pgsql-performance@postgresql.org, Josh Berkus Subject: Re: Configurator project launched References: <17c492d2af42972995595f73c426f2aa@biglumber.com> In-Reply-To: <17c492d2af42972995595f73c426f2aa@biglumber.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:0ce7ee5c3478b8d72edd8e05ccd40b70 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.041 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/426 X-Sequence-Number: 13063 Greg Sabino Mullane wrote: > > >>>>Um, can't we just get that from pg_settings? >>>> >>>>Anyway, I'll be deriving settings from the .conf file, since most of the >>>>time the Configurator will be run on a new installation. >>> >>>Aren't most of the settings all kept in the SHOW variables anyway? > > > As I said, it may not be applicable to this project, but thought I would > offer. One gotcha the module makes transparent is that in older versions of > PG, the variables are returned in a different way (via RAISE). My module > will allow you to get the configuration for any connected database, for > any configuration file, and the defaults for any known version, and do > quick comparisons between them all. So you could use it to see what has > changed between a particular server and its conf file, or the differences > between two conf files, or the differences between two databases, or even show > what has changed in the default conf file from 7.4.7 and 8.0.1. It will also > allow you to rewrite the conf files in a standard way. Sounds a little similar to what's in pgAdmin CVS right now. The configuration editor can retrieve the config file and display configured and active setting concurrently, together with explanations taken from pg_settings (when not run against a pgsql server but a file current settings are missing, comments are taken from a pg_settings csv dump). There's the infrastructure to give hints about all settings, with very few currently implemented. I wonder if this could be combined with the configurator somehow. Currently, integration won't work with Perl, so maybe C for the core and Perl for the interactive part would be better. Regards, Andreas From pgsql-performance-owner@postgresql.org Wed Jun 22 05: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 BA13F52833 for ; Wed, 22 Jun 2005 05:39:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58569-04 for ; Wed, 22 Jun 2005 08:39:25 +0000 (GMT) Received: from exobox.exoweb.net (unknown [221.122.43.98]) by svr1.postgresql.org (Postfix) with SMTP id 75ABD52800 for ; Wed, 22 Jun 2005 05:39:21 -0300 (ADT) Received: (qmail 29397 invoked from network); 22 Jun 2005 08:39:22 -0000 Received: from exo185.exoweb.net (HELO tobias.nordicbet.invalid) (192.168.0.185) by 0 with SMTP; 22 Jun 2005 08:39:22 -0000 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id A6700E0D07; Wed, 22 Jun 2005 16:39:21 +0800 (CST) Date: Wed, 22 Jun 2005 16:39:21 +0800 From: Tobias Brox To: Kjell Tore Fossbakk Cc: Tobias Brox , pgsql-performance@postgresql.org Subject: Re: Querying 19million records very slowly Message-ID: <20050622083921.GZ7839@tobias> References: <42B8719A.6040809@refractions.net> <20050622080357.GW7839@tobias> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Group Nordicbet 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: 200506/427 X-Sequence-Number: 13064 [Kjell Tore Fossbakk - Wed at 10:18:30AM +0200] > I'll test the use of current_timestamp, rather than now(). I am not > sure if Pg can do a match between a fixed timestamp and a datetime? I have almost all my experience with timestamps wo timezones, but ... isn't that almost the same as the timedate type? > time > current_timestamp - interval '24 hours', > when time is yyyy-mm-dd hh-mm-ss+02, like 2005-06-22 16:00:00+02. Try to type in '2005-06-21 16:36:22+08' directly in the query, and see if it makes changes. Or probably '2005-06-21 10:36:22+02' in your case ;-) (btw, does postgresql really handles timezones? '+02' is quite different from 'CET', which will be obvious sometime in the late autoumn...) -- Tobias Brox, +86-13521622905 Nordicbet, IT dept From pgsql-performance-owner@postgresql.org Wed Jun 22 05: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 1A8B5528B4 for ; Wed, 22 Jun 2005 05:55:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62477-01 for ; Wed, 22 Jun 2005 08:55:50 +0000 (GMT) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id BB5BA52882 for ; Wed, 22 Jun 2005 05:55:48 -0300 (ADT) Received: from [172.16.1.182] grzm [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.5 $ on Linux via secured & encrypted transport (TLS); Wed, 22 Jun 2005 02:55:38 -0600 In-Reply-To: <20050622083921.GZ7839@tobias> References: <42B8719A.6040809@refractions.net> <20050622080357.GW7839@tobias> <20050622083921.GZ7839@tobias> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <8B2836FF-F335-49A4-8131-8EF2D02100F9@myrealbox.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: Querying 19million records very slowly Date: Wed, 22 Jun 2005 17:55:35 +0900 To: Tobias Brox X-Mailer: Apple Mail (2.730) 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: 200506/428 X-Sequence-Number: 13065 On Jun 22, 2005, at 5:39 PM, Tobias Brox wrote: > (btw, does postgresql really handles timezones? '+02' is quite > different > from 'CET', which will be obvious sometime in the late autoumn...) Yes, it does. It doesn't (currently) record the time zone name, but rather only the offset from UTC. If a time zone name (rather than UTC offset) is given, it is converted to the UTC offset *at that timestamptz* when it is stored. For time zones that take into account DST, their UTC offset changes during the year, and PostgreSQL records the equivalent UTC offset for the appropriate timestamptz values. There has been discussion in the past on storing the time zone name with the timestamptz as well, though no one has implemented this yet. Michael Glaesemann grzm myrealbox com From pgsql-performance-owner@postgresql.org Tue Jun 28 01:30: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 04E2852833 for ; Wed, 22 Jun 2005 06:03:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60372-08 for ; Wed, 22 Jun 2005 09:03:31 +0000 (GMT) Received: from web32910.mail.mud.yahoo.com (web32910.mail.mud.yahoo.com [68.142.206.57]) by svr1.postgresql.org (Postfix) with SMTP id C15BC5284D for ; Wed, 22 Jun 2005 06:03:28 -0300 (ADT) Received: (qmail 34688 invoked by uid 60001); 22 Jun 2005 09:03:29 -0000 Message-ID: <20050622090329.34686.qmail@web32910.mail.mud.yahoo.com> Received: from [216.132.49.70] by web32910.mail.mud.yahoo.com via HTTP; Wed, 22 Jun 2005 02:03:29 PDT X-RocketYMMF: adamle2028 Date: Wed, 22 Jun 2005 02:03:29 -0700 (PDT) From: Aditya Damle Reply-To: aditya@skillnetinc.com Subject: LIKE search with ending % not optimized in v8 To: pgsql-performance@postgresql.org 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/526 X-Sequence-Number: 13163 Hello. I believe in earlier versions, a query of the form select attrib from ttt where attrib like 'foo%' would be able to take advantage of an index. I have seen this in the past. Currently I am using v8.0.3. From what I can see is that the execultion plan seems to use a seq scan and to totally ignore the index. Is this the case? -Aditya From pgsql-performance-owner@postgresql.org Wed Jun 22 06:10: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 36C1352886 for ; Wed, 22 Jun 2005 06:10:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65425-03 for ; Wed, 22 Jun 2005 09:10:43 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id D4F1B52923 for ; Wed, 22 Jun 2005 06:10:40 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so195317wra for ; Wed, 22 Jun 2005 02:10:42 -0700 (PDT) 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:content-disposition:references; b=AAd7ZNMTq37s+Fefgasrllmp8sy57MuvQA7DLLAD3VluAzeTstsAQSvb4/km+fGYsKGnswNYX2UDCgSnJq67mmmKFNElEZLI+X0RPMXaKK+j7tAio8NpjVZ5NKETQTJrOk0mbvK1/qDj0FtclvvRq2JLTzqQSCUUrQnXP+pgEPk= Received: by 10.54.42.17 with SMTP id p17mr312675wrp; Wed, 22 Jun 2005 02:10:42 -0700 (PDT) Received: by 10.54.104.3 with HTTP; Wed, 22 Jun 2005 02:10:42 -0700 (PDT) Message-ID: Date: Wed, 22 Jun 2005 11:10:42 +0200 From: Kjell Tore Fossbakk Reply-To: Kjell Tore Fossbakk To: Michael Glaesemann Subject: Re: Querying 19million records very slowly Cc: Tobias Brox , pgsql-performance@postgresql.org In-Reply-To: <8B2836FF-F335-49A4-8131-8EF2D02100F9@myrealbox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <42B8719A.6040809@refractions.net> <20050622080357.GW7839@tobias> <20050622083921.GZ7839@tobias> <8B2836FF-F335-49A4-8131-8EF2D02100F9@myrealbox.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.168 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/429 X-Sequence-Number: 13066 > Try to type in '2005-06-21 16:36:22+08' directly in the query, and see if= it > makes changes. Or probably '2005-06-21 10:36:22+02' in your case ;-) Which one does Pg read fastes? Does he convert datetime in the table, then my where clause and check, for each row? How does he compare a datetime with a datetime? Timestamp are easy, large number bigger than another large number.. time (datetime) > '2005-06-21 10:36:22+02' or=20 time (timestamp) > 'some timestamp pointing to yesterday' Hmm.. I cant find any doc that describes this very good. On 6/22/05, Michael Glaesemann wrote: >=20 > On Jun 22, 2005, at 5:39 PM, Tobias Brox wrote: >=20 > > (btw, does postgresql really handles timezones? '+02' is quite =20 > > different > > from 'CET', which will be obvious sometime in the late autoumn...) >=20 > Yes, it does. It doesn't (currently) record the time zone name, but =20 > rather only the offset from UTC. If a time zone name (rather than UTC =20 > offset) is given, it is converted to the UTC offset *at that =20 > timestamptz* when it is stored. For time zones that take into account =20 > DST, their UTC offset changes during the year, and PostgreSQL records =20 > the equivalent UTC offset for the appropriate timestamptz values. >=20 > There has been discussion in the past on storing the time zone name =20 > with the timestamptz as well, though no one has implemented this yet. >=20 > Michael Glaesemann > grzm myrealbox com >=20 >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? >=20 > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Wed Jun 22 06:15: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 43F7C52882 for ; Wed, 22 Jun 2005 06:15:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 62583-09 for ; Wed, 22 Jun 2005 09:15:05 +0000 (GMT) Received: from dozer.computec.de (dozer.computec.de [212.123.108.12]) by svr1.postgresql.org (Postfix) with ESMTP id E5B1C52923 for ; Wed, 22 Jun 2005 06:14:59 -0300 (ADT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Forums & tsearch2 - best practices reg. concurrency Date: Wed, 22 Jun 2005 11:14:56 +0200 Message-ID: <2266D0630E43BB4290742247C891057507A0D796@dozer.computec.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Forums & tsearch2 - best practices reg. concurrency Thread-Index: AcV3CtsTUb7WGTisTOKtrCR/y3TSyQ== From: "Markus Wollny" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.277 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200506/430 X-Sequence-Number: 13067 Hello! =20 We're using PostgreSQL 8.0.1 as general backend for all of our websites, including our online forums (aka bulletin boards or whatever you wish to call that). As for full text search capabilities, we've chosen to implement this via tsearch2. However, the tables themselves are quite large, and as there's lots of weird user input in them (just no way of limiting our users to "proper" orthography), so are the indices; we have already split up the main posting-table in two, one containing the more recent messages (<6 months) and one for everything else. Search capabilities have been limited to accessing only one of those, either recent or archive. Still, the tsearch2-GiST-index for a table is around 325MB in size; the "recent messages" table itself without any indices weighs in at about 1.8GB containing over one million rows, the archive-table is a little over 3GB and contains about 1.3 million rows. A full text search in the table with the recent postings can take up to five minutes. This wouldn't be much of a problem, as we're providing other, quicker search options (like searching for an author or a full text search just on the topics); the problem with the full text search lies in the locking mechanisms: As long as there's a search going on, all the subsequent INSERTs or UPDATEs on that table fail due to timeout. This means that currently, whenever we allow full text searching, there may be a timeframe of more than one hour, during which users cannot write any new postings in our forum or edit (i.e. update) anything. This is hardly acceptable... This is what I did to actually diagnose that simple tsearch2-related SELECTs where causing the write-locks: First I started a full text search query which I knew would run over four minutes. Then I waited for other users to try and post some messages; soon enough a 'ps ax|grep wait' showed several "INSERT/UPDATE waiting"-backends. So I took a look at the locks: select s.current_query as statement, l.mode as lock_mode, l.granted as lock_granted, c.relname as locked_relation, c.relnamespace as locked_relnamespace, c.reltype as locked_reltype from pg_stat_activity s, pg_locks l, pg_class c where l.pid =3D s.procpid and l.relation =3D c.oid order by age(s.query_start) desc; I found four locks for the search query at the very beginning of the resultset - all of them of the AccessShareLock persuasion and granted alright: one on the message-table, one on the thread-table, one on the tsearch2-index and another one on the primary key index of the thread-table. The hanging inserts/updates were waiting for an AccessExclusiveLock on the tsearch2-index - all the other locks of these queries were marked as granted. As far as I understand from some of the previous messages on the mailing list regarding concurrency issues with GiST-type indices, any SELECT that's using a tsearch2-index would completely lock write-access to that index for the runtime of the query - is that correct so far? Now I'd like to find out about possible solutions or workarounds for this issue. Surely some of you must have encountered quite similar situations, so what did you do about it? I already pondered the idea of a separate insert/update-queue-table which would then be processed by a cron-job, thus separating the information-entry from the actual insert into the table that's blocked due to the lock on the index. Another possibility (which I find a little bit more compelling) would involve replicating the message-table via Slony-I to another database which could then be used as only target for any search-queries which require use of the GiST-index. Would this provide the needed "asynchronicity" to avoid this race condition between the AccessShareLock from the search-SELECT and the AccessExclusiveLock from the write access queries? I'd be very glad to know your opinions on this matter. Kind regards Markus From pgsql-performance-owner@postgresql.org Wed Jun 22 06:36: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 5277B528A8 for ; Wed, 22 Jun 2005 06:36:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68252-08 for ; Wed, 22 Jun 2005 09:36:53 +0000 (GMT) Received: from exobox.exoweb.net (unknown [221.122.43.98]) by svr1.postgresql.org (Postfix) with SMTP id 23CE952886 for ; Wed, 22 Jun 2005 06:36:45 -0300 (ADT) Received: (qmail 31153 invoked from network); 22 Jun 2005 09:36:44 -0000 Received: from exo185.exoweb.net (HELO tobias.nordicbet.invalid) (192.168.0.185) by 0 with SMTP; 22 Jun 2005 09:36:44 -0000 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id 6EA79E0D07; Wed, 22 Jun 2005 17:36:44 +0800 (CST) Date: Wed, 22 Jun 2005 17:36:44 +0800 From: Tobias Brox To: Kjell Tore Fossbakk Cc: Michael Glaesemann , Tobias Brox , pgsql-performance@postgresql.org Subject: Re: Querying 19million records very slowly Message-ID: <20050622093644.GA7839@tobias> References: <42B8719A.6040809@refractions.net> <20050622080357.GW7839@tobias> <20050622083921.GZ7839@tobias> <8B2836FF-F335-49A4-8131-8EF2D02100F9@myrealbox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Group Nordicbet 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: 200506/431 X-Sequence-Number: 13068 [Kjell Tore Fossbakk - Wed at 11:10:42AM +0200] > Which one does Pg read fastes? Does he convert datetime in the table, > then my where clause and check, for each row? How does he compare a > datetime with a datetime? Timestamp are easy, large number bigger than > another large number.. > > time (datetime) > '2005-06-21 10:36:22+02' > > or > > time (timestamp) > 'some timestamp pointing to yesterday' If I have understood it correctly, the planner will recognize the timestamp and compare it with the statistics in the first example but not in the second, and thus it will be more likely to use index scan on the first one and seqscan on the second. -- Tobias Brox, +86-13521622905 Nordicbet, IT dept From pgsql-performance-owner@postgresql.org Wed Jun 22 07:53: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 982FE52913 for ; Wed, 22 Jun 2005 07:53:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83365-10 for ; Wed, 22 Jun 2005 10:53:36 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2837E528D0 for ; Wed, 22 Jun 2005 07:53:28 -0300 (ADT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.13.4/8.13.4) with ESMTP id j5MArLUb013214; Wed, 22 Jun 2005 14:53:21 +0400 (MSD) Date: Wed, 22 Jun 2005 14:53:20 +0400 (MSD) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: Markus Wollny Cc: pgsql-performance@postgresql.org Subject: Re: Forums & tsearch2 - best practices reg. concurrency In-Reply-To: <2266D0630E43BB4290742247C891057507A0D796@dozer.computec.de> Message-ID: References: <2266D0630E43BB4290742247C891057507A0D796@dozer.computec.de> 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.644 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, URIBL_SBL X-Spam-Level: X-Archive-Number: 200506/432 X-Sequence-Number: 13069 Markus, wait for 8.1 which should solve all of these issues. We're working on GiST concurrency & recovery right now. See http://www.pgsql.ru/db/mw/msg.html?mid=2073083 for details. Oleg On Wed, 22 Jun 2005, Markus Wollny wrote: > Hello! > > We're using PostgreSQL 8.0.1 as general backend for all of our websites, > including our online forums (aka bulletin boards or whatever you wish to > call that). As for full text search capabilities, we've chosen to > implement this via tsearch2. However, the tables themselves are quite > large, and as there's lots of weird user input in them (just no way of > limiting our users to "proper" orthography), so are the indices; we have > already split up the main posting-table in two, one containing the more > recent messages (<6 months) and one for everything else. > > Search capabilities have been limited to accessing only one of those, > either recent or archive. Still, the tsearch2-GiST-index for a table is > around 325MB in size; the "recent messages" table itself without any > indices weighs in at about 1.8GB containing over one million rows, the > archive-table is a little over 3GB and contains about 1.3 million rows. > A full text search in the table with the recent postings can take up to > five minutes. > > This wouldn't be much of a problem, as we're providing other, quicker > search options (like searching for an author or a full text search just > on the topics); the problem with the full text search lies in the > locking mechanisms: As long as there's a search going on, all the > subsequent INSERTs or UPDATEs on that table fail due to timeout. This > means that currently, whenever we allow full text searching, there may > be a timeframe of more than one hour, during which users cannot write > any new postings in our forum or edit (i.e. update) anything. This is > hardly acceptable... > > This is what I did to actually diagnose that simple tsearch2-related > SELECTs where causing the write-locks: > > First I started a full text search query which I knew would run over > four minutes. Then I waited for other users to try and post some > messages; soon enough a 'ps ax|grep wait' showed several "INSERT/UPDATE > waiting"-backends. So I took a look at the locks: > > select s.current_query as statement, > l.mode as lock_mode, > l.granted as lock_granted, > c.relname as locked_relation, > c.relnamespace as locked_relnamespace, > c.reltype as locked_reltype > from pg_stat_activity s, > pg_locks l, > pg_class c > where > l.pid = s.procpid > and > l.relation = c.oid > order by age(s.query_start) desc; > > I found four locks for the search query at the very beginning of the > resultset - all of them of the AccessShareLock persuasion and granted > alright: one on the message-table, one on the thread-table, one on the > tsearch2-index and another one on the primary key index of the > thread-table. > > The hanging inserts/updates were waiting for an AccessExclusiveLock on > the tsearch2-index - all the other locks of these queries were marked as > granted. > > As far as I understand from some of the previous messages on the mailing > list regarding concurrency issues with GiST-type indices, any SELECT > that's using a tsearch2-index would completely lock write-access to that > index for the runtime of the query - is that correct so far? > > Now I'd like to find out about possible solutions or workarounds for > this issue. Surely some of you must have encountered quite similar > situations, so what did you do about it? I already pondered the idea of > a separate insert/update-queue-table which would then be processed by a > cron-job, thus separating the information-entry from the actual insert > into the table that's blocked due to the lock on the index. Another > possibility (which I find a little bit more compelling) would involve > replicating the message-table via Slony-I to another database which > could then be used as only target for any search-queries which require > use of the GiST-index. Would this provide the needed "asynchronicity" to > avoid this race condition between the AccessShareLock from the > search-SELECT and the AccessExclusiveLock from the write access queries? > > I'd be very glad to know your opinions on this matter. > > Kind regards > > Markus > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match > 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 Wed Jun 22 10:51: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 834D9528C7 for ; Wed, 22 Jun 2005 10:51:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25764-03 for ; Wed, 22 Jun 2005 13:50: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 1DBC75293C for ; Wed, 22 Jun 2005 10:50:49 -0300 (ADT) 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 j5MDod7p027061; Wed, 22 Jun 2005 09:50:39 -0400 (EDT) To: Tobias Brox Cc: Kjell Tore Fossbakk , Michael Glaesemann , pgsql-performance@postgresql.org Subject: Re: Querying 19million records very slowly In-reply-to: <20050622093644.GA7839@tobias> References: <42B8719A.6040809@refractions.net> <20050622080357.GW7839@tobias> <20050622083921.GZ7839@tobias> <8B2836FF-F335-49A4-8131-8EF2D02100F9@myrealbox.com> <20050622093644.GA7839@tobias> Comments: In-reply-to Tobias Brox message dated "Wed, 22 Jun 2005 17:36:44 +0800" Date: Wed, 22 Jun 2005 09:50:39 -0400 Message-ID: <27060.1119448239@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: 200506/433 X-Sequence-Number: 13070 Tobias Brox writes: >> time (datetime) > '2005-06-21 10:36:22+02' >> or >> time (timestamp) > 'some timestamp pointing to yesterday' > If I have understood it correctly, the planner will recognize the timestamp > and compare it with the statistics in the first example but not in the > second, and thus it will be more likely to use index scan on the first one > and seqscan on the second. That statement is true for releases before 8.0. Kjell has not at any point told us what PG version he is running, unless I missed it... regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jun 22 11:19: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 2989652913 for ; Wed, 22 Jun 2005 11:19:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31620-02 for ; Wed, 22 Jun 2005 14:19:32 +0000 (GMT) Received: from pd4mo1so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by svr1.postgresql.org (Postfix) with ESMTP id D2578528CB for ; Wed, 22 Jun 2005 11:19:30 -0300 (ADT) Received: from pd2mr2so.prod.shaw.ca (pd2mr2so-qfe3.prod.shaw.ca [10.0.141.109]) by l-daemon (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0IIH00M70P420RD0@l-daemon> for pgsql-performance@postgresql.org; Wed, 22 Jun 2005 08:19:14 -0600 (MDT) Received: from pn2ml5so.prod.shaw.ca ([10.0.121.149]) by pd2mr2so.prod.shaw.ca (Sun ONE Messaging Server 6.0 HotFix 1.01 (built Mar 15 2004)) with ESMTP id <0IIH00NP2P4228M0@pd2mr2so.prod.shaw.ca> for pgsql-performance@postgresql.org; Wed, 22 Jun 2005 08:19:14 -0600 (MDT) Received: from refractions.net (S0106000f66d52c48.gv.shawcable.net [24.69.99.70]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0IIH00F38P417X@l-daemon> for pgsql-performance@postgresql.org; Wed, 22 Jun 2005 08:19:14 -0600 (MDT) Date: Wed, 22 Jun 2005 07:20:13 -0700 From: Paul Ramsey Subject: Re: Querying 19million records very slowly In-reply-to: To: Kjell Tore Fossbakk Cc: PFC , pgsql-performance@postgresql.org Message-id: MIME-version: 1.0 (Apple Message framework v553) X-Mailer: Apple Mail (2.553) Content-type: text/plain; format=flowed; charset=US-ASCII; delsp=yes Content-transfer-encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.12 tagged_above=0 required=5 tests=DNS_FROM_AHBL_RHSBL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/434 X-Sequence-Number: 13071 OK, so the planner is in fact making a mistake (I think). Try turning down your random_page_cost a little. It defaults at 4.0, see if 2.0 works "right". (Careful, move these things around too much for one query, you will wreck others.) 4.0 is a little large for almost all modern hardware, so see if moving it down a little makes things somewhat smarter. P On Wednesday, June 22, 2005, at 12:45 AM, Kjell Tore Fossbakk wrote: > database=> set enable_seqscan to on; > SET > Time: 0.34 ms > > > > database=> explain analyze select count(*) from test where p1=53; > QUERY PLAN > ----------------------------------------------------------------------- > ------------------------------------------------ > Aggregate (cost=522824.50..522824.50 rows=1 width=0) (actual > time=56380.72..56380.72 rows=1 loops=1) > -> Seq Scan on test (cost=0.00..517383.30 rows=2176479 width=0) > (actual time=9.61..47677.48 rows=2220746 loops=1) > Filter: (p1 = 53) > Total runtime: 56380.79 msec > (4 rows) > > Time: 56381.40 ms > > > > database=> explain analyze select count(*) from test where p1=53 and > time > now() - interval '24 hours' ; > QUERY PLAN > ----------------------------------------------------------------------- > ------------------------------------------------- > Aggregate (cost=661969.01..661969.01 rows=1 width=0) (actual > time=45787.02..45787.02 rows=1 loops=1) > -> Seq Scan on test (cost=0.00..660155.28 rows=725493 width=0) > (actual time=37799.32..45613.58 rows=42424 loops=1) > Filter: ((p1 = 53) AND ("time" > (now() - '1 day'::interval))) > Total runtime: 45787.09 msec > (4 rows) > > Time: 45787.79 ms > > > > database=> explain analyze select date_trunc('hour', time),count(*) as > total from test where p1=53 and time>now()-interval '24 hours' group > by date_trunc order by date_trunc; > QUERY > PLAN > ----------------------------------------------------------------------- > ------------------------------------------------------------- > Aggregate (cost=755116.97..760558.17 rows=72549 width=8) (actual > time=46040.63..46717.61 rows=23 loops=1) > -> Group (cost=755116.97..758744.44 rows=725493 width=8) (actual > time=46022.06..46548.84 rows=42407 loops=1) > -> Sort (cost=755116.97..756930.70 rows=725493 width=8) > (actual time=46022.04..46198.94 rows=42407 loops=1) > Sort Key: date_trunc('hour'::text, "time") > -> Seq Scan on test (cost=0.00..660155.28 rows=725493 > width=8) (actual time=37784.91..45690.88 rows=42407 loops=1) > Filter: ((p1 = 53) AND ("time" > (now() - '1 > day'::interval))) > Total runtime: 46718.43 msec > (7 rows) > > Time: 46719.44 ms > > > > database=> create index test_time_p1_idx on test(time,p1) ; > CREATE INDEX > Time: 178926.02 ms > > database=> vacuum analyze test ; > VACUUM > Time: 73058.33 ms > > database=> \d test > Table "public.test" > Column | Type | Modifiers > -------------+--------------------------+----------- > time | timestamp with time zone | > source | inet | > destination | inet | > p1 | integer | > p2 | integer | > > > > database=> \di > public | test_time_idx | index | database | test > public | test_source_idx | index | database | test > public | test_destination_idx | index | database | test > public | test_p1_idx | index | database | test > public | test_p2_idx | index | database | test > public | test_time_p1_idx | index | database | test > > > > database=> set enable_seqscan to off ; > SET > Time: 0.28 ms > > > > database=> explain analyze select date_trunc('hour', time),count(*) as > total from test where p1=53 and time>now()-interval '24 hours' group > by date_trunc order by date_trunc; > Aggregate (cost=2315252.66..2320767.17 rows=73527 width=8) (actual > time=2081.15..2720.44 rows=23 loops=1) > -> Group (cost=2315252.66..2318929.00 rows=735268 width=8) > (actual time=2079.76..2564.22 rows=41366 loops=1) > -> Sort (cost=2315252.66..2317090.83 rows=735268 width=8) > (actual time=2079.74..2243.32 rows=41366 loops=1) > Sort Key: date_trunc('hour'::text, "time") > -> Index Scan using test_time_p1_idx on test > (cost=0.00..2218878.46 rows=735268 width=8) (actual > time=29.50..1774.52 rows=41366 loops=1) > Index Cond: (("time" > (now() - '1 > day'::interval)) AND (p1 = 53)) > Total runtime: 2735.42 msec > > Time: 2736.48 ms > > > > database=> explain analyze select date_trunc('hour', time),count(*) as > total from test where p1=80 and time>now()-interval '24 hours' group > by date_trunc order by date_trunc; > Aggregate (cost=1071732.15..1074305.59 rows=34313 width=8) (actual > time=6353.93..7321.99 rows=22 loops=1) > -> Group (cost=1071732.15..1073447.77 rows=343125 width=8) > (actual time=6323.76..7078.10 rows=64267 loops=1) > -> Sort (cost=1071732.15..1072589.96 rows=343125 width=8) > (actual time=6323.75..6579.42 rows=64267 loops=1) > Sort Key: date_trunc('hour'::text, "time") > -> Index Scan using test_time_p1_idx on test > (cost=0.00..1035479.58 rows=343125 width=8) (actual time=0.20..5858.67 > rows=64267 loops=1) > Index Cond: (("time" > (now() - '1 > day'::interval)) AND (p1 = 80)) > Total runtime: 7322.82 msec > > Time: 7323.90 ms > > > > database=> explain analyze select date_trunc('hour', time),count(*) as > total from test where p1=139 and time>now()-interval '24 hours' group > by date_trunc order by date_trunc; > Aggregate (cost=701562.34..703250.12 rows=22504 width=8) (actual > time=2448.41..3033.80 rows=22 loops=1) > -> Group (cost=701562.34..702687.53 rows=225037 width=8) (actual > time=2417.39..2884.25 rows=36637 loops=1) > -> Sort (cost=701562.34..702124.94 rows=225037 width=8) > (actual time=2417.38..2574.19 rows=36637 loops=1) > Sort Key: date_trunc('hour'::text, "time") > -> Index Scan using test_time_p1_idx on test > (cost=0.00..679115.34 rows=225037 width=8) (actual time=8.47..2156.18 > rows=36637 loops=1) > Index Cond: (("time" > (now() - '1 > day'::interval)) AND (p1 = 139)) > Total runtime: 3034.57 msec > > Time: 3035.70 ms > > > > Now, this query gives me all the hours in a day, with the count of all > p1=53 for each hour. Pg uses 46.7 seconds to run with seqscan, while > 2.7 seconds indexing on (time,p1). I think I turned "set > enable_seqscan to on;" again, and then the planner used seqscan, and > not index. > - Why does Pg not see the benefits of using index? > - and how can i tune the optimisation fields in postgresql.conf to > help him? > > So now my PG uses a reasonable amout of time on these queries (with > enable_seqscan turned off) > > The next place which seems to slow my queries, is probably my > connection to PHP. I got a bash script running in cron on my server > (freebsd 4.11), which runs php on a php file. To force PG to not use > seqscans, I have modifies the postgresql.conf: > > .. > enable_seqscan = false > enable_indexscan = true > .. > effective_cache_size = 10000 > random_page_cost = 2 > .. > > I save the file, type 'pg_crl reload' then enter 'psql database'. > > database=> show enable_seqscan ; > enable_seqscan > ---------------- > on > (1 row) > > > argus=> show effective_cache_size ; > effective_cache_size > ---------------------- > 1000 > (1 row) > > I have used the manual pages on postgresql, postmaster, and so on, but > I cant find anywhere to specify which config file Pg is to use. I'm > not entirely sure if he uses the one im editing > (/usr/local/etc/postgresql.conf). > > Any hints, tips or help is most appreciated! > > Kjell Tore. > > > > > > On 6/21/05, PFC wrote: >> >> use CURRENT_TIME which is a constant instead of now() which is not >> considered constant... (I think) >> >> Paul Ramsey Refractions Research Email: pramsey@refractions.net Phone: (250) 885-0632 From pgsql-performance-owner@postgresql.org Wed Jun 22 11:41: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 9A513528B4 for ; Wed, 22 Jun 2005 11:41:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36458-05 for ; Wed, 22 Jun 2005 14:41:55 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by svr1.postgresql.org (Postfix) with ESMTP id C7D4552817 for ; Wed, 22 Jun 2005 11:41:51 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so58694wra for ; Wed, 22 Jun 2005 07:41:55 -0700 (PDT) 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:content-disposition:references; b=uk0FmkAlbIeuu0kVi2tKsju+kWZipXJCq8uXwwBdDenvsllaEVneva0Hdx3Keh2rIAGkkDZB6izmkjaxpBh5lZqAaloKV53CgHa0llBmY9QvECEfd0Ko1wtnZk5OyhjBIUZf593Iv4EAC/f6FGOLbANrCuEFYibiDR62Z2lCo6k= Received: by 10.54.149.14 with SMTP id w14mr486360wrd; Wed, 22 Jun 2005 07:41:54 -0700 (PDT) Received: by 10.54.104.3 with HTTP; Wed, 22 Jun 2005 07:41:54 -0700 (PDT) Message-ID: Date: Wed, 22 Jun 2005 07:41:54 -0700 From: Kjell Tore Fossbakk Reply-To: Kjell Tore Fossbakk To: Bricklen Anderson Subject: Re: Querying 19million records very slowly Cc: pgsql-performance@postgresql.org In-Reply-To: <42B976D0.3000909@PresiNET.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <42B976D0.3000909@PresiNET.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.136 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/435 X-Sequence-Number: 13072 I cant get the config file to load into my postgres. that's the problem. I want to set it to 10k, but it is only still at 1000... I save the file and restart the service.. yes, i ment 'pg_ctl reload', sry about that one. kjell tore On 6/22/05, Bricklen Anderson wrote: > >> enable_seqscan =3D false > >> enable_indexscan =3D true > >> .. > >> effective_cache_size =3D 10000 > >> random_page_cost =3D 2 > >> .. > >> > >> I save the file, type 'pg_crl reload' then enter 'psql database'. > >> > >> argus=3D> show effective_cache_size ; > >> effective_cache_size > >> ---------------------- > >> 1000 > >> (1 row) >=20 > I assume that 'pg_crl' is a typo? That should read 'pg_ctl reload' > Also, you said that your effective_cache_size =3D 10000, yet when you SHO= W > it, > it's only 1000. A cut 'n paste error, or maybe your erroneous "pg_crl" > didn't > trigger the reload? >=20 > --=20 > _______________________________ >=20 > This e-mail may be privileged and/or confidential, and the sender does > not waive any related rights and obligations. Any distribution, use or > copying of this e-mail or the information it contains by other than an > intended recipient is unauthorized. If you received this e-mail in > error, please advise me (by return e-mail or otherwise) immediately. > _______________________________ > From pgsql-performance-owner@postgresql.org Wed Jun 22 11:50: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 CFD6752800 for ; Wed, 22 Jun 2005 11:50:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39442-05 for ; Wed, 22 Jun 2005 14:50:44 +0000 (GMT) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id 7AFB652913 for ; Wed, 22 Jun 2005 11:50:43 -0300 (ADT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id j5MEsVsM028015 for ; Wed, 22 Jun 2005 09:54:31 -0500 Date: Wed, 22 Jun 2005 09:52:27 -0500 From: Frank Wiles To: pgsql-performance@postgresql.org Subject: Performance Tuning Article Message-Id: <20050622095227.05938982.frank@wiles.org> X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-redhat-linux-gnu) 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/436 X-Sequence-Number: 13073 Hi Everyone, I've put together a short article and posted it online regarding performance tuning PostgreSQL in general. I believe it helps to bring together the info in a easy to digest manner. I would appreciate any feedback, comments, and especially any technical corrections. The article can be found here: http://www.revsys.com/writings/postgresql-performance.html Thanks! --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Wed Jun 22 12:27: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 3F20D528D5 for ; Wed, 22 Jun 2005 12:26:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46572-02 for ; Wed, 22 Jun 2005 15:26:36 +0000 (GMT) Received: from mx-00.sil.at (mx-00.sil.at [62.116.68.196]) by svr1.postgresql.org (Postfix) with ESMTP id 406B15287D for ; Wed, 22 Jun 2005 12:26:32 -0300 (ADT) Received: (qmail-ldap/ctrl 86340 invoked from network); 22 Jun 2005 15:26:29 -0000 Received: from unknown (HELO bazaar.foomatic.at) ([213.129.239.202]) (envelope-sender ) by mx-00.sil.at (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 22 Jun 2005 15:26:29 -0000 Received: from localhost (bazaar.foomatic.lan [127.0.0.1]) by bazaar.foomatic.at (Postfix) with ESMTP id 0BA92DF204 for ; Wed, 22 Jun 2005 17:26:31 +0200 (CEST) Received: from bazaar.foomatic.at ([127.0.0.1]) by localhost (bazaar.foomatic.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12116-07 for ; Wed, 22 Jun 2005 17:26:28 +0200 (CEST) Received: from [192.168.15.239] (Weyoun.foomatic.lan [192.168.15.239]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by bazaar.foomatic.at (Postfix) with ESMTP id 3F0A0DF203 for ; Wed, 22 Jun 2005 17:26:28 +0200 (CEST) Message-ID: <42B9827D.40609@foo.at> Date: Wed, 22 Jun 2005 17:23:41 +0200 From: Stefan Weiss Organization: Foo Orbital Operations User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Querying 19million records very slowly References: <42B8719A.6040809@refractions.net> <20050622080357.GW7839@tobias> <20050622083921.GZ7839@tobias> <8B2836FF-F335-49A4-8131-8EF2D02100F9@myrealbox.com> In-Reply-To: <8B2836FF-F335-49A4-8131-8EF2D02100F9@myrealbox.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at foomatic.at X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/437 X-Sequence-Number: 13074 On 2005-06-22 10:55, Michael Glaesemann wrote: > There has been discussion in the past on storing the time zone name > with the timestamptz as well, though no one has implemented this yet. The reason for this may be that time zone names (abbreviations) are not unique. For example, "ECT" can mean "Ecuador Time" (offset -05) or "Eastern Caribbean Time" (offset -04). http://www.worldtimezone.com/wtz-names/timezonenames.html cheers, stefan From pgsql-performance-owner@postgresql.org Wed Jun 22 13:29: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 B135652833 for ; Wed, 22 Jun 2005 13:29:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59505-08 for ; Wed, 22 Jun 2005 16:28:57 +0000 (GMT) Received: from exobox.exoweb.net (unknown [221.122.43.98]) by svr1.postgresql.org (Postfix) with SMTP id 4F58E52825 for ; Wed, 22 Jun 2005 13:28:52 -0300 (ADT) Received: (qmail 13856 invoked from network); 22 Jun 2005 16:28:45 -0000 Received: from exo185.exoweb.net (HELO tobias.nordicbet.invalid) (192.168.0.185) by 0 with SMTP; 22 Jun 2005 16:28:45 -0000 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id 9E460E0D07; Thu, 23 Jun 2005 00:28:44 +0800 (CST) Date: Thu, 23 Jun 2005 00:28:44 +0800 From: Tobias Brox To: Kjell Tore Fossbakk Cc: pgsql-performance@postgresql.org Subject: Re: Querying 19million records very slowly Message-ID: <20050622162844.GE7839@tobias> References: <42B976D0.3000909@PresiNET.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Group Nordicbet 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: 200506/439 X-Sequence-Number: 13076 [Kjell Tore Fossbakk - Wed at 07:41:54AM -0700] > I cant get the config file to load into my postgres. that's the > problem. I want to set it to 10k, but it is only still at 1000... I > save the file and restart the service.. > > yes, i ment 'pg_ctl reload', sry about that one. Classical problem, a bit depending on the distro you are using. The "master" file usually resides in /etc/postgresql while the actual file used usually resides in /var/lib/postgres/data ... or something. Some distros copies over the file (such that one always should edit the file in /etc) others don't (thus you either have to do that your self, or edit the file in the database data directory. -- Tobias Brox, +86-13521622905 Nordicbet, IT dept From pgsql-performance-owner@postgresql.org Wed Jun 22 14:16: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 430435284D for ; Wed, 22 Jun 2005 14:15:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70878-01 for ; Wed, 22 Jun 2005 17:15:46 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 62E2C5283F for ; Wed, 22 Jun 2005 14:15:43 -0300 (ADT) 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 7517513; Wed, 22 Jun 2005 10:17:51 -0700 From: Josh Berkus Organization: Aglio Database Solutions To: Frank Wiles Subject: Re: Performance Tuning Article Date: Wed, 22 Jun 2005 10:16:03 -0700 User-Agent: KMail/1.8 Cc: pgsql-performance@postgresql.org References: <20050622095227.05938982.frank@wiles.org> In-Reply-To: <20050622095227.05938982.frank@wiles.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506221016.03808.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: 200506/440 X-Sequence-Number: 13077 Frank, > I've put together a short article and posted it online regarding > performance tuning PostgreSQL in general. I believe it helps to bring > together the info in a easy to digest manner. I would appreciate any > feedback, comments, and especially any technical corrections. Looks nice. You should mark the link to the perf tips at Varlena.com as "PostgreSQL 7.4" and augment it with the current version here: www.powerpostgresql.com/PerfList as well as the Annotated .Conf File: www.powerpostgresql.com/Docs For my part, I've generally seen that SATA disks still suck for read-write applications. I generally rate 1 UltraSCSI = 2 SATA disks for anything but a 99% read application. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jun 22 14:41: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 F2F3B5283F for ; Wed, 22 Jun 2005 14:41:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72411-09 for ; Wed, 22 Jun 2005 17:40:54 +0000 (GMT) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id 396C352934 for ; Wed, 22 Jun 2005 14:40:53 -0300 (ADT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id j5MHiax3028379; Wed, 22 Jun 2005 12:44:36 -0500 Date: Wed, 22 Jun 2005 12:42:32 -0500 From: Frank Wiles To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Performance Tuning Article Message-Id: <20050622124232.71b05e3f.frank@wiles.org> In-Reply-To: <200506221016.03808.josh@agliodbs.com> References: <20050622095227.05938982.frank@wiles.org> <200506221016.03808.josh@agliodbs.com> X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-redhat-linux-gnu) 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/441 X-Sequence-Number: 13078 On Wed, 22 Jun 2005 10:16:03 -0700 Josh Berkus wrote: > Frank, > > > I've put together a short article and posted it online regarding > > performance tuning PostgreSQL in general. I believe it helps to > > bring together the info in a easy to digest manner. I would > > appreciate any feedback, comments, and especially any technical > > corrections. > > Looks nice. You should mark the link to the perf tips at Varlena.com > as "PostgreSQL 7.4" and augment it with the current version here: > www.powerpostgresql.com/PerfList > as well as the Annotated .Conf File: > www.powerpostgresql.com/Docs Thanks! These changes have been incorporated. > For my part, I've generally seen that SATA disks still suck for > read-write applications. I generally rate 1 UltraSCSI = 2 SATA > disks for anything but a 99% read application. I'll work this bit of wisdom in later tonight. Thanks again for the feedback. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Wed Jun 22 15:08: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 5318A5282E for ; Wed, 22 Jun 2005 15:08:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79972-06 for ; Wed, 22 Jun 2005 18:08:06 +0000 (GMT) Received: from veggie-fuel.com (veggie-fuel.com [200.46.208.238]) by svr1.postgresql.org (Postfix) with ESMTP id 372C95283F for ; Wed, 22 Jun 2005 15:08:05 -0300 (ADT) Received: from localhost (unknown [200.46.204.144]) by veggie-fuel.com (Postfix) with ESMTP id 7542635FA89; Wed, 22 Jun 2005 18:08:06 +0000 (GMT) Received: from veggie-fuel.com ([200.46.208.238]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77673-09; Wed, 22 Jun 2005 18:08:02 +0000 (GMT) Received: from [10.0.0.8] (71-35-20-68.phnx.qwest.net [71.35.20.68]) by veggie-fuel.com (Postfix) with ESMTP id 0432135FA88; Wed, 22 Jun 2005 18:08:02 +0000 (GMT) Subject: Re: Performance Tuning Article From: Karim Nassar Reply-To: karim.nassar@acm.org To: Frank Wiles Cc: pgsql-performance@postgresql.org In-Reply-To: <20050622095227.05938982.frank@wiles.org> References: <20050622095227.05938982.frank@wiles.org> Content-Type: text/plain Date: Wed, 22 Jun 2005 11:05:05 -0700 Message-Id: <1119463505.6816.79.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/442 X-Sequence-Number: 13079 On Wed, 2005-06-22 at 09:52 -0500, Frank Wiles wrote: > I've put together a short article and posted it online regarding > performance tuning PostgreSQL in general. Nice work! Some minor issues I saw: * section "Understanding the process", para 5: "Now that PostgreSQL has a plan of what it believes to be the best way to retrieve the hardware it is time to actually get it." Do you mean "retrieve the data" instead of "retrieve the hardware"? * Perhaps some examples under "Disk Configuration"? * section "Database Design and Layout", after new table layout: "Take for example the employee table above. Your probably only display active employees throughout the majority of the application..." Do you mean "You're probably only displaying"? HTH, -- Karim Nassar From pgsql-performance-owner@postgresql.org Tue Jun 28 01: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 705B2528CE for ; Wed, 22 Jun 2005 15:50:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86132-06 for ; Wed, 22 Jun 2005 18:50:15 +0000 (GMT) Received: from matlab.pharmadm.com (derma.pharmadm.com [193.190.169.32]) by svr1.postgresql.org (Postfix) with ESMTP id 0A3D65285C for ; Wed, 22 Jun 2005 15:50:12 -0300 (ADT) Received: from matlab.pharmadm.com (matlab.pharmadm.com [192.168.93.22]) by matlab.pharmadm.com (Postfix) with ESMTP id 1CCD1BCE5 for ; Wed, 22 Jun 2005 20:50:13 +0200 (CEST) Date: Wed, 22 Jun 2005 20:50:13 +0200 (CEST) From: Kurt De Grave To: pgsql-performance@postgresql.org Subject: parameterized LIKE does not use index Message-ID: 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: 200506/530 X-Sequence-Number: 13167 Hi, Consider the where-clauses: WHERE lower(col) LIKE 'abc'; WHERE lower(col) LIKE 'abc%'; these will both use a b-tree functional index in lower(col) if one exists. The clause WHERE lower(col) LIKE '%abc'; can't use the index as you would expect, because of the wildcard at the front (as mentioned in the manual). Thus, it has to do a seqscan, on what in my case is a very large table. But still that's not too bad, because I expect an overwhelming amount of the simple cases, and only very few that start with a percentage sign. Now, what's problematic is if i replace the literal with a parameter, like this: WHERE lower(col) LIKE ? It seems that the parameterized query gets compiled once, and because the parameter is not yet known, one cannot be sure it doesn't start with a percentage sign. Using the parameterized version causes ALL cases to use a seqscan. Of course, I could modify the application and send different SQL depending on which case we're in or just constructing a query with a literal each time, but is there a way to add a hint to the SQL that would cause the query to be re-planned if it's a case that could use the index? Or can I convince the (Perl) driver to do so? kurt. From pgsql-performance-owner@postgresql.org Wed Jun 22 16: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 F06D652958 for ; Wed, 22 Jun 2005 16:25:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93316-05 for ; Wed, 22 Jun 2005 19:25:21 +0000 (GMT) Received: from matlab.pharmadm.com (derma.pharmadm.com [193.190.169.32]) by svr1.postgresql.org (Postfix) with ESMTP id 6960F52939 for ; Wed, 22 Jun 2005 16:25:20 -0300 (ADT) Received: from [192.168.93.22] (matlab.pharmadm.com [192.168.93.22]) by matlab.pharmadm.com (Postfix) with ESMTP id 4540DBCE5 for ; Wed, 22 Jun 2005 21:25:21 +0200 (CEST) Message-ID: <42B9BB20.7050109@student.kuleuven.ac.be> Date: Wed, 22 Jun 2005 21:25:20 +0200 From: Kurt De Grave User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: parameterized LIKE does not use index 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/443 X-Sequence-Number: 13080 Hi, Consider the where-clauses: WHERE lower(col) LIKE 'abc'; WHERE lower(col) LIKE 'abc%'; these will both use a b-tree functional index in lower(col) if one exists. The clause WHERE lower(col) LIKE '%abc'; can't use the index as you would expect, because of the wildcard at the front. Thus, it has to do a seqscan, on what in my case is a very large table. But still that's not too bad, because I expect an overwhelming amount of the simple cases, and only very few that start with a percentage sign. Now, what's problematic is if I replace the literal with a parameter, like this: WHERE lower(col) LIKE ? It seems that the parameterized query gets compiled once, and because the parameter is not yet known, one cannot be sure it doesn't start with a percentage sign. Using the parameterized version causes ALL cases to use a seqscan. Of course, I could modify the application and send different SQL depending on which case we're in or just constructing a query with a literal each time, but is there a way to add a hint to the SQL that would cause the query to be re-planned if it's a case that could use the index? Or can I convince the (Perl) driver to do so? kurt. From pgsql-performance-owner@postgresql.org Wed Jun 22 18:07: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 353D652825 for ; Wed, 22 Jun 2005 18:06:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15260-05 for ; Wed, 22 Jun 2005 21:06:55 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 39DA952806 for ; Wed, 22 Jun 2005 18:06:54 -0300 (ADT) 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 7518513; Wed, 22 Jun 2005 14:09:03 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Kurt De Grave Subject: Re: parameterized LIKE does not use index Date: Wed, 22 Jun 2005 14:08:55 -0700 User-Agent: KMail/1.8 Cc: pgsql-performance@postgresql.org References: <42B9BB20.7050109@student.kuleuven.ac.be> In-Reply-To: <42B9BB20.7050109@student.kuleuven.ac.be> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200506221408.55942.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/444 X-Sequence-Number: 13081 Kurt, > Of course, I could modify the application and send different SQL > depending on which case we're in or just constructing a query with a > literal each time, but is there a way to add a hint to the SQL that > would cause the query to be re-planned if it's a case that could use the > index? =A0Or can I convince the (Perl) driver to do so? There should be an option to tell DBD::Pg not to cache a query plan. =20 Let's see .... yes. pg_server_prepare=3D0, passed to the prepare() call. =2D-=20 =2D-Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jun 22 22:06: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 F0A875282E for ; Wed, 22 Jun 2005 22:06:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81951-07 for ; Thu, 23 Jun 2005 01:06:19 +0000 (GMT) Received: from exobox.exoweb.net (unknown [221.122.43.98]) by svr1.postgresql.org (Postfix) with SMTP id 1BA4952806 for ; Wed, 22 Jun 2005 22:06:13 -0300 (ADT) Received: (qmail 25168 invoked from network); 23 Jun 2005 01:06:05 -0000 Received: from exo185.exoweb.net (HELO tobias.nordicbet.invalid) (192.168.0.185) by 0 with SMTP; 23 Jun 2005 01:06:05 -0000 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id 3A82AE0D07; Thu, 23 Jun 2005 09:06:04 +0800 (CST) Date: Thu, 23 Jun 2005 09:06:04 +0800 From: Tobias Brox To: Frank Wiles Cc: pgsql-performance@postgresql.org Subject: Re: Performance Tuning Article Message-ID: <20050623010604.GI7839@tobias> References: <20050622095227.05938982.frank@wiles.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050622095227.05938982.frank@wiles.org> Organization: Group Nordicbet 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: 200506/445 X-Sequence-Number: 13082 [Frank Wiles - Wed at 09:52:27AM -0500] > I've put together a short article and posted it online regarding > performance tuning PostgreSQL in general. I believe it helps to bring > together the info in a easy to digest manner. I would appreciate any > feedback, comments, and especially any technical corrections. I did not read through the whole article, but I already have some comments; work_mem was formerly sort_mem. As many of us still use pg7, you should probably have a note about it. There are already quite some short articles at the web about this issue, and that was actually my starting point when I was assigned the task of tweaking the database performance. I think diversity is a good thing, some of the short articles was relatively outdated, others were not very well written. And also - I still never had the chance to do proper benchmarking of the impact of my changes in the configuration file, I just chose to trust some of the advices when I saw almost the same advice repeated in several articles. I think we need some comprehensive chapter about this in the manual, with plenty of pointers - or eventually some separate well-organized pages telling about all known issues. It seems to me that many of the standard tips here are repeating themselves over and over again. -- Tobias Brox, +86-13521622905 Nordicbet, IT dept From pgsql-performance-owner@postgresql.org Wed Jun 22 23:31: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 16AA15282E for ; Wed, 22 Jun 2005 23:31:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95110-09 for ; Thu, 23 Jun 2005 02:31:28 +0000 (GMT) Received: from mxsf16.cluster1.charter.net (mxsf16.cluster1.charter.net [209.225.28.216]) by svr1.postgresql.org (Postfix) with ESMTP id 1043552835 for ; Wed, 22 Jun 2005 23:31:25 -0300 (ADT) Received: from mxip04a.cluster1.charter.net (mxip04a.cluster1.charter.net [209.225.28.134]) by mxsf16.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id j5N2VRc9020753 for ; Wed, 22 Jun 2005 22:31:27 -0400 Received: from pc-68-118-180-13.will.ct.charter.com (HELO [192.168.116.102]) (68.118.180.13) by mxip04a.cluster1.charter.net with ESMTP; 22 Jun 2005 22:31:28 -0400 X-IronPort-AV: i="3.93,222,1115006400"; d="scan'208"; a="396719937:sNHT15733068" Message-ID: <42BA1F01.1010700@NarrowPathInc.com> Date: Wed, 22 Jun 2005 22:31:29 -0400 From: Keith Worthington Reply-To: KeithW@NarrowPathInc.com Organization: Narrow Path, Inc. User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Frank Wiles Cc: pgsql-performance@postgresql.org Subject: Re: Performance Tuning Article References: <20050622095227.05938982.frank@wiles.org> <200506221016.03808.josh@agliodbs.com> <20050622124232.71b05e3f.frank@wiles.org> In-Reply-To: <20050622124232.71b05e3f.frank@wiles.org> 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.051 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/446 X-Sequence-Number: 13083 >>> I've put together a short article and posted it online regarding >>> performance tuning PostgreSQL in general. I believe it helps to >>> bring together the info in a easy to digest manner. I would >>> appreciate any feedback, comments, and especially any technical >>> corrections. >> >>Looks nice. You should mark the link to the perf tips at Varlena.com >>as "PostgreSQL 7.4" and augment it with the current version here: >>www.powerpostgresql.com/PerfList >>as well as the Annotated .Conf File: >>www.powerpostgresql.com/Docs > > > Thanks! These changes have been incorporated. > > >>For my part, I've generally seen that SATA disks still suck for >>read-write applications. I generally rate 1 UltraSCSI = 2 SATA >>disks for anything but a 99% read application. > > > I'll work this bit of wisdom in later tonight. Thanks again for the > feedback. > > --------------------------------- > Frank Wiles > http://www.wiles.org > --------------------------------- Frank, A couple of things I wish I had been told when I started asking how to configure a new machine. Use RAID 10 (striping across mirrored disks) or RAID 0+1 (mirror a striped array) for your data. Use RAID 1 (mirror) for your OS Use RAID 1 (mirror) for the WAL. Don't put anything else on the array holding the WAL. There have been problems with Xeon processors. -- Kind Regards, Keith From pgsql-performance-owner@postgresql.org Tue Jun 28 01:44: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 B9B3E5288E for ; Thu, 23 Jun 2005 00:20:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11506-05 for ; Thu, 23 Jun 2005 03:20:05 +0000 (GMT) Received: from sccimhc91.asp.att.net (sccimhc91.asp.att.net [63.240.76.165]) by svr1.postgresql.org (Postfix) with ESMTP id F1ECD52968 for ; Thu, 23 Jun 2005 00:20:00 -0300 (ADT) Received: from [192.168.0.2] (12-223-83-43.client.insightbb.com[12.223.83.43]) by sccimhc91.asp.att.net (sccimhc91) with ESMTP id <20050623031955i9100st5pue>; Thu, 23 Jun 2005 03:19:59 +0000 Message-ID: <42BA2A59.60504@dhtns.com> Date: Wed, 22 Jun 2005 23:19:53 -0400 From: Elliott Bennett Reply-To: pgmail@dhtns.com User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: select distinct on varchar -- wild performance differences! 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: 200506/529 X-Sequence-Number: 13166 Hey, all. I've bounced this around in #postgres for an hour or so, and it was suggested that I post it here as well. Hopefully someone can help me out. I have three machines. All have 512MB of ram. Machine A is a 2.0ghz celeron, running debian, pg verison 7.4.6. Machine B is a 1.8ghz celeron, running centos 3.4, pg verison 8.0.3. (7.3.9 also exhibited the behaviour below, by the way) Machine C is a 1.0ghz athlon, running centos 4.0, pg verison 7.4.7. The SAME data and schema is loaded (from a pg_dump, default parameters) onto all three machines. With the same query: "select distinct model from exif_common", machines A and C return results quickly (1/4 second). Machine B chews on it for 30ish seconds! Note, this column is a VARCHAR(40). Here's an explain analyze for it. Machine A (fast): photos=# explain analyze select distinct model from exif_common; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Unique (cost=2629.74..2732.11 rows=5 width=15) (actual time=211.358..265.049 rows=6 loops=1) -> Sort (cost=2629.74..2680.93 rows=20473 width=15) (actual time=211.351..242.296 rows=20473 loops=1) Sort Key: model -> Seq Scan on exif_common (cost=0.00..1163.73 rows=20473 width=15) (actual time=0.022..58.635 rows=20473 loops=1) Total runtime: 265.928 ms (5 rows) Machine B (slow): photos=# explain analyze select distinct model from exif_common; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Unique (cost=2640.74..2743.11 rows=6 width=15) (actual time=27939.231..32914.134 rows=6 loops=1) -> Sort (cost=2640.74..2691.93 rows=20473 width=15) (actual time=27939.222..27983.784 rows=20473 loops=1) Sort Key: model -> Seq Scan on exif_common (cost=0.00..1174.73 rows=20473 width=15) (actual time=0.071..97.772 rows=20473 loops=1) Total runtime: 32915.031 ms (5 rows) ( yes, i know, six distinct rows out of 20,000.... But holy moly! 1/4 sec vs 32.9 sec?!?! ) Now, if I do a similar query against an INT column, the speeds are more in line with each other: Machine A: photos=# explain analyze select distinct imagewidth from exif_common; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- Unique (cost=2629.74..2732.11 rows=36 width=4) (actual time=179.899..225.934 rows=107 loops=1) -> Sort (cost=2629.74..2680.93 rows=20473 width=4) (actual time=179.891..207.632 rows=20473 loops=1) Sort Key: imagewidth -> Seq Scan on exif_common (cost=0.00..1163.73 rows=20473 width=4) (actual time=0.024..62.946 rows=20473 loops=1) Total runtime: 226.707 ms (5 rows) Machine B: photos=# explain analyze select distinct imagewidth from exif_common; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- Unique (cost=2640.74..2743.11 rows=24 width=4) (actual time=209.394..287.131 rows=107 loops=1) -> Sort (cost=2640.74..2691.93 rows=20473 width=4) (actual time=209.384..251.693 rows=20473 loops=1) Sort Key: imagewidth -> Seq Scan on exif_common (cost=0.00..1174.73 rows=20473 width=4) (actual time=0.074..94.574 rows=20473 loops=1) Total runtime: 288.411 ms (5 rows) Machine C exhibits the same behaviour as A for all queries. This weird slow behaviour on machine B also appeared in 7.3.9. Upgrading didn't seem to help. neilc from irc thought it may be a qsort(2) quirk, but a sample C program I whipped up testing different sized data sets with a similar distribution gave very similar sort timings between the three machines.. Therefore, I don't think it's qsort(2) to blame... Anyone have any ideas as to what may be up with machine B? Thanks, -Elliott From pgsql-performance-owner@postgresql.org Thu Jun 23 05:33: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 61B0F52934 for ; Thu, 23 Jun 2005 05:33:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81922-06 for ; Thu, 23 Jun 2005 08:33:18 +0000 (GMT) Received: from matlab.pharmadm.com (derma.pharmadm.com [193.190.169.32]) by svr1.postgresql.org (Postfix) with ESMTP id 74A12528D9 for ; Thu, 23 Jun 2005 05:33:17 -0300 (ADT) Received: from [192.168.93.22] (matlab.pharmadm.com [192.168.93.22]) by matlab.pharmadm.com (Postfix) with ESMTP id D12D9BCE5; Thu, 23 Jun 2005 10:33:18 +0200 (CEST) Message-ID: <42BA73CE.4030909@student.kuleuven.ac.be> Date: Thu, 23 Jun 2005 10:33:18 +0200 From: Kurt De Grave User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: parameterized LIKE does not use index 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/447 X-Sequence-Number: 13084 > > Of course, I could modify the application and send different SQL > > depending on which case we're in or just constructing a query with a > > literal each time, but is there a way to add a hint to the SQL that > > would cause the query to be re-planned if it's a case that could use the > > index? Or can I convince the (Perl) driver to do so? > There should be an option to tell DBD::Pg not to cache a query plan. > Let's see .... > > yes. pg_server_prepare=0, passed to the prepare() call. That does the trick! Now I can have the cake and eat it! (clean code and high perf) Now it's tempting to dream of some mechanism that could make the database consider replanning the query automatically once it knows the parameter, or choose from a set of plans depending on the parameter. In this case the general plan was about three orders of magnitude slower than the specialized plan. But I guess this case is not all that common and the developer can work around it. thanks, kurt. -- ir. Kurt De Grave http://www.PharmaDM.com PharmaDM nv. phone: +32-16-298494 Kapeldreef 60, B-3001 Leuven, Belgium fax: +32-16-298490 From pgsql-performance-owner@postgresql.org Thu Jun 23 06:22: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 B402B52886 for ; Thu, 23 Jun 2005 06:22:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91410-10 for ; Thu, 23 Jun 2005 09:22:23 +0000 (GMT) Received: from www.aldratech.com (www.aldratech.com [193.226.161.42]) by svr1.postgresql.org (Postfix) with ESMTP id 51F0852806 for ; Thu, 23 Jun 2005 06:22:22 -0300 (ADT) Received: from [192.168.0.6] (rpopescu [192.168.0.6]) by www.aldratech.com (Postfix) with ESMTP id AABA9123DFD for ; Thu, 23 Jun 2005 12:20:36 +0300 (EEST) Message-ID: <42BA7F49.6080101@aldratech.com> Date: Thu, 23 Jun 2005 12:22:17 +0300 From: Radu-Adrian Popescu Reply-To: radu.popescu@aldratech.com Organization: Aldratech Ltd. User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Performance Tuning Article References: <20050622095227.05938982.frank@wiles.org> <200506221016.03808.josh@agliodbs.com> <20050622124232.71b05e3f.frank@wiles.org> <42BA1F01.1010700@NarrowPathInc.com> In-Reply-To: <42BA1F01.1010700@NarrowPathInc.com> Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms070307090706050109060602" 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: 200506/448 X-Sequence-Number: 13085 This is a cryptographically signed message in MIME format. --------------ms070307090706050109060602 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > > There have been problems with Xeon processors. > Can you elaborate on that please ? Thanks, -- Radu-Adrian Popescu CSA, DBA, Developer Aldrapay MD Aldratech Ltd. +40213212243 --------------ms070307090706050109060602 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIJDTCC AuEwggJKoAMCAQICAw0/VDANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UE ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0EwHhcNMDQxMDE4MTEwNjM0WhcNMDUxMDE4MTEwNjM0 WjBMMR8wHQYDVQQDExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSkwJwYJKoZIhvcNAQkBFhpy YWR1LnBvcGVzY3VAYWxkcmF0ZWNoLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC ggEBAM+UjztouTxkdmm0OFNJxUGs2UpnbgswyyR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x0ZC4xLDAq BgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMNP1QwegYLKoZI hvcNAQkQAgsxa6BpMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGlu ZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWlu ZyBDQQIDDT9UMA0GCSqGSIb3DQEBAQUABIIBAGG7xaim7p7h+PpPj5GoFJIvu66pL9HMcurb hiMS0te+uIExqWqgaBODXnPY0QHfoYEFPfo+PbKLsqYdZKrOqaipWxCssQTVF94jTfflK4Zk 4BwD/dztlCVww+ey6yJ914CgqwsTEqjyCPektWiasakVYkeOn1ig1p9dKoABaURI18zwTs2e ta5Zl3fXvexr/ClG/CpbCZXHJm7WYziKr1LX0IiBAoiBxCYmU9nIPBgFwOYnGIymtnkk/lCy MINJI1Wm72aM4XREj+Py/79/cZwVdQDVnhejNYP7bsqLs+XdJAM49Q2L1g8/pfKKdjqVaOlE VjYgeBcEBvacxBI8hVQAAAAAAAA= --------------ms070307090706050109060602-- From pgsql-performance-owner@postgresql.org Tue Jun 28 01:55: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 D12A652968 for ; Thu, 23 Jun 2005 06:57:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00513-01 for ; Thu, 23 Jun 2005 09:57:08 +0000 (GMT) Received: from smtp-gw.fnbs.net.my (smtp-gw.fnbs.net.my [202.9.108.191]) by svr1.postgresql.org (Postfix) with ESMTP id C6FDE528C7 for ; Thu, 23 Jun 2005 06:57:03 -0300 (ADT) Received: from mail-std.fnbs.net.my (smtp-std.fnbs.net.my [202.9.108.197]) by fnsrvlx9.fnbs.net.my (SMTP Mailer) with ESMTP id B3F5A529FF for ; Thu, 23 Jun 2005 17:57:03 +0800 (MYT) Received: from Beh (unverified [203.106.54.162]) by mail-std.fnbs.net.my (SurgeMail 3.0c2) with ESMTP id 14657212 for ; Thu, 23 Jun 2005 17:57:02 +0800 MYT Message-ID: <000601c577d9$e2658600$a279640a@Beh> From: "Chun Yit(Chronos)" To: Subject: Postgresql7.4.5 running slow on plpgsql function Date: Thu, 23 Jun 2005 17:56:52 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0003_01C5781C.EF90D170" 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.096 tagged_above=0 required=5 tests=HTML_50_60, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200506/531 X-Sequence-Number: 13168 This is a multi-part message in MIME format. ------=_NextPart_000_0003_01C5781C.EF90D170 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable >hi, need some help with some experts here. >currently we have a function that use together with temp table, it = calls search result function, everytime >this function is calling, it will go through some filter before come = out as a result. >now we have some major problem , the first time the function execute, = it take about 13 second >second time the function is execute, it take about 17 second, every = time you execute the function >the time taken will grow about 4 second, ? >may i know what going on here? >since we use function with temp table, so every statement that related = to temp table will using EXECUTE >command. > >regards >ivan ------=_NextPart_000_0003_01C5781C.EF90D170 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable
>hi, need some help with some = experts=20 here.
>currently we have a function that = use together=20 with temp table, it calls search result function, everytime
>this function is calling, it will = go through=20 some filter before come out as a result.
>now we have some major problem , = the first time=20 the function execute, it take about 13 second
>second time the function is = execute, it take=20 about 17 second, every time you execute the function
>the time taken will grow about 4 = second,=20 ?
>may i know what going on=20 here?
>since we use function with temp = table, so every=20 statement that related to temp table will using EXECUTE
>command.
>
>regards
>ivan
------=_NextPart_000_0003_01C5781C.EF90D170-- From pgsql-performance-owner@postgresql.org Tue Jun 28 01:44: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 D00C1528A8 for ; Thu, 23 Jun 2005 07:40:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02750-08 for ; Thu, 23 Jun 2005 10:40:13 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id E4D495288E for ; Thu, 23 Jun 2005 07:40:11 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so399403wra for ; Thu, 23 Jun 2005 03:40:15 -0700 (PDT) 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; b=J7GZTUm8ePF4I20A0zX2jdhYtbkAEHIyVoLewTNV63LwAXU5vw1SqU8dE1eI8aK/ymVfpCTaHsdSHrtbPpNcgcP2wqWvtDEIFk2+ifp9Gf4+JUd7LxpbF7fDRneILcy7H9TTeX7QrKG3uZARYi/YgK5O9ySK63MZ7MwX+t70Mrc= Received: by 10.54.29.41 with SMTP id c41mr1055513wrc; Thu, 23 Jun 2005 03:40:15 -0700 (PDT) Received: by 10.54.42.25 with HTTP; Thu, 23 Jun 2005 03:40:14 -0700 (PDT) Message-ID: Date: Thu, 23 Jun 2005 12:40:15 +0200 From: Meetesh Karia Reply-To: meetesh.karia@alumni.duke.edu To: pgsql-performance@postgresql.org Subject: How are text columns stored? Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2959_22010652.1119523215002" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.081 tagged_above=0 required=5 tests=HTML_30_40, HTML_MESSAGE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/528 X-Sequence-Number: 13165 ------=_Part_2959_22010652.1119523215002 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi all, I'm running PG 8.0.3 on WinXP and I'm coming across some performance issues= =20 related to text columns. Basically, it appears as though PG is storing the= =20 text data inline with the rest of the row data as queries that don't touch= =20 the text column are slower when there is data in the text column than when= =20 there isn't. According to section 8.3 of the doc: "Long values are also stored in background tables so they do not interfere= =20 with rapid access to the shorter column values." So, how long does a value have to be to be considered "long"? If necessary, here is some more specific information about what I'm doing: 1) I create a new table and use 'COPY FROM' to populate it. When the data i= n=20 the text column is limited to a max of 60 characters, this part takes 2-3= =20 minutes less than when the data is at its full size. The table will be=20 populated with ~750k rows. Here's an example of the table I create (no, I= =20 didn't name the fields "vc_field1", "vc_field2", etc ;) ): create table my_table_import ( vc_field1 varchar(255), vc_field2 varchar(255), vc_field3 varchar(255), f_field1 float8, text_field1 text, ts_field1 timestamp, v_field4 varchar(255), i_field1 int8, i_field2 int8 ); 2) I populate i_field1 and i_field2 from lookup tables. This step takes=20 about 7 mins longer with the full text data than with the limited data. update my_table_import set i_field1 =3D f.i_field1, i_field2 =3D u.i_field2 from lookup1 as f, lookup2 as u where vc_field2 =3D f.vc_field2 and vc_field1 =3D u.vc_field1; 3) I then create an index on this table and run a couple of queries on it.= =20 Each of these queries takes about 10 minutes longer with the full text data= =20 then without it. Here's the index that I create and an example of one of th= e=20 queries that I run: create index idx_my_table_import_i1_i2 on my_table_import (i_field1,=20 i_field2); analyze my_table_import; select i_field1, i_field2, max(ts_field1) as ts_field1, count(*) as=20 dup_count from my_table_import where i_field1 between 0 and 9999 group by i_field1, i_field2 Thanks for the help, Meetesh Karia ------=_Part_2959_22010652.1119523215002 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi all,

I'm running PG 8.0.3 on WinXP and I'm coming across some performance issues related to text columns.  Basically, it appears as though PG is storing the text data inline with the rest of the row data as queries that don't touch the text column are slower when there is data in the text column than when there isn't.  According to section 8.3 of the doc:

"Long values are also stored in background tables so they do not inter= fere with=20 rapid access to the shorter column values."

So, how long does a value have to be to be considered "long"?

If necessary, here is some more specific information about what I'm doing:<= br>
1) I create a new table and use 'COPY FROM' to populate it.  When the data in the text column is limited to a max of 60 characters, this part takes 2-3 minutes less than when the data is at its full size.  The table will be populated with ~750k rows.  Here's an example of the table I create (no, I didn't name the fields "vc_field1", "vc_field2", etc ;) ):

    create table my_table_import
    (
        vc_field1 varchar(255),
        vc_field2 varchar(255),
        vc_field3 varchar(255),
        f_field1 float8,
        text_field1 text,
        ts_field1 timestamp,
        v_field4 varchar(255),
        i_field1 int8,
        i_field2 int8
    );

2) I populate i_field1 and i_field2 from lookup tables.  This step takes about 7 mins longer with the full text data than with the limited data.

    update my_table_import
        set i_field1 =3D f.i_field1,
            i_field2= =3D u.i_field2
        from lookup1 as f, lookup2 as u<= br>         where vc_field2 =3D f.vc_field2<= br>             and vc_f= ield1 =3D u.vc_field1;

3) I then create an index on this table and run a couple of queries on it.  Each of these queries takes about 10 minutes longer with the full text data then without it.  Here's the index that I create and an example of one of the queries that I run:

    create index idx_my_table_import_i1_i2 on my_table_impor= t (i_field1, i_field2);
    analyze my_table_import;

    select i_field1, i_field2, max(ts_field1) as ts_field1, = count(*) as dup_count
        from my_table_import
        where i_field1 between 0 and 999= 9
        group by i_field1, i_field2

Thanks for the help,
Meetesh Karia
------=_Part_2959_22010652.1119523215002-- From pgsql-performance-owner@postgresql.org Thu Jun 23 09: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 BE32F528A8 for ; Thu, 23 Jun 2005 09:16:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26187-04 for ; Thu, 23 Jun 2005 12:16:18 +0000 (GMT) Received: from mxsf32.cluster1.charter.net (mxsf32.cluster1.charter.net [209.225.28.156]) by svr1.postgresql.org (Postfix) with ESMTP id 57A5852806 for ; Thu, 23 Jun 2005 09:16:17 -0300 (ADT) Received: from mxip19a.cluster1.charter.net (mxip19a.cluster1.charter.net [209.225.28.149]) by mxsf32.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id j5NCGJgx030326 for ; Thu, 23 Jun 2005 08:16:19 -0400 Received: from pc-68-118-180-13.will.ct.charter.com (HELO [192.168.116.102]) (68.118.180.13) by mxip19a.cluster1.charter.net with ESMTP; 23 Jun 2005 08:16:19 -0400 X-IronPort-AV: i="3.93,223,1115006400"; d="scan'208"; a="1166178772:sNHT16051300" Message-ID: <42BAA816.2040806@NarrowPathInc.com> Date: Thu, 23 Jun 2005 08:16:22 -0400 From: Keith Worthington Reply-To: KeithW@NarrowPathInc.com Organization: Narrow Path, Inc. User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: radu.popescu@aldratech.com Cc: pgsql-performance@postgresql.org Subject: Re: Performance Tuning Article References: <20050622095227.05938982.frank@wiles.org> <200506221016.03808.josh@agliodbs.com> <20050622124232.71b05e3f.frank@wiles.org> <42BA1F01.1010700@NarrowPathInc.com> <42BA7F49.6080101@aldratech.com> In-Reply-To: <42BA7F49.6080101@aldratech.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.046 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/449 X-Sequence-Number: 13086 Radu-Adrian Popescu wrote: >> >> There have been problems with Xeon processors. >> > > Can you elaborate on that please ? > > Thanks, Not really as I do not understand the issue. Here is one post from the archives. http://archives.postgresql.org/pgsql-performance/2005-05/msg00441.php If you search the archives for xeon sooner or later you will bump into something relevant. -- Kind Regards, Keith From pgsql-performance-owner@postgresql.org Thu Jun 23 10:31: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 158A05294F for ; Thu, 23 Jun 2005 10:31:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42323-06 for ; Thu, 23 Jun 2005 13:31:10 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id CB73A528D9 for ; Thu, 23 Jun 2005 10:31:08 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so62784wri for ; Thu, 23 Jun 2005 06:31:13 -0700 (PDT) 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:references; b=HJg7DcGPOwXGz7DbUYfc3DcUb6cDSg7YBdRo0kOi3iQcNABRhA+/ZGQWAImjf6+nHl2C57Mh26s9wDv3VqWsKav9kD6MjEIluMQNMvbVWVVXxkM8gS3umyT0Q+uEx2azi+r4jFhGgDWyjo3fSPTNEkoZqndK/gcvM6KXLYxbx8g= Received: by 10.54.42.17 with SMTP id p17mr1120671wrp; Thu, 23 Jun 2005 06:31:13 -0700 (PDT) Received: by 10.54.104.3 with HTTP; Thu, 23 Jun 2005 06:31:13 -0700 (PDT) Message-ID: Date: Thu, 23 Jun 2005 15:31:13 +0200 From: Kjell Tore Fossbakk Reply-To: Kjell Tore Fossbakk To: Tobias Brox Subject: Re: Querying 19million records very slowly Cc: pgsql-performance@postgresql.org In-Reply-To: <20050622162844.GE7839@tobias> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10735_31559800.1119533473130" References: <42B976D0.3000909@PresiNET.com> <20050622162844.GE7839@tobias> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.368 tagged_above=0 required=5 tests=AWL, HTML_20_30, HTML_MESSAGE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/450 X-Sequence-Number: 13087 ------=_Part_10735_31559800.1119533473130 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline -I also changed now() to current_time, which increased performance quite=20 good. I need to make further tests, before I'll post any results. -I tried to change now()- interval 'x hours' to like 2005-06-22 16:00:00+02= .=20 This also increased the performance. changing to time > '2005-06-22 16:00:00+02' (or what ever date is 24 hours= =20 back) or time > current_time - interval '24 hours' will be used. I'm running FreeBSD 4.11, and im editing the file in=20 /usr/local/etc/postgresql.conf, but it doesnt help. When i start up "psql= =20 database", none of the options are changed (with a restart of the=20 postmaster). I cant find a '--configuration=3Dpath/file' option for the=20 postmaster either... Kjell Tore On 6/22/05, Tobias Brox wrote:=20 >=20 > [Kjell Tore Fossbakk - Wed at 07:41:54AM -0700] > > I cant get the config file to load into my postgres. that's the > > problem. I want to set it to 10k, but it is only still at 1000... I > > save the file and restart the service.. > > > > yes, i ment 'pg_ctl reload', sry about that one. >=20 > Classical problem, a bit depending on the distro you are using. >=20 > The "master" file usually resides in /etc/postgresql while the actual fil= e > used usually resides in /var/lib/postgres/data ... or something. Some > distros copies over the file (such that one always should edit the file i= n > /etc) others don't (thus you either have to do that your self, or edit th= e > file in the database data directory. >=20 > -- > Tobias Brox, +86-13521622905 > Nordicbet, IT dept > ------=_Part_10735_31559800.1119533473130 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
-I also changed now() to current_time, which increased performance qui= te good. I need to make further tests, before I'll post any results.
-I tried to change now()- interval 'x hours' to like 2005-06-22 16:00:= 00+02. This also increased the performance.
 
changing to time > '2005-06-22 16:00:00+02' (or what ever date is 2= 4 hours back) or time > current_time - interval '24 hours' will be used.=
 
I'm running FreeBSD 4.11, and im editing the file in /usr/local/etc/po= stgresql.conf, but it doesnt help. When i start up "psql database"= ;, none of the options are changed (with a restart of the postmaster). I ca= nt find a '--configuration=3Dpath/file' option for the postmaster either...
 
Kjell Tore
 
On 6/22/05, = Tobias Brox <tobias@nordicbe= t.com> wrote:
[Kjell Tore Fossbakk - Wed at 07= :41:54AM -0700]
> I cant get the config file to load into my postgres= . that's the
> problem. I want to set it to 10k, but it is only still at 1000... = I
> save the file and restart the service..
>
> yes, i me= nt 'pg_ctl reload', sry about that one.

Classical problem, a bit dep= ending on the distro you are using.

The "master" file usually resides in /etc/postgresql whil= e the actual file
used usually resides in /var/lib/postgres/data ... or = something.  Some
distros copies over the file (such that one a= lways should edit the file in
/etc) others don't (thus you either have to do that your self, or edit = the
file in the database data directory.

--
Tobias Brox, +86-1= 3521622905
Nordicbet, IT dept

------=_Part_10735_31559800.1119533473130-- From pgsql-performance-owner@postgresql.org Thu Jun 23 10:36: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 6BFFE5285C for ; Thu, 23 Jun 2005 10:36:07 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41965-07 for ; Thu, 23 Jun 2005 13:36:01 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 6453452825 for ; Thu, 23 Jun 2005 10:36:00 -0300 (ADT) Received: (qmail 5311 invoked from network); 23 Jun 2005 13:34:10 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (64.7.143.116) by net2.micro-automation.com with SMTP; 23 Jun 2005 13:34:10 -0000 In-Reply-To: <42BAA816.2040806@NarrowPathInc.com> References: <20050622095227.05938982.frank@wiles.org> <200506221016.03808.josh@agliodbs.com> <20050622124232.71b05e3f.frank@wiles.org> <42BA1F01.1010700@NarrowPathInc.com> <42BA7F49.6080101@aldratech.com> <42BAA816.2040806@NarrowPathInc.com> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <533D107C-FDF0-4A6A-A88F-0751DCDDEA4D@fastcrypt.com> Cc: radu.popescu@aldratech.com, pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Performance Tuning Article Date: Thu, 23 Jun 2005 09:36:04 -0400 To: KeithW@NarrowPathInc.com X-Mailer: Apple Mail (2.730) 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: 200506/451 X-Sequence-Number: 13088 My understanding is that it isn't particularly XEON processors that is the problem Any dual processor will exhibit the problem, XEON's with hyperthreading exacerbate the problem though and the good news is that it has been fixed in 8.1 Dave On 23-Jun-05, at 8:16 AM, Keith Worthington wrote: > Radu-Adrian Popescu wrote: > >>> >>> There have been problems with Xeon processors. >>> >>> >> Can you elaborate on that please ? >> Thanks, >> > > Not really as I do not understand the issue. > > Here is one post from the archives. > http://archives.postgresql.org/pgsql-performance/2005-05/msg00441.php > > If you search the archives for xeon sooner or later you will bump > into something relevant. > > -- > Kind Regards, > Keith > > ---------------------------(end of > broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > > Dave Cramer davec@postgresintl.com www.postgresintl.com ICQ #14675561 jabber davecramer@jabber.org ph (519 939 0336 ) From pgsql-performance-owner@postgresql.org Thu Jun 23 10:46: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 1E80F52934 for ; Thu, 23 Jun 2005 10:46:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44747-06 for ; Thu, 23 Jun 2005 13:46:35 +0000 (GMT) Received: from www.aldratech.com (www.aldratech.com [193.226.161.42]) by svr1.postgresql.org (Postfix) with ESMTP id D415652899 for ; Thu, 23 Jun 2005 10:46:34 -0300 (ADT) Received: from [192.168.0.6] (rpopescu [192.168.0.6]) by www.aldratech.com (Postfix) with ESMTP id 86A56123D84 for ; Thu, 23 Jun 2005 16:44:50 +0300 (EEST) Message-ID: <42BABD37.9030207@aldratech.com> Date: Thu, 23 Jun 2005 16:46:31 +0300 From: Radu-Adrian Popescu Reply-To: radu.popescu@aldratech.com Organization: Aldratech Ltd. User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Performance Tuning Article References: <20050622095227.05938982.frank@wiles.org> <200506221016.03808.josh@agliodbs.com> <20050622124232.71b05e3f.frank@wiles.org> <42BA1F01.1010700@NarrowPathInc.com> <42BA7F49.6080101@aldratech.com> <42BAA816.2040806@NarrowPathInc.com> <533D107C-FDF0-4A6A-A88F-0751DCDDEA4D@fastcrypt.com> In-Reply-To: <533D107C-FDF0-4A6A-A88F-0751DCDDEA4D@fastcrypt.com> Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms010800030707020304050607" 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: 200506/452 X-Sequence-Number: 13089 This is a cryptographically signed message in MIME format. --------------ms010800030707020304050607 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Dave Cramer wrote: > My understanding is that it isn't particularly XEON processors that is > the problem > > Any dual processor will exhibit the problem, XEON's with hyperthreading > exacerbate the problem though > > and the good news is that it has been fixed in 8.1 > Where's that ? The only information I have is a message from Tom Lane saying the buffer manager (or something like that) locking has been redone for 8.0. Any pointers ? > Dave Thanks, -- Radu-Adrian Popescu CSA, DBA, Developer Aldrapay MD Aldratech Ltd. +40213212243 --------------ms010800030707020304050607 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIJDTCC AuEwggJKoAMCAQICAw0/VDANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UE ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0EwHhcNMDQxMDE4MTEwNjM0WhcNMDUxMDE4MTEwNjM0 WjBMMR8wHQYDVQQDExZUaGF3dGUgRnJlZW1haWwgTWVtYmVyMSkwJwYJKoZIhvcNAQkBFhpy YWR1LnBvcGVzY3VAYWxkcmF0ZWNoLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC ggEBAM+UjztouTxkdmm0OFNJxUGs2UpnbgswyyR0EmZYGpPnge2EjGIbnxgCsgtId466dmqw OokdKo7xf/XNzhYxR3NluUf6SsQhd8lVWt8ATHFchGEs5iHZAEcsbu2hzkrVTbrgfcer8+r/ WUlrEiMC1tJBXKQFxqVDZiLDrfGs+yxm0HSwnHE9DFrNFUpcqvZ0haBs4DA52AQw6rOxZaza eoDVXETwOHKp5K4igmC7Fu1tyA63g7RMn7dDtZ9r6U86FfN6RAOJ0SVvvlRWq31Z8ziLNtKO EytsMpVPlVL1Hhx86S5gqweU9YaXsZ3jfHXkMo8tpN33hplgBtPcjwToLnUCAwEAAaM3MDUw JQYDVR0RBB4wHIEacmFkdS5wb3Blc2N1QGFsZHJhdGVjaC5jb20wDAYDVR0TAQH/BAIwADAN BgkqhkiG9w0BAQQFAAOBgQBq9KdN3dCGQ2TgIrAjyWeDihQMsVMdfAVymKpOz/SDwsvnVP0N 9PDFr3MAcKql/ZodgVm4GylYyQVALIT6UcsjBd38kRRaLZhwB4zyp1s22uYsc3e7c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C+fgKnnmmkStN1Ph6BaSr4WAcYvtI8PcS1esD4m5a+r1D+8dcXDNRO5goxuUboo rNPidPfDsUCXZIm7N04AAAAAAAA= --------------ms010800030707020304050607-- From pgsql-performance-owner@postgresql.org Thu Jun 23 10:47: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 3993652933 for ; Thu, 23 Jun 2005 10:47:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45673-03 for ; Thu, 23 Jun 2005 13:47:11 +0000 (GMT) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id E421F52862 for ; Thu, 23 Jun 2005 10:47:10 -0300 (ADT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id j5NDowIj030666; Thu, 23 Jun 2005 08:50:58 -0500 Date: Thu, 23 Jun 2005 08:48:54 -0500 From: Frank Wiles To: KeithW@NarrowPathInc.com Cc: pgsql-performance@postgresql.org Subject: Re: Performance Tuning Article Message-Id: <20050623084854.0776d7a7.frank@wiles.org> In-Reply-To: <42BA1F01.1010700@NarrowPathInc.com> References: <20050622095227.05938982.frank@wiles.org> <200506221016.03808.josh@agliodbs.com> <20050622124232.71b05e3f.frank@wiles.org> <42BA1F01.1010700@NarrowPathInc.com> X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-redhat-linux-gnu) 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/453 X-Sequence-Number: 13090 On Wed, 22 Jun 2005 22:31:29 -0400 Keith Worthington wrote: > Frank, > > A couple of things I wish I had been told when I started asking how to > > configure a new machine. > > Use RAID 10 (striping across mirrored disks) > or RAID 0+1 (mirror a striped array) for your data. > Use RAID 1 (mirror) for your OS > Use RAID 1 (mirror) for the WAL. > > Don't put anything else on the array holding the WAL. > > There have been problems with Xeon processors. I believe all of these issues are covered in the article, but obviously not clearly enough. I'll work on rewording that section. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Thu Jun 23 11:19: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 B361752838 for ; Thu, 23 Jun 2005 11:19:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51242-05 for ; Thu, 23 Jun 2005 14:19:03 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id BC4E75285C for ; Thu, 23 Jun 2005 11:19:01 -0300 (ADT) Received: (qmail 8278 invoked by uid 500); 23 Jun 2005 14:18:54 -0000 Date: Thu, 23 Jun 2005 09:18:54 -0500 From: Bruno Wolff III To: Kurt De Grave Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: parameterized LIKE does not use index Message-ID: <20050623141854.GA7505@wolff.to> Mail-Followup-To: Bruno Wolff III , Kurt De Grave , Josh Berkus , pgsql-performance@postgresql.org References: <42BA73CE.4030909@student.kuleuven.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42BA73CE.4030909@student.kuleuven.ac.be> User-Agent: Mutt/1.5.6i 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: 200506/454 X-Sequence-Number: 13091 On Thu, Jun 23, 2005 at 10:33:18 +0200, Kurt De Grave wrote: > > Now it's tempting to dream of some mechanism that could make the > database consider > replanning the query automatically once it knows the parameter, or > choose from > a set of plans depending on the parameter. In this case the general plan > was about three orders > of magnitude slower than the specialized plan. But I guess this case is > not all that common > and the developer can work around it. I remember some discussion about delaying planning until the first actual query so that planning could use actual parameters to do the planning. If you really want to have it check the parameters every time, I think you will need to replan every time. I don't know if there is a way to save some of the prepare working while doing this. From pgsql-performance-owner@postgresql.org Thu Jun 23 11: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 53B8F52984 for ; Thu, 23 Jun 2005 11:44:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56712-06 for ; Thu, 23 Jun 2005 14:44:50 +0000 (GMT) Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by svr1.postgresql.org (Postfix) with ESMTP id 146FF52862 for ; Thu, 23 Jun 2005 11:44:48 -0300 (ADT) Received: from osgiliath.mathom.us ([70.108.108.63]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IIJ00BVPKYS3BS1@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 23 Jun 2005 09:44:53 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 72D07603DCC for ; Thu, 23 Jun 2005 10:44:52 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 08009-03-10 for ; Thu, 23 Jun 2005 10:44:52 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 5A805600657; Thu, 23 Jun 2005 10:44:52 -0400 (EDT) Date: Thu, 23 Jun 2005 10:44:52 -0400 From: Michael Stone Subject: Re: Performance Tuning Article In-reply-to: <42BA1F01.1010700@NarrowPathInc.com> To: pgsql-performance@postgresql.org Mail-Followup-To: pgsql-performance@postgresql.org Message-id: <20050623144452.GB9591@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <20050622095227.05938982.frank@wiles.org> <200506221016.03808.josh@agliodbs.com> <20050622124232.71b05e3f.frank@wiles.org> <42BA1F01.1010700@NarrowPathInc.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/455 X-Sequence-Number: 13092 On Wed, Jun 22, 2005 at 10:31:29PM -0400, Keith Worthington wrote: >Use RAID 10 (striping across mirrored disks) > or RAID 0+1 (mirror a striped array) for your data. yikes! never tell an unsuspecting person to use mirred stripes--that configuration has lower reliability and performance than striped mirrors with no redeeming qualities. Mike Stone From pgsql-performance-owner@postgresql.org Thu Jun 23 12:10: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 5D8715295E for ; Thu, 23 Jun 2005 12:10:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63211-07 for ; Thu, 23 Jun 2005 15:10:15 +0000 (GMT) Received: from turing.dhtns.com (turing.dhtns.com [66.118.163.130]) by svr1.postgresql.org (Postfix) with ESMTP id 98C8E5293C for ; Thu, 23 Jun 2005 12:10:11 -0300 (ADT) Received: by turing.dhtns.com (Postfix, from userid 1000) id 555823CE235; Thu, 23 Jun 2005 11:09:45 -0400 (EDT) Date: Thu, 23 Jun 2005 11:09:45 -0400 From: Elliott Bennett To: pgsql-performance@postgresql.org Subject: select distinct on varchar - wild performance differences! Message-ID: <20050623150945.GA31186@turing.dhtns.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: 200506/456 X-Sequence-Number: 13093 Hey, all. I've bounced this around in #postgres for an hour or so, and it was suggested that I post it here as well. Hopefully someone can help me out. I have three machines. All have 512MB of ram. Machine A is a 2.0ghz celeron, running debian, pg verison 7.4.6. Machine B is a 1.8ghz celeron, running centos 3.4, pg verison 8.0.3. (7.3.9 also exhibited the behaviour below, by the way) Machine C is a 1.0ghz athlon, running centos 4.0, pg verison 7.4.7. The SAME data and schema is loaded (from a pg_dump, default parameters) onto all three machines. With the same query: "select distinct model from exif_common", machines A and C return results quickly (1/4 second). Machine B chews on it for 30ish seconds! Note, this column is a VARCHAR(40). Here's an explain analyze for it. Machine A (fast): photos=# explain analyze select distinct model from exif_common; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- +-- Unique (cost=2629.74..2732.11 rows=5 width=15) (actual time=211.358..265.049 rows=6 loops=1) -> Sort (cost=2629.74..2680.93 rows=20473 width=15) (actual time=211.351..242.296 rows=20473 loops=1) Sort Key: model -> Seq Scan on exif_common (cost=0.00..1163.73 rows=20473 width=15) (actual time=0.022..58.635 rows=20473 loops=1) Total runtime: 265.928 ms (5 rows) Machine B (slow): photos=# explain analyze select distinct model from exif_common; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- +-- Unique (cost=2640.74..2743.11 rows=6 width=15) (actual time=27939.231..32914.134 rows=6 loops=1) -> Sort (cost=2640.74..2691.93 rows=20473 width=15) (actual time=27939.222..27983.784 rows=20473 loops=1) Sort Key: model -> Seq Scan on exif_common (cost=0.00..1174.73 rows=20473 width=15) (actual time=0.071..97.772 rows=20473 loops=1) Total runtime: 32915.031 ms (5 rows) ( yes, i know, six distinct rows out of 20,000.... But holy moly! 1/4 sec vs 32.9 sec?!?! ) Now, if I do a similar query against an INT column, the speeds are more in line with each other: Machine A: photos=# explain analyze select distinct imagewidth from exif_common; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- +- Unique (cost=2629.74..2732.11 rows=36 width=4) (actual time=179.899..225.934 rows=107 loops=1) -> Sort (cost=2629.74..2680.93 rows=20473 width=4) (actual time=179.891..207.632 rows=20473 loops=1) Sort Key: imagewidth -> Seq Scan on exif_common (cost=0.00..1163.73 rows=20473 width=4) (actual time=0.024..62.946 rows=20473 loops=1) Total runtime: 226.707 ms (5 rows) Machine B: photos=# explain analyze select distinct imagewidth from exif_common; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- +- Unique (cost=2640.74..2743.11 rows=24 width=4) (actual time=209.394..287.131 rows=107 loops=1) -> Sort (cost=2640.74..2691.93 rows=20473 width=4) (actual time=209.384..251.693 rows=20473 loops=1) Sort Key: imagewidth -> Seq Scan on exif_common (cost=0.00..1174.73 rows=20473 width=4) (actual time=0.074..94.574 rows=20473 loops=1) Total runtime: 288.411 ms (5 rows) Machine C exhibits the same behaviour as A for all queries. This weird slow behaviour on machine B also appeared in 7.3.9. Upgrading didn't seem to help. neilc from irc thought it may be a qsort(2) quirk, but a sample C program I whipped up testing different sized data sets with a similar distribution gave very similar sort timings between the three machines.. Therefore, I don't think it's qsort(2) to blame... Anyone have any ideas as to what may be up with machine B? Thanks, -Elliott From pgsql-performance-owner@postgresql.org Thu Jun 23 12:31: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 E726852863 for ; Thu, 23 Jun 2005 12:31:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66164-09 for ; Thu, 23 Jun 2005 15:31:19 +0000 (GMT) Received: from exobox.exoweb.net (unknown [221.122.43.98]) by svr1.postgresql.org (Postfix) with SMTP id D171452812 for ; Thu, 23 Jun 2005 12:31:16 -0300 (ADT) Received: (qmail 28537 invoked from network); 23 Jun 2005 15:31:14 -0000 Received: from exo185.exoweb.net (HELO tobias.nordicbet.invalid) (192.168.0.185) by 0 with SMTP; 23 Jun 2005 15:31:14 -0000 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id 881E5E0DB6; Thu, 23 Jun 2005 23:31:12 +0800 (CST) Date: Thu, 23 Jun 2005 23:31:12 +0800 From: Tobias Brox To: Kjell Tore Fossbakk Cc: Tobias Brox , pgsql-performance@postgresql.org Subject: Re: Querying 19million records very slowly Message-ID: <20050623153112.GS7839@tobias> References: <42B976D0.3000909@PresiNET.com> <20050622162844.GE7839@tobias> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Group Nordicbet 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: 200506/457 X-Sequence-Number: 13094 > I'm running FreeBSD 4.11, and im editing the file in > /usr/local/etc/postgresql.conf, but it doesnt help. On my system the 'live' config file resides in /var/lib/postgresql/data/postgresql.conf - maybe you have them in /usr/local/var/lib ... -- Tobias Brox, +86-13521622905 Nordicbet, IT dept From pgsql-performance-owner@postgresql.org Thu Jun 23 12:35: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 5872A52825 for ; Thu, 23 Jun 2005 12:35:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69866-01 for ; Thu, 23 Jun 2005 15:34:57 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4491B52913 for ; Thu, 23 Jun 2005 12:34:56 -0300 (ADT) 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 j5NFYtXY005596; Thu, 23 Jun 2005 11:34:55 -0400 (EDT) To: Elliott Bennett Cc: pgsql-performance@postgresql.org Subject: Re: select distinct on varchar - wild performance differences! In-reply-to: <20050623150945.GA31186@turing.dhtns.com> References: <20050623150945.GA31186@turing.dhtns.com> Comments: In-reply-to Elliott Bennett message dated "Thu, 23 Jun 2005 11:09:45 -0400" Date: Thu, 23 Jun 2005 11:34:55 -0400 Message-ID: <5595.1119540895@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: 200506/458 X-Sequence-Number: 13095 Elliott Bennett writes: > Anyone have any ideas as to what may be up with machine B? Different locale setting? strcoll() can be horribly slow in some locales ... regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 23 13:17: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 D880752863 for ; Thu, 23 Jun 2005 13:17:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76182-08 for ; Thu, 23 Jun 2005 16:16:59 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id DA89652833 for ; Thu, 23 Jun 2005 13:16:58 -0300 (ADT) Received: (qmail 7334 invoked from network); 23 Jun 2005 16:15:03 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (64.7.143.116) by net2.micro-automation.com with SMTP; 23 Jun 2005 16:15:03 -0000 In-Reply-To: <42BABD37.9030207@aldratech.com> References: <20050622095227.05938982.frank@wiles.org> <200506221016.03808.josh@agliodbs.com> <20050622124232.71b05e3f.frank@wiles.org> <42BA1F01.1010700@NarrowPathInc.com> <42BA7F49.6080101@aldratech.com> <42BAA816.2040806@NarrowPathInc.com> <533D107C-FDF0-4A6A-A88F-0751DCDDEA4D@fastcrypt.com> <42BABD37.9030207@aldratech.com> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Performance Tuning Article Date: Thu, 23 Jun 2005 12:16:57 -0400 To: radu.popescu@aldratech.com X-Mailer: Apple Mail (2.730) 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: 200506/459 X-Sequence-Number: 13096 AFAIK, the problem was the buffer manager Dave On 23-Jun-05, at 9:46 AM, Radu-Adrian Popescu wrote: > Dave Cramer wrote: > >> My understanding is that it isn't particularly XEON processors >> that is the problem >> Any dual processor will exhibit the problem, XEON's with >> hyperthreading exacerbate the problem though >> and the good news is that it has been fixed in 8.1 >> > > Where's that ? The only information I have is a message from Tom > Lane saying the buffer manager (or something like that) locking has > been redone for 8.0. Any pointers ? > > >> Dave >> > > Thanks, > -- > Radu-Adrian Popescu > CSA, DBA, Developer > Aldrapay MD > Aldratech Ltd. > +40213212243 > From pgsql-performance-owner@postgresql.org Thu Jun 23 14:10: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 6F1FF52825 for ; Thu, 23 Jun 2005 14:09:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87130-04 for ; Thu, 23 Jun 2005 17:09:33 +0000 (GMT) Received: from turing.dhtns.com (turing.dhtns.com [66.118.163.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2796152863 for ; Thu, 23 Jun 2005 14:09:32 -0300 (ADT) Received: by turing.dhtns.com (Postfix, from userid 1000) id 8BB493CE235; Thu, 23 Jun 2005 13:09:07 -0400 (EDT) Date: Thu, 23 Jun 2005 13:09:07 -0400 From: Elliott Bennett To: pgsql-performance@postgresql.org Subject: Re: select distinct on varchar - wild performance differences! Message-ID: <20050623170907.GA32134@turing.dhtns.com> References: <20050623150945.GA31186@turing.dhtns.com> <5595.1119540895@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5595.1119540895@sss.pgh.pa.us> 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: 200506/460 X-Sequence-Number: 13097 hah! That did it. Setting to 'C' makes it just as fast as the other machines. I think it defaulted to en_US... Thanks! -Elliott On Thu, Jun 23, 2005 at 11:34:55AM -0400, Tom Lane wrote: > Elliott Bennett writes: > > Anyone have any ideas as to what may be up with machine B? > > Different locale setting? strcoll() can be horribly slow in some > locales ... > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Thu Jun 23 14: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 DE4EB52825 for ; Thu, 23 Jun 2005 14:15:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88472-03 for ; Thu, 23 Jun 2005 17:15: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 34F0552812 for ; Thu, 23 Jun 2005 14:15:33 -0300 (ADT) 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 j5NHFOUP006452; Thu, 23 Jun 2005 13:15:24 -0400 (EDT) To: Dave Cramer Cc: radu.popescu@aldratech.com, pgsql-performance@postgresql.org Subject: Re: Performance Tuning Article In-reply-to: References: <20050622095227.05938982.frank@wiles.org> <200506221016.03808.josh@agliodbs.com> <20050622124232.71b05e3f.frank@wiles.org> <42BA1F01.1010700@NarrowPathInc.com> <42BA7F49.6080101@aldratech.com> <42BAA816.2040806@NarrowPathInc.com> <533D107C-FDF0-4A6A-A88F-0751DCDDEA4D@fastcrypt.com> <42BABD37.9030207@aldratech.com> Comments: In-reply-to Dave Cramer message dated "Thu, 23 Jun 2005 12:16:57 -0400" Date: Thu, 23 Jun 2005 13:15:24 -0400 Message-ID: <6451.1119546924@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: 200506/461 X-Sequence-Number: 13098 Dave Cramer writes: > AFAIK, the problem was the buffer manager The buffer manager was the place that seemed to be hit hardest by Xeon's problems with spinlock contention. I think we've partially fixed that issue in 8.1, but as we continue to improve the system's performance, it's likely to surface as a bottleneck again in other places. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 23 15:55: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 4A57B52882 for ; Thu, 23 Jun 2005 15:55:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10225-05 for ; Thu, 23 Jun 2005 18:55:17 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 1335D528C3 for ; Thu, 23 Jun 2005 15:55:14 -0300 (ADT) 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 7522726; Thu, 23 Jun 2005 11:57:22 -0700 From: Josh Berkus Organization: Aglio Database Solutions To: Bruno Wolff III Subject: Re: parameterized LIKE does not use index Date: Thu, 23 Jun 2005 11:55:35 -0700 User-Agent: KMail/1.8 Cc: Kurt De Grave , pgsql-performance@postgresql.org References: <42BA73CE.4030909@student.kuleuven.ac.be> <20050623141854.GA7505@wolff.to> In-Reply-To: <20050623141854.GA7505@wolff.to> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506231155.36126.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: 200506/462 X-Sequence-Number: 13099 Bruno, > I remember some discussion about delaying planning until the first > actual query so that planning could use actual parameters to do > the planning. If you really want to have it check the parameters > every time, I think you will need to replan every time. I don't > know if there is a way to save some of the prepare working while > doing this. That wouldn't help much in Kurt's case. Nor in most "real" cases, which is why I think the idea never went anywhere. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Jun 23 16:38: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 DA27C52806 for ; Thu, 23 Jun 2005 16:38:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23702-04 for ; Thu, 23 Jun 2005 19:38:14 +0000 (GMT) Received: from presinet-main.presinet.com (presinet.com [209.53.156.1]) by svr1.postgresql.org (Postfix) with ESMTP id CAD2252812 for ; Thu, 23 Jun 2005 16:38:09 -0300 (ADT) 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 MJ799DGW; Thu, 23 Jun 2005 12:34:09 -0700 Message-ID: <42BB0F9C.2050207@PresiNET.com> Date: Thu, 23 Jun 2005 12:38:04 -0700 From: Bricklen Anderson User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: ETL optimization X-Enigmail-Version: 0.91.0.0 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.016 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/463 X-Sequence-Number: 13100 Situation: I'm trying to optimize an ETL process with many upserts (~100k aggregated rows) (no duplicates allowed). The source (table t2) table holds around 14 million rows, and I'm grabbing them 100,000 rows at a time from t2, resulting in about 100,000 distinct rows in the destination table (t1). What I've tried: i. FOR EXECUTE LOOP over my result set (aggregated results, 100k-ish rows), and try an update first, check the ROW_COUNT, if 0, then do an insert. ... run time: approx. 25 mins ii. in a function (pseudo code), (table name is dynamic): ... up_stm := 'UPDATE '||t1||' SET x=t2.x FROM (select sum(x),a,b,c from t2 group by a,b,c) as t2 WHERE '||t1||'.a=t2.a AND '||t1||'.b=t2.b AND '||t1||'.c=t3.c'; EXECUTE up_stm; ins_stm := 'INSERT INTO '||t1||' (x,a,b,c) select x,a,b,c FROM (select sum(x) as x,a,b,c from t2 group by a,b,c) as t2 WHERE NOT EXISTS (select true from '||t1||' where '||t1||'.a=t2.a and '||t1||'.b=t2.b and '||t1||'.c=t2.c limit 1)'; EXECUTE ins_stm; ... takes about 7 minutes. The performance of this is reasonable, but there is room for improvement. I think it's the NOT EXISTS subquery on the insert that makes the first run slow. Any revisions that may be faster (for the subquery)? Note, this subquery is necessary so that duplicates don't get into the target table (t1). Subsequent runs will be mostly updates (and still slow), with few inserts. I'm not seeing a way for that update statement to be sped up, but maybe someone else does? iii. UNIQUE constraint on table "t1". This didn't seem to perform too badly with fewer rows (preliminary tests), but as you'd expect, on error the whole transaction would roll back. Is it possible to skip a row if it causes an error, as opposed to aborting the transaction altogether? To summarize, I'm looking for the most efficient and fastest way to perform my upserts. Tips and/or references to pertinent docs are also appreciated! If any more information is necessary, please let me know. (postgresql 8.0.3, linux) Cheers, Bricklen -- _______________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. _______________________________ From pgsql-performance-owner@postgresql.org Thu Jun 23 16:54: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 5FBC452835 for ; Thu, 23 Jun 2005 16:54:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28780-05 for ; Thu, 23 Jun 2005 19:54:07 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by svr1.postgresql.org (Postfix) with ESMTP id B4A715280D for ; Thu, 23 Jun 2005 16:54:04 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 68so6114wra for ; Thu, 23 Jun 2005 12:54:06 -0700 (PDT) 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:references; b=WrI9dROzlHwgo6lqZzH9RSd/oRupnWlj171AfKxPB2EvWz/v9gS1TBJruoNxg6rW1i4IsCcbJ2MzTxS+zMIYBnuJk6DV7DbvBDY5cPV2qmDF/UQANrJHoCddIbFA2eVRuIBv/FNdPYE1o4dfcB88GMJMC5yyCfueV4UHM/QzvwA= Received: by 10.54.47.63 with SMTP id u63mr1350696wru; Thu, 23 Jun 2005 12:54:06 -0700 (PDT) Received: by 10.54.42.25 with HTTP; Thu, 23 Jun 2005 12:54:06 -0700 (PDT) Message-ID: Date: Thu, 23 Jun 2005 21:54:06 +0200 From: Meetesh Karia Reply-To: meetesh.karia@alumni.duke.edu To: Bricklen Anderson Subject: Re: ETL optimization Cc: pgsql-performance@postgresql.org In-Reply-To: <42BB0F9C.2050207@PresiNET.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3496_26142805.1119556446721" References: <42BB0F9C.2050207@PresiNET.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.53 tagged_above=0 required=5 tests=AWL, HTML_20_30, HTML_MESSAGE, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/464 X-Sequence-Number: 13101 ------=_Part_3496_26142805.1119556446721 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I don't know what this will change wrt how often you need to run VACUUM (I'= m=20 a SQL Server guy), but instead of an update and insert, try a delete and=20 insert. You'll only have to find the duplicate rows once and your insert=20 doesn't need a where clause. Meetesh On 6/23/05, Bricklen Anderson wrote: >=20 > Situation: > I'm trying to optimize an ETL process with many upserts (~100k aggregated= =20 > rows) > (no duplicates allowed). The source (table t2) table holds around 14=20 > million > rows, and I'm grabbing them 100,000 rows at a time from t2, resulting in= =20 > about > 100,000 distinct rows in the destination table (t1). >=20 >=20 > What I've tried: >=20 > i. FOR EXECUTE LOOP over my result set (aggregated results, 100k-ish=20 > rows), and > try an update first, check the ROW_COUNT, if 0, then do an insert. > ... > run time: approx. 25 mins >=20 >=20 > ii. in a function (pseudo code), (table name is dynamic): > ... > up_stm :=3D > 'UPDATE '||t1||' SET x=3Dt2.x > FROM (select sum(x),a,b,c > from t2 > group by a,b,c) as t2 > WHERE '||t1||'.a=3Dt2.a AND '||t1||'.b=3Dt2.b AND '||t1||'.c=3Dt3.c'; >=20 > EXECUTE up_stm; >=20 > ins_stm :=3D > 'INSERT INTO '||t1||' (x,a,b,c) select x,a,b,c > FROM (select sum(x) as x,a,b,c from t2 group by a,b,c) as t2 > WHERE NOT EXISTS > (select true from '||t1||' > where '||t1||'.a=3Dt2.a > and '||t1||'.b=3Dt2.b > and '||t1||'.c=3Dt2.c > limit 1)'; >=20 > EXECUTE ins_stm; > ... >=20 > takes about 7 minutes. The performance of this is reasonable, but there i= s=20 > room > for improvement. > I think it's the NOT EXISTS subquery on the insert that makes the first= =20 > run > slow. Any revisions that may be faster (for the subquery)? > Note, this subquery is necessary so that duplicates don't get into the=20 > target > table (t1). >=20 > Subsequent runs will be mostly updates (and still slow), with few inserts= .=20 > I'm > not seeing a way for that update statement to be sped up, but maybe=20 > someone else > does? >=20 >=20 > iii. UNIQUE constraint on table "t1". This didn't seem to perform too=20 > badly with > fewer rows (preliminary tests), but as you'd expect, on error the whole > transaction would roll back. Is it possible to skip a row if it causes an= =20 > error, > as opposed to aborting the transaction altogether? >=20 >=20 >=20 > To summarize, I'm looking for the most efficient and fastest way to=20 > perform my > upserts. Tips and/or references to pertinent docs are also appreciated! > If any more information is necessary, please let me know. >=20 >=20 > (postgresql 8.0.3, linux) >=20 >=20 > Cheers, >=20 > Bricklen > -- > _______________________________ >=20 > This e-mail may be privileged and/or confidential, and the sender does > not waive any related rights and obligations. Any distribution, use or > copying of this e-mail or the information it contains by other than an > intended recipient is unauthorized. If you received this e-mail in > error, please advise me (by return e-mail or otherwise) immediately. > _______________________________ >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > ------=_Part_3496_26142805.1119556446721 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I don't know what this will change wrt how often you need to run VACUUM (I'm a SQL Server guy), but instead of an update and insert, try a delete and insert.  You'll only have to find the duplicate rows once and your insert doesn't need a where clause.

Meetesh

On 6/23/05, Bricklen Anderson <BAnderson@presinet.com> wrote:
Situation:
I'm trying to optimize an ETL process with many upserts (~100= k aggregated rows)
(no duplicates allowed). The source (table t2) table = holds around 14 million
rows, and I'm grabbing them 100,000 rows at a ti= me from t2, resulting in about
100,000 distinct rows in the destination table (t1).


What I'= ve tried:

i. FOR EXECUTE LOOP over my result set (aggregated results= , 100k-ish rows), and
try an update first, check the ROW_COUNT, if 0, th= en do an insert.
...
run time: approx. 25 mins


ii. in a function (pseudo c= ode), (table name is dynamic):
...
up_stm :=3D
'UPDATE '||t1||' SE= T x=3Dt2.x
FROM    (select sum(x),a,b,c
 &nb= sp;      from t2
    &= nbsp;   group by a,b,c) as t2
WHERE '||t1||'.a=3Dt2.a AND '||t1||'.b=3Dt2.b AND '||t1||'.c=3Dt3.c';
EXECUTE up_stm;

ins_stm :=3D
'INSERT INTO '||t1||' (x,a,b,c= ) select x,a,b,c
FROM (select sum(x) as x,a,b,c from t2 group by a,b,c) = as t2
WHERE NOT EXISTS
        (se= lect true from '||t1||'
        = where '||t1||'.a=3Dt2.a
        = and '||t1||'.b=3Dt2.b
        an= d '||t1||'.c=3Dt2.c
        limi= t 1)';

EXECUTE ins_stm;
...

takes about 7 minutes. The per= formance of this is reasonable, but there is room
for improvement.
I think it's the NOT EXISTS subquery on the insert = that makes the first run
slow. Any revisions that may be faster (for the= subquery)?
Note, this subquery is necessary so that duplicates don't ge= t into the target
table (t1).

Subsequent runs will be mostly updates (and still sl= ow), with few inserts. I'm
not seeing a way for that update statement to= be sped up, but maybe someone else
does?


iii. UNIQUE constra= int on table "t1". This didn't seem to perform too badly with
fewer rows (preliminary tests), but as you'd expect, on error the whole=
transaction would roll back. Is it possible to skip a row if it causes = an error,
as opposed to aborting the transaction altogether?



To summarize, I'm looking for the most efficient and fastest way to= perform my
upserts. Tips and/or references to pertinent docs are also a= ppreciated!
If any more information is necessary, please let me know.


(postgresql 8.0.3, linux)


Cheers,

Bricklen--
_______________________________

This e-mail may be privileged= and/or confidential, and the sender does
not waive any related rights a= nd obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an<= br>intended recipient is unauthorized. If you received this e-mail in
er= ror, please advise me (by return e-mail or otherwise) immediately.
_____= __________________________

---------------------------(end of broadcast)----------------------= -----
TIP 2: you can get off all lists at once with the unregister comma= nd
    (send "unregister YourEmailAddressHere&q= uot; to majordomo@postgresql.org)

------=_Part_3496_26142805.1119556446721-- From pgsql-performance-owner@postgresql.org Thu Jun 23 17: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 2A5DE52970 for ; Thu, 23 Jun 2005 17:17:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37179-06 for ; Thu, 23 Jun 2005 20:16:50 +0000 (GMT) Received: from presinet-main.presinet.com (presinet.com [209.53.156.1]) by svr1.postgresql.org (Postfix) with ESMTP id A1EFB5282E for ; Thu, 23 Jun 2005 17:16:48 -0300 (ADT) 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 MJ799DNA; Thu, 23 Jun 2005 13:12:55 -0700 Message-ID: <42BB18B2.4040009@PresiNET.com> Date: Thu, 23 Jun 2005 13:16:50 -0700 From: Bricklen Anderson User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: meetesh.karia@alumni.duke.edu Cc: pgsql-performance@postgresql.org Subject: Re: ETL optimization References: <42BB0F9C.2050207@PresiNET.com> In-Reply-To: X-Enigmail-Version: 0.91.0.0 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.016 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/465 X-Sequence-Number: 13102 Meetesh Karia wrote: > I don't know what this will change wrt how often you need to run VACUUM > (I'm a SQL Server guy), but instead of an update and insert, try a > delete and insert. You'll only have to find the duplicate rows once and > your insert doesn't need a where clause. > > Meetesh > Vacuum analyze in generally run about once an hour. You know, I didn't even think to try a delete + insert combo (which will not be visible to the other queries that are occurring). Truncate is out of the question, because of the aforementioned queries, but I'll give the d+i a shot. Thanks! -- _______________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. _______________________________ From pgsql-performance-owner@postgresql.org Thu Jun 23 18:56: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 2EDED52995 for ; Thu, 23 Jun 2005 18:56:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58265-06 for ; Thu, 23 Jun 2005 21:56:44 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id 8292D52983 for ; Thu, 23 Jun 2005 18:56:41 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5NLuf0Y095859; Thu, 23 Jun 2005 23:56:42 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050623234711.053c4d48@pop.interactivemediafactory.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Thu, 23 Jun 2005 23:56:27 +0200 To: Bricklen Anderson From: Jacques Caron Subject: Re: ETL optimization Cc: pgsql-performance@postgresql.org In-Reply-To: <42BB0F9C.2050207@PresiNET.com> References: <42BB0F9C.2050207@PresiNET.com> 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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/466 X-Sequence-Number: 13103 Hi, At 21:38 23/06/2005, Bricklen Anderson wrote: >Situation: >I'm trying to optimize an ETL process with many upserts (~100k aggregated >rows) >(no duplicates allowed). The source (table t2) table holds around 14 million >rows, and I'm grabbing them 100,000 rows at a time from t2, resulting in about >100,000 distinct rows in the destination table (t1). > > >What I've tried: > >i. FOR EXECUTE LOOP over my result set (aggregated results, 100k-ish >rows), and >try an update first, check the ROW_COUNT, if 0, then do an insert. >... >run time: approx. 25 mins > > >ii. in a function (pseudo code), (table name is dynamic): >... >up_stm := >'UPDATE '||t1||' SET x=t2.x >FROM (select sum(x),a,b,c > from t2 > group by a,b,c) as t2 >WHERE '||t1||'.a=t2.a AND '||t1||'.b=t2.b AND '||t1||'.c=t3.c'; > >EXECUTE up_stm; > >ins_stm := >'INSERT INTO '||t1||' (x,a,b,c) select x,a,b,c >FROM (select sum(x) as x,a,b,c from t2 group by a,b,c) as t2 >WHERE NOT EXISTS > (select true from '||t1||' > where '||t1||'.a=t2.a > and '||t1||'.b=t2.b > and '||t1||'.c=t2.c > limit 1)'; > >EXECUTE ins_stm; >... I have a similar situation, and the solution I use (though I haven't really tested many different situations): - have a trigger ON INSERT which does: UPDATE set whatever_value=NEW.whatever_value,... WHERE whatever_key=NEW.whatever.key AND... IF FOUND THEN RETURN NULL; ELSE RETURN NEW; END IF; - use COPY For optimal performance, a different trigger function is created for each table, which allows the query plan of the UPDATE to be cached. Let us know how that works out for you and if you find a better solution! Jacques. From pgsql-performance-owner@postgresql.org Thu Jun 23 19: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 6A799528C3 for ; Thu, 23 Jun 2005 19:04:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57786-10 for ; Thu, 23 Jun 2005 22:04:32 +0000 (GMT) Received: from presinet-main.presinet.com (presinet.com [209.53.156.1]) by svr1.postgresql.org (Postfix) with ESMTP id 281C45288E for ; Thu, 23 Jun 2005 19:04:31 -0300 (ADT) 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 MJ7991AP; Thu, 23 Jun 2005 15:00:38 -0700 Message-ID: <42BB31F1.7000303@PresiNET.com> Date: Thu, 23 Jun 2005 15:04:33 -0700 From: Bricklen Anderson User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jacques Caron Cc: pgsql-performance@postgresql.org Subject: Re: ETL optimization References: <42BB0F9C.2050207@PresiNET.com> <6.2.0.14.0.20050623234711.053c4d48@pop.interactivemediafactory.net> In-Reply-To: <6.2.0.14.0.20050623234711.053c4d48@pop.interactivemediafactory.net> X-Enigmail-Version: 0.91.0.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.015 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/467 X-Sequence-Number: 13104 Jacques Caron wrote: > > I have a similar situation, and the solution I use (though I haven't > really tested many different situations): > - have a trigger ON INSERT which does: > UPDATE set whatever_value=NEW.whatever_value,... WHERE > whatever_key=NEW.whatever.key AND... > IF FOUND THEN > RETURN NULL; > ELSE > RETURN NEW; > END IF; > - use COPY > > For optimal performance, a different trigger function is created for > each table, which allows the query plan of the UPDATE to be cached. > > Let us know how that works out for you and if you find a better solution! > > Jacques. > Hi Jacques, thanks for the suggestion. I've previously tested triggers under a variety of situations and there was no way that they would work under the load we currently have, and the much greater load that we will be expecting soon (~40x increase in data). I'm in the process of testing the delete scenario right now, and at first blush seems to perform fairly well. 2.5 million rows before aggregation, and 171000 after, in a little under 7 minutes. Currently testing again with about 18.5 million rows. A drawback by using the delete method is that we cannot do any of the aggregation incrementally, but so far that hasn't been a big help anyways. I still need to test the performance of concurrent querying against the destination table whilst the aggregation is occurring. -- _______________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. _______________________________ From pgsql-performance-owner@postgresql.org Fri Jun 24 01:27: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 6AFDC52913 for ; Fri, 24 Jun 2005 01:27:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40154-04 for ; Fri, 24 Jun 2005 04:27:27 +0000 (GMT) Received: from zigo.dhs.org (ua-83-227-204-174.cust.bredbandsbolaget.se [83.227.204.174]) by svr1.postgresql.org (Postfix) with ESMTP id B3745528D9 for ; Fri, 24 Jun 2005 01:27:25 -0300 (ADT) Received: from zigo.zigo.dhs.org (zigo.zigo.dhs.org [192.168.0.1]) by zigo.dhs.org (Postfix) with ESMTP id 5078D8467; Fri, 24 Jun 2005 06:27:21 +0200 (CEST) Date: Fri, 24 Jun 2005 06:27:21 +0200 (CEST) From: Dennis Bjorklund To: Bricklen Anderson Cc: pgsql-performance@postgresql.org Subject: Re: ETL optimization In-Reply-To: <42BB0F9C.2050207@PresiNET.com> Message-ID: 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.424 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/468 X-Sequence-Number: 13105 On Thu, 23 Jun 2005, Bricklen Anderson wrote: > iii. UNIQUE constraint on table "t1". This didn't seem to perform too > badly with fewer rows (preliminary tests), but as you'd expect, on error > the whole transaction would roll back. Is it possible to skip a row if > it causes an error, as opposed to aborting the transaction altogether? You don't need to roll back the whole transaction if you use savepoints or the exception features in pl/pgsql Take a look at this example: http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE -- /Dennis Bj�rklund From pgsql-performance-owner@postgresql.org Fri Jun 24 01:33: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 E0E4252980 for ; Fri, 24 Jun 2005 01:33:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41312-06 for ; Fri, 24 Jun 2005 04:32:56 +0000 (GMT) Received: from web81703.mail.yahoo.com (web81703.mail.yahoo.com [206.190.37.134]) by svr1.postgresql.org (Postfix) with SMTP id C966C52968 for ; Fri, 24 Jun 2005 01:32:55 -0300 (ADT) Received: (qmail 32589 invoked by uid 60001); 24 Jun 2005 04:32:54 -0000 Message-ID: <20050624043254.32587.qmail@web81703.mail.yahoo.com> Received: from [71.129.149.229] by web81703.mail.yahoo.com via HTTP; Thu, 23 Jun 2005 21:32:54 PDT X-RocketYMMF: scottnmeg@sbcglobal.net Date: Thu, 23 Jun 2005 21:32:54 -0700 (PDT) From: Scott Goldstein Reply-To: sgoldstein@apache.org Subject: Postgres 8 vs Postgres 7.4/cygwin To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-970518458-1119587574=:30256" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.4 tagged_above=0 required=5 tests=AWL, HTML_10_20, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200506/469 X-Sequence-Number: 13106 --0-970518458-1119587574=:30256 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit I'm currently trying to make a decision on whether to use the Cygwin port of Postgres 7.4 or Postgres 8.0 for a windows installation. Can someone provide some comparison info from a performance point of view? I was thinking that the Cygwin port has the overhead of the translation layer, but 8.0 is a newer product and may still have performance issue. Can anyone comment on this? Thanks for the help. Scott --0-970518458-1119587574=:30256 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
I'm currently trying to make a decision on whether to use the Cygwin port of Postgres 7.4 or Postgres 8.0 for a windows installation.  Can someone provide some comparison info from a performance point of view?  I was thinking that the Cygwin port has the overhead of the translation layer, but 8.0 is a newer product and may still have performance issue.  Can anyone comment on this? 
 
Thanks for the help.
 
Scott
--0-970518458-1119587574=:30256-- From pgsql-performance-owner@postgresql.org Fri Jun 24 02:02: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 21239528BB for ; Fri, 24 Jun 2005 02:02:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44768-08 for ; Fri, 24 Jun 2005 05:02:03 +0000 (GMT) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id A17CD5280C for ; Fri, 24 Jun 2005 02:02:01 -0300 (ADT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 8379124FE0; Fri, 24 Jun 2005 13:01:54 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 6A9A024FDF; Fri, 24 Jun 2005 13:01:54 +0800 (WST) Message-ID: <42BB9505.3030005@familyhealth.com.au> Date: Fri, 24 Jun 2005 13:07:17 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: sgoldstein@apache.org Cc: pgsql-performance@postgresql.org Subject: Re: Postgres 8 vs Postgres 7.4/cygwin References: <20050624043254.32587.qmail@web81703.mail.yahoo.com> In-Reply-To: <20050624043254.32587.qmail@web81703.mail.yahoo.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.063 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/470 X-Sequence-Number: 13107 PostgreSQL 8 for windows faster AND more reliable :) Chris Scott Goldstein wrote: > I'm currently trying to make a decision on whether to use the Cygwin > port of Postgres 7.4 or Postgres 8.0 for a windows installation. Can > someone provide some comparison info from a performance point of view? > I was thinking that the Cygwin port has the overhead of the translation > layer, but 8.0 is a newer product and may still have performance issue. > Can anyone comment on this? > > Thanks for the help. > > Scott From pgsql-performance-owner@postgresql.org Fri Jun 24 10:40: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 820455280C for ; Fri, 24 Jun 2005 10:40:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48796-05 for ; Fri, 24 Jun 2005 13:40:29 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0E4F352985 for ; Fri, 24 Jun 2005 10:40:28 -0300 (ADT) 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 j5ODeRR4026064; Fri, 24 Jun 2005 09:40:27 -0400 (EDT) To: sgoldstein@apache.org Cc: pgsql-performance@postgresql.org Subject: Re: Postgres 8 vs Postgres 7.4/cygwin In-reply-to: <20050624043254.32587.qmail@web81703.mail.yahoo.com> References: <20050624043254.32587.qmail@web81703.mail.yahoo.com> Comments: In-reply-to Scott Goldstein message dated "Thu, 23 Jun 2005 21:32:54 -0700" Date: Fri, 24 Jun 2005 09:40:27 -0400 Message-ID: <26063.1119620427@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: 200506/471 X-Sequence-Number: 13108 Scott Goldstein writes: > I'm currently trying to make a decision on whether to use the Cygwin port of Postgres 7.4 or Postgres 8.0 for a windows installation. Can someone provide some comparison info from a performance point of view? I was thinking that the Cygwin port has the overhead of the translation layer, but 8.0 is a newer product and may still have performance issue. Can anyone comment on this? Well, the performance issues of the cygwin-based releases are the stuff of legend ;-). New product or no, this is really a no-brainer. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jun 24 15:18: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 258E452885 for ; Fri, 24 Jun 2005 15:18:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02082-04 for ; Fri, 24 Jun 2005 18:18:45 +0000 (GMT) Received: from adicia.telenet-ops.be (adicia.telenet-ops.be [195.130.132.56]) by svr1.postgresql.org (Postfix) with ESMTP id 8332052862 for ; Fri, 24 Jun 2005 15:18:43 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by adicia.telenet-ops.be (Postfix) with SMTP id 70E16440F7 for ; Fri, 24 Jun 2005 20:18:43 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by adicia.telenet-ops.be (Postfix) with ESMTP id E05954407A for ; Fri, 24 Jun 2005 20:18:42 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: <1c365a8bdeb09957fadda7a6fdc8ff02@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-76--403992528 From: Yves Vindevogel Subject: Speed with offset clause Date: Fri, 24 Jun 2005 20:18:48 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/472 X-Sequence-Number: 13109 --Apple-Mail-76--403992528 Content-Type: multipart/alternative; boundary=Apple-Mail-77--403992527 --Apple-Mail-77--403992527 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi again all, My queries are now optimised. They all use the indexes like they=20 should. However, there's still a slight problem when I issue the "offset"=20 clause. We have a table that contains 600.000 records We display them by 25 in the webpage. So, when I want the last page, which is: 600k / 25 =3D page 24000 - 1 =3D=20= 23999, I issue the offset of 23999 * 25 This take a long time to run, about 5-10 seconds whereas offset below=20 100 take less than a second. Can I speed this up ? Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-77--403992527 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Hi again all, My queries are now optimised. They all use the indexes like they should. However, there's still a slight problem when I issue the "offset" clause. We have a table that contains 600.000 records We display them by 25 in the webpage. So, when I want the last page, which is: 600k / 25 =3D page 24000 - 1 =3D 23999, I issue the offset of 23999 * 25 This take a long time to run, about 5-10 seconds whereas offset below 100 take less than a second. Can I speed this up ? =20 Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-77--403992527-- --Apple-Mail-76--403992528 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP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+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-76--403992528 Content-Type: multipart/alternative; boundary=Apple-Mail-78--403992525 --Apple-Mail-78--403992525 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-78--403992525 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-78--403992525-- --Apple-Mail-76--403992528-- From pgsql-performance-owner@postgresql.org Fri Jun 24 15:54: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 C6FFF528AD for ; Fri, 24 Jun 2005 15:54:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08040-04 for ; Fri, 24 Jun 2005 18:54:36 +0000 (GMT) Received: from web32807.mail.mud.yahoo.com (web32807.mail.mud.yahoo.com [68.142.206.37]) by svr1.postgresql.org (Postfix) with SMTP id E119252823 for ; Fri, 24 Jun 2005 15:54:35 -0300 (ADT) Received: (qmail 56686 invoked by uid 60001); 24 Jun 2005 18:54:31 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=vMLb9cWe5hMOWO86TFqHx666emrAhaSb8Om5lKND9FSI2B5m6XSWz52Htxr3/Wyt0cMAbe05xQlL74ns97UeWpn4D4c4WgaR7dJpsmAxG9jc+08nfh5i1BwyFRq+h2BfJbfXcqGzobONLWoIkGLR/5qJJW00l443Bq+iCeNwvAY= ; Message-ID: <20050624185431.56684.qmail@web32807.mail.mud.yahoo.com> Received: from [69.226.167.220] by web32807.mail.mud.yahoo.com via HTTP; Fri, 24 Jun 2005 11:54:31 PDT Date: Fri, 24 Jun 2005 11:54:31 -0700 (PDT) From: Puddle Subject: max_connections / shared_buffers / effective_cache_size questions To: pgsql-performance@postgresql.org 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=2.548 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, FORGED_YAHOO_RCVD X-Spam-Level: ** X-Archive-Number: 200506/473 X-Sequence-Number: 13110 Hello, I'm a Sun Solaris sys admin for a start-up company. I've got the UNIX background, but now I'm having to learn PostgreSQL to support it on our servers :) Server Background: Solaris 10 x86 PostgreSQL 8.0.3 Dell PowerEdge 2650 w/4gb ram. This is running JBoss/Apache as well (I KNOW the bad juju of running it all on one box, but it's all we have currently for this project). I'm dedicating 1gb for PostgreSQL alone. So, far I LOVE it compared to MySQL it's solid. The only things I'm kind of confused about (and I've been searching for answers on lot of good perf docs, but not too clear to me) are the following: 1.) shared_buffers I see lot of reference to making this the size of available ram (for the DB). However, I also read to make it the size of pgdata directory. I notice when I load postgres each daemon is using the amount of shared memory (shared_buffers). Our current dataset (pgdata) is 85mb in size. So, I'm curious should this size reflect the pgdata or the 'actual' memory given? I currently have this at 128mb 2.) effective_cache_size - from what I read this is the 'total' allowed memory for postgresql to use correct? So, if I am willing to allow 1GB of memory should I make this 1GB? 3.) max_connections, been trying to figure 'how' to determine this #. I've read this is buffer_size+500k per a connection. ie. 128mb(buffer) + 500kb = 128.5mb per connection? I was curious about 'sort_mem' I can't find reference of it in the 8.0.3 documentation, has it been removed? work_mem and max_stack_depth set to 4096 maintenance_work_mem set to 64mb Thanks for any help on this. I'm sure bombardment of newbies gets old :) -William ____________________________________________________ Yahoo! Sports Rekindle the Rivalries. Sign up for Fantasy Football http://football.fantasysports.yahoo.com From pgsql-performance-owner@postgresql.org Fri Jun 24 15:55: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 D801752816 for ; Fri, 24 Jun 2005 15:55:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08961-06 for ; Fri, 24 Jun 2005 18:54:58 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by svr1.postgresql.org (Postfix) with ESMTP id 701C252932 for ; Fri, 24 Jun 2005 15:54:54 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 69so1089811wra for ; Fri, 24 Jun 2005 11:54:55 -0700 (PDT) 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:content-disposition:references; b=m8SNoth2egk4w3n2hdUrOOpJnsg64KyQYtHAlbTprRcSKJDyRsb9LVNSMa2FThtRQmBw15rgCOSiJPd9CGeTU2BQUQvxvG3Feax9RBG74vBkSKRZC6F2GVKLucUedv2nX4Th7+F5WyDMcnbVOxismto5PRHct3/XJNysGNTqc0c= Received: by 10.54.101.10 with SMTP id y10mr2023274wrb; Fri, 24 Jun 2005 11:54:55 -0700 (PDT) Received: by 10.54.13.24 with HTTP; Fri, 24 Jun 2005 11:54:55 -0700 (PDT) Message-ID: <9e4684ce05062411545fdfe5fc@mail.gmail.com> Date: Fri, 24 Jun 2005 20:54:55 +0200 From: hubert depesz lubaczewski Reply-To: hubert depesz lubaczewski To: Yves Vindevogel Subject: Re: Speed with offset clause Cc: pgsql-performance@postgresql.org In-Reply-To: <1c365a8bdeb09957fadda7a6fdc8ff02@implements.be> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1c365a8bdeb09957fadda7a6fdc8ff02@implements.be> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/474 X-Sequence-Number: 13111 On 6/24/05, Yves Vindevogel wrote: > So, when I want the last page, which is: 600k / 25 =3D page 24000 - 1 =3D > 23999, I issue the offset of 23999 * 25 improving this is hard, but not impossible. if you have right index created, try to reverse the order and fetch first adverts, and then resort it (just the 25 adverts) in correct order. it will be faster. depesz From pgsql-performance-owner@postgresql.org Fri Jun 24 16:16: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 34F785295C for ; Fri, 24 Jun 2005 16:16:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12543-04 for ; Fri, 24 Jun 2005 19:16:21 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id D5F83528AD for ; Fri, 24 Jun 2005 16:16:19 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050624191616m9100ngbgpe>; Fri, 24 Jun 2005 19:16:16 +0000 Received: by juju.arbash-meinel.com (Postfix, from userid 505) id 82BE656083; Fri, 24 Jun 2005 14:16:14 -0500 (CDT) Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 53ED55607F; Fri, 24 Jun 2005 14:16:05 -0500 (CDT) Message-ID: <42BC5BF2.9070900@arbash-meinel.com> Date: Fri, 24 Jun 2005 14:16:02 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Puddle Cc: pgsql-performance@postgresql.org Subject: Re: max_connections / shared_buffers / effective_cache_size References: <20050624185431.56684.qmail@web32807.mail.mud.yahoo.com> In-Reply-To: <20050624185431.56684.qmail@web32807.mail.mud.yahoo.com> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigA3F4A593FC96FA2CA9644A44" 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: 200506/475 X-Sequence-Number: 13112 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA3F4A593FC96FA2CA9644A44 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Puddle wrote: >Hello, I'm a Sun Solaris sys admin for a start-up >company. I've got the UNIX background, but now I'm >having to learn PostgreSQL to support it on our >servers :) > >Server Background: > >Solaris 10 x86 >PostgreSQL 8.0.3 >Dell PowerEdge 2650 w/4gb ram. >This is running JBoss/Apache as well (I KNOW the bad >juju of running it all on one box, but it's all we >have currently for this project). I'm dedicating 1gb >for PostgreSQL alone. > >So, far I LOVE it compared to MySQL it's solid. > >The only things I'm kind of confused about (and I've >been searching for answers on lot of good perf docs, >but not too clear to me) are the following: > >1.) shared_buffers I see lot of reference to making >this the size of available ram (for the DB). However, >I also read to make it the size of pgdata directory. > >I notice when I load postgres each daemon is using the >amount of shared memory (shared_buffers). Our current >dataset (pgdata) is 85mb in size. So, I'm curious >should this size reflect the pgdata or the 'actual' >memory given? > >I currently have this at 128mb > > You generally want shared_buffers to be no more than 10% of available ram. Postgres expects the OS to do it's own caching. 128M/4G = 3% seems reasonable to me. I would certainly never set it to 100% of ram. >2.) effective_cache_size - from what I read this is >the 'total' allowed memory for postgresql to use >correct? So, if I am willing to allow 1GB of memory >should I make this 1GB? > > This is the effective amount of caching between the actual postgres buffers, and the OS buffers. If you are dedicating this machine to postgres, I would set it to something like 3.5G. If it is a mixed machine, then you have to think about it. This does not change how postgres uses RAM, it changes how postgres estimates whether an Index scan will be cheaper than a Sequential scan, based on the likelihood that the data you want will already be cached in Ram. If you dataset is only 85MB, and you don't think it will grow, you really don't have to worry about this much. You have a very small database. >3.) max_connections, been trying to figure 'how' to >determine this #. I've read this is buffer_size+500k >per a connection. > >ie. 128mb(buffer) + 500kb = 128.5mb per connection? > > Max connections is just how many concurrent connections you want to allow. If you can get away with lower, do so. Mostly this is to prevent connections * work_mem to get bigger than your real working memory and causing you to swap. >I was curious about 'sort_mem' I can't find reference >of it in the 8.0.3 documentation, has it been removed? > > sort_mem changed to work_mem in 8.0, same thing with vacuum_mem -> maintenance_work_mem. >work_mem and max_stack_depth set to 4096 >maintenance_work_mem set to 64mb > > Depends how much space you want to give per connection. 4M is pretty small for a machine with 4G of RAM, but if your DB is only 85M it might be plenty. work_mem is how much memory a sort/hash/etc will use before it spills to disk. So look at your queries. If you tend to sort most of your 85M db in a single query, you might want to make it a little bit more. But if all of your queries are very selective, 4M could be plenty. I would make maintenance_work_mem more like 512M. It is only used for CREATE INDEX, VACUUM, etc. Things that are not generally done by more than one process at a time. And it's nice for them to have plenty of room to run fast. >Thanks for any help on this. I'm sure bombardment of >newbies gets old :) > >-William > > Good luck, John =:-> --------------enigA3F4A593FC96FA2CA9644A44 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCvFv1JdeBCYSNAAMRAtqOAJ960C9x/0pvQ/BISZG54d2dOyuI9QCcCwWg Zl5o+mS6t7IBNVuCYSuUqbs= =RGGy -----END PGP SIGNATURE----- --------------enigA3F4A593FC96FA2CA9644A44-- From pgsql-performance-owner@postgresql.org Fri Jun 24 16:22: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 D4D5852885 for ; Fri, 24 Jun 2005 16:22:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14791-02 for ; Fri, 24 Jun 2005 19:22:23 +0000 (GMT) Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) by svr1.postgresql.org (Postfix) with ESMTP id 2FC9752862 for ; Fri, 24 Jun 2005 16:22:21 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP id <20050624192216m92008hd3se>; Fri, 24 Jun 2005 19:22:19 +0000 Received: by juju.arbash-meinel.com (Postfix, from userid 505) id EE5A256083; Fri, 24 Jun 2005 14:22:14 -0500 (CDT) Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id D47D25607F; Fri, 24 Jun 2005 14:22:06 -0500 (CDT) Message-ID: <42BC5D5F.9000609@arbash-meinel.com> Date: Fri, 24 Jun 2005 14:22:07 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yves Vindevogel , pgsql-performance@postgresql.org Subject: Re: Speed with offset clause References: <1c365a8bdeb09957fadda7a6fdc8ff02@implements.be> In-Reply-To: <1c365a8bdeb09957fadda7a6fdc8ff02@implements.be> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigBF8C1D6E9A2CE84996D266BB" 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: 200506/476 X-Sequence-Number: 13113 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBF8C1D6E9A2CE84996D266BB Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Yves Vindevogel wrote: > Hi again all, > > My queries are now optimised. They all use the indexes like they should= =2E > However, there's still a slight problem when I issue the "offset" claus= e. > > We have a table that contains 600.000 records > We display them by 25 in the webpage. > So, when I want the last page, which is: 600k / 25 =3D page 24000 - 1 =3D= =20 > 23999, I issue the offset of 23999 * 25 > This take a long time to run, about 5-10 seconds whereas offset below=20 > 100 take less than a second. > > Can I speed this up ? > > > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > *Yves Vindevogel* > *Implements* > Postgres has the optimization that it will plan a query, and once it=20 reaches the limit, it can stop even though there is more data available. The problem you are having is that it has to go through "offset" rows=20 first, before it can apply the limit. If you can, (as mentioned in the other post), try to refine your index=20 so that you can reverse it for the second half of the data. This is probably tricky, as you may not know how many rows you have (or=20 the amount might be changing). A potentially better thing, is if you have an index you are using, you=20 could use a subselect so that the only portion that needs to have 60k=20 rows is a single column. Maybe an example: Instead of saying: SELECT * FROM table1, table2 WHERE table1.id =3D table2.id ORDER BY=20 table1.date OFFSET x LIMIT 25; You could do: SELECT * FROM (SELECT id FROM table1 OFFSET x LIMIT 25) as subselect JOIN table1 ON subselect.id =3D table1.id , table2 WHERE table1.id =3D table2.id; That means that the culling process is done on only a few rows of one=20 table, and the rest of the real merging work is done on only a few rows. It really depends on you query, though, as what rows you are sorting on=20 has a big influence on how well this will work. John =3D:-> --------------enigBF8C1D6E9A2CE84996D266BB 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCvF1fJdeBCYSNAAMRAg92AKCHqaqj/Ky96WI6VRekeeyZxnsS/QCgws5R srECUpUSdVdVg2rfwU425rA= =yAlJ -----END PGP SIGNATURE----- --------------enigBF8C1D6E9A2CE84996D266BB-- From pgsql-performance-owner@postgresql.org Fri Jun 24 16: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 AF48B5294F for ; Fri, 24 Jun 2005 16:26:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15623-03 for ; Fri, 24 Jun 2005 19:26:46 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id CC03C52885 for ; Fri, 24 Jun 2005 16:26:44 -0300 (ADT) Received: from 209-161-193-22.dsl.look.ca (209-161-193-22.dsl.look.ca [209.161.193.22]) by tht.net (Postfix) with ESMTP id A057176BFC; Fri, 24 Jun 2005 15:26:45 -0400 (EDT) Subject: Re: max_connections / shared_buffers / From: Rod Taylor To: Puddle Cc: pgsql-performance@postgresql.org In-Reply-To: <20050624185431.56684.qmail@web32807.mail.mud.yahoo.com> References: <20050624185431.56684.qmail@web32807.mail.mud.yahoo.com> Content-Type: text/plain Date: Fri, 24 Jun 2005 15:24:05 -0400 Message-Id: <1119641045.45024.73.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.2.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: 200506/477 X-Sequence-Number: 13114 > 1.) shared_buffers I see lot of reference to making > this the size of available ram (for the DB). However, > I also read to make it the size of pgdata directory. > 2.) effective_cache_size - from what I read this is > the 'total' allowed memory for postgresql to use > correct? So, if I am willing to allow 1GB of memory > should I make this 1GB? shared_buffers in your case should be about 10000. It is not taken on a per connection basis, but is global for that cluster. Perhaps your memory analysis tool is fooling with you? effective_cache_size is what you want to set to the amount of ram that you expect the kernel to use for caching the database information in memory. PostgreSQL will not allocate this memory, but it will make adjustments to the query execution methods (plan) chosen. > 3.) max_connections, been trying to figure 'how' to > determine this #. I've read this is buffer_size+500k > per a connection. > ie. 128mb(buffer) + 500kb = 128.5mb per connection? Max connections is the number of connections to the database you intend to allow. Shared_buffers must be of a certain minimum size to have that number of connections, but the 10k number above should cover any reasonable configurations. > work_mem and max_stack_depth set to 4096 > maintenance_work_mem set to 64mb Sort_mem and vacuum_mem became work_mem and maintenance_work_mem as those terms better indicate what they really do. > Thanks for any help on this. I'm sure bombardment of > newbies gets old :) That's alright. We only request that once you have things figured out that you, at your leisure, help out a few others. -- From pgsql-performance-owner@postgresql.org Fri Jun 24 16:50: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 0EF5B5295D for ; Fri, 24 Jun 2005 16:50:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19014-06 for ; Fri, 24 Jun 2005 19:50:46 +0000 (GMT) Received: from EXCHANGE.sf.nimblefish.com (unknown [66.54.159.162]) by svr1.postgresql.org (Postfix) with ESMTP id 09F1C52970 for ; Fri, 24 Jun 2005 16:50:45 -0300 (ADT) 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: Performance - moving from oracle to postgresql Date: Fri, 24 Jun 2005 12:49:51 -0700 Message-ID: <2F9239F5E316C54688FDA9814FF045D6AB0024@EXCHANGE.sf.nimblefish.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Performance - moving from oracle to postgresql Thread-Index: AcV49c3Xilw2ZiCSQY2xyv2MtwuWww== From: "Greg Maples" To: 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: 200506/478 X-Sequence-Number: 13115 Hi: I'm beginning the push at our company to look at running=20 postgreSQL in production here. We have a dual CPU 2.8 GHZ Xeon=20 Box running oracle. Typical CPU load runs between 20% and 90%. Raw DB size is about 200GB. We hit the disk at roughly 15MB/s read volume and 3MB/s write. At any given time we have from 2 to 70 sessions running on the instance. Sessions often persist for 24 hours or more. Total Free Free Mb Mb % =09 IDXS_EXT10 2000 290 14.5 =09 DATA_EXT100 10000 3200 32 =09 SYSTEM 220 95.2 43.3 IDXS_EXT100 20000 9600 48 DATA_EXT10 6000 2990 49.8 UNDOB 4000 2561.1 64 TEMP 8000 5802.9 72.5=09 DATA_LOB_EXT20 2000 1560 78 IDXS_EXT1 500 401 80.2 DATA_EXT1 4000 3758 94 Total Instance 56720 30258.2 53.3 =20 There are some immediate questions from our engineers about performance "- Oracle has one particular performance enhancement that Postgres is missing. If you do a select that returns 100,000 rows in a given order, and all you want are rows 99101 to 99200, then Oracle can do that very efficiently. With Postgres, it has to read the first 99200 rows and then discard the first 99100. But... If we really want to look at performance, then we ought to put together a set of benchmarks of some typical tasks." Is this accurate: accoring to http://www.postgresql.org/docs/8.0/interactive/queries-limit.html -- " The rows skipped by an OFFSET clause still have to be computed=20 inside the server; therefore a large OFFSET can be inefficient." What are the key performance areas I should be looking at? Where is psql not appropriate to replace Oracle? Thanks in advance, apologies if this occurs as spam, please send Replies to me off-list. =20 From pgsql-performance-owner@postgresql.org Fri Jun 24 16:58: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 0A0415285B for ; Fri, 24 Jun 2005 16:56:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18488-06 for ; Fri, 24 Jun 2005 19:56:37 +0000 (GMT) Received: from web32812.mail.mud.yahoo.com (web32812.mail.mud.yahoo.com [68.142.206.42]) by svr1.postgresql.org (Postfix) with SMTP id 29C575280D for ; Fri, 24 Jun 2005 16:56:34 -0300 (ADT) Received: (qmail 74869 invoked by uid 60001); 24 Jun 2005 19:56:35 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=6eUli/oJYH0GsmBlPgjnZVqMGukwNi55B1pgVMtErRkEaRxeG5ydJisUK1mHv5MQnSuhTM4/fXn+80vFdrH5AXNnLaSU1E4EjEn3HEpsmQluoHszEPJTj+EJC8tW2wSkM1ISpwd+ZEdJRpl5lVIfSgmhaPG1vztCzs7J1kP/llI= ; Message-ID: <20050624195635.74867.qmail@web32812.mail.mud.yahoo.com> Received: from [69.226.167.220] by web32812.mail.mud.yahoo.com via HTTP; Fri, 24 Jun 2005 12:56:35 PDT Date: Fri, 24 Jun 2005 12:56:35 -0700 (PDT) From: Puddle Subject: Re: max_connections / shared_buffers / effective_cache_size questions To: pgsql-performance@postgresql.org In-Reply-To: <42BC5BF2.9070900@arbash-meinel.com> 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=2.454 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_YAHOO_RCVD X-Spam-Level: ** X-Archive-Number: 200506/479 X-Sequence-Number: 13116 Thanks for the feedback guys. The database will grow in size. This first client years worth of data was 85mb (test to proof of concept). The 05 datasets I expect to be much larger. I think I may increase the work_mem and maintenance_work_mem a bit more as suggested to. I'm a bit still confused with max_connections. I've been keeping the max_connections to the # of Apache connections. Since, this is all currently one one box and it's a web-based application. I wanted to make sure it stuck with the same # of connections. However, is there a formula or way to determine if a current setup with memory etc to allow such connections? Exactly how is max_connections determined or is a guess? Again thanks for your help and Mr. Taylors. Look forward to providing help when I got more a grasp on things to !:) -William --- John A Meinel wrote: > Puddle wrote: > > >Hello, I'm a Sun Solaris sys admin for a start-up > >company. I've got the UNIX background, but now I'm > >having to learn PostgreSQL to support it on our > >servers :) > > > >Server Background: > > > >Solaris 10 x86 > >PostgreSQL 8.0.3 > >Dell PowerEdge 2650 w/4gb ram. > >This is running JBoss/Apache as well (I KNOW the > bad > >juju of running it all on one box, but it's all we > >have currently for this project). I'm dedicating > 1gb > >for PostgreSQL alone. > > > >So, far I LOVE it compared to MySQL it's solid. > > > >The only things I'm kind of confused about (and > I've > >been searching for answers on lot of good perf > docs, > >but not too clear to me) are the following: > > > >1.) shared_buffers I see lot of reference to making > >this the size of available ram (for the DB). > However, > >I also read to make it the size of pgdata > directory. > > > >I notice when I load postgres each daemon is using > the > >amount of shared memory (shared_buffers). Our > current > >dataset (pgdata) is 85mb in size. So, I'm curious > >should this size reflect the pgdata or the 'actual' > >memory given? > > > >I currently have this at 128mb > > > > > You generally want shared_buffers to be no more than > 10% of available > ram. Postgres expects the OS to do it's own caching. > 128M/4G = 3% seems > reasonable to me. I would certainly never set it to > 100% of ram. > > >2.) effective_cache_size - from what I read this is > >the 'total' allowed memory for postgresql to use > >correct? So, if I am willing to allow 1GB of memory > >should I make this 1GB? > > > > > This is the effective amount of caching between the > actual postgres > buffers, and the OS buffers. If you are dedicating > this machine to > postgres, I would set it to something like 3.5G. If > it is a mixed > machine, then you have to think about it. > > This does not change how postgres uses RAM, it > changes how postgres > estimates whether an Index scan will be cheaper than > a Sequential scan, > based on the likelihood that the data you want will > already be cached in > Ram. > > If you dataset is only 85MB, and you don't think it > will grow, you > really don't have to worry about this much. You have > a very small database. > > >3.) max_connections, been trying to figure 'how' to > >determine this #. I've read this is > buffer_size+500k > >per a connection. > > > >ie. 128mb(buffer) + 500kb = 128.5mb per > connection? > > > > > Max connections is just how many concurrent > connections you want to > allow. If you can get away with lower, do so. > Mostly this is to prevent > connections * work_mem to get bigger than your real > working memory and > causing you to swap. > > >I was curious about 'sort_mem' I can't find > reference > >of it in the 8.0.3 documentation, has it been > removed? > > > > > sort_mem changed to work_mem in 8.0, same thing with > vacuum_mem -> > maintenance_work_mem. > > >work_mem and max_stack_depth set to 4096 > >maintenance_work_mem set to 64mb > > > > > Depends how much space you want to give per > connection. 4M is pretty > small for a machine with 4G of RAM, but if your DB > is only 85M it might > be plenty. > work_mem is how much memory a sort/hash/etc will use > before it spills to > disk. So look at your queries. If you tend to sort > most of your 85M db > in a single query, you might want to make it a > little bit more. But if > all of your queries are very selective, 4M could be > plenty. > > I would make maintenance_work_mem more like 512M. It > is only used for > CREATE INDEX, VACUUM, etc. Things that are not > generally done by more > than one process at a time. And it's nice for them > to have plenty of > room to run fast. > > >Thanks for any help on this. I'm sure bombardment > of > >newbies gets old :) > > > >-William > > > > > Good luck, > John > =:-> > > ____________________________________________________ Yahoo! Sports Rekindle the Rivalries. Sign up for Fantasy Football http://football.fantasysports.yahoo.com From pgsql-performance-owner@postgresql.org Fri Jun 24 17:19: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 483835295C for ; Fri, 24 Jun 2005 17:19:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25738-04 for ; Fri, 24 Jun 2005 20:19:26 +0000 (GMT) Received: from poros.telenet-ops.be (poros.telenet-ops.be [195.130.132.44]) by svr1.postgresql.org (Postfix) with ESMTP id 98CE5528B7 for ; Fri, 24 Jun 2005 17:19:22 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by poros.telenet-ops.be (Postfix) with SMTP id 28B0C3BC098 for ; Fri, 24 Jun 2005 22:19:21 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by poros.telenet-ops.be (Postfix) with ESMTP id 2E5D73BC021 for ; Fri, 24 Jun 2005 22:19:20 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) To: pgsql-performance@postgresql.org Message-Id: <2efd5ae220a4d27b141196b0e7c752e1@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-87--396754584 From: Yves Vindevogel Subject: Fwd: Speed with offset clause Date: Fri, 24 Jun 2005 22:19:26 +0200 X-Mailer: Apple Mail (2.622) 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: 200506/480 X-Sequence-Number: 13117 --Apple-Mail-87--396754584 Content-Type: multipart/alternative; boundary=Apple-Mail-88--396754584 --Apple-Mail-88--396754584 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Hmm, I can't do this, i'm afraid. Or it would be rather difficult > > My query is executed through a webpage (link to the page in a=20 > navigation bar) > I do not know how many records there are (data is changing, and=20 > currently is 600k records) > > The only thing I could do, is doing this in a function where I first=20= > get the page, and then decide whether to use the normal sort order or=20= > the reversed order > That would put my weak point right in the middle, which is not that=20 > bad, but I would like to find an easier way, if that is possible > > Huge memory would help ? > > On 24 Jun 2005, at 20:54, hubert depesz lubaczewski wrote: > >> On 6/24/05, Yves Vindevogel wrote: >>> So, when I want the last page, which is: 600k / 25 =3D page 24000 - = 1 =3D >>> 23999, I issue the offset of 23999 * 25 >> >> improving this is hard, but not impossible. >> if you have right index created, try to reverse the order and fetch >> first adverts, and then resort it (just the 25 adverts) in correct >> order. >> it will be faster. >> >> depesz >> >> > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > Yves Vindevogel > Implements > --Apple-Mail-88--396754584 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Hmm, I can't do this, i'm afraid. Or it would be rather difficult My query is executed through a webpage (link to the page in a navigation bar) I do not know how many records there are (data is changing, and currently is 600k records) The only thing I could do, is doing this in a function where I first get the page, and then decide whether to use the normal sort order or the reversed order That would put my weak point right in the middle, which is not that bad, but I would like to find an easier way, if that is possible Huge memory would help ? On 24 Jun 2005, at 20:54, hubert depesz lubaczewski wrote: On 6/24/05, Yves Vindevogel < wrote: So, when I want the last page, which is: 600k / 25 =3D page 24000 - 1 =3D 23999, I issue the offset of 23999 * 25 improving this is hard, but not impossible. if you have right index created, try to reverse the order and fetch first adverts, and then resort it (just the 25 adverts) in correct order. it will be faster. depesz Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-88--396754584-- --Apple-Mail-87--396754584 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8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K/IAAACcQAAr8gAAAJxA= --Apple-Mail-87--396754584 Content-Type: multipart/alternative; boundary=Apple-Mail-89--396754582 --Apple-Mail-89--396754582 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. =20= > Then you win. > Mahatma Ghandi. > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-89--396754582 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma Ghandi. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-89--396754582-- --Apple-Mail-87--396754584 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0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kH+CwCXIsIOCiCJb2CQB0D+H+FEE0LoEYEGTOCgCGEKH/2uMrGfI8GEF7RyIWHwOoH+CEBptU EaEITOFCEyLOF0FoJr16aUDpb9fbH+GAF0RSz2KgCABjdACSB4ED3V3YH+C8CjbCFAEwLP006EG8 G2X35LbnK6B/5iH+GcGSs8FoFehCC0CYEavXAT5WRSDyDdxACKBtvwFwFkJqHEHAUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-87--396754584 Content-Type: multipart/alternative; boundary=Apple-Mail-90--396754580 --Apple-Mail-90--396754580 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-90--396754580 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-90--396754580-- --Apple-Mail-87--396754584-- From pgsql-performance-owner@postgresql.org Fri Jun 24 17:24: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 A788B5295D for ; Fri, 24 Jun 2005 17:23:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26682-02 for ; Fri, 24 Jun 2005 20:23:37 +0000 (GMT) Received: from poros.telenet-ops.be (poros.telenet-ops.be [195.130.132.44]) by svr1.postgresql.org (Postfix) with ESMTP id ECE4C52913 for ; Fri, 24 Jun 2005 17:23:36 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by poros.telenet-ops.be (Postfix) with SMTP id 8CB2C3BC068 for ; Fri, 24 Jun 2005 22:23:38 +0200 (MEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by poros.telenet-ops.be (Postfix) with ESMTP id C1A793BC0F4 for ; Fri, 24 Jun 2005 22:23:37 +0200 (MEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <42BC5D5F.9000609@arbash-meinel.com> References: <1c365a8bdeb09957fadda7a6fdc8ff02@implements.be> <42BC5D5F.9000609@arbash-meinel.com> Content-Type: multipart/mixed; boundary=Apple-Mail-92--396496862 Message-Id: From: Yves Vindevogel Subject: Re: Speed with offset clause Date: Fri, 24 Jun 2005 22:23:43 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/481 X-Sequence-Number: 13118 --Apple-Mail-92--396496862 Content-Type: multipart/alternative; boundary=Apple-Mail-93--396496862 --Apple-Mail-93--396496862 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi, Indeed, I would have to do it through a function, where I check the=20 number of pages, .... It puts my weakest point in the middle then. I could simply rewrite my query like you state, just to check. I think all my queries are on one table only. (I report in a website=20 on one table, that has been denormalized into other smaller tables for=20= speed) But the problem is on the big table. I'm currently looking at another possibility, and that is generating=20 XML files based upon my database. This would increase disk space=20 enormously, but limit my problems with the database. Since I am using Cocoon for the website, this is not such a problematic=20= decision, disks are cheap and I need only a few modifications to my=20 code. On 24 Jun 2005, at 21:22, John A Meinel wrote: > Yves Vindevogel wrote: > >> Hi again all, >> >> My queries are now optimised. They all use the indexes like they=20 >> should. >> However, there's still a slight problem when I issue the "offset"=20 >> clause. >> >> We have a table that contains 600.000 records >> We display them by 25 in the webpage. >> So, when I want the last page, which is: 600k / 25 =3D page 24000 - 1 = =3D=20 >> 23999, I issue the offset of 23999 * 25 >> This take a long time to run, about 5-10 seconds whereas offset below=20= >> 100 take less than a second. >> >> Can I speed this up ? >> >> >> Met vriendelijke groeten, >> Bien =E0 vous, >> Kind regards, >> >> *Yves Vindevogel* >> *Implements* >> > Postgres has the optimization that it will plan a query, and once it=20= > reaches the limit, it can stop even though there is more data=20 > available. > The problem you are having is that it has to go through "offset" rows=20= > first, before it can apply the limit. > If you can, (as mentioned in the other post), try to refine your index=20= > so that you can reverse it for the second half of the data. > > This is probably tricky, as you may not know how many rows you have=20 > (or the amount might be changing). > > A potentially better thing, is if you have an index you are using, you=20= > could use a subselect so that the only portion that needs to have 60k=20= > rows is a single column. > > Maybe an example: > Instead of saying: > > SELECT * FROM table1, table2 WHERE table1.id =3D table2.id ORDER BY=20 > table1.date OFFSET x LIMIT 25; > > You could do: > > SELECT * FROM > (SELECT id FROM table1 OFFSET x LIMIT 25) as subselect > JOIN table1 ON subselect.id =3D table1.id > , table2 > WHERE table1.id =3D table2.id; > > That means that the culling process is done on only a few rows of one=20= > table, and the rest of the real merging work is done on only a few=20 > rows. > > It really depends on you query, though, as what rows you are sorting=20= > on has a big influence on how well this will work. > > John > =3D:-> > > > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-93--396496862 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 Hi,=20 Indeed, I would have to do it through a function, where I check the number of pages, .... It puts my weakest point in the middle then. I could simply rewrite my query like you state, just to check. I think all my queries are on one table only. (I report in a website on one table, that has been denormalized into other smaller tables for speed) But the problem is on the big table. I'm currently looking at another possibility, and that is generating XML files based upon my database. This would increase disk space enormously, but limit my problems with the database. Since I am using Cocoon for the website, this is not such a problematic decision, disks are cheap and I need only a few modifications to my code. On 24 Jun 2005, at 21:22, John A Meinel wrote: Yves Vindevogel wrote: Hi again all, My queries are now optimised. They all use the indexes like they should. However, there's still a slight problem when I issue the "offset" clause. We have a table that contains 600.000 records We display them by 25 in the webpage. So, when I want the last page, which is: 600k / 25 =3D page 24000 - 1 =3D 23999, I issue the offset of 23999 * 25 This take a long time to run, about 5-10 seconds whereas offset below 100 take less than a second. Can I speed this up ? Met vriendelijke groeten, Bien =E0 vous, Kind regards, *Yves Vindevogel* *Implements* Postgres has the optimization that it will plan a query, and once it reaches the limit, it can stop even though there is more data available. The problem you are having is that it has to go through "offset" rows first, before it can apply the limit. If you can, (as mentioned in the other post), try to refine your index so that you can reverse it for the second half of the data. This is probably tricky, as you may not know how many rows you have (or the amount might be changing). A potentially better thing, is if you have an index you are using, you could use a subselect so that the only portion that needs to have 60k rows is a single column. Maybe an example: Instead of saying: SELECT * FROM table1, table2 WHERE table1.id =3D table2.id ORDER BY table1.date OFFSET x LIMIT 25; You could do: SELECT * FROM (SELECT id FROM table1 OFFSET x LIMIT 25) as subselect JOIN table1 ON subselect.id =3D table1.id , table2 WHERE table1.id =3D table2.id; That means that the culling process is done on only a few rows of one table, and the rest of the real merging work is done on only a few rows. It really depends on you query, though, as what rows you are sorting on has a big influence on how well this will work. John =3D:-> Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-93--396496862-- --Apple-Mail-92--396496862 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWs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AUVxeLACSB3HZ 2GNKEyEgP6EsEaNEKQCn3MH+DuDZEgIOEUEAZMDuDbxB7jFL5zbCDQC2Et2cC/zwIP8AH+BoBKDf 1iCxEEC4CfFgEqEYNFCeU4BWA2DSXIGgXGIWu+XmCQB35r2R0EEgEOQyIWEOD88GECDvVmCyCZIs DACpGaE0EkN+DP8GIQEGDyFUH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-92--396496862 Content-Type: multipart/alternative; boundary=Apple-Mail-94--396496860 --Apple-Mail-94--396496860 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-94--396496860 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-94--396496860-- --Apple-Mail-92--396496862-- From pgsql-performance-owner@postgresql.org Fri Jun 24 17:34: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 D1AAA528AD for ; Fri, 24 Jun 2005 17:34:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26815-05 for ; Fri, 24 Jun 2005 20:34:48 +0000 (GMT) Received: from apate.telenet-ops.be (apate.telenet-ops.be [195.130.132.57]) by svr1.postgresql.org (Postfix) with ESMTP id 5388E5285B for ; Fri, 24 Jun 2005 17:34:46 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by apate.telenet-ops.be (Postfix) with SMTP id 9BD0338119 for ; Fri, 24 Jun 2005 22:34:47 +0200 (CEST) Received: from [10.0.1.11] (d5152B1F3.access.telenet.be [81.82.177.243]) by apate.telenet-ops.be (Postfix) with ESMTP id DF3993802C for ; Fri, 24 Jun 2005 22:34:46 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v622) In-Reply-To: <2efd5ae220a4d27b141196b0e7c752e1@implements.be> References: <2efd5ae220a4d27b141196b0e7c752e1@implements.be> Content-Type: multipart/mixed; boundary=Apple-Mail-102--395828184 Message-Id: <9be37ba2f850707ad5db17162c56cd64@implements.be> From: Yves Vindevogel Subject: Re: Speed with offset clause Date: Fri, 24 Jun 2005 22:34:52 +0200 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.622) 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: 200506/482 X-Sequence-Number: 13119 --Apple-Mail-102--395828184 Content-Type: multipart/alternative; boundary=Apple-Mail-103--395828184 --Apple-Mail-103--395828184 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed I just ran this query select p.* from tblPrintjobs p , (select oid from tblPrintjobs limit 25=20= offset 622825) as subset where p.oid =3D subset.oid And it seems to be a bit faster than without the subselect, probably=20 because I'm only getting one column. The speed gain is not that high though On 24 Jun 2005, at 22:19, Yves Vindevogel wrote: >> >> Hmm, I can't do this, i'm afraid. Or it would be rather difficult >> >> My query is executed through a webpage (link to the page in a=20 >> navigation bar) >> I do not know how many records there are (data is changing, and=20 >> currently is 600k records) >> >> The only thing I could do, is doing this in a function where I first=20= >> get the page, and then decide whether to use the normal sort order or=20= >> the reversed order >> That would put my weak point right in the middle, which is not that=20= >> bad, but I would like to find an easier way, if that is possible >> >> Huge memory would help ? >> >> On 24 Jun 2005, at 20:54, hubert depesz lubaczewski wrote: >> >>> On 6/24/05, Yves Vindevogel wrote: >>>> So, when I want the last page, which is: 600k / 25 =3D page 24000 - = 1=20 >>>> =3D >>>> 23999, I issue the offset of 23999 * 25 >>> >>> improving this is hard, but not impossible. >>> if you have right index created, try to reverse the order and fetch >>> first adverts, and then resort it (just the 25 adverts) in correct >>> order. >>> it will be faster. >>> >>> depesz >>> >>> >> Met vriendelijke groeten, >> Bien =E0 vous, >> Kind regards, >> >> Yves Vindevogel >> Implements >> > >> >> Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 >> >> Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 >> >> Web: http://www.implements.be >> >> First they ignore you. Then they laugh at you. Then they fight you.=20= >> Then you win. >> Mahatma Ghandi. >> >> > Met vriendelijke groeten, > Bien =E0 vous, > Kind regards, > > Yves Vindevogel > Implements > > > > Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 > > Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 > > Web: http://www.implements.be > > First they ignore you. Then they laugh at you. Then they fight you. =20= > Then you win. > Mahatma Ghandi. > > ---------------------------(end of=20 > broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to=20 > majordomo@postgresql.org > Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements --Apple-Mail-103--395828184 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 I just ran this query select p.* from tblPrintjobs p , (select oid from tblPrintjobs limit 25 offset 622825) as subset where p.oid =3D subset.oid And it seems to be a bit faster than without the subselect, probably because I'm only getting one column. The speed gain is not that high though On 24 Jun 2005, at 22:19, Yves Vindevogel wrote: Hmm, I can't do this, i'm afraid. Or it would be rather difficult My query is executed through a webpage (link to the page in a navigation bar) I do not know how many records there are (data is changing, and currently is 600k records) The only thing I could do, is doing this in a function where I first get the page, and then decide whether to use the normal sort order or the reversed order That would put my weak point right in the middle, which is not that bad, but I would like to find an easier way, if that is possible Huge memory would help ? On 24 Jun 2005, at 20:54, hubert depesz lubaczewski wrote: On 6/24/05, Yves Vindevogel < wrote: So, when I want the last page, which is: 600k / 25 =3D page 24000 - 1 =3D 23999, I issue the offset of 23999 * 25 improving this is hard, but not impossible. if you have right index created, try to reverse the order and fetch first adverts, and then resort it (just the 25 adverts) in correct order. it will be faster. depesz Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements < Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma = Ghandi. Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements < Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you.=20 Then you win. Mahatma Ghandi. ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org Met vriendelijke groeten, Bien =E0 vous, Kind regards, Yves Vindevogel Implements = --Apple-Mail-103--395828184-- --Apple-Mail-102--395828184 Content-Transfer-Encoding: base64 Content-Type: image/tiff; x-unix-mode=0666; name="Pasted Graphic 2.tiff" Content-Disposition: inline; filename="Pasted Graphic 2.tiff" TU0AKgAAFciAP6BP5/wWDQeEQmFQuGQ2HQ+FP5+v9rOh5P9IMBuP8zK9tP8fJNlP8QoNjP8FndhP 8MnyVjJHSMrqFnv9BL1vP9ett2v98PuJxChUOiUWGQOCUalUujOV4PZ/qBluR/mdVtJ/jVHst/ho 9MF/g08WABHJfv8AWa0WoAHFfWuzgg6sB/hY9ysUohjv8qqVqv9LMZxv9ouV40zEYmHUjFY2HPx+ RNtOl4Rhftt/phiRs6LC/iA5LewnJeWg46W22+02cAHOwa26bC0HPY7TZ7G2G9dv8EHFdP8Om9YP 8rKJov9UtFzv9Dzh/sRvu5/vZ9PzHdeF4zsUqgQRlOR5v9DMBwv8uqe/jZIVwNHu6B0/WAKHvWGr RAA1ra0G1c/vfgANrdraXrTQIAA6JW2TUrQNz/ja0oAjO4YAjSWS0DOWawjys4RkIk4Lj2sAWEUZ B/ieUJqH+PZdnAf5aG06R5nsfLtqW7UaoWZJwukwLyi4VRsn+F5HGYf8QJWBQ7JWAI5tYti2Dm1T bQHAq0De1Q2FwtA1Fof4AjVDIBDQV0vDQWK0DY/oADYWsrNQN81NOuDZtYOM6ycs4Cjq+Q9JWE5D pGJpOpqP5dMwW5sHUf53xlHCExupjqoIbh3Hu55vp6ch3Hof4wlMrAdEWYh/gmP1RtXK0DDi2rXy nVzXjpVs8NM1g1vuNU2gANEugGMBRwu4YADTNsvwyAA3v+0k6LRWLb2dBUpjk2I4NVOx/gYPC6BU QiwCgSsS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UH/3LFL0Ue+HkHh18IMHPwoCqCRe54ILoCMBvEKC6Cl8CC18IIWFa FKL2DGCtEEIXE0MH2+H+EKD4fZ10fZ374Z7h7l7p7sIMEF9eRd6d1p1t4H4L/ohCDECsEkIQIAVC MiX+dTUoH++n0/X++4W/4hEHe7Xo/xQGTO/zQXEu/0Cd1S/0Yglg/3g73q/yWPUE/zsa1C/0IeVW /0GeFU/3G4Xa/0MfVY/1or2bQlbRUiiVpJpQ/y+U0jEYggzzOSkRUM/0KfJqfzop3+p1Aw3+53I7 n+UCJWak3m26H+OxYdX+Xiij6leVRY3+YKheaks1Yy3+VCPBEIe5zM5qOxbdICAADgEAAAMAAAAB ADgAAAEBAAMAAAABAEAAAAECAAMAAAAEAAAWdgEDAAMAAAABAAUAAAEGAAMAAAABAAIAAAERAAQA AAABAAAACAEVAAMAAAABAAQAAAEWAAQAAAABAAAAkgEXAAQAAAABAAAVwAEaAAUAAAABAAAWfgEb AAUAAAABAAAWhgEcAAMAAAABAAEAAAEoAAMAAAABAAIAAAFSAAMAAAABAAEAAAAAAAAACAAIAAgA CAAK/IAAACcQAAr8gAAAJxA= --Apple-Mail-102--395828184 Content-Type: multipart/alternative; boundary=Apple-Mail-104--395828182 --Apple-Mail-104--395828182 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-104--395828182 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII Mail: yves.vindevogel@implements.be - Mobile: +32 (478) 80 82 91 Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76 Web: http://www.implements.be First they ignore you. Then they laugh at you. Then they fight you. Then you win. Mahatma Ghandi. --Apple-Mail-104--395828182-- --Apple-Mail-102--395828184-- From pgsql-performance-owner@postgresql.org Fri Jun 24 18:18: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 F011A52885 for ; Fri, 24 Jun 2005 18:18:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36153-01 for ; Fri, 24 Jun 2005 21:18:26 +0000 (GMT) Received: from fed1rmmtao09.cox.net (fed1rmmtao09.cox.net [68.230.241.30]) by svr1.postgresql.org (Postfix) with ESMTP id D3AC35280D for ; Fri, 24 Jun 2005 18:18:24 -0300 (ADT) Received: from [192.168.2.107] (really [24.251.200.200]) by fed1rmmtao09.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050624211826.TOTJ7275.fed1rmmtao09.cox.net@[192.168.2.107]> for ; Fri, 24 Jun 2005 17:18:26 -0400 Mime-Version: 1.0 (Apple Message framework v730) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9766B55B-9CC2-4CD8-9AF0-6747FBDAD2B1@viatornetworks.com> Content-Transfer-Encoding: 7bit From: Todd Landfried Subject: Re: Needed: Simplified guide to optimal memory configuration Date: Fri, 24 Jun 2005 14:18:24 -0700 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.730) 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: 200506/483 X-Sequence-Number: 13120 For those who provided some guidance, I say "thank you." You comments helped out a lot. All of our customers who are using the older release are now very pleased with the performance of the database now that we were able to give them meaningful configuration settings. I'm also pleased to see that Frank WIles has taken upon himself the effort to write this guidance down for folks like me. Kudos to you all. Thanks again. Todd On Jun 15, 2005, at 2:06 AM, Todd Landfried wrote: > I deeply apologize if this has been covered with some similar topic > before, but I need a little guidance in the optimization > department. We use Postgres as our database and we're having some > issues dealing with customers who are, shall we say, "thrifty" when > it comes to buying RAM. > > We tell them to buy at least 1GB, but there's always the bargain > chaser who thinks 256MB of RAM "is more than enough. So here's what > I need--in layman's terms 'cause I'll need to forward this message > on to them to prove what I'm saying (don't ya love customers?). > > 1. Our database has a total of 35 tables and maybe 300 variables > 2. There are five primary tables and only two of these are written > to every minute, sometimes up to a menial 1500 transactions per > minute. > 3. Our customers usually buy RAM in 256MB, 512MB, 1GB or 2GB. We've > tried to come up with a optimization scheme based on what we've > been able to discern from lists like this, but we don't have a lot > of confidence. Using the default settings seems to work best with > 1GB, but we need help with the other RAM sizes. > > What's the problem? The sucker gets s-l-o-w on relatively simple > queries. For example, simply listing all of the users online at one > time takes 30-45 seconds if we're talking about 800 users. We've > adjusted the time period for vacuuming the tables to the point > where it occurs once an hour, but we're getting only a 25% > performance gain from that. We're looking at the system settings > now to see how those can be tweaked. > > So, what I need is to be pointed to (or told) what are the best > settings for our database given these memory configurations. What > should we do? > > Thanks > > Todd > > Don't know if this will help, but here's the result of show all: > > NOTICE: enable_seqscan is on > NOTICE: enable_indexscan is on > NOTICE: enable_tidscan is on > NOTICE: enable_sort is on > NOTICE: enable_nestloop is on > NOTICE: enable_mergejoin is on > NOTICE: enable_hashjoin is on > NOTICE: ksqo is off > NOTICE: geqo is on > NOTICE: tcpip_socket is on > NOTICE: ssl is off > NOTICE: fsync is on > NOTICE: silent_mode is off > NOTICE: log_connections is off > NOTICE: log_timestamp is off > NOTICE: log_pid is off > NOTICE: debug_print_query is off > NOTICE: debug_print_parse is off > NOTICE: debug_print_rewritten is off > NOTICE: debug_print_plan is off > NOTICE: debug_pretty_print is off > NOTICE: show_parser_stats is off > NOTICE: show_planner_stats is off > NOTICE: show_executor_stats is off > NOTICE: show_query_stats is off > NOTICE: stats_start_collector is on > NOTICE: stats_reset_on_server_start is on > NOTICE: stats_command_string is off > NOTICE: stats_row_level is off > NOTICE: stats_block_level is off > NOTICE: trace_notify is off > NOTICE: hostname_lookup is off > NOTICE: show_source_port is off > NOTICE: sql_inheritance is on > NOTICE: australian_timezones is off > NOTICE: fixbtree is on > NOTICE: password_encryption is off > NOTICE: transform_null_equals is off > NOTICE: geqo_threshold is 20 > NOTICE: geqo_pool_size is 0 > NOTICE: geqo_effort is 1 > NOTICE: geqo_generations is 0 > NOTICE: geqo_random_seed is -1 > NOTICE: deadlock_timeout is 1000 > NOTICE: syslog is 0 > NOTICE: max_connections is 64 > NOTICE: shared_buffers is 256 > NOTICE: port is 5432 > NOTICE: unix_socket_permissions is 511 > NOTICE: sort_mem is 2048 > NOTICE: vacuum_mem is 126622 > NOTICE: max_files_per_process is 1000 > NOTICE: debug_level is 0 > NOTICE: max_expr_depth is 10000 > NOTICE: max_fsm_relations is 500 > NOTICE: max_fsm_pages is 10000 > NOTICE: max_locks_per_transaction is 64 > NOTICE: authentication_timeout is 60 > NOTICE: pre_auth_delay is 0 > NOTICE: checkpoint_segments is 3 > NOTICE: checkpoint_timeout is 300 > NOTICE: wal_buffers is 8 > NOTICE: wal_files is 0 > NOTICE: wal_debug is 0 > NOTICE: commit_delay is 0 > NOTICE: commit_siblings is 5 > NOTICE: effective_cache_size is 79350 > NOTICE: random_page_cost is 2 > NOTICE: cpu_tuple_cost is 0.01 > NOTICE: cpu_index_tuple_cost is 0.001 > NOTICE: cpu_operator_cost is 0.0025 > NOTICE: geqo_selection_bias is 2 > NOTICE: default_transaction_isolation is read committed > NOTICE: dynamic_library_path is $libdir > NOTICE: krb_server_keyfile is FILE:/etc/pgsql/krb5.keytab > NOTICE: syslog_facility is LOCAL0 > NOTICE: syslog_ident is postgres > NOTICE: unix_socket_group is unset > NOTICE: unix_socket_directory is unset > NOTICE: virtual_host is unset > NOTICE: wal_sync_method is fdatasync > NOTICE: DateStyle is ISO with US (NonEuropean) conventions > NOTICE: Time zone is unset > NOTICE: TRANSACTION ISOLATION LEVEL is READ COMMITTED > NOTICE: Current client encoding is 'SQL_ASCII' > NOTICE: Current server encoding is 'SQL_ASCII' > NOTICE: Seed for random number generator is unavailable > > ---------------------------(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 Fri Jun 24 19:04: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 E50B552832 for ; Fri, 24 Jun 2005 19:04:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41031-09 for ; Fri, 24 Jun 2005 22:04:01 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6F66E5294F for ; Fri, 24 Jun 2005 19:03:56 -0300 (ADT) Received: from 209-161-193-22.dsl.look.ca (209-161-193-22.dsl.look.ca [209.161.193.22]) by tht.net (Postfix) with ESMTP id 0E45D76A15; Fri, 24 Jun 2005 18:03:33 -0400 (EDT) Subject: Re: Performance - moving from oracle to postgresql From: Rod Taylor To: Greg Maples Cc: pgsql-performance@postgresql.org In-Reply-To: <2F9239F5E316C54688FDA9814FF045D6AB0024@EXCHANGE.sf.nimblefish.com> References: <2F9239F5E316C54688FDA9814FF045D6AB0024@EXCHANGE.sf.nimblefish.com> Content-Type: text/plain Date: Fri, 24 Jun 2005 18:00:52 -0400 Message-Id: <1119650452.45024.90.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.2.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: 200506/485 X-Sequence-Number: 13122 > There are some immediate questions from our engineers about performance > > "- Oracle has one particular performance enhancement that Postgres is > missing. If you do a select that returns 100,000 rows in a given order, > and all you want are rows 99101 to 99200, then Oracle can do that very > efficiently. With Postgres, it has to read the first 99200 rows and > then discard the first 99100. But... If we really want to look at > performance, then we ought to put together a set of benchmarks of some > typical tasks." > > Is this accurate: > accoring to > http://www.postgresql.org/docs/8.0/interactive/queries-limit.html > -- " The rows skipped by an OFFSET clause still have to be computed > inside the server; therefore a large OFFSET can be inefficient." Yes. That's accurate. First you need to determine whether PostgreSQLs method is fast enough for that specific query, and if the performance gains for other queries (inserts, updates, delete) from reduced index management evens out your concern. All performance gains through design changes either increase complexity dramatically or have a performance trade-off elsewhere. I find it rather odd that anyone would issue a single one-off select for 0.1% of the data about 99.1% of the way through, without doing anything with the rest. Perhaps you want to take a look at using a CURSOR? > Where is psql not appropriate to replace Oracle? Anything involving reporting using complex aggregates or very long running selects which Oracle can divide amongst multiple CPUs. Well, PostgreSQL can do it if you give it enough time to run the query, but a CUBE in PostgreSQL on a TB sized table would likely take significantly longer to complete. It's mostly just that the Pg developers haven't implemented those features optimally, or at all, yet. -- From pgsql-performance-owner@postgresql.org Fri Jun 24 19:01: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 D419C52863 for ; Fri, 24 Jun 2005 19:01:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43781-02 for ; Fri, 24 Jun 2005 22:01:12 +0000 (GMT) Received: from mail.aveo.aveopharma.com (67.109.105.227.ptr.us.xo.net [67.109.105.227]) by svr1.postgresql.org (Postfix) with SMTP id 9CBC152896 for ; Fri, 24 Jun 2005 19:01:03 -0300 (ADT) 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: Performance Tuning Article Date: Fri, 24 Jun 2005 18:02:36 -0400 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Performance Tuning Article Thread-Index: AcV3OmFA0R6QobUsSVWCb6fOmdqnTwBy+UyA From: "Dmitri Bichko" To: "Frank Wiles" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/484 X-Sequence-Number: 13121 Hi, The article seems to dismiss RAID5 a little too quickly. For many application types, using fast striped mirrors for the index space and RAID5 for the data can offer quite good performance (provided a sufficient number of spindles for the RAID5 - 5 or 6 disks or more). In fact, random read (ie most webapps) performance of RAID5 isn't necessarily worse than that of RAID10, and can in fact be better in some circumstances. And, using the cheaper RAID5 might allow you to do that separation between index and data in the first place. Just thought I'd mention it, Dmitri -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Frank Wiles Sent: Wednesday, June 22, 2005 10:52 AM To: pgsql-performance@postgresql.org Subject: [PERFORM] Performance Tuning Article Hi Everyone,=20 I've put together a short article and posted it online regarding performance tuning PostgreSQL in general. I believe it helps to bring together the info in a easy to digest manner. I would appreciate any feedback, comments, and especially any technical corrections. =20 The article can be found here:=20 http://www.revsys.com/writings/postgresql-performance.html Thanks!=20 --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- ---------------------------(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 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 Jun 24 20: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 BDC1852932 for ; Fri, 24 Jun 2005 20:41:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 58000-03 for ; Fri, 24 Jun 2005 23:41:44 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [67.100.216.10]) by svr1.postgresql.org (Postfix) with ESMTP id 19EE152969 for ; Fri, 24 Jun 2005 20:41:41 -0300 (ADT) Received: by flake.decibel.org (Postfix, from userid 1001) id 0FDB615229; Fri, 24 Jun 2005 18:41:44 -0500 (CDT) Date: Fri, 24 Jun 2005 18:41:44 -0500 From: "Jim C. Nasby" To: Josh Berkus Cc: Bruno Wolff III , Kurt De Grave , pgsql-performance@postgresql.org Subject: Re: parameterized LIKE does not use index Message-ID: <20050624234144.GE89438@decibel.org> References: <42BA73CE.4030909@student.kuleuven.ac.be> <20050623141854.GA7505@wolff.to> <200506231155.36126.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200506231155.36126.josh@agliodbs.com> X-Operating-System: FreeBSD 4.11-RELEASE-p10 i386 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.9i 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: 200506/486 X-Sequence-Number: 13123 On Thu, Jun 23, 2005 at 11:55:35AM -0700, Josh Berkus wrote: > Bruno, > > > I remember some discussion about delaying planning until the first > > actual query so that planning could use actual parameters to do > > the planning. If you really want to have it check the parameters > > every time, I think you will need to replan every time. I don't > > know if there is a way to save some of the prepare working while > > doing this. > > That wouldn't help much in Kurt's case. Nor in most "real" cases, which is > why I think the idea never went anywhere. I suspect the only way to do this and have it work well would be to cache plans based on the relevant statistics of the parameters passed in. Basically, as part of parsing (which could always be cached, btw, so long as schema changes clear the cache), you store what fields in what tables/indexes each parameter corresponds to. When you go to execute you look up the stats relevant to each parameter; you can then cache plans according to the stats each parameter has. Of course caching all that is a non-trivial amount of work, so you'd only want to do it for pretty complex queries. -- 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 Jun 24 22: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 447895288B for ; Fri, 24 Jun 2005 22:09:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74220-03 for ; Sat, 25 Jun 2005 01:09:27 +0000 (GMT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id A5C94528C3 for ; Fri, 24 Jun 2005 22:09:25 -0300 (ADT) Received: (qmail 18310 invoked from network); 25 Jun 2005 01:09:29 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 25 Jun 2005 01:09:29 -0000 From: "Greg Sabino Mullane" To: pgsql-performance@postgresql.org Subject: Re: Configurator project launched X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <42B921BB.3000705@pse-consulting.de> Date: Sat, 25 Jun 2005 01:09:29 -0000 X-Mailer: JoyMail 1.48 Message-ID: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.118 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/487 X-Sequence-Number: 13124 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > Sounds a little similar to what's in pgAdmin CVS right now. The > configuration editor can retrieve the config file and display configured > and active setting concurrently, together with explanations taken from > pg_settings (when not run against a pgsql server but a file current > settings are missing, comments are taken from a pg_settings csv dump). > There's the infrastructure to give hints about all settings, with very > few currently implemented. > > I wonder if this could be combined with the configurator somehow. > Currently, integration won't work with Perl, so maybe C for the core and > Perl for the interactive part would be better. Probably so. Seems there is a bit of convergent evolution going on. When I get a moment of free time, I'll check out the pgAdmin code. Can someone shoot me a URL to the files in question? (assuming a web cvs interface). - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200506242107 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFCvK6AvJuQZxSWSsgRApFcAKDVQ5OdVgVc2PmY/p719teJ3BqNjQCgrgyx +w+w8GCGXUFO+5dxi5RPwKo= =eG7M -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Sat Jun 25 04:48: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 567AE5288D for ; Sat, 25 Jun 2005 04:48:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51445-02 for ; Sat, 25 Jun 2005 07:48:47 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by svr1.postgresql.org (Postfix) with ESMTP id 109B95284D for ; Sat, 25 Jun 2005 04:48:46 -0300 (ADT) Received: from p548F1A0E.dip0.t-ipconnect.de [84.143.26.14] (helo=pse.dyndns.org) by mrelayeu.kundenserver.de with ESMTP (Nemesis), id 0ML21M-1Dm5PB2uvd-0002x9; Sat, 25 Jun 2005 09:48:45 +0200 Received: from [195.20.225.146] (helo=[192.168.1.218]) by pse.dyndns.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.44) id 1Dm5PA-0003RP-75; Sat, 25 Jun 2005 09:48:44 +0200 Message-ID: <42BD0BCA.2090100@pse-consulting.de> Date: Sat, 25 Jun 2005 09:46:18 +0200 From: Andreas Pflug User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Greg Sabino Mullane Cc: pgsql-performance@postgresql.org Subject: Re: Configurator project launched References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:0ce7ee5c3478b8d72edd8e05ccd40b70 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.688 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL X-Spam-Level: * X-Archive-Number: 200506/488 X-Sequence-Number: 13125 Greg Sabino Mullane wrote: >>I wonder if this could be combined with the configurator somehow. >>Currently, integration won't work with Perl, so maybe C for the core and >>Perl for the interactive part would be better. >> >> > >Probably so. Seems there is a bit of convergent evolution going on. When I >get a moment of free time, I'll check out the pgAdmin code. Can someone >shoot me a URL to the files in question? (assuming a web cvs interface). > > > http://svn.pgadmin.org/cgi-bin/viewcvs.cgi/trunk/pgadmin3/src/frm/frmMainConfig.cpp?rev=4317&view=markup This is an editor only, an expert mode (e.g. recommendations for different sizes/loads) would be nice. Regards, Andreas From pgsql-performance-owner@postgresql.org Sat Jun 25 07:47: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 5F55B52822 for ; Sat, 25 Jun 2005 07:47:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82198-03 for ; Sat, 25 Jun 2005 10:47:18 +0000 (GMT) Received: from www.aldratech.com (www.aldratech.com [193.226.161.42]) by svr1.postgresql.org (Postfix) with ESMTP id E3E5852886 for ; Sat, 25 Jun 2005 07:47:17 -0300 (ADT) Received: by www.aldratech.com (Postfix, from userid 48) id 7E2ED123F08; Sat, 25 Jun 2005 13:45:27 +0300 (EEST) Received: from 193.138.218.24 (SquirrelMail authenticated user radu.popescu) by www.aldratech.com with HTTP; Sat, 25 Jun 2005 13:45:27 +0300 (EEST) Message-ID: <41821.193.138.218.24.1119696327.squirrel@www.aldratech.com> In-Reply-To: <2F9239F5E316C54688FDA9814FF045D6AB0024@EXCHANGE.sf.nimblefish.com> References: <2F9239F5E316C54688FDA9814FF045D6AB0024@EXCHANGE.sf.nimblefish.com> Date: Sat, 25 Jun 2005 13:45:27 +0300 (EEST) Subject: Re: Performance - moving from oracle to postgresql From: "Radu-Adrian Popescu" To: "Greg Maples" Cc: pgsql-performance@postgresql.org Reply-To: radu.popescu@aldratech.com User-Agent: SquirrelMail/1.4.4-1.FC3 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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: 200506/489 X-Sequence-Number: 13126 > "- Oracle has one particular performance enhancement that Postgres is > missing. If you do a select that returns 100,000 rows in a given order, > and all you want are rows 99101 to 99200, then Oracle can do that very > efficiently. With Postgres, it has to read the first 99200 rows and > then discard the first 99100. When I was reading up on resultset pagination on AskTom I got a clear impression that the same happens in Oracle as well. Resultset is like: 0....START...STOP...END 0............STOP START...END You first select all the rows from 0 to STOP and then from that select the rows from START to end (which is now STOP). This is done using ROWNUM twice and subselects. It was discussed over there that this obviously produces higher response times as you move towards the end of a very large resultset. Tom even pointed out the same effect when using google search, as you move forward through a very large (millions) search result. Regards, -- Radu-Adrian Popescu CSA, DBA, Developer Aldrapay MD Aldratech Ltd. +40213212243 From pgsql-performance-owner@postgresql.org Sat Jun 25 08:44: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 0846A5285B for ; Sat, 25 Jun 2005 08:44:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88844-08 for ; Sat, 25 Jun 2005 11:44:28 +0000 (GMT) Received: from www.aldratech.com (www.aldratech.com [193.226.161.42]) by svr1.postgresql.org (Postfix) with ESMTP id 937EC52835 for ; Sat, 25 Jun 2005 08:44:27 -0300 (ADT) Received: by www.aldratech.com (Postfix, from userid 48) id E16D0123F08; Sat, 25 Jun 2005 14:42:44 +0300 (EEST) Received: from 193.138.218.24 (SquirrelMail authenticated user radu.popescu) by www.aldratech.com with HTTP; Sat, 25 Jun 2005 14:42:44 +0300 (EEST) Message-ID: <47992.193.138.218.24.1119699764.squirrel@www.aldratech.com> In-Reply-To: <9be37ba2f850707ad5db17162c56cd64@implements.be> References: <2efd5ae220a4d27b141196b0e7c752e1@implements.be> <9be37ba2f850707ad5db17162c56cd64@implements.be> Date: Sat, 25 Jun 2005 14:42:44 +0300 (EEST) Subject: Re: Speed with offset clause From: "Radu-Adrian Popescu" To: "Yves Vindevogel" Cc: pgsql-performance@postgresql.org Reply-To: radu.popescu@aldratech.com User-Agent: SquirrelMail/1.4.4-1.FC3 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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: 200506/490 X-Sequence-Number: 13127 > I just ran this query > > select p.* from tblPrintjobs p , (select oid from tblPrintjobs limit 25 > offset 622825) as subset where p.oid = subset.oid > I'm just curious here, from a social point of view. How often do you think someone will paginate over say 300K rows in steps of 25 ? The way I see things, pagination is only meant for humans. If someone really looks at 300K rows then it's really cheaper and makes more sense to download them/import into spreadsheet program instead of clicking next 12.000 times. If it's not intended for humans then there's better ways of doing this. Regards, -- Radu-Adrian Popescu CSA, DBA, Developer Aldrapay MD Aldratech Ltd. +40213212243 From pgsql-patches-owner@postgresql.org Mon Jun 27 03:28:09 2005 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B5E07528CB for ; Mon, 27 Jun 2005 03:28:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29018-05 for ; Mon, 27 Jun 2005 06:27:57 +0000 (GMT) Received: from mail.Mi8.com (mail.mi8.com [63.240.6.44]) by svr1.postgresql.org (Postfix) with ESMTP id CFFBE52809 for ; Mon, 27 Jun 2005 03:27:54 -0300 (ADT) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW06 Welcome to Mi8 Corporation www.Mi8.com); Mon, 27 Jun 2005 02:27:48 -0400 X-Server-Uuid: 1ED1145E-230D-43E2-AB12-AD281CC67F76 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 27 Jun 2005 02:27:48 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: Re: COPY FROM performance improvements Date: Mon, 27 Jun 2005 02:23:05 -0400 Message-ID: <3E37B936B592014B978C4415F90D662D0C420B@MI8NYCMAIL06.Mi8.com> X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: [PATCHES] COPY FROM performance improvements Thread-Index: AcV61K2xWcjc56+oQtmb7LoEHOFQhgADABHV From: "Luke Lonergan" To: "Alvaro Herrera" Cc: "Bruce Momjian" , "Alon Goldshuv" , pgsql-patches@postgresql.org X-OriginalArrivalTime: 27 Jun 2005 06:27:48.0174 (UTC) FILETIME=[5629D6E0:01C57AE1] X-WSS-ID: 6EA143EE1K8576596-01-01 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C57AE1.55BB2216" 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: 200506/507 X-Sequence-Number: 16239 This is a multi-part message in MIME format. ------_=_NextPart_001_01C57AE1.55BB2216 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Alvaro, > Am I the only one annoyed by the fact that the patch is not very nice = to > 80-columns-wide terminals? It doesn't need to be a rigid rule but I > think the code looks much better if it's not too wide. This code is > wide already, but I think we should be making it better, not the other > way around. Yup - fixed (as well as I can without mucking readability). > Also, your text editor seems to be messing the indentation of comments > when there are ( or other symbols in the comment text. (Maybe this > doesn't matter a lot because pgindent will fix it, but still -- it = makes > it slightly more difficult to read.) Yah - I think I fixed several mis-indented comments. I'm using vim with tabstop=3D4. I personally don't like tabs in text and would prefer them expanded using spaces, but that's a nice way to make small formatting changes look huge in a cvs diff. See attached - only formatting changes included. - Luke ------_=_NextPart_001_01C57AE1.55BB2216 Content-Type: application/octet-stream; name=fast_copy_V11_8.1.patch Content-Transfer-Encoding: base64 Content-Description: fast_copy_V11_8.1.patch Content-Disposition: attachment; filename=fast_copy_V11_8.1.patch SW5kZXg6IHNyYy9iYWNrZW5kL2NvbW1hbmRzL2NvcHkuYwo9PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAv cHJvamVjdHMvY3Zzcm9vdC9wZ3NxbC9zcmMvYmFja2VuZC9jb21tYW5kcy9jb3B5LmMsdgpyZXRy aWV2aW5nIHJldmlzaW9uIDEuMjQ1CmRpZmYgLWMgLXIxLjI0NSBjb3B5LmMKKioqIHNyYy9iYWNr ZW5kL2NvbW1hbmRzL2NvcHkuYwkyIEp1biAyMDA1IDAxOjIxOjIyIC0wMDAwCTEuMjQ1Ci0tLSBz cmMvYmFja2VuZC9jb21tYW5kcy9jb3B5LmMJMjcgSnVuIDIwMDUgMDY6MTk6NTYg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KyAJCQli cmVhazsKKyAJCWRlZmF1bHQ6CisgCQkJY2xpZW50X2VuY29kaW5nX29ubHkgPSBmYWxzZTsKKyAJ fQorIAkKKyAKICAJY29weV9kZXN0ID0gQ09QWV9GSUxFOwkJLyogZGVmYXVsdCAqLwogIAljb3B5 X2ZpbGUgPSBOVUxMOwogIAljb3B5X21zZ2J1ZiA9IE5VTEw7CioqKioqKioqKioqKioqKgoqKiog MTAyOSwxMDM2ICoqKioKLS0tIDEwODcsMTEwMSAtLS0tCiAgCQkJCQkJIGVycm1zZygiXCIlc1wi IGlzIGEgZGlyZWN0b3J5IiwgZmlsZW5hbWUpKSk7CiAgCQkJfQogIAkJfQorICAgICAgICAgICAg ICAgCisgICAgICAgICAgICAgICBpZiAoY3N2X21vZGUgfHwgYmluYXJ5KSAvKiBvbGQgcGF0aCAq LwogIAkJQ29weUZyb20ocmVsLCBhdHRudW1saXN0LCBiaW5hcnksIG9pZHMsIGRlbGltLCBudWxs X3ByaW50LCBjc3ZfbW9kZSwKICAJCQkJIHF1b3RlLCBlc2NhcGUsIGZvcmNlX25vdG51bGxfYXR0 cywgaGVhZGVyX2xpbmUpOworICAgICAgICAgICAgICAgLyogbmV3IHBhdGggZm9yIGltcHJvdmVk IHBlcmZvcm1hbmNlIChvbmx5IGZvciBkZWxpbWl0ZWQgZm9ybWF0IGZvciBub3cpICovCisgICAg ICAgICAgICAgICBlbHNlCisgICAgICAgICBDb3B5RnJvbURlbGltaXRlZChyZWwsIGF0dG51bWxp c3QsIGJpbmFyeSwgb2lkcywgZGVsaW0sIG51bGxfcHJpbnQsIGNzdl9tb2RlLAorICAgICAgICAg ICAgICAgICAgcXVvdGUsIGVzY2FwZSwgZm9yY2Vfbm90bnVsbF9hdHRzKTsKKyAKICAJfQogIAll bHNlCiAgCXsJCQkJCQkJLyogY29weSBmcm9tIGRhdGFiYXNlIHRvIGZpbGUgKi8KKioqKioqKioq KioqKioqCioqKiAxMTA2LDExMTQgKioqKgogIAkJCQkJIGV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aW5nIHRoZSBsaW5lLiBDb252 ZXJ0IGl0IHRvIHNlcnZlciBlbmNvZGluZy4KKyAJICovCisgCWlmICh0cmFuc2NvZGUpCisgCXsK KyAJCWN2dCA9IChjaGFyICopIHBnX2NsaWVudF90b19zZXJ2ZXIoKHVuc2lnbmVkIGNoYXIgKikg bGluZV9idWYuZGF0YSwKKyAJCQkJCQkJCQkJICAgbGluZV9idWYubGVuKTsKKyAJCWlmIChjdnQg IT0gbGluZV9idWYuZGF0YSkKKyAJCXsKKyAJCQkvKiB0cmFuc2ZlciBjb252ZXJ0ZWQgZGF0YSBi YWNrIHRvIGxpbmVfYnVmICovCisgICAgICAgICAgICAgbGluZV9idWYubGVuPTA7CisgCSAgICAg ICAgbGluZV9idWYuZGF0YVswXSA9ICdcMCc7CisgCSAgICAgICAgbGluZV9idWYuY3Vyc29yID0g MDsKKyAgICAgICAgICAgICBhcHBlbmRCaW5hcnlTdHJpbmdJbmZvKCZsaW5lX2J1ZixjdnQsc3Ry bGVuKGN2dCkpOworIAkJfQorIAl9CisgCisgICAgIC8qIGluZGljYXRlIHRoYXQgY29udmVyc2lv biBoYWQgb2NjdXJlZCAqLworIAlsaW5lX2J1Zl9jb252ZXJ0ZWQgPSB0cnVlOworIAorICAgICAv KgorIAkgKiBjaGVjayBpZiB0aGlzIGxpbmUgaXMgYW4gZW5kIG1hcmtlciAtLSAiXC4iCisgCSAq LworIAllbmRfbWFya2VyID0gZmFsc2U7CisgCisgICAgIHN3aXRjaChlb2xfdHlwZSkKKyAJewor IAkJY2FzZSBFT0xfTkw6CisgCQkJaWYgKCFzdHJjbXAobGluZV9idWYuZGF0YSwiXFwuXG4iKSkK KyAJCQkJZW5kX21hcmtlciA9IHRydWU7CisgCQkJYnJlYWs7CisgCQljYXNlIEVPTF9DUjoKKyAJ CQlpZiAoIXN0cmNtcChsaW5lX2J1Zi5kYXRhLCJcXC5cciIpKQorIAkJCQllbmRfbWFya2VyID0g dHJ1ZTsKKyAJCQlicmVhazsK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5dGUgKi8KKyAJeworIAkJZm9yIChzdGFydCA9 IHM7ICpzICE9IGMgJiYgcyA8IHN0YXJ0ICsgbGVuIDsgcysrKQorIAkJCTsKKyAJfQorIAkKKyAg ICAgcmV0dXJuICggKCpzID09IGMpID8gKGNoYXIgKikgcyA6IE5VTEwgKTsKKyB9CisgCisgY2hh ciAqc3RyMmNocmxlbihjb25zdCBjaGFyICpzLCBpbnQgYzEsIGludCBjMiwgc2l6ZV90IGxlbiwg Y2hhciAqY19mb3VuZCkKKyB7CisgCWNvbnN0IGNoYXIgKnN0YXJ0OworIAkqY19mb3VuZCA9ICdc MCc7CisgCQorIAlmb3IgKHN0YXJ0ID0gczsgKnMgIT0gYzEgJiYgKnMgIT0gYzIgJiYgcyA8IHN0 YXJ0ICsgbGVuIDsgcysrKQorIAkJOworIAkKKyAJKmNfZm91bmQgPSAqczsgCisgICAgIHJldHVy biAoICpjX2ZvdW5kICE9ICdcMCcgPyAoY2hhciAqKSBzIDogTlVMTCApOworIH0K ------_=_NextPart_001_01C57AE1.55BB2216-- From pgsql-performance-owner@postgresql.org Mon Jun 27 08:20: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 B52AE52835 for ; Mon, 27 Jun 2005 08:19:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81309-01 for ; Mon, 27 Jun 2005 11:19:55 +0000 (GMT) Received: from mail.sto.netlight.se (1-1-10-39a.sh.sth.bostream.se [82.182.50.216]) by svr1.postgresql.org (Postfix) with ESMTP id ED437528C3 for ; Mon, 27 Jun 2005 08:19:52 -0300 (ADT) Received: from prraxp ([192.168.12.76]) by mail.sto.netlight.se (8.11.2/8.11.2) with ESMTP id j5RC8X314165 for ; Mon, 27 Jun 2005 14:08:33 +0200 From: "Praveen Raja" To: Subject: Insert performance vs Table size Date: Mon, 27 Jun 2005 13:24:06 +0200 Message-ID: <001201c57b0a$beb2b780$4c0ca8c0@sto.netlight.se> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: <41821.193.138.218.24.1119696327.squirrel@www.aldratech.com> Importance: Normal 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.055 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/491 X-Sequence-Number: 13128 Hi all I'm wondering if and how the size of a table affects speed of inserts into it? What if the table has indexes, does that alter the answer? Thanks From pgsql-performance-owner@postgresql.org Mon Jun 27 08: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 9287552863 for ; Mon, 27 Jun 2005 08:31:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79205-09 for ; Mon, 27 Jun 2005 11:30:59 +0000 (GMT) Received: from smtp-hz.alibaba-inc.com (unknown [220.189.213.3]) by svr1.postgresql.org (Postfix) with ESMTP id 39F6B52818 for ; Mon, 27 Jun 2005 08:30:57 -0300 (ADT) Received: from ljh1469 (unknown [10.0.76.30]) by smtp-hz (Postfix) with ESMTP id 6F2E466C097; Mon, 27 Jun 2005 19:30:53 +0800 (CST) Date: Mon, 27 Jun 2005 19:30:50 +0800 From: "=?gb2312?B?wO69rbuq?=" To: "Praveen Raja" , "pgsql-performance" Subject: Re: Insert performance vs Table size X-mailer: Foxmail 5.0 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 Message-Id: <20050627113053.6F2E466C097@smtp-hz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.271 tagged_above=0 required=5 tests=AWL, DNS_FROM_AHBL_RHSBL, FROM_ENDS_IN_NUMS, MIME_BASE64_TEXT X-Spam-Level: * X-Archive-Number: 200506/492 X-Sequence-Number: 13129 UHJhdmVlbiBSYWphOg0KDQoJICAgICAgSSB0aGluayB0aGUgc2l6ZSBvZiBhIHRhYmxlIGRvbid0 IGFmZmVjdCB0aGUgc3BlZWQgb2YgaW5zZXJ0cyBpbnRvIGl0LkJlY2F1c2UgUG9zdGdyZVNRTCBq dXN0IGRvaW5nIHNvbWV0aGluZyBsaWtlICJhcHBlbmQiIG9uIHRoZSBkYXRhIGZpbGVzLg0KICAg ICAgICAgIEJ1dCB0aGUgaW5kZXggZG8gc3BlZWQtZG93biB0aGUgaW5zZXJ0cy4gQmVjYXVzZSBQ b3N0Z3JlU1FMIHNob3VsZCBtYWludGFpbiB0aGUgaW5kZXggd2hlbiBkb2luZyBpbnNlcnRzLg0K DQoJCSAgaG9wZSB0aGlzIGlzIHVzZWZ1bCBmb3IgeW91ciBxdWVzdGlvbi4NCg0KDQoNCj09PT09 PT0gMjAwNS0wNi0yNyAxOToyNDowNiB5b3Ugd3JvdGWjuj09PT09PT0NCg0KPkhpIGFsbA0KPg0K PkknbSB3b25kZXJpbmcgaWYgYW5kIGhvdyB0aGUgc2l6ZSBvZiBhIHRhYmxlIGFmZmVjdHMgc3Bl ZWQgb2YgaW5zZXJ0cw0KPmludG8gaXQ/IFdoYXQgaWYgdGhlIHRhYmxlIGhhcyBpbmRleGVzLCBk b2VzIHRoYXQgYWx0ZXIgdGhlIGFuc3dlcj8NCj4NCj5UaGFua3MNCj4NCj4NCj4NCj4tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0oZW5kIG9mIGJyb2FkY2FzdCktLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0NCj5USVAgMTogc3Vic2NyaWJlIGFuZCB1bnN1YnNjcmliZSBjb21tYW5kcyBnbyB0 byBtYWpvcmRvbW9AcG9zdGdyZXNxbC5vcmcNCj4NCg0KPSA9ID0gPSA9ID0gPSA9ID0gPSA9ID0g PSA9ID0gPSA9ID0gPSA9DQoJCQkNCg0KoaGhoaGhoaGhoaGhoaFCZXN0IHJlZ2FyZHMhDQogIA0K oaGhoaGhoaGhoaGhoaGhoQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIMDuva27qg0K ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNlYW11cyBEZWFuDQogICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgQWxpYmFiYS5jb20NCgkJCSAgICAgICAgICAgICAgICAgICBURUw6 MDU3MS04NTAyMjA4OC0yMjg3DQqhoaGhoaGhoaGhoaGhoaGhICAgICAgICAgICAgICAgIGxqaDE0 NjlAYWxpYmFiYS1pbmMuY29tDQqhoaGhoaGhoaGhoaGhoaGhICAgICAgICAgICAgICAgIDIwMDUt MDYtMjcNCg== From pgsql-performance-owner@postgresql.org Mon Jun 27 08:40: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 3472452835 for ; Mon, 27 Jun 2005 08:40:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83314-04 for ; Mon, 27 Jun 2005 11:40:27 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id 83EA15281E for ; Mon, 27 Jun 2005 08:40:25 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5RBeIsO004013; Mon, 27 Jun 2005 13:40:24 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050627133508.05df6eb0@pop.interactivemediafactory.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Mon, 27 Jun 2005 13:40:13 +0200 To: "Praveen Raja" From: Jacques Caron Subject: Re: Insert performance vs Table size Cc: In-Reply-To: <001201c57b0a$beb2b780$4c0ca8c0@sto.netlight.se> References: <41821.193.138.218.24.1119696327.squirrel@www.aldratech.com> <001201c57b0a$beb2b780$4c0ca8c0@sto.netlight.se> 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.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/493 X-Sequence-Number: 13130 Hi, At 13:24 27/06/2005, Praveen Raja wrote: >I'm wondering if and how the size of a table affects speed of inserts >into it? What if the table has indexes, does that alter the answer? Many parameters will affect the result: - whether there are any indexes (including the primary key, unique constraints...) to update or not - whether there are any foreign keys from or to that table - the size of the rows - whether the table (or at least the bits being updated) fit in RAM or not - whether the table has "holes" (due to former updates/deletes and vacuum) and how they are placed - and probably a bunch of other things... Obviously, if you have an append-only (no updates, no deletes) table with no indexes and no foreign keys, the size of the table should not matter much. As soon as one of those conditions is not met table size will have an impact, probably small as long as whatever is needed can be held in RAM, a lot bigger once it's not the case. Hope that helps, Jacques. From pgsql-patches-owner@postgresql.org Mon Jun 27 08:45:37 2005 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C8FD052818 for ; Mon, 27 Jun 2005 08:45:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84842-03 for ; Mon, 27 Jun 2005 11:45:31 +0000 (GMT) Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) by svr1.postgresql.org (Postfix) with ESMTP id F083C52813 for ; Mon, 27 Jun 2005 08:45:28 -0300 (ADT) Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com [24.211.165.134]) (authenticated (0 bits)) by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j5RAx0121146; Mon, 27 Jun 2005 05:59:01 -0500 Message-ID: <42BFE6CF.1030101@dunslane.net> Date: Mon, 27 Jun 2005 07:45:19 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.7.8-1.3.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luke Lonergan Cc: Alvaro Herrera , Bruce Momjian , Alon Goldshuv , pgsql-patches@postgresql.org Subject: Re: COPY FROM performance improvements References: <3E37B936B592014B978C4415F90D662D0C420B@MI8NYCMAIL06.Mi8.com> In-Reply-To: <3E37B936B592014B978C4415F90D662D0C420B@MI8NYCMAIL06.Mi8.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.025 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/512 X-Sequence-Number: 16244 Luke Lonergan wrote: >Yah - I think I fixed several mis-indented comments. I'm using vim with >tabstop=4. I personally don't like tabs in text and would prefer them >expanded using spaces, but that's a nice way to make small formatting >changes look huge in a cvs diff. > > > You might like to look at running pgindent (see src/tools/pgindent) over the file before cutting a patch. Since this is usually run over each file just before a release, the only badness should be things from recent patches. cheers andrew From pgsql-performance-owner@postgresql.org Mon Jun 27 08:46: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 40586528A6 for ; Mon, 27 Jun 2005 08:46:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83794-06 for ; Mon, 27 Jun 2005 11:46:00 +0000 (GMT) Received: from mail.sto.netlight.se (1-1-10-39a.sh.sth.bostream.se [82.182.50.216]) by svr1.postgresql.org (Postfix) with ESMTP id 1B70252865 for ; Mon, 27 Jun 2005 08:45:56 -0300 (ADT) Received: from prraxp ([192.168.12.76]) by mail.sto.netlight.se (8.11.2/8.11.2) with ESMTP id j5RCYd315241; Mon, 27 Jun 2005 14:34:39 +0200 From: "Praveen Raja" To: "'Jacques Caron'" Cc: Subject: Re: Insert performance vs Table size Date: Mon, 27 Jun 2005 13:50:13 +0200 Message-ID: <001301c57b0e$643942c0$4c0ca8c0@sto.netlight.se> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: <6.2.0.14.0.20050627133508.05df6eb0@pop.interactivemediafactory.net> Importance: Normal 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.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/494 X-Sequence-Number: 13131 Just to clear things up a bit, the scenario that I'm interested in is a table with a large number of indexes on it (maybe 7-8). In this scenario other than the overhead of having to maintain the indexes (which I'm guessing is the same regardless of the size of the table), does the size of the table play a role in determining insert performance (and I mean only insert performance)? -----Original Message----- From: Jacques Caron [mailto:jc@directinfos.com] Sent: 27 June 2005 13:40 To: Praveen Raja Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Insert performance vs Table size Hi, At 13:24 27/06/2005, Praveen Raja wrote: >I'm wondering if and how the size of a table affects speed of inserts >into it? What if the table has indexes, does that alter the answer? Many parameters will affect the result: - whether there are any indexes (including the primary key, unique constraints...) to update or not - whether there are any foreign keys from or to that table - the size of the rows - whether the table (or at least the bits being updated) fit in RAM or not - whether the table has "holes" (due to former updates/deletes and vacuum) and how they are placed - and probably a bunch of other things... Obviously, if you have an append-only (no updates, no deletes) table with no indexes and no foreign keys, the size of the table should not matter much. As soon as one of those conditions is not met table size will have an impact, probably small as long as whatever is needed can be held in RAM, a lot bigger once it's not the case. Hope that helps, Jacques. From pgsql-performance-owner@postgresql.org Mon Jun 27 09:05: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 B51C052865 for ; Mon, 27 Jun 2005 09:05:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90041-06 for ; Mon, 27 Jun 2005 12:05:10 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id 7679B52863 for ; Mon, 27 Jun 2005 09:05:08 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5RC592B006078; Mon, 27 Jun 2005 14:05:10 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050627135541.055202c0@wheresmymailserver.com> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Mon, 27 Jun 2005 14:05:03 +0200 To: "Praveen Raja" From: Jacques Caron Subject: Re: Insert performance vs Table size Cc: In-Reply-To: <001301c57b0e$643942c0$4c0ca8c0@sto.netlight.se> References: <6.2.0.14.0.20050627133508.05df6eb0@pop.interactivemediafactory.net> <001301c57b0e$643942c0$4c0ca8c0@sto.netlight.se> 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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/495 X-Sequence-Number: 13132 Hi, At 13:50 27/06/2005, Praveen Raja wrote: >Just to clear things up a bit, the scenario that I'm interested in is a >table with a large number of indexes on it (maybe 7-8). If you're after performance you'll want to carefully consider which indexes are really useful and/or redesign your schema so that you can have less indexes on that table. 7 or 8 indexes is quite a lot, and that really has a cost. > In this scenario >other than the overhead of having to maintain the indexes (which I'm >guessing is the same regardless of the size of the table) Definitely not: indexes grow with the size of the table. Depending on what columns you index (and their types), the indexes may be a fraction of the size of the table, or they may be very close in size (in extreme cases they may even be larger). With 7 or 8 indexes, that can be quite a large volume of data to manipulate, especially if the values of the columns inserted can span the whole range of the index (rather than being solely id- or time-based, for instance, in which case index updates are concentrated in a small area of each of the indexes), as this means you'll need to have a majority of the indexes in RAM if you want to maintain decent performance. >does the size of the table play a role in determining insert performance >(and I mean >only insert performance)? In this case, it's really the indexes that'll cause you trouble, though heavily fragmented tables (due to lots of deletes or updates) will also incur a penalty just for the data part of the inserts. Also, don't forget the usual hints if you are going to do lots of inserts: - batch them in large transactions, don't do them one at a time - better yet, use COPY rather than INSERT - in some situations, you might be better of dropping the indexes, doing large batch inserts, then re-creating the indexes. YMMV depending on the existing/new ratio, whether you need to maintain indexed access to the tables, etc. - pay attention to foreign keys Jacques. From pgsql-performance-owner@postgresql.org Mon Jun 27 09:41: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 3CB3152809 for ; Mon, 27 Jun 2005 09:40:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95064-08 for ; Mon, 27 Jun 2005 12:40:32 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id B9E465281E for ; Mon, 27 Jun 2005 09:40:28 -0300 (ADT) 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: Performance - moving from oracle to postgresql Date: Mon, 27 Jun 2005 08:40:29 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2BC2@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Performance - moving from oracle to postgresql thread-index: AcV49c3Xilw2ZiCSQY2xyv2MtwuWwwCHjMuw From: "Merlin Moncure" To: "Greg Maples" Cc: , "Rod Taylor" 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: 200506/496 X-Sequence-Number: 13133 > There are some immediate questions from our engineers about performance >=20 > "- Oracle has one particular performance enhancement that Postgres is > missing. If you do a select that returns 100,000 rows in a given order, > and all you want are rows 99101 to 99200, then Oracle can do that very > efficiently. With Postgres, it has to read the first 99200 rows and > then discard the first 99100. But... If we really want to look at > performance, then we ought to put together a set of benchmarks of some > typical tasks." I agree with Rod: you are correct but this is a very odd objection. You are declaring a set but are only interested in a tiny subset of that based on arbitrary critera. You can do this with cursors or with clever querying (not without materializing the full set however), but why? =20 Merlin From pgsql-performance-owner@postgresql.org Mon Jun 27 10:38: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 3054552806 for ; Mon, 27 Jun 2005 10:38:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03733-06 for ; Mon, 27 Jun 2005 13:37:57 +0000 (GMT) Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id E2B6D52865 for ; Mon, 27 Jun 2005 10:37:56 -0300 (ADT) Received: from nitrogenio.carvalhaes.net (unknown [200.175.206.50]) by svr2.postgresql.org (Postfix) with ESMTP id 89711F0AC6 for ; Mon, 27 Jun 2005 14:34:08 +0100 (BST) Received: from [192.168.0.190] ([192.168.0.190]) (authenticated bits=0) by nitrogenio.carvalhaes.net (8.13.4/8.13.4) with ESMTP id j5RDKvJX030140 for ; Mon, 27 Jun 2005 10:20:58 -0300 Message-ID: <42BFFFF3.2080702@carvalhaes.net> Date: Mon, 27 Jun 2005 10:32:35 -0300 From: grupos User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: PERFORMANCE ISSUE ODBC x LIBPQ C++ Application Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Triade-MailScanner-Information: Por favor, entre em contato para obter detalhes X-Triade-MailScanner: Found to be clean X-MailScanner-From: grupos@carvalhaes.net X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.161 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/497 X-Sequence-Number: 13134 Hi ! My company is evaluating to compatibilizate our system (developed in C++) to PostgreSQL. Our programmer made a lot of tests and he informed me that the performance using ODBC is very similar than using libpq, even with a big number of simultaneous connections/queries. Of course that for us is simpler use ODBC because will be easier to maintan as we already support a lot of other databases using ODBC (MySQL, DB2, etc). Someone already had this experience? What are the key benefits using libpq insted of ODBC ? Our application have a heavy load and around 150 concorrent users. Regards, Rodrigo Carvalhaes -- Esta mensagem foi verificada pelo sistema de antiv�rus e acredita-se estar livre de perigo. From pgsql-performance-owner@postgresql.org Mon Jun 27 11:29: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 716BA52813 for ; Mon, 27 Jun 2005 11:29:07 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18281-08 for ; Mon, 27 Jun 2005 14:29:03 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id D36D952809 for ; Mon, 27 Jun 2005 11:29:01 -0300 (ADT) 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: PERFORMANCE ISSUE ODBC x LIBPQ C++ Application Date: Mon, 27 Jun 2005 10:29:05 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2BC6@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PERFORMANCE ISSUE ODBC x LIBPQ C++ Application thread-index: AcV7HY7oblznKdbzSOeLoBGQ9vVtJgABcqAw From: "Merlin Moncure" To: "grupos" 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: 200506/498 X-Sequence-Number: 13135 > Hi ! >=20 > My company is evaluating to compatibilizate our system (developed in > C++) to PostgreSQL. >=20 > Our programmer made a lot of tests and he informed me that the > performance using ODBC is very similar than using libpq, even with a big > number of simultaneous connections/queries. Of course that for us is > simpler use ODBC because will be easier to maintan as we already support > a lot of other databases using ODBC (MySQL, DB2, etc). >=20 > Someone already had this experience? What are the key benefits using > libpq insted of ODBC ? >=20 > Our application have a heavy load and around 150 concorrent users. The ODBC driver for postgresql implements its own protocol stack. Unfortunately, it is still on protocol revision 2 (out of 3). Also, IMO libpq is a little better tested and durable than the odbc driver. This naturally follows from the fact that libpq is more widely used and more actively developed than odbc. If you are heavily C++ invested you can consider wrapping libpq yourself if you want absolute maximum performance. If you happen to be developing on Borland platform give strong consideration to Zeos connection library which is very well designed (it wraps libpq). You might want to consider posting your question to the odbc list. Merlin=20 From pgsql-performance-owner@postgresql.org Mon Jun 27 11:46: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 C41A352835 for ; Mon, 27 Jun 2005 11:46:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23669-03 for ; Mon, 27 Jun 2005 14:46:43 +0000 (GMT) Received: from asmail001.abovesecurity.com (asmail001.abovesecurity.com [206.162.148.235]) by svr1.postgresql.org (Postfix) with ESMTP id 36BA952809 for ; Mon, 27 Jun 2005 11:46:42 -0300 (ADT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: Re: PERFORMANCE ISSUE ODBC x LIBPQ C++ Application X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Date: Mon, 27 Jun 2005 10:46:46 -0400 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PERFORMANCE ISSUE ODBC x LIBPQ C++ Application Thread-Index: AcV7HY7oblznKdbzSOeLoBGQ9vVtJgABcqAwAADMS4A= From: "Eric Lauzon" To: "Merlin Moncure" , , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.07 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/499 X-Sequence-Number: 13136 i would take a peek at psqlodbc-8.0 drivers .. i wouldn't battle with other version you might find such as (unixodbc ones) -elz > -----Original Message----- > From: pgsql-performance-owner@postgresql.org=20 > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 > Merlin Moncure > Sent: 27 juin 2005 10:29 > To: grupos > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] PERFORMANCE ISSUE ODBC x LIBPQ C++ Application >=20 > > Hi ! > >=20 > > My company is evaluating to compatibilizate our system (developed in > > C++) to PostgreSQL. > >=20 > > Our programmer made a lot of tests and he informed me that the=20 > > performance using ODBC is very similar than using libpq, even with a > big > > number of simultaneous connections/queries. Of course that=20 > for us is=20 > > simpler use ODBC because will be easier to maintan as we already > support > > a lot of other databases using ODBC (MySQL, DB2, etc). > >=20 > > Someone already had this experience? What are the key=20 > benefits using=20 > > libpq insted of ODBC ? > >=20 > > Our application have a heavy load and around 150 concorrent users. >=20 > The ODBC driver for postgresql implements its own protocol stack. > Unfortunately, it is still on protocol revision 2 (out of 3).=20 > Also, IMO libpq is a little better tested and durable than=20 > the odbc driver. This naturally follows from the fact that=20 > libpq is more widely used and more actively developed than odbc. >=20 > If you are heavily C++ invested you can consider wrapping=20 > libpq yourself if you want absolute maximum performance. If=20 > you happen to be developing on Borland platform give strong=20 > consideration to Zeos connection library which is very well=20 > designed (it wraps libpq). >=20 > You might want to consider posting your question to the odbc list. >=20 > Merlin=20 >=20 >=20 > ---------------------------(end of=20 > broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match >=20 From pgsql-performance-owner@postgresql.org Mon Jun 27 15: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 9483F528CE for ; Mon, 27 Jun 2005 15:14:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67317-07 for ; Mon, 27 Jun 2005 18:14:12 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 2504F52835 for ; Mon, 27 Jun 2005 15:14:10 -0300 (ADT) 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: [HACKERS] How two perform TPC-H test on postgresql-8.0.2 Date: Mon, 27 Jun 2005 14:14:10 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2BD1@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [HACKERS] How two perform TPC-H test on postgresql-8.0.2 thread-index: AcV7OVGaQpooJ6KtRyy7NEtBo4TevgAB1zug From: "Merlin Moncure" To: "Josh Berkus" Cc: , "innodb" 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: 200506/500 X-Sequence-Number: 13137 [moved to pgsql-performance] > > Currently I want to take a TPC-H test on postgresql-8.0.2. I have > > downloaded the DBGEN and QGEN from the homepage of TPC. But I > encountered > > many problems which forced me to request some help. 1. How to load the > data > > from flat file generated by dbgen tool? To the best of my knowledge, > there > > is a SQL Loader in Oracle 2. How to simulate the currency environment? > > Where can I download a client which connects to DB server through ODBC? >=20 > Get DBT3 from Sourceforge (search on "osdldbt"). This is OSDL's TPCH-like > test. >=20 > However, given your knowledge of PostgreSQL you're unlikely to get any > kind of > result you can use -- TPCH requires siginficant database tuning knowledge. I don't necessarily agree. In fact, I remember reading the standards for one of the TPC benchmarks and it said you were not supposed to specifically tune for the test. Any submission, including one with stock settings, should be given consideration (and the .conf settings should be submitted along with the benchmark results). This can only help to increase the body of knowledge on configuring the database. Merlin From pgsql-performance-owner@postgresql.org Mon Jun 27 15:15: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 0DC725292A for ; Mon, 27 Jun 2005 15:15:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67642-06 for ; Mon, 27 Jun 2005 18:15:08 +0000 (GMT) Received: from presinet-main.presinet.com (presinet.com [209.53.156.1]) by svr1.postgresql.org (Postfix) with ESMTP id 7CD51528BB for ; Mon, 27 Jun 2005 15:15:07 -0300 (ADT) 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 MJ790KH0; Mon, 27 Jun 2005 11:11:06 -0700 Message-ID: <42C0422A.7020408@PresiNET.com> Date: Mon, 27 Jun 2005 11:15:06 -0700 From: Bricklen Anderson User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dennis Bjorklund Cc: pgsql-performance@postgresql.org Subject: Re: ETL optimization References: In-Reply-To: X-Enigmail-Version: 0.91.0.0 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.015 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/501 X-Sequence-Number: 13138 Dennis Bjorklund wrote: > On Thu, 23 Jun 2005, Bricklen Anderson wrote: > > >>iii. UNIQUE constraint on table "t1". This didn't seem to perform too >>badly with fewer rows (preliminary tests), but as you'd expect, on error >>the whole transaction would roll back. Is it possible to skip a row if >>it causes an error, as opposed to aborting the transaction altogether? > > > You don't need to roll back the whole transaction if you use savepoints or > the exception features in pl/pgsql > > Take a look at this example: > > http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE > Hmmm... forgot about savepoints. That's an interesting idea that I'll have to check out. I earlier mentioned that I was going to test the delete + insert version, and it works pretty well. I got it down to about 3 minutes using that method. I'll test the savepoint and the exception version that you listed as well. Thanks! -- _______________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. _______________________________ From pgsql-patches-owner@postgresql.org Mon Jun 27 15:53:04 2005 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EC1CA5281E for ; Mon, 27 Jun 2005 15:52:58 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80294-03 for ; Mon, 27 Jun 2005 18:52:58 +0000 (GMT) Received: from mail.Mi8.com (nycgw01.mi8.com [63.240.6.41]) by svr1.postgresql.org (Postfix) with ESMTP id E769352823 for ; Mon, 27 Jun 2005 15:52:51 -0300 (ADT) Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- GW01 Welcome to Mi8 Corporation www.Mi8.com); Mon, 27 Jun 2005 14:52:39 -0400 X-Server-Uuid: F1A2E19A-84E4-48DD-8F48-B475613F58B2 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 27 Jun 2005 14:52:39 -0400 Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Mon, 27 Jun 2005 14:52:35 -0500 User-Agent: Microsoft-Entourage/11.1.0.040913 Date: Mon, 27 Jun 2005 11:52:30 -0700 Subject: Re: COPY FROM performance improvements From: "Luke Lonergan" To: "Andrew Dunstan" Cc: "Alvaro Herrera" , "Bruce Momjian" , "Alon Goldshuv" , pgsql-patches@postgresql.org Message-ID: In-Reply-To: <42BFE6CF.1030101@dunslane.net> MIME-Version: 1.0 X-OriginalArrivalTime: 27 Jun 2005 18:52:39.0457 (UTC) FILETIME=[643E7110:01C57B49] X-WSS-ID: 6EDE957D3203579562-01-01 Content-Type: multipart/mixed; boundary=B_3202717953_5185116 X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/520 X-Sequence-Number: 16252 > 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. --B_3202717953_5185116 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Andrew, > You might like to look at running pgindent (see src/tools/pgindent) over > the file before cutting a patch. Since this is usually run over each > file just before a release, the only badness should be things from > recent patches. I've attached two patches, one gained from running pgindent against the current CVS tip copy.c (:-D) and one gained by running the COPY FROM perf improvements through the same. Nifty tool! Only formatting changes in these. - Luke --B_3202717953_5185116 Content-Type: application/octet-stream; name=copy-pgindent.patch Content-Disposition: attachment; filename=copy-pgindent.patch Content-Transfer-Encoding: base64 SW5kZXg6IHNyYy9iYWNrZW5kL2NvbW1hbmRzL2NvcHkuYwo9PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBm aWxlOiAvcHJvamVjdHMvY3Zzcm9vdC9wZ3NxbC9zcmMvYmFja2VuZC9jb21tYW5kcy9jb3B5 LmMsdgpyZXRyaWV2aW5nIHJldmlzaW9uIDEuMjQ1CmRpZmYgLWMgLXIxLjI0NSBjb3B5LmMK KioqIHNyYy9iYWNrZW5kL2NvbW1hbmRzL2NvcHkuYwkyIEp1biAyMDA1IDAxOjIxOjIyIC0w MDAwCTEuMjQ1Ci0tLSBzcmMvYmFja2VuZC9jb21tYW5kcy9jb3B5LmMJMjcgSnVuIDIwMDUg MTg6Mjc6MzYgLTAwMDAKKioqKioqKioqKioqKioqCioqKiAxLDMgKioqKgotLS0gMSw0IC0t LS0KKyAKICAvKi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KICAgKgogICAqIGNvcHkuYwoqKioqKioq KioqKioqKioKKioqIDEwMSwxMDkgKioqKgogIAogIC8qIHRoZXNlIGFyZSBqdXN0IGZvciBl cnJvciBtZXNzYWdlcywgc2VlIGNvcHlfaW5fZXJyb3JfY2FsbGJhY2sgKi8KICBzdGF0aWMg Ym9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 YXJpYWJsZXMKISAJICovCiAgCWZlX2VvZiA9IGZhbHNlOwogIAllb2xfdHlwZSA9IEVPTF9V TktOT1dOOwogIAljb3B5X2JpbmFyeSA9IGJpbmFyeTsKKioqKioqKioqKioqKioqCioqKiAx Njg2LDE3MDIgKioqKgogIAljb3B5X2xpbmVubyA9IDA7CiAgCWNvcHlfYXR0bmFtZSA9IE5V TEw7CiAgCiEgCS8qIFNldCB1cCBjYWxsYmFjayB0byBpZGVudGlmeSBlcnJvciBsaW5lIG51 bWJlciAqLwogIAllcnJjb250ZXh0LmNhbGxiYWNrID0gY29weV9pbl9lcnJvcl9jYWxsYmFj azsKICAJZXJyY29udGV4dC5hcmcgPSBOVUxMOwogIAllcnJjb250ZXh0LnByZXZpb3VzID0g ZXJyb3JfY29udGV4dF9zdGFjazsKICAJZXJyb3JfY29udGV4dF9zdGFjayA9ICZlcnJjb250 ZXh0OwogIAohIAkvKiBvbiBpbnB1dCBqdXN0IHRocm93IHRoZSBoZWFkZXIgbGluZSBhd2F5 ICovCiAgCWlmIChoZWFkZXJfbGluZSkKICAJewogIAkJY29weV9saW5lbm8rKzsKISAJCWRv bmUgPSBDb3B5UmVhZExpbmUocXVvdGUsIGVzY2FwZSkgOwogIAl9CiAgCiAgCXdoaWxlICgh ZG9uZSkKLS0tIDE4NjcsMTg4NyAtLS0tCiAgCWNvcHlfbGluZW5vID0gMDsKICAJY29weV9h dHRuYW1lID0gTlVMTDsKICAKISAJLyoKISAJICogU2V0IHVwIGNhbGxiYWNrIHRvIGlkZW50 aWZ5IGVycm9yIGxpbmUgbnVtYmVyCiEgCSAqLwogIAllcnJjb250ZXh0LmNhbGxiYWNrID0g Y29weV9pbl9lcnJvcl9jYWxsYmFjazsKICAJZXJyY29udGV4dC5hcmcgPSBOVUxMOwogIAll cnJjb250ZXh0LnByZXZpb3VzID0gZXJyb3JfY29udGV4dF9zdGFjazsKICAJZXJyb3JfY29u dGV4dF9zdGFjayA9ICZlcnJjb250ZXh0OwogIA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dChsKSk7CiAgCQkJaW50CQkJYXR0bnVtOwogIAoh IAkJCS8qIExvb2t1cCBjb2x1bW4gbmFtZSwgZXJlcG9ydCBvbiBmYWlsdXJlICovCiEgCQkJ LyogTm90ZSB3ZSBkaXNhbGxvdyBzeXN0ZW0gY29sdW1ucyBoZXJlICovCiAgCQkJYXR0bnVt ID0gYXR0bmFtZUF0dE51bShyZWwsIG5hbWUsIGZhbHNlKTsKISAJCQkvKiBDaGVjayBmb3Ig ZHVwbGljYXRlcyAqLwogIAkJCWlmIChsaXN0X21lbWJlcl9pbnQoYXR0bnVtcywgYXR0bnVt KSkKICAJCQkJZXJlcG9ydChFUlJPUiwKICAJCQkJCQkoZXJyY29kZShFUlJDT0RFX0RVUExJ Q0FURV9DT0xVTU4pLAotLS0gMzA3NywzMDkyIC0tLS0KICAJCQljaGFyCSAgICpuYW1lID0g c3RyVmFsKGxmaXJzdChsKSk7CiAgCQkJaW50CQkJYXR0bnVtOwogIAohIAkJCS8qCiEgCQkJ ICogTG9va3VwIGNvbHVtbiBuYW1lLCBlcmVwb3J0IG9uIGZhaWx1cmUKISAJCQkgKi8KISAJ CQkvKgohIAkJCSAqIE5vdGUgd2UgZGlzYWxsb3cgc3lzdGVtIGNvbHVtbnMgaGVyZQohIAkJ CSAqLwogIAkJCWF0dG51bSA9IGF0dG5hbWVBdHROdW0ocmVsLCBuYW1lLCBmYWxzZSk7CiEg CQkJLyoKISAJCQkgKiBDaGVjayBmb3IgZHVwbGljYXRlcwohIAkJCSAqLwogIAkJCWlmIChs aXN0X21lbWJlcl9pbnQoYXR0bnVtcywgYXR0bnVtKSkKICAJCQkJZXJlcG9ydChFUlJPUiwK ICAJCQkJCQkoZXJyY29kZShFUlJDT0RFX0RVUExJQ0FURV9DT0xVTU4pLAo= --B_3202717953_5185116 Content-Type: application/octet-stream; name=fast_copy_V12_8.1.patch Content-Disposition: attachment; filename=fast_copy_V12_8.1.patch Content-Transfer-Encoding: base64 SW5kZXg6IHNyYy9iYWN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GJhY2s7CiAgCWVycmNvbnRleHQuYXJnID0gTlVMTDsKICAJZXJyY29udGV4 dC5wcmV2aW91cyA9IGVycm9yX2NvbnRleHRfc3RhY2s7CiAgCWVycm9yX2NvbnRleHRfc3Rh Y2sgPSAmZXJyY29udGV4dDsKICAKISAJLyoKISAJICogb24gaW5wdXQganVzdCB0aHJvdyB0 aGUgaGVhZGVyIGxpbmUgYXdheQohIAkgKi8KICAJaWYgKGhlYWRlcl9saW5lKQogIAl7CiAg CQljb3B5X2xpbmVubysrOwohIAkJZG9uZSA9IENvcHlSZWFkTGluZShxdW90ZSwgZXNjYXBl KTsKICAJfQogIAogIAl3aGlsZSAoIWRvbmUpCioqKioqKioqKioqKioqKgoqKiogMTcwOCwx NzIwICoqKioKICAKICAJCWNvcHlfbGluZW5vKys7CiAgCiEgCQkvKiBSZXNldCB0aGUgcGVy LXR1cGxlIGV4cHJjb250ZXh0ICovCiAgCQlSZXNldFBlclR1cGxlRXhwckNvbnRleHQoZXN0 YXRlKTsKICAKISAJCS8qIFN3aXRjaCBpbnRvIGl0cyBtZW1vcnkgY29udGV4dCAqLwogIAkJ TWVtb3J5Q29udGV4dFN3aXRjaFRvKEdldFBlclR1cGxlTWVtb3J5Q29udGV4dChlc3RhdGUp KTsKICAKISAJCS8qIEluaXRpYWxpemUgYWxsIHZhbHVlcyBmb3Igcm93IHRvIE5VTEwgKi8K ICAJCU1lbVNldCh2YWx1ZXMsIDAsIG51bV9waHlzX2F0dHJzICogc2l6ZW9mKERhdHVtKSk7 CiAgCQlNZW1TZXQobnVsbHMsICduJywgbnVtX3BoeXNfYXR0cnMgKiBzaXplb2YoY2hhcikp OwogIAotLS0gMTk3MSwxOTg5IC0tLS0KICAKICAJCWNvcHlfbGluZW5vKys7CiAgCiEgCQkv KgohIAkJICogUmVzZXQgdGhlIHBlci10dXBsZSBleHByY29udGV4dAohIAkJICovCiAgCQlS ZXNldFBlclR1cGxlRXhwckNvbnRleHQoZXN0YXRlKTsKICAKISAJC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CBpbnQgYzEsIGludCBjMiwgc2l6ZV90IGxlbiwgY2hhciAqY19mb3Vu ZCkKKyB7CisgCWNvbnN0IGNoYXIgKnN0YXJ0OworIAorIAkqY19mb3VuZCA9ICdcMCc7Cisg CisgCWZvciAoc3RhcnQgPSBzOyAqcyAhPSBjMSAmJiAqcyAhPSBjMiAmJiBzIDwgc3RhcnQg KyBsZW47IHMrKykKKyAJCTsKKyAKKyAJKmNfZm91bmQgPSAqczsKKyAJcmV0dXJuICgqY19m b3VuZCAhPSAnXDAnID8gKGNoYXIgKikgcyA6IE5VTEwpOworIH0K --B_3202717953_5185116-- From pgsql-patches-owner@postgresql.org Mon Jun 27 17:20:56 2005 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C0EE952806 for ; Mon, 27 Jun 2005 17:20:52 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95993-06 for ; Mon, 27 Jun 2005 20:20:50 +0000 (GMT) Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) by svr1.postgresql.org (Postfix) with ESMTP id 71B935292A for ; Mon, 27 Jun 2005 17:20:48 -0300 (ADT) Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com [24.211.165.134]) (authenticated (0 bits)) by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j5RJY5817198; Mon, 27 Jun 2005 14:34:05 -0500 Message-ID: <42C05F88.7000105@dunslane.net> Date: Mon, 27 Jun 2005 16:20:24 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.7.8-1.3.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luke Lonergan Cc: Alvaro Herrera , Bruce Momjian , Alon Goldshuv , pgsql-patches@postgresql.org Subject: Re: COPY FROM performance improvements References: 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.025 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/521 X-Sequence-Number: 16253 Luke Lonergan wrote: >Andrew, > > > >>You might like to look at running pgindent (see src/tools/pgindent) over >>the file before cutting a patch. Since this is usually run over each >>file just before a release, the only badness should be things from >>recent patches. >> >> > >I've attached two patches, one gained from running pgindent against the >current CVS tip copy.c (:-D) and one gained by running the COPY FROM perf >improvements through the same. Nifty tool! > >Only formatting changes in these. > > > > Luke, Something strange has happened. I suspect that you've inadvertantly used GNU indent or an unpatched BSD indent. pgindent needs a special patched BSD indent to work according to the PG standards - see the README cheers andrew From pgsql-performance-owner@postgresql.org Mon Jun 27 17:47: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 B79B55280C for ; Mon, 27 Jun 2005 17:46:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02349-04 for ; Mon, 27 Jun 2005 20:46:48 +0000 (GMT) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.192]) by svr1.postgresql.org (Postfix) with ESMTP id 8E22352865 for ; Mon, 27 Jun 2005 17:46:46 -0300 (ADT) Received: by nproxy.gmail.com with SMTP id x37so197753nfc for ; Mon, 27 Jun 2005 13:46:48 -0700 (PDT) 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:content-disposition; b=MCnX3F/t0YqX5qXWRtv4vPIFJNme9qKOCI94XaUXaWNNizfiLMw8l8FOwoQBvHOXA6WQgUbHnGg+5TUMBDIXN9hmns+Zb0O+xBe8jhbSDpjXQFK83ohfW/5wstIY+2t03oy1byqL7ArGpujZyyRQynXzE7AJ2dbTh6IPEZw9Iso= Received: by 10.48.3.15 with SMTP id 15mr118099nfc; Mon, 27 Jun 2005 13:46:48 -0700 (PDT) Received: by 10.48.49.14 with HTTP; Mon, 27 Jun 2005 13:46:48 -0700 (PDT) Message-ID: <4b09a0c050627134660b3925@mail.gmail.com> Date: Mon, 27 Jun 2005 22:46:48 +0200 From: Jean-Max Reymond Reply-To: Jean-Max Reymond To: pgsql-performance@postgresql.org Subject: perl garbage collector Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.071 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/502 X-Sequence-Number: 13139 Hi,=20 I have a stored procedure written in perl and I doubt that perl's garbage collector is working :-( after a lot of work, postmaster has a size of 1100 Mb and I think that the keyword "undef" has no effects. Before tuning my procedure, does it exist a known issue, a workaround ? --=20 Jean-Max Reymond CKR Solutions Open Source Nice France http://www.ckr-solutions.com From pgsql-performance-owner@postgresql.org Mon Jun 27 18:11: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 E934152892 for ; Mon, 27 Jun 2005 18:11:50 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05641-09 for ; Mon, 27 Jun 2005 21:11:47 +0000 (GMT) Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) by svr1.postgresql.org (Postfix) with ESMTP id A6EBC5287E for ; Mon, 27 Jun 2005 18:11:46 -0300 (ADT) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id CF329B85A for ; Mon, 27 Jun 2005 17:11:48 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v730) In-Reply-To: <4b09a0c050627134660b3925@mail.gmail.com> References: <4b09a0c050627134660b3925@mail.gmail.com> Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-10--134412680; protocol="application/pkcs7-signature" Message-Id: From: Vivek Khera Subject: Re: perl garbage collector Date: Mon, 27 Jun 2005 17:11:47 -0400 To: pgsql-performance@postgresql.org X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.029 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/503 X-Sequence-Number: 13140 --Apple-Mail-10--134412680 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Jun 27, 2005, at 4:46 PM, Jean-Max Reymond wrote: > Hi, > I have a stored procedure written in perl and I doubt that perl's > garbage collector is working :-( > after a lot of work, postmaster has a size of 1100 Mb and I think > that the keyword "undef" has no effects. > Before tuning my procedure, does it exist a known issue, a > workaround ? just because your application frees the memory doesn't mean that the OS takes it back. in other words, don't confuse memory usage with memory leakage. Vivek Khera, Ph.D. +1-301-869-4449 x806 --Apple-Mail-10--134412680 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGhzCCAz8w ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCS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AYJKoZIhvcNAQkDMQsGCSqGSIb3DQEH ATAcBgkqhkiG9w0BCQUxDxcNMDUwNjI3MjExMTQ4WjAjBgkqhkiG9w0BCQQxFgQUYoYMKmxYxSPm PpuHnnSj9WCv2b4weAYJKwYBBAGCNxAEMWswaTBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhh d3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVt YWlsIElzc3VpbmcgQ0ECAw5qHzB6BgsqhkiG9w0BCRACCzFroGkwYjELMAkGA1UEBhMCWkExJTAj BgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJz b25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAgMOah8wDQYJKoZIhvcNAQEBBQAEggEA0slQzPMv3xCR rN19QBCzJz45RNOnQNN6y5iDKeZWMwpM7HSwP/+0WFnD3AS2CORbclz0r7EkibSby46tpxx02wCu Sz+XJ4ioxxT9b2hQ/ytSl20IC3Fftg/0WnuswhSP0taLMmh4NRiFzTT4L0pnX81KO+lcsnNCtGal CKVEnHeBGiAaM6N19F57ad8HvK3uVoL7Mx5Klx5gyaOvERb+c8jM0dcFE0lbDv8Bddwf/0N0lU7m sAQEkzHDLQhhyftO/AygapKrzEpvHS61ZPGhh6kHPCkhnqtKvKvzPvA90jsEnbMFs+cfmRxZBACd GVDoF1gfLFKvlI5aoDfEnJZfGwAAAAAAAA== --Apple-Mail-10--134412680-- From pgsql-performance-owner@postgresql.org Mon Jun 27 19:35: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 3526752828 for ; Mon, 27 Jun 2005 19:35:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23107-05 for ; Mon, 27 Jun 2005 22:35:33 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 3CE9D52822 for ; Mon, 27 Jun 2005 19:35:32 -0300 (ADT) 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 7539091; Mon, 27 Jun 2005 15:37:42 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Karl O. Pinc" Subject: Re: Poor index choice -- multiple indexes of the same columns Date: Mon, 27 Jun 2005 15:37:41 -0700 User-Agent: KMail/1.8 Cc: pgsql-performance@postgresql.org References: <1119913766l.4428l.2l@mofo> In-Reply-To: <1119913766l.4428l.2l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506271537.41797.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/506 X-Sequence-Number: 13143 Karl, > Seems to me that when there's a constant value in the query > and an = comparision it will always be faster to use the (b-tree) > index that's ordered first by the constant value, as then all further > blocks are guarenteed to have a higher relevant information > density. At least when compared with another index that has the > same columns in it. That really depends on the stats. Such a choice would *not* be appropriate if the < comparison was expected to return 1- rows while the = condition applied to 15% of the table. What is your STATISTICS_TARGET for the relevant columns set to? When's the last time you ran analyze? If this is all updated, you want to post the pg_stats rows for the relevant columns? -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jun 27 19:41: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 4792352828 for ; Mon, 27 Jun 2005 19:41:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23400-03 for ; Mon, 27 Jun 2005 22:41:20 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id E7B5652822 for ; Mon, 27 Jun 2005 19:41:18 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5RMfCsh056281; Tue, 28 Jun 2005 00:41:14 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050628003823.065c2de8@pop.interactivemediafactory.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Tue, 28 Jun 2005 00:40:53 +0200 To: "Karl O. Pinc" From: Jacques Caron Subject: Re: Forcing use of a particular index Cc: pgsql-performance@postgresql.org In-Reply-To: <1119914161l.4428l.4l@mofo> References: <1119914161l.4428l.4l@mofo> 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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/507 X-Sequence-Number: 13144 Hi, At 01:16 28/06/2005, Karl O. Pinc wrote: >http://www.postgresql.org/docs/8.0/static/indexes-examine.html > >Says: > >"If you do not succeed in adjusting the costs to be more >appropriate, then you may have to resort to forcing index >usage explicitly." > >Is there a way to force a query to use a particular index? Not that I know of. >If not, what does this sentence mean? That you can force the planner to use an index (any one) over not using an index (and using seq scans instead) by setting enable_seqscan to off. Jacques. From pgsql-performance-owner@postgresql.org Mon Jun 27 19:20: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 E1214528BB for ; Mon, 27 Jun 2005 19:20:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20202-01 for ; Mon, 27 Jun 2005 22:20:22 +0000 (GMT) Received: from mail28.sea5.speakeasy.net (mail28.sea5.speakeasy.net [69.17.117.30]) by svr1.postgresql.org (Postfix) with ESMTP id A93255286D for ; Mon, 27 Jun 2005 19:20:20 -0300 (ADT) Received: (qmail 26064 invoked from network); 27 Jun 2005 22:20:23 -0000 Received: from dsl093-114-095.chi2.dsl.speakeasy.net (HELO mofo.meme.com) ([66.93.114.95]) (envelope-sender ) by mail28.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 27 Jun 2005 22:20:23 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id 96ACB6E421 for ; Mon, 27 Jun 2005 18:09:26 -0500 (CDT) Date: Mon, 27 Jun 2005 23:09:26 +0000 From: "Karl O. Pinc" Subject: Poor index choice -- multiple indexes of the same columns To: pgsql-performance@postgresql.org X-Mailer: Balsa 2.3.0 Message-Id: <1119913766l.4428l.2l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline 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: 200506/504 X-Sequence-Number: 13141 Postgresql 8.0.3 Hi, I have a query select 1 from census where date < '1975-9-21' and sname = 'RAD' and status != 'A' limit 1; Explain analyze says it always uses the index made by: CREATE INDEX census_date_sname ON census (date, sname); this is even after I made the index: CREATE INDEX census_sname_date ON census (sname, date); I made census_sname_date because it ran too slow. By deleting census_date_sname (temporarly, because my apps don't like this) I can force the use of census_sname_date and the query runs fine. Seems to me that when there's a constant value in the query and an = comparision it will always be faster to use the (b-tree) index that's ordered first by the constant value, as then all further blocks are guarenteed to have a higher relevant information density. At least when compared with another index that has the same columns in it. As you might imagine there are relatively few sname values and relatively many date values in my data. I use a query like the above in a trigger to enforce bounds limitations. I don't expect (want) to find any rows returned. I've figured out how to avoid executing this code very often, so this is not presently a serious problem for me. Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein From pgsql-performance-owner@postgresql.org Mon Jun 27 19:27: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 4974F5282B for ; Mon, 27 Jun 2005 19:27:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19891-10 for ; Mon, 27 Jun 2005 22:26:55 +0000 (GMT) Received: from mail24.sea5.speakeasy.net (mail24.sea5.speakeasy.net [69.17.117.26]) by svr1.postgresql.org (Postfix) with ESMTP id 9453652828 for ; Mon, 27 Jun 2005 19:26:54 -0300 (ADT) Received: (qmail 28912 invoked from network); 27 Jun 2005 22:26:57 -0000 Received: from dsl093-114-095.chi2.dsl.speakeasy.net (HELO mofo.meme.com) ([66.93.114.95]) (envelope-sender ) by mail24.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 27 Jun 2005 22:26:57 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id 1C46B6E421 for ; Mon, 27 Jun 2005 18:16:01 -0500 (CDT) Date: Mon, 27 Jun 2005 23:16:01 +0000 From: "Karl O. Pinc" Subject: Forcing use of a particular index To: pgsql-performance@postgresql.org X-Mailer: Balsa 2.3.0 Message-Id: <1119914161l.4428l.4l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline 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: 200506/505 X-Sequence-Number: 13142 http://www.postgresql.org/docs/8.0/static/indexes-examine.html Says: "If you do not succeed in adjusting the costs to be more appropriate, then you may have to resort to forcing index usage explicitly." Is there a way to force a query to use a particular index? If not, what does this sentence mean? Thanks. Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein From pgsql-performance-owner@postgresql.org Mon Jun 27 19:41: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 3848952822 for ; Mon, 27 Jun 2005 19:41:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23400-04 for ; Mon, 27 Jun 2005 22:41:40 +0000 (GMT) Received: from mail28.sea5.speakeasy.net (mail28.sea5.speakeasy.net [69.17.117.30]) by svr1.postgresql.org (Postfix) with ESMTP id B490E52835 for ; Mon, 27 Jun 2005 19:41:38 -0300 (ADT) Received: (qmail 32633 invoked from network); 27 Jun 2005 22:41:42 -0000 Received: from dsl093-114-095.chi2.dsl.speakeasy.net (HELO mofo.meme.com) ([66.93.114.95]) (envelope-sender ) by mail28.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 27 Jun 2005 22:41:42 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id 754536E421 for ; Mon, 27 Jun 2005 18:30:45 -0500 (CDT) Date: Mon, 27 Jun 2005 23:30:45 +0000 From: "Karl O. Pinc" Subject: Performance analysis of plpgsql code To: pgsql-performance@postgresql.org X-Mailer: Balsa 2.3.0 Message-Id: <1119915045l.4428l.5l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline 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: 200506/508 X-Sequence-Number: 13145 Hi, I'm having a hard time finding the poorly performing statements in my plpgsql procedures, many of which are triggers. Am I missing something? I can get the query plans by starting up a new connection and doing: SET DEBUG_PRINT_PLAN TO TRUE; SET CLIENT_MIN_MESSAGES TO DEBUG1; And then running code that exercises my functions. Then I can find the queries that, in theory, could have problems. But problems remain after this. What I'd really like is a SET variable (or maybe a clause in CREATE FUNCTION) that causes any functions compiled to issue EXPLAIN ANALYZE output and the query text itself, to be RAISEd. Then I could watch the performance as it ran. Short of that I think I'm going to be reduced to writing a C function that returns the real system time so I can spatter my code with RAISE statements that indicate actual execution time. Is there a better approach? Does anybody have such a C function handy? Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein From pgsql-performance-owner@postgresql.org Mon Jun 27 20:33: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 3270E52835 for ; Mon, 27 Jun 2005 20:33:15 -0300 (ADT) Received: 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-04 for ; Mon, 27 Jun 2005 23:33:07 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 820415282B for ; Mon, 27 Jun 2005 20:33:05 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j5RNX4KB084372 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Jun 2005 17:33:06 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j5RNX3ns017108; Mon, 27 Jun 2005 17:33:03 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j5RNX3JA017107; Mon, 27 Jun 2005 17:33:03 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 27 Jun 2005 17:33:03 -0600 From: Michael Fuhr To: "Karl O. Pinc" Cc: pgsql-performance@postgresql.org Subject: Re: Performance analysis of plpgsql code Message-ID: <20050627233303.GA17069@winnie.fuhr.org> References: <1119915045l.4428l.5l@mofo> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1119915045l.4428l.5l@mofo> 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: 200506/509 X-Sequence-Number: 13146 On Mon, Jun 27, 2005 at 11:30:45PM +0000, Karl O. Pinc wrote: > > Short of that I think I'm going to be reduced to > writing a C function that returns the real > system time so I can spatter my code with > RAISE statements that indicate actual execution > time. See timeofday(). http://www.postgresql.org/docs/8.0/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Mon Jun 27 22:15: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 5BCE752863 for ; Mon, 27 Jun 2005 22:15:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61283-07 for ; Tue, 28 Jun 2005 01:15:56 +0000 (GMT) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id BDA9752813 for ; Mon, 27 Jun 2005 22:15:53 -0300 (ADT) Received: from [172.16.1.100] glaesema [61.197.227.146] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 1.5 $ on Linux via secured & encrypted transport (TLS); Mon, 27 Jun 2005 19:15:55 -0600 In-Reply-To: <1119923648l.11411l.0l@mofo> References: <1119915045l.4428l.5l@mofo> <20050627233303.GA17069@winnie.fuhr.org> <1119923648l.11411l.0l@mofo> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <00AC59C9-7A32-40A6-80A7-B5428F02D0E6@myrealbox.com> Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: Performance analysis of plpgsql code Date: Tue, 28 Jun 2005 10:15:50 +0900 To: "Karl O. Pinc" X-Mailer: Apple Mail (2.730) 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: 200506/511 X-Sequence-Number: 13148 On Jun 28, 2005, at 10:54 AM, Karl O. Pinc wrote: > > On 06/27/2005 06:33:03 PM, Michael Fuhr wrote: > >> On Mon, Jun 27, 2005 at 11:30:45PM +0000, Karl O. Pinc wrote: >> > >> > Short of that I think I'm going to be reduced to >> > writing a C function that returns the real >> > system time so I can spatter my code with >> > RAISE statements that indicate actual execution >> > time. >> See timeofday(). >> > > That only gives you the time at the start of the transaction, > so you get no indication of how long anything in the > transaction takes. I recommend you look again. Michael Glaesemann grzm myrealbox com From pgsql-performance-owner@postgresql.org Mon Jun 27 22:25: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 D1B6452863 for ; Mon, 27 Jun 2005 22:25:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66697-01 for ; Tue, 28 Jun 2005 01:25:01 +0000 (GMT) Received: from wallace.eclinic.com.au (wallace.eclinic.com.au [203.63.55.34]) by svr1.postgresql.org (Postfix) with SMTP id C280052813 for ; Mon, 27 Jun 2005 22:24:57 -0300 (ADT) Received: (qmail 14046 invoked by uid 1031); 28 Jun 2005 01:26:33 -0000 Received: from 192.168.1.28 by wallace.eclinic.com.au (envelope-from , uid 64011) with qmail-scanner-1.24 (clamdscan: 0.75-1. uvscan: v4.3.20/v4390. spamassassin: 2.53. Clear:RC:1(192.168.1.28):. Processed in 2.640236 secs); 28 Jun 2005 01:26:32 -0000 Received: from shawn.office (HELO ?192.168.1.28?) (192.168.1.28) by wallace.office with SMTP; 28 Jun 2005 01:26:29 -0000 Message-ID: <42C0A6E0.6000101@eclinic.com.au> Date: Tue, 28 Jun 2005 11:24:48 +1000 From: Leigh Dyer User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Faster drives for WAL than for data? 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: 200506/512 X-Sequence-Number: 13149 Hi all, My company currently runs a number of both web-based and more transactional projects on a PostgreSQL 7.3 server, and we're looking to upgrade to a new machine running 8.0 to boost performance and handle data growth in to the future. Right now I'm looking at a Sun Fire V40z server in a fairly modest configuration: 2 Opteron 848 (2.2ghz) CPUs, and 4GB of RAM. The V40z has 6 drive bays, and from earlier posts and the info at http://www.powerpostgresql.com/PerfList/ it sounds like the best configuration would be: * 2 drives in RAID 1 for OS and WAL * 4 drives in RAID 1+0 for data However, using 73gb 15krpm drives, I'll be limiting myself to about 140GB of data storage, and I'm not sure if this will be enough to cover the life of the server. If I stick with the faster drives for the WAL, how significant a performance impact will there be if I use larger 10krpm drives for the data? Also, if anyone could recommend a SCSI RAID card for this configuration, or if anyone has any other suggestions, it'd be greatly appreciated. Thanks Leigh From pgsql-performance-owner@postgresql.org Mon Jun 27 22:34: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 88370528AD for ; Mon, 27 Jun 2005 22:34:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66697-05 for ; Tue, 28 Jun 2005 01:34:22 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id AB72D52828 for ; Mon, 27 Jun 2005 22:34:20 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j5S1YKkY084461 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Jun 2005 19:34:22 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j5S1YKSI017486; Mon, 27 Jun 2005 19:34:20 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j5S1YJLS017485; Mon, 27 Jun 2005 19:34:19 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 27 Jun 2005 19:34:19 -0600 From: Michael Fuhr To: "Karl O. Pinc" Cc: pgsql-performance@postgresql.org Subject: Re: Performance analysis of plpgsql code Message-ID: <20050628013419.GA17407@winnie.fuhr.org> References: <1119915045l.4428l.5l@mofo> <20050627233303.GA17069@winnie.fuhr.org> <1119923648l.11411l.0l@mofo> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1119923648l.11411l.0l@mofo> 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: 200506/513 X-Sequence-Number: 13150 On Tue, Jun 28, 2005 at 01:54:08AM +0000, Karl O. Pinc wrote: > On 06/27/2005 06:33:03 PM, Michael Fuhr wrote: > > >See timeofday(). > > That only gives you the time at the start of the transaction, > so you get no indication of how long anything in the > transaction takes. Did you read the documentation or try it? Perhaps you're thinking of now(), current_timestamp, and friends, which don't advance during a transaction; but as the documentation states, "timeofday() returns the wall-clock time and does advance during transactions." I just ran tests on versions of PostgreSQL going back to 7.2.8 and in all of them timeofday() advanced during a transaction. Does it not work on your system? If not then something's broken -- what OS and version of PostgreSQL are you using? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Mon Jun 27 22:05: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 786D552997 for ; Mon, 27 Jun 2005 22:05:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61888-02 for ; Tue, 28 Jun 2005 01:05:03 +0000 (GMT) Received: from mail23.sea5.speakeasy.net (mail23.sea5.speakeasy.net [69.17.117.25]) by svr1.postgresql.org (Postfix) with ESMTP id BA4175299C for ; Mon, 27 Jun 2005 22:05:01 -0300 (ADT) Received: (qmail 12608 invoked from network); 28 Jun 2005 01:05:05 -0000 Received: from dsl093-114-095.chi2.dsl.speakeasy.net (HELO mofo.meme.com) ([66.93.114.95]) (envelope-sender ) by mail23.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 28 Jun 2005 01:05:05 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id 72AE86E421; Mon, 27 Jun 2005 20:54:08 -0500 (CDT) Date: Tue, 28 Jun 2005 01:54:08 +0000 From: "Karl O. Pinc" Subject: Re: Performance analysis of plpgsql code To: Michael Fuhr Cc: pgsql-performance@postgresql.org References: <1119915045l.4428l.5l@mofo> <20050627233303.GA17069@winnie.fuhr.org> In-Reply-To: <20050627233303.GA17069@winnie.fuhr.org> (from mike@fuhr.org on Mon Jun 27 18:33:03 2005) X-Mailer: Balsa 2.3.0 Message-Id: <1119923648l.11411l.0l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline 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: 200506/510 X-Sequence-Number: 13147 On 06/27/2005 06:33:03 PM, Michael Fuhr wrote: > On Mon, Jun 27, 2005 at 11:30:45PM +0000, Karl O. Pinc wrote: > > > > Short of that I think I'm going to be reduced to > > writing a C function that returns the real > > system time so I can spatter my code with > > RAISE statements that indicate actual execution > > time. > > See timeofday(). That only gives you the time at the start of the transaction, so you get no indication of how long anything in the transaction takes. Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein From pgsql-performance-owner@postgresql.org Mon Jun 27 22:47: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 57C8B52822 for ; Mon, 27 Jun 2005 22:47:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71037-02 for ; Tue, 28 Jun 2005 01:47:45 +0000 (GMT) Received: from mail27.sea5.speakeasy.net (mail27.sea5.speakeasy.net [69.17.117.29]) by svr1.postgresql.org (Postfix) with ESMTP id C4BDC52981 for ; Mon, 27 Jun 2005 22:47:43 -0300 (ADT) Received: (qmail 20051 invoked from network); 28 Jun 2005 01:47:47 -0000 Received: from dsl093-114-095.chi2.dsl.speakeasy.net (HELO mofo.meme.com) ([66.93.114.95]) (envelope-sender ) by mail27.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 28 Jun 2005 01:47:46 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id 570B66E421; Mon, 27 Jun 2005 21:36:51 -0500 (CDT) Date: Tue, 28 Jun 2005 02:36:51 +0000 From: "Karl O. Pinc" Subject: Re: Poor index choice -- multiple indexes of the same To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org References: <1119913766l.4428l.2l@mofo> <200506271537.41797.josh@agliodbs.com> In-Reply-To: <200506271537.41797.josh@agliodbs.com> (from josh@agliodbs.com on Mon Jun 27 17:37:41 2005) X-Mailer: Balsa 2.3.0 Message-Id: <1119926211l.11411l.2l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline 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: 200506/514 X-Sequence-Number: 13151 On 06/27/2005 05:37:41 PM, Josh Berkus wrote: > Karl, > > > Seems to me that when there's a constant value in the query > > and an = comparision it will always be faster to use the (b-tree) > > index that's ordered first by the constant value, as then all > further > > blocks are guarenteed to have a higher relevant information > > density. At least when compared with another index that has the > > same columns in it. > > That really depends on the stats. Such a choice would *not* be > appropriate if the < comparison was expected to return 1- rows while > the = > condition applied to 15% of the table. We're talking internals here so I don't know what I'm talking about, but, when the = comparison returns 15% of the table you can find your way straight to the 1- (sic) relevent rows because that 15% is further sorted by the second column of the index. So that's one disk read and after that when you scan the rest of the blocks every datum is relevant/returned. So your scan will pass through fewer disk blocks. The only case that would make sense to consider using the other index is if the planner knew it could get the answer in 1 disk read, in which case it should be able to get the answer out of either index in one disk read as both indexes are on the same columns. > What is your STATISTICS_TARGET for the relevant columns set to? STATISTICS_TARGET is the default, which I read as 10 the docs. > When's > the last time you ran analyze? I'm doing this in a torture test script, loading data. Every fibnocci number of rows * 100 I VACCUM ANALYZE. So, 100, 200, 300, 500, 800, etc. Just for grins I've created the index I'd like it to use and run VACUUM ANALYZE and shown the EXPLAIN ANALYZE below. > If this is all updated, you want to > post > the pg_stats rows for the relevant columns? Pg_stats rows below. (I've tried to wrap the lines short so as not to mess up anybody's mailer.) # create index census_sname_date on census (sname, date); CREATE INDEX # vacuum analyze census; VACUUM # explain analyze select 1 from census where date < '1975-9-21' and sname = 'RAD' and status != 'A' ; QUERY PLAN --------------------------------------------------------------- --------------------------------------------------------------- ---- Index Scan using census_date_sname on census (cost=0.00..2169.51 rows=1437 width=0) (actual time=40.610..40.610 rows=0 loops=1) Index Cond: ((date < '1975-09-21'::date) AND (sname = 'RAD'::bpchar)) Filter: (status <> 'A'::bpchar) Total runtime: 40.652 ms (4 rows) Compare with: # drop index census_date_sname; DROP INDEX # explain analyze select date from census where sname = 'RAD' and date < '1975-9-21' and status != 'A' limit 1; QUERY PLAN ------------------------------------------------------------------- ------------------------------------------------------------------- Limit (cost=0.00..3.37 rows=1 width=4) (actual time=0.097..0.097 rows=0 loops=1) -> Index Scan using census_sname_date on census (cost=0.00..5203.95 rows=1544 width=4) (actual time=0.094..0.094 rows=0 loops=1) Index Cond: ((sname = 'RAD'::bpchar) AND (date < '1975-09-21'::date)) Filter: (status <> 'A'::bpchar) Total runtime: 0.133 ms (5 rows) # select * from pg_stats where tablename = 'census' and (attname = 'sname' or attname = 'date'); schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation ------------+-----------+---------+-----------+-----------+----------- -+-------------------------------------------------------------------- ---------------------------------------------+------------------------ ---------------------------------------------------------------------- --------------+------------------------------------------------------- ---------------------------------------------------------------------+ ------------- babase | census | date | 0 | 4 | 4687 | {1979-02-01,1976-06-16,1977-03-23,1978-08-25,1979-09-20,1971-06-28 ,1972-04-28,1972-08-27,1974-04-06,1975-03-19} | {0.002,0.00166667,0.00166667,0.00166667,0.00166667,0.00133333 ,0.00133333,0.00133333,0.00133333,0.00133333} | {1959-07-15,1966-02-18,1969-02-22,1971-01-10,1972-07-26,1974-02-09 ,1975-05-27,1976-07-28,1977-08-19,1978-08-07,1979-10-02} | 1 babase | census | sname | 0 | 7 | 177 | {MAX,ALT,PRE,COW,EST,JAN,RIN,ZUM,DUT,LUL} | {0.0166667,0.015,0.015,0.0146667 ,0.0143333,0.014,0.0136667,0.0136667,0.0133333,0.0133333} | {ALI,BUN,FAN,IBI,LER,NDO,PET,RUS,SLM,TOT,XEN} | 0.0446897 (2 rows) Thanks. Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein From pgsql-performance-owner@postgresql.org Mon Jun 27 23:37: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 6CADA52949 for ; Mon, 27 Jun 2005 23:37:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81510-01 for ; Tue, 28 Jun 2005 02:37:44 +0000 (GMT) Received: from smtp001.bizmail.yahoo.com (smtp001.bizmail.yahoo.com [216.136.172.125]) by svr1.postgresql.org (Postfix) with SMTP id 7FEB0528A9 for ; Mon, 27 Jun 2005 23:37:42 -0300 (ADT) Received: from unknown (HELO ?192.168.3.41?) (david.mitchell@telogis.com@203.98.10.169 with plain) by smtp001.bizmail.yahoo.com with SMTP; 28 Jun 2005 02:37:43 -0000 Message-ID: <42C0B7EE.4040608@telogis.com> Date: Tue, 28 Jun 2005 14:37:34 +1200 From: David Mitchell User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: How can I speed up this function? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/517 X-Sequence-Number: 13154 We have the following function in our home grown mirroring package, but it isn't running as fast as we would like. We need to select statements from the pending_statement table, and we want to select all the statements for a single transaction (pending_trans) in one go (that is, we either select all the statements for a transaction, or none of them). We select as many blocks of statements as it takes to top the 100 statement limit (so if the last transaction we pull has enough statements to put our count at 110, we'll still take it, but then we're done). Here is our function: CREATE OR REPLACE FUNCTION dbmirror.get_pending() RETURNS SETOF dbmirror.pending_statement AS $BODY$ DECLARE count INT4; transaction RECORD; statement dbmirror.pending_statement; BEGIN count := 0; FOR transaction IN SELECT t.trans_id as ID FROM pending_trans AS t WHERE fetched = false ORDER BY trans_id LIMIT 50 LOOP update pending_trans set fetched = true where trans_id = transaction.id; FOR statement IN SELECT s.id, s.transaction_id, s.table_name, s.op, s.data FROM dbmirror.pending_statement AS s WHERE s.transaction_id = transaction.id ORDER BY s.id ASC LOOP count := count + 1; RETURN NEXT statement; END LOOP; IF count > 100 THEN EXIT; END IF; END LOOP; RETURN; END;$BODY$ LANGUAGE 'plpgsql' VOLATILE; Table Schemas: CREATE TABLE dbmirror.pending_trans ( trans_id oid NOT NULL, fetched bool DEFAULT false, CONSTRAINT pending_trans_pkey PRIMARY KEY (trans_id) ) WITHOUT OIDS; CREATE TABLE dbmirror.pending_statement ( id oid NOT NULL DEFAULT nextval('dbmirror.statement_id_seq'::text), transaction_id oid NOT NULL, table_name text NOT NULL, op char NOT NULL, data text NOT NULL, CONSTRAINT pending_statement_pkey PRIMARY KEY (id) ) WITHOUT OIDS; CREATE UNIQUE INDEX idx_stmt_tran_id_id ON dbmirror.pending_statement USING btree (transaction_id, id); Postgres 8.0.1 on Linux. Any Help would be greatly appreciated. Regards -- David Mitchell Software Engineer Telogis From pgsql-performance-owner@postgresql.org Mon Jun 27 23:49: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 CF896528C1 for ; Mon, 27 Jun 2005 23:49:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82717-02 for ; Tue, 28 Jun 2005 02:49:21 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 2E018528A9 for ; Mon, 27 Jun 2005 23:49:20 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j5S2nJHA084521 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Jun 2005 20:49:22 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j5S2nJto017780; Mon, 27 Jun 2005 20:49:19 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j5S2nJ02017779; Mon, 27 Jun 2005 20:49:19 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 27 Jun 2005 20:49:18 -0600 From: Michael Fuhr To: "Karl O. Pinc" Cc: pgsql-performance@postgresql.org Subject: Re: Performance analysis of plpgsql code Message-ID: <20050628024918.GA17735@winnie.fuhr.org> References: <1119915045l.4428l.5l@mofo> <20050627233303.GA17069@winnie.fuhr.org> <1119923648l.11411l.0l@mofo> <20050628013419.GA17407@winnie.fuhr.org> <1119927786l.11411l.3l@mofo> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1119927786l.11411l.3l@mofo> 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: 200506/518 X-Sequence-Number: 13155 On Tue, Jun 28, 2005 at 03:03:06AM +0000, Karl O. Pinc wrote: > > For all your work a documentation patch is appended that > I think is easier to read and might avoid this problem > in the future. Patches should go to the pgsql-patches list -- the people who review and apply patches might not be following this thread. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Mon Jun 27 23:14: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 4EC3952986 for ; Mon, 27 Jun 2005 23:14:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75157-02 for ; Tue, 28 Jun 2005 02:14:00 +0000 (GMT) Received: from mail22.sea5.speakeasy.net (mail22.sea5.speakeasy.net [69.17.117.24]) by svr1.postgresql.org (Postfix) with ESMTP id C1C6E52969 for ; Mon, 27 Jun 2005 23:13:58 -0300 (ADT) Received: (qmail 4619 invoked from network); 28 Jun 2005 02:14:03 -0000 Received: from dsl093-114-095.chi2.dsl.speakeasy.net (HELO mofo.meme.com) ([66.93.114.95]) (envelope-sender ) by mail22.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 28 Jun 2005 02:14:03 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id D2F106E421; Mon, 27 Jun 2005 22:03:06 -0500 (CDT) Date: Tue, 28 Jun 2005 03:03:06 +0000 From: "Karl O. Pinc" Subject: Re: Performance analysis of plpgsql code To: Michael Fuhr Cc: pgsql-performance@postgresql.org, Michael Glaesemann References: <1119915045l.4428l.5l@mofo> <20050627233303.GA17069@winnie.fuhr.org> <1119923648l.11411l.0l@mofo> <20050628013419.GA17407@winnie.fuhr.org> In-Reply-To: <20050628013419.GA17407@winnie.fuhr.org> (from mike@fuhr.org on Mon Jun 27 20:34:19 2005) X-Mailer: Balsa 2.3.0 Message-Id: <1119927786l.11411l.3l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline 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: 200506/515 X-Sequence-Number: 13152 On 06/27/2005 08:34:19 PM, Michael Fuhr wrote: > On Tue, Jun 28, 2005 at 01:54:08AM +0000, Karl O. Pinc wrote: > > On 06/27/2005 06:33:03 PM, Michael Fuhr wrote: > > > > >See timeofday(). > > > > That only gives you the time at the start of the transaction, > > so you get no indication of how long anything in the > > transaction takes. > > Did you read the documentation or try it? Perhaps you're thinking > of now(), current_timestamp, and friends, which don't advance during > a transaction; but as the documentation states, "timeofday() returns > the wall-clock time and does advance during transactions." Very sorry. I did not read through the complete documentation. > I just ran tests on versions of PostgreSQL going back to 7.2.8 and > in all of them timeofday() advanced during a transaction. For all your work a documentation patch is appended that I think is easier to read and might avoid this problem in the future. If you don't read all the way through the current cvs version then you might think, as I did, that timeofday() is a CURRENT_TIMESTAMP related function. Sorry, but 3 lines wrap in the patch in my email client. :( Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein --- func.sgml 2005-06-26 17:05:35.000000000 -0500 +++ func.sgml.new 2005-06-27 21:51:05.301097896 -0500 @@ -5787,15 +5787,6 @@ - There is also the function timeofday(), which for historical - reasons returns a text string rather than a timestamp value: - -SELECT timeofday(); -Result: Sat Feb 17 19:07:32.000126 2001 EST - - - - It is important to know that CURRENT_TIMESTAMP and related functions return the start time of the current transaction; their values do not @@ -5803,8 +5794,7 @@ the intent is to allow a single transaction to have a consistent notion of the current time, so that multiple modifications within the same transaction bear the same - time stamp. timeofday() - returns the wall-clock time and does advance during transactions. + time stamp. @@ -5815,6 +5805,18 @@ + There is also the function timeofday() which + returns the wall-clock time and advances during transactions. For + historical reasons timeofday() returns a + text string rather than a timestamp + value: + +SELECT timeofday(); +Result: Sat Feb 17 19:07:32.000126 2001 EST + + + + All the date/time data types also accept the special literal value now to specify the current date and time. Thus, the following three all return the same result: From pgsql-performance-owner@postgresql.org Tue Jun 28 00:03: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 E272B52969 for ; Tue, 28 Jun 2005 00:03:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88613-04 for ; Tue, 28 Jun 2005 03:03:08 +0000 (GMT) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 89E6D528C1 for ; Tue, 28 Jun 2005 00:03:04 -0300 (ADT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id BDB9624FE0; Tue, 28 Jun 2005 11:03:01 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id BBF2224FDF; Tue, 28 Jun 2005 11:03:01 +0800 (WST) Message-ID: <42C0BE50.3090105@familyhealth.com.au> Date: Tue, 28 Jun 2005 11:04:48 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Mitchell Cc: pgsql-performance@postgresql.org Subject: Re: How can I speed up this function? References: <42C0B7EE.4040608@telogis.com> In-Reply-To: <42C0B7EE.4040608@telogis.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.166 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200506/519 X-Sequence-Number: 13156 What's wrong with Slony? David Mitchell wrote: > We have the following function in our home grown mirroring package, but > it isn't running as fast as we would like. We need to select statements > from the pending_statement table, and we want to select all the > statements for a single transaction (pending_trans) in one go (that is, > we either select all the statements for a transaction, or none of them). > We select as many blocks of statements as it takes to top the 100 > statement limit (so if the last transaction we pull has enough > statements to put our count at 110, we'll still take it, but then we're > done). > > Here is our function: > > CREATE OR REPLACE FUNCTION dbmirror.get_pending() > RETURNS SETOF dbmirror.pending_statement AS > $BODY$ > > DECLARE > count INT4; > transaction RECORD; > statement dbmirror.pending_statement; > BEGIN > count := 0; > > FOR transaction IN SELECT t.trans_id as ID > FROM pending_trans AS t WHERE fetched = false > ORDER BY trans_id LIMIT 50 > LOOP > update pending_trans set fetched = true where trans_id = > transaction.id; > > FOR statement IN SELECT s.id, s.transaction_id, s.table_name, > s.op, s.data > FROM dbmirror.pending_statement AS s > WHERE s.transaction_id = transaction.id > ORDER BY s.id ASC > LOOP > count := count + 1; > > RETURN NEXT statement; > END LOOP; > > IF count > 100 THEN > EXIT; > END IF; > END LOOP; > > RETURN; > END;$BODY$ > LANGUAGE 'plpgsql' VOLATILE; > > Table Schemas: > > CREATE TABLE dbmirror.pending_trans > ( > trans_id oid NOT NULL, > fetched bool DEFAULT false, > CONSTRAINT pending_trans_pkey PRIMARY KEY (trans_id) > ) > WITHOUT OIDS; > > CREATE TABLE dbmirror.pending_statement > ( > id oid NOT NULL DEFAULT nextval('dbmirror.statement_id_seq'::text), > transaction_id oid NOT NULL, > table_name text NOT NULL, > op char NOT NULL, > data text NOT NULL, > CONSTRAINT pending_statement_pkey PRIMARY KEY (id) > ) > WITHOUT OIDS; > > CREATE UNIQUE INDEX idx_stmt_tran_id_id > ON dbmirror.pending_statement > USING btree > (transaction_id, id); > > Postgres 8.0.1 on Linux. > > Any Help would be greatly appreciated. > > Regards > From pgsql-performance-owner@postgresql.org Tue Jun 28 00:11: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 B82BE52849 for ; Tue, 28 Jun 2005 00:11:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90562-10 for ; Tue, 28 Jun 2005 03:11:17 +0000 (GMT) Received: from smtp004.bizmail.sc5.yahoo.com (smtp004.bizmail.sc5.yahoo.com [66.163.175.81]) by svr1.postgresql.org (Postfix) with SMTP id 3D85152818 for ; Tue, 28 Jun 2005 00:11:16 -0300 (ADT) Received: from unknown (HELO ?192.168.3.41?) (david.mitchell@telogis.com@203.98.10.169 with plain) by smtp004.bizmail.sc5.yahoo.com with SMTP; 28 Jun 2005 03:11:11 -0000 Message-ID: <42C0BFC6.7070507@telogis.com> Date: Tue, 28 Jun 2005 15:11:02 +1200 From: David Mitchell User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Kings-Lynne Cc: pgsql-performance@postgresql.org Subject: Re: How can I speed up this function? References: <42C0B7EE.4040608@telogis.com> <42C0BE50.3090105@familyhealth.com.au> In-Reply-To: <42C0BE50.3090105@familyhealth.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/520 X-Sequence-Number: 13157 Christopher Kings-Lynne wrote: > What's wrong with Slony? Because it's not multi-master. Our mirroring package is. -- David Mitchell Software Engineer Telogis From pgsql-performance-owner@postgresql.org Mon Jun 27 23:22: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 A5CEB528A9 for ; Mon, 27 Jun 2005 23:22:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76304-06 for ; Tue, 28 Jun 2005 02:22:16 +0000 (GMT) Received: from mail22.sea5.speakeasy.net (mail22.sea5.speakeasy.net [69.17.117.24]) by svr1.postgresql.org (Postfix) with ESMTP id D66EB52986 for ; Mon, 27 Jun 2005 23:22:15 -0300 (ADT) Received: (qmail 32521 invoked from network); 28 Jun 2005 02:22:20 -0000 Received: from dsl093-114-095.chi2.dsl.speakeasy.net (HELO mofo.meme.com) ([66.93.114.95]) (envelope-sender ) by mail22.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 28 Jun 2005 02:22:20 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id A9F616E421; Mon, 27 Jun 2005 22:11:25 -0500 (CDT) Date: Tue, 28 Jun 2005 03:11:25 +0000 From: "Karl O. Pinc" Subject: Re: Poor index choice -- multiple indexes of the same To: "Karl O. Pinc" Cc: josh@agliodbs.com, pgsql-performance@postgresql.org References: <1119913766l.4428l.2l@mofo> <200506271537.41797.josh@agliodbs.com> <1119926211l.11411l.2l@mofo> In-Reply-To: <1119926211l.11411l.2l@mofo> (from kop@meme.com on Mon Jun 27 21:36:51 2005) X-Mailer: Balsa 2.3.0 Message-Id: <1119928285l.11411l.4l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline 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: 200506/516 X-Sequence-Number: 13153 On 06/27/2005 09:36:51 PM, Karl O. Pinc wrote: > I'm doing this in a torture test script, loading data. > Every fibnocci number of rows * 100 I VACCUM ANALYZE. > So, 100, 200, 300, 500, 800, etc. (And of course disconnect my client and re-connect so as to use the new statistics. sure would be nice if I didn't have to do this.) Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein From pgsql-performance-owner@postgresql.org Tue Jun 28 00:19: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 E7F5352849 for ; Tue, 28 Jun 2005 00:18:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90278-08 for ; Tue, 28 Jun 2005 03:18:50 +0000 (GMT) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 3D33452818 for ; Tue, 28 Jun 2005 00:18:49 -0300 (ADT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 850EF24FDF; Tue, 28 Jun 2005 11:18:48 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 64FEE24FCE; Tue, 28 Jun 2005 11:18:48 +0800 (WST) Message-ID: <42C0C204.1030301@familyhealth.com.au> Date: Tue, 28 Jun 2005 11:20:36 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Mitchell Cc: pgsql-performance@postgresql.org Subject: Re: How can I speed up this function? References: <42C0B7EE.4040608@telogis.com> <42C0BE50.3090105@familyhealth.com.au> <42C0BFC6.7070507@telogis.com> In-Reply-To: <42C0BFC6.7070507@telogis.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.063 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/521 X-Sequence-Number: 13158 >> What's wrong with Slony? > > Because it's not multi-master. Our mirroring package is. I'm curious - how did you write a multi-master replication package in pgsql, when pgsql doesn't have 2 phase commits or any kind of distributed syncing or conflict resolution in a release version? Chris From pgsql-performance-owner@postgresql.org Tue Jun 28 00:21: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 BCB435298B for ; Tue, 28 Jun 2005 00:21:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94483-04 for ; Tue, 28 Jun 2005 03:21:10 +0000 (GMT) Received: from mxsf25.cluster1.charter.net (mxsf25.cluster1.charter.net [209.225.28.225]) by svr1.postgresql.org (Postfix) with ESMTP id D715252982 for ; Tue, 28 Jun 2005 00:21:08 -0300 (ADT) Received: from mxip06a.cluster1.charter.net (mxip06a.cluster1.charter.net [209.225.28.136]) by mxsf25.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id j5S3L7Mn004608 for ; Mon, 27 Jun 2005 23:21:07 -0400 Received: from 68-118-180-13.dhcp.nwtn.ct.charter.com (HELO [192.168.116.102]) (68.118.180.13) by mxip06a.cluster1.charter.net with ESMTP; 27 Jun 2005 23:21:07 -0400 X-IronPort-AV: i="3.93,236,1115006400"; d="scan'208"; a="1044215367:sNHT19829868" Message-ID: <42C0C226.8070201@NarrowPathInc.com> Date: Mon, 27 Jun 2005 23:21:10 -0400 From: Keith Worthington Reply-To: KeithW@NarrowPathInc.com Organization: Narrow Path, Inc. User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Mitchell Cc: pgsql-performance@postgresql.org Subject: Re: How can I speed up this function? References: <42C0B7EE.4040608@telogis.com> In-Reply-To: <42C0B7EE.4040608@telogis.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.044 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/522 X-Sequence-Number: 13159 David Mitchell wrote: > We have the following function in our home grown mirroring package, but > it isn't running as fast as we would like. We need to select statements > from the pending_statement table, and we want to select all the > statements for a single transaction (pending_trans) in one go (that is, > we either select all the statements for a transaction, or none of them). > We select as many blocks of statements as it takes to top the 100 > statement limit (so if the last transaction we pull has enough > statements to put our count at 110, we'll still take it, but then we're > done). > > Here is our function: > > CREATE OR REPLACE FUNCTION dbmirror.get_pending() > RETURNS SETOF dbmirror.pending_statement AS > $BODY$ > > DECLARE > count INT4; > transaction RECORD; > statement dbmirror.pending_statement; > BEGIN > count := 0; > > FOR transaction IN SELECT t.trans_id as ID > FROM pending_trans AS t WHERE fetched = false > ORDER BY trans_id LIMIT 50 > LOOP > update pending_trans set fetched = true where trans_id = > transaction.id; > > FOR statement IN SELECT s.id, s.transaction_id, s.table_name, > s.op, s.data > FROM dbmirror.pending_statement AS s > WHERE s.transaction_id = transaction.id > ORDER BY s.id ASC > LOOP > count := count + 1; > > RETURN NEXT statement; > END LOOP; > > IF count > 100 THEN > EXIT; > END IF; > END LOOP; > > RETURN; > END;$BODY$ > LANGUAGE 'plpgsql' VOLATILE; David, I'm still a newbie and it may not affect performance but why are you aliasing the tables? Can you not simply use FOR transaction IN SELECT trans_id FROM pending_trans WHERE fetched = false ORDER BY trans_id LIMIT 50 and FOR statement IN SELECT id, transaction_id, table_name, op, data FROM dbmirror.pending_statement WHERE pending_statement.transaction_id = transaction.trans_id ORDER BY pending_statement.id I am pretty sure that the ORDER BY is slowing down both of these queries. Since you are going to go through the whole table eventually do you really need to sort the data at this point? -- Kind Regards, Keith From pgsql-performance-owner@postgresql.org Tue Jun 28 00:32: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 0FB4452886 for ; Tue, 28 Jun 2005 00:32:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95758-06 for ; Tue, 28 Jun 2005 03:32:05 +0000 (GMT) Received: from smtp005.bizmail.sc5.yahoo.com (smtp005.bizmail.sc5.yahoo.com [66.163.175.82]) by svr1.postgresql.org (Postfix) with SMTP id 063865294F for ; Tue, 28 Jun 2005 00:32:03 -0300 (ADT) Received: from unknown (HELO ?192.168.3.41?) (david.mitchell@telogis.com@203.98.10.169 with plain) by smtp005.bizmail.sc5.yahoo.com with SMTP; 28 Jun 2005 03:31:56 -0000 Message-ID: <42C0C4A4.9090809@telogis.com> Date: Tue, 28 Jun 2005 15:31:48 +1200 From: David Mitchell User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Kings-Lynne Cc: pgsql-performance@postgresql.org Subject: Re: How can I speed up this function? References: <42C0B7EE.4040608@telogis.com> <42C0BE50.3090105@familyhealth.com.au> <42C0BFC6.7070507@telogis.com> <42C0C204.1030301@familyhealth.com.au> In-Reply-To: <42C0C204.1030301@familyhealth.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/523 X-Sequence-Number: 13160 Christopher Kings-Lynne wrote: > > I'm curious - how did you write a multi-master replication package in > pgsql, when pgsql doesn't have 2 phase commits or any kind of > distributed syncing or conflict resolution in a release version? We didn't write it entirely in pgsql, there is a worker process that takes care of actually committing to the database. Cheers -- David Mitchell Software Engineer Telogis From pgsql-performance-owner@postgresql.org Tue Jun 28 00:35: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 D57AF528C3 for ; Tue, 28 Jun 2005 00:34:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96432-03 for ; Tue, 28 Jun 2005 03:33:59 +0000 (GMT) Received: from smtp008.bizmail.sc5.yahoo.com (smtp008.bizmail.sc5.yahoo.com [66.163.170.74]) by svr1.postgresql.org (Postfix) with SMTP id DA8895288B for ; Tue, 28 Jun 2005 00:33:58 -0300 (ADT) Received: from unknown (HELO ?192.168.3.41?) (david.mitchell@telogis.com@203.98.10.169 with plain) by smtp008.bizmail.sc5.yahoo.com with SMTP; 28 Jun 2005 03:33:52 -0000 Message-ID: <42C0C518.4020109@telogis.com> Date: Tue, 28 Jun 2005 15:33:44 +1200 From: David Mitchell User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: KeithW@NarrowPathInc.com Cc: pgsql-performance@postgresql.org Subject: Re: How can I speed up this function? References: <42C0B7EE.4040608@telogis.com> <42C0C226.8070201@NarrowPathInc.com> In-Reply-To: <42C0C226.8070201@NarrowPathInc.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-Archive-Number: 200506/524 X-Sequence-Number: 13161 Hi Keith, Unfortunately, we must have those sorts. The statements within a transaction must be executed on the slave in the same order as they were on the master, and similarly, transactions must also go in the same order. As for aliasing the tables, that is just a remnant from previous versions of the code. Thanks David Keith Worthington wrote: > I'm still a newbie and it may not affect performance but why are you > aliasing the tables? Can you not simply use > > FOR transaction IN SELECT trans_id > FROM pending_trans > WHERE fetched = false > ORDER BY trans_id > LIMIT 50 > > and > > FOR statement IN SELECT id, > transaction_id, > table_name, > op, > data > FROM dbmirror.pending_statement > WHERE pending_statement.transaction_id = > transaction.trans_id > ORDER BY pending_statement.id > > I am pretty sure that the ORDER BY is slowing down both of these > queries. Since you are going to go through the whole table eventually > do you really need to sort the data at this point? > -- David Mitchell Software Engineer Telogis From pgsql-performance-owner@postgresql.org Tue Jun 28 01:07: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 60961529AB for ; Tue, 28 Jun 2005 01:06:23 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06191-01 for ; Tue, 28 Jun 2005 04:06:21 +0000 (GMT) Received: from WM12.inbox.com (wm12.inbox.com [208.50.6.12]) by svr1.postgresql.org (Postfix) with SMTP id 4D16F52996 for ; Tue, 28 Jun 2005 01:06:20 -0300 (ADT) Received: from inbox.com (127.0.0.1:25) by inbox.com with [InBox.Com ESMTP Server] id <506270042810.WM12> for from ; Mon, 27 Jun 2005 8:06:13 PM -0800 Mime-Version: 1.0 Date: Mon, 27 Jun 2005 20:06:11 -0800 Message-ID: <96ACC448E50.000007FCs.gnanavel@inbox.com> From: Gnanavel Shanmugam Subject: Re: How can I speed up this function? To: David Mitchell , pgsql-performance@postgresql.org In-Reply-To: <42C0B7EE.4040608@telogis.com> X-Mailer: IBISIT WebMail 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=0.093 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/525 X-Sequence-Number: 13162 Merge the two select statements like this and try, SELECT t.trans_id as ID,s.id, s.transaction_id, s.table_name, s.op, s.data FROM pending_trans AS t join dbmirror.pending_statement AS s on (s.transaction_id=3Dt.id) WHERE t.fetched =3D false order by t.trans_id,s.id limit 100; If the above query works in the way you want, then you can also do the update using the same. with regards, S.Gnanavel > -----Original Message----- > From: david.mitchell=40telogis.com > Sent: Tue, 28 Jun 2005 14:37:34 +1200 > To: pgsql-performance=40postgresql.org > Subject: =5BPERFORM=5D How can I speed up this function? > > We have the following function in our home grown mirroring package, but > it isn't running as fast as we would like. We need to select statements > from the pending_statement table, and we want to select all the > statements for a single transaction (pending_trans) in one go (that is, > we either select all the statements for a transaction, or none of them). > We select as many blocks of statements as it takes to top the 100 > statement limit (so if the last transaction we pull has enough > statements to put our count at 110, we'll still take it, but then we're > done). > > Here is our function: > > CREATE OR REPLACE FUNCTION dbmirror.get_pending() > RETURNS SETOF dbmirror.pending_statement AS > =24BODY=24 > > DECLARE > count INT4; > transaction RECORD; > statement dbmirror.pending_statement; > BEGIN > count :=3D 0; > > FOR transaction IN SELECT t.trans_id as ID > FROM pending_trans AS t WHERE fetched =3D false > ORDER BY trans_id LIMIT 50 > LOOP > update pending_trans set fetched =3D true where trans_id =3D > transaction.id; > > =09 FOR statement IN SELECT s.id, s.transaction_id, s.table_name, s.op, > s.data > FROM dbmirror.pending_statement AS s > WHERE s.transaction_id =3D transaction.id > ORDER BY s.id ASC > LOOP > count :=3D count + 1; > > RETURN NEXT statement; > END LOOP; > > IF count > 100 THEN > EXIT; > END IF; > END LOOP; > > RETURN; > END;=24BODY=24 > LANGUAGE 'plpgsql' VOLATILE; > > Table Schemas: > > CREATE TABLE dbmirror.pending_trans > ( > trans_id oid NOT NULL, > fetched bool DEFAULT false, > CONSTRAINT pending_trans_pkey PRIMARY KEY (trans_id) > ) > WITHOUT OIDS; > > CREATE TABLE dbmirror.pending_statement > ( > id oid NOT NULL DEFAULT nextval('dbmirror.statement_id_seq'::text), > transaction_id oid NOT NULL, > table_name text NOT NULL, > op char NOT NULL, > data text NOT NULL, > CONSTRAINT pending_statement_pkey PRIMARY KEY (id) > ) > WITHOUT OIDS; > > CREATE UNIQUE INDEX idx_stmt_tran_id_id > ON dbmirror.pending_statement > USING btree > (transaction_id, id); > > Postgres 8.0.1 on Linux. > > Any Help would be greatly appreciated. > > Regards > > -- > David Mitchell > Software Engineer > Telogis > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend= From pgsql-performance-owner@postgresql.org Tue Jun 28 01:32: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 784825294D for ; Tue, 28 Jun 2005 01:29:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08105-09 for ; Tue, 28 Jun 2005 04:29:46 +0000 (GMT) Received: from smtp003.bizmail.yahoo.com (smtp003.bizmail.yahoo.com [216.136.130.195]) by svr1.postgresql.org (Postfix) with SMTP id 2675A52949 for ; Tue, 28 Jun 2005 01:29:45 -0300 (ADT) Received: from unknown (HELO ?192.168.3.41?) (david.mitchell@telogis.com@203.98.10.169 with plain) by smtp003.bizmail.yahoo.com with SMTP; 28 Jun 2005 04:29:41 -0000 Message-ID: <42C0D22C.6060609@telogis.com> Date: Tue, 28 Jun 2005 16:29:32 +1200 From: David Mitchell User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gnanavel Shanmugam Cc: pgsql-performance@postgresql.org Subject: Re: How can I speed up this function? References: <96ACC448E50.000007FCs.gnanavel@inbox.com> In-Reply-To: <96ACC448E50.000007FCs.gnanavel@inbox.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-Archive-Number: 200506/527 X-Sequence-Number: 13164 Hi Gnanavel, Thanks, but that will only return at most 100 statements. If there is a transaction with 110 statements then this will not return all the statements for that transaction. We need to make sure that the function returns all the statements for a transaction. Cheers David Gnanavel Shanmugam wrote: > Merge the two select statements like this and try, > > SELECT t.trans_id as ID,s.id, s.transaction_id, s.table_name, s.op, s.data > FROM pending_trans AS t join dbmirror.pending_statement AS s > on (s.transaction_id=t.id) > WHERE t.fetched = false order by t.trans_id,s.id limit 100; > > If the above query works in the way you want, then you can also do the > update > using the same. > > with regards, > S.Gnanavel > > > >>-----Original Message----- >>From: david.mitchell@telogis.com >>Sent: Tue, 28 Jun 2005 14:37:34 +1200 >>To: pgsql-performance@postgresql.org >>Subject: [PERFORM] How can I speed up this function? >> >>We have the following function in our home grown mirroring package, but >>it isn't running as fast as we would like. We need to select statements >>from the pending_statement table, and we want to select all the >>statements for a single transaction (pending_trans) in one go (that is, >>we either select all the statements for a transaction, or none of them). >>We select as many blocks of statements as it takes to top the 100 >>statement limit (so if the last transaction we pull has enough >>statements to put our count at 110, we'll still take it, but then we're >>done). >> >>Here is our function: >> >>CREATE OR REPLACE FUNCTION dbmirror.get_pending() >> RETURNS SETOF dbmirror.pending_statement AS >>$BODY$ >> >>DECLARE >> count INT4; >> transaction RECORD; >> statement dbmirror.pending_statement; >> BEGIN >> count := 0; >> >> FOR transaction IN SELECT t.trans_id as ID >> FROM pending_trans AS t WHERE fetched = false >> ORDER BY trans_id LIMIT 50 >> LOOP >> update pending_trans set fetched = true where trans_id = >>transaction.id; >> >> FOR statement IN SELECT s.id, s.transaction_id, s.table_name, s.op, >>s.data >> FROM dbmirror.pending_statement AS s >> WHERE s.transaction_id = transaction.id >> ORDER BY s.id ASC >> LOOP >> count := count + 1; >> >> RETURN NEXT statement; >> END LOOP; >> >> IF count > 100 THEN >> EXIT; >> END IF; >> END LOOP; >> >> RETURN; >> END;$BODY$ >> LANGUAGE 'plpgsql' VOLATILE; >> >>Table Schemas: >> >>CREATE TABLE dbmirror.pending_trans >>( >> trans_id oid NOT NULL, >> fetched bool DEFAULT false, >> CONSTRAINT pending_trans_pkey PRIMARY KEY (trans_id) >>) >>WITHOUT OIDS; >> >>CREATE TABLE dbmirror.pending_statement >>( >> id oid NOT NULL DEFAULT nextval('dbmirror.statement_id_seq'::text), >> transaction_id oid NOT NULL, >> table_name text NOT NULL, >> op char NOT NULL, >> data text NOT NULL, >> CONSTRAINT pending_statement_pkey PRIMARY KEY (id) >>) >>WITHOUT OIDS; >> >>CREATE UNIQUE INDEX idx_stmt_tran_id_id >> ON dbmirror.pending_statement >> USING btree >> (transaction_id, id); >> >>Postgres 8.0.1 on Linux. >> >>Any Help would be greatly appreciated. >> >>Regards >> >>-- >>David Mitchell >>Software Engineer >>Telogis >> >>---------------------------(end of broadcast)--------------------------- >>TIP 8: explain analyze is your friend -- David Mitchell Software Engineer Telogis From pgsql-performance-owner@postgresql.org Tue Jun 28 04:57: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 C4D525287E for ; Tue, 28 Jun 2005 01:42:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 09224-10 for ; Tue, 28 Jun 2005 04:42:32 +0000 (GMT) Received: from WM12.inbox.com (wm12.inbox.com [208.50.6.12]) by svr1.postgresql.org (Postfix) with SMTP id 0D0D652835 for ; Tue, 28 Jun 2005 01:42:31 -0300 (ADT) Received: from inbox.com (127.0.0.1:25) by inbox.com with [InBox.Com ESMTP Server] id <506270043866.WM12> for from ; Mon, 27 Jun 2005 8:42:30 PM -0800 Mime-Version: 1.0 Date: Mon, 27 Jun 2005 20:42:28 -0800 Message-ID: <96FDE539A64.0000082As.gnanavel@inbox.com> From: Gnanavel Shanmugam Subject: Re: How can I speed up this function? To: David Mitchell Cc: pgsql-performance@postgresql.org In-Reply-To: <42C0D22C.6060609@telogis.com> References: <96acc448e50.000007fcs.gnanavel@inbox.com> X-Mailer: IBISIT WebMail 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=0.082 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/542 X-Sequence-Number: 13179 But in the function you are exiting the loop when the count hits 100. If you do not want to limit the statements then remove the limit clause from the query I've written. with regards, S.Gnanavel > -----Original Message----- > From: david.mitchell=40telogis.com > Sent: Tue, 28 Jun 2005 16:29:32 +1200 > To: s.gnanavel=40inbox.com > Subject: Re: =5BPERFORM=5D How can I speed up this function? > > Hi Gnanavel, > > Thanks, but that will only return at most 100 statements. If there is a > transaction with 110 statements then this will not return all the > statements for that transaction. We need to make sure that the function > returns all the statements for a transaction. > > Cheers > > David > > Gnanavel Shanmugam wrote: > > Merge the two select statements like this and try, > > > > SELECT t.trans_id as ID,s.id, s.transaction_id, s.table_name, s.op, > s.data > > FROM pending_trans AS t join dbmirror.pending_statement AS s > > on (s.transaction_id=3Dt.id) > > WHERE t.fetched =3D false order by t.trans_id,s.id limit 100; > > > > If the above query works in the way you want, then you can also do the > > update > > using the same. > > > > with regards, > > S.Gnanavel > > > > > > > >>-----Original Message----- > >>From: david.mitchell=40telogis.com > >>Sent: Tue, 28 Jun 2005 14:37:34 +1200 > >>To: pgsql-performance=40postgresql.org > >>Subject: =5BPERFORM=5D How can I speed up this function? > >> > >>We have the following function in our home grown mirroring package, but > >>it isn't running as fast as we would like. We need to select statements > >>from the pending_statement table, and we want to select all the > >>statements for a single transaction (pending_trans) in one go (that is, > >>we either select all the statements for a transaction, or none of > them). > >>We select as many blocks of statements as it takes to top the 100 > >>statement limit (so if the last transaction we pull has enough > >>statements to put our count at 110, we'll still take it, but then we're > >>done). > >> > >>Here is our function: > >> > >>CREATE OR REPLACE FUNCTION dbmirror.get_pending() > >> RETURNS SETOF dbmirror.pending_statement AS > >>=24BODY=24 > >> > >>DECLARE > >> count INT4; > >> transaction RECORD; > >> statement dbmirror.pending_statement; > >> BEGIN > >> count :=3D 0; > >> > >> FOR transaction IN SELECT t.trans_id as ID > >> FROM pending_trans AS t WHERE fetched =3D false > >> ORDER BY trans_id LIMIT 50 > >> LOOP > >> update pending_trans set fetched =3D true where trans_id = =3D > >>transaction.id; > >> > >>=09 FOR statement IN SELECT s.id, s.transaction_id, s.table_name, > s.op, > >>s.data > >> FROM dbmirror.pending_statement AS s > >> WHERE s.transaction_id =3D transaction.id > >> ORDER BY s.id ASC > >> LOOP > >> count :=3D count + 1; > >> > >> RETURN NEXT statement; > >> END LOOP; > >> > >> IF count > 100 THEN > >> EXIT; > >> END IF; > >> END LOOP; > >> > >> RETURN; > >> END;=24BODY=24 > >> LANGUAGE 'plpgsql' VOLATILE; > >> > >>Table Schemas: > >> > >>CREATE TABLE dbmirror.pending_trans > >>( > >> trans_id oid NOT NULL, > >> fetched bool DEFAULT false, > >> CONSTRAINT pending_trans_pkey PRIMARY KEY (trans_id) > >>) > >>WITHOUT OIDS; > >> > >>CREATE TABLE dbmirror.pending_statement > >>( > >> id oid NOT NULL DEFAULT nextval('dbmirror.statement_id_seq'::text), > >> transaction_id oid NOT NULL, > >> table_name text NOT NULL, > >> op char NOT NULL, > >> data text NOT NULL, > >> CONSTRAINT pending_statement_pkey PRIMARY KEY (id) > >>) > >>WITHOUT OIDS; > >> > >>CREATE UNIQUE INDEX idx_stmt_tran_id_id > >> ON dbmirror.pending_statement > >> USING btree > >> (transaction_id, id); > >> > >>Postgres 8.0.1 on Linux. > >> > >>Any Help would be greatly appreciated. > >> > >>Regards > >> > >>-- > >>David Mitchell > >>Software Engineer > >>Telogis > >> > >>---------------------------(end of > broadcast)--------------------------- > >>TIP 8: explain analyze is your friend > > > -- > David Mitchell > Software Engineer > Telogis= From pgsql-patches-owner@postgresql.org Tue Jun 28 04:44:00 2005 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DE8E452972 for ; Tue, 28 Jun 2005 01:45:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13788-04 for ; Tue, 28 Jun 2005 04:45:25 +0000 (GMT) Received: from mail.Mi8.com (nycgw05.mi8.com [63.240.6.50]) by svr1.postgresql.org (Postfix) with ESMTP id 60B6252886 for ; Tue, 28 Jun 2005 01:45:21 -0300 (ADT) Received: from 172.16.1.118 by mail.Mi8.com with ESMTP (- GW05 Welcome to Mi8 Corporation www.Mi8.com); Tue, 28 Jun 2005 00:45:10 -0400 X-Server-Uuid: E0C866E6-C6CD-48B5-AE61-E57E73CF3CC7 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by d01smtp03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 28 Jun 2005 00:45:09 -0400 Received: from 24.5.173.15 ([24.5.173.15]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.104]) with Microsoft Exchange Server HTTP-DAV ; Tue, 28 Jun 2005 00:45:05 -0500 User-Agent: Microsoft-Entourage/11.1.0.040913 Date: Mon, 27 Jun 2005 21:44:59 -0700 Subject: Re: COPY FROM performance improvements From: "Luke Lonergan" To: "Andrew Dunstan" Cc: "Alvaro Herrera" , "Bruce Momjian" , "Alon Goldshuv" , pgsql-patches@postgresql.org Message-ID: In-Reply-To: <42C05F88.7000105@dunslane.net> MIME-Version: 1.0 X-OriginalArrivalTime: 28 Jun 2005 04:45:09.0283 (UTC) FILETIME=[29976730:01C57B9C] X-WSS-ID: 6EDE0A5C2EW3728066-01-01 Content-Type: multipart/mixed; boundary=B_3202753503_1429494 X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/542 X-Sequence-Number: 16274 > 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. --B_3202753503_1429494 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Andrew, > Something strange has happened. I suspect that you've inadvertantly used > GNU indent or an unpatched BSD indent. pgindent needs a special patched > BSD indent to work according to the PG standards - see the README OK - phew! I generated new symbols for pgindent and fixed a bug in the awk scripting within (diff attached) and ran against the CVS tip copy.c and got only minor changes in formatting that appear to be consistent with the rest of the code. I pgindent'ed the COPY FROM performance modded code and it looks good and tests good. Only formatting changes to the previous patch for copy.c attached. Patch to update pgindent with new symbols and fix a bug in an awk section (extra \\ in front of a ')'). - Luke --B_3202753503_1429494 Content-Type: application/octet-stream; name=fast_copy_V14_8.1.patch Content-Disposition: attachment; filename=fast_copy_V14_8.1.patch Content-Transfer-Encoding: base64 SW5kZXg6IHNyYy9iYWNrZW5kL2NvbW1hbmRzL2NvcHkuYwo9PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDU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0YXJ0OworIAorIAlpZiAoY2xpZW50X2VuY29kaW5nX29ubHkpCisgCXsK KyAJCWludAkJCW1ibGVuID0gcGdfZW5jb2RpbmdfbWJsZW4oY2xpZW50X2VuY29kaW5nLCBz KTsKKyAKKyAJCWZvciAoc3RhcnQgPSBzOyAqcyAhPSBjICYmIHMgPCBzdGFydCArIGxlbjsg cyArPSBtYmxlbikKKyAJCQltYmxlbiA9IHBnX2VuY29kaW5nX21ibGVuKGNsaWVudF9lbmNv ZGluZywgcyk7CisgCX0KKyAJZWxzZQorIAkJLyogc2FmZSB0byBzY3JvbGwgYnl0ZSBieSBi eXRlICovCisgCXsKKyAJCWZvciAoc3RhcnQgPSBzOyAqcyAhPSBjICYmIHMgPCBzdGFydCAr IGxlbjsgcysrKQorIAkJCTsKKyAJfQorIAorIAlyZXR1cm4gKCgqcyA9PSBjKSA/IChjaGFy ICopIHMgOiBOVUxMKTsKKyB9CisgCisgY2hhciAqCisgc3RyMmNocmxlbihjb25zdCBjaGFy ICpzLCBpbnQgYzEsIGludCBjMiwgc2l6ZV90IGxlbiwgY2hhciAqY19mb3VuZCkKKyB7Cisg CWNvbnN0IGNoYXIgKnN0YXJ0OworIAorIAkqY19mb3VuZCA9ICdcMCc7CisgCisgCWZvciAo c3RhcnQgPSBzOyAqcyAhPSBjMSAmJiAqcyAhPSBjMiAmJiBzIDwgc3RhcnQgKyBsZW47IHMr KykKKyAJCTsKKyAKKyAJKmNfZm91bmQgPSAqczsKKyAJcmV0dXJuICgqY19mb3VuZCAhPSAn XDAnID8gKGNoYXIgKikgcyA6IE5VTEwpOworIH0K --B_3202753503_1429494 Content-Type: application/octet-stream; name=pgindent-81.patch Content-Disposition: attachment; filename=pgindent-81.patch Content-Transfer-Encoding: base64 SW5kZXg6IHNyYy90b29scy9wZ2luZGVudC9wZ2luZGVudAo9PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBm aWxlO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cCiAgLVR4bF94YWN0X2Fib3J0IFwKICAt VHhsX3hhY3RfY29tbWl0IFwKICAtVHl5X3NpemVfdCBcCiAgLVR5eV9zdGF0ZV90eXBlIFwK ICAtVHpfc3RyZWFtIFwKICAtVHpfc3RyZWFtcCBcCiAgL3RtcC8kJGEgPi90bXAvJCQgMj4m MQo= --B_3202753503_1429494-- From pgsql-performance-owner@postgresql.org Tue Jun 28 04:39: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 9D43D528B1 for ; Tue, 28 Jun 2005 01:55:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11283-10 for ; Tue, 28 Jun 2005 04:55:10 +0000 (GMT) Received: from smtp004.bizmail.sc5.yahoo.com (smtp004.bizmail.sc5.yahoo.com [66.163.175.81]) by svr1.postgresql.org (Postfix) with SMTP id 24EFB52862 for ; Tue, 28 Jun 2005 01:55:08 -0300 (ADT) Received: from unknown (HELO ?192.168.3.41?) (david.mitchell@telogis.com@203.98.10.169 with plain) by smtp004.bizmail.sc5.yahoo.com with SMTP; 28 Jun 2005 04:55:08 -0000 Message-ID: <42C0D824.1030105@telogis.com> Date: Tue, 28 Jun 2005 16:55:00 +1200 From: David Mitchell User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gnanavel Shanmugam Cc: pgsql-performance@postgresql.org Subject: Re: How can I speed up this function? References: <96acc448e50.000007fcs.gnanavel@inbox.com> <96FDE539A64.0000082As.gnanavel@inbox.com> In-Reply-To: <96FDE539A64.0000082As.gnanavel@inbox.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-Archive-Number: 200506/541 X-Sequence-Number: 13178 The function I have exits the loop when the count hits 100 yes, but the inner loop can push the count up as high as necessary to select all the statements for a transaction, so by the time it exits, the count could be much higher. I do want to limit the statements, but I want to get enough for complete transactions. David Gnanavel Shanmugam wrote: > But in the function you are exiting the loop when the count hits 100. If you > do not want to limit the statements then remove the limit clause from the > query I've written. > > with regards, > S.Gnanavel > > > >>-----Original Message----- >>From: david.mitchell@telogis.com >>Sent: Tue, 28 Jun 2005 16:29:32 +1200 >>To: s.gnanavel@inbox.com >>Subject: Re: [PERFORM] How can I speed up this function? >> >>Hi Gnanavel, >> >>Thanks, but that will only return at most 100 statements. If there is a >>transaction with 110 statements then this will not return all the >>statements for that transaction. We need to make sure that the function >>returns all the statements for a transaction. >> >>Cheers >> >>David >> >>Gnanavel Shanmugam wrote: >> >>>Merge the two select statements like this and try, >>> >>>SELECT t.trans_id as ID,s.id, s.transaction_id, s.table_name, s.op, >> >>s.data >> >>> FROM pending_trans AS t join dbmirror.pending_statement AS s >>> on (s.transaction_id=t.id) >>>WHERE t.fetched = false order by t.trans_id,s.id limit 100; >>> >>> If the above query works in the way you want, then you can also do the >>>update >>>using the same. >>> >>>with regards, >>>S.Gnanavel >>> >>> >>> >>> >>>>-----Original Message----- >>>>From: david.mitchell@telogis.com >>>>Sent: Tue, 28 Jun 2005 14:37:34 +1200 >>>>To: pgsql-performance@postgresql.org >>>>Subject: [PERFORM] How can I speed up this function? >>>> >>>>We have the following function in our home grown mirroring package, but >>>>it isn't running as fast as we would like. We need to select statements >>> >>>>from the pending_statement table, and we want to select all the >>> >>>>statements for a single transaction (pending_trans) in one go (that is, >>>>we either select all the statements for a transaction, or none of >> >>them). >> >>>>We select as many blocks of statements as it takes to top the 100 >>>>statement limit (so if the last transaction we pull has enough >>>>statements to put our count at 110, we'll still take it, but then we're >>>>done). >>>> >>>>Here is our function: >>>> >>>>CREATE OR REPLACE FUNCTION dbmirror.get_pending() >>>> RETURNS SETOF dbmirror.pending_statement AS >>>>$BODY$ >>>> >>>>DECLARE >>>> count INT4; >>>> transaction RECORD; >>>> statement dbmirror.pending_statement; >>>> BEGIN >>>> count := 0; >>>> >>>> FOR transaction IN SELECT t.trans_id as ID >>>> FROM pending_trans AS t WHERE fetched = false >>>> ORDER BY trans_id LIMIT 50 >>>> LOOP >>>> update pending_trans set fetched = true where trans_id = >>>>transaction.id; >>>> >>>> FOR statement IN SELECT s.id, s.transaction_id, s.table_name, >> >>s.op, >> >>>>s.data >>>> FROM dbmirror.pending_statement AS s >>>> WHERE s.transaction_id = transaction.id >>>> ORDER BY s.id ASC >>>> LOOP >>>> count := count + 1; >>>> >>>> RETURN NEXT statement; >>>> END LOOP; >>>> >>>> IF count > 100 THEN >>>> EXIT; >>>> END IF; >>>> END LOOP; >>>> >>>> RETURN; >>>> END;$BODY$ >>>> LANGUAGE 'plpgsql' VOLATILE; >>>> >>>>Table Schemas: >>>> >>>>CREATE TABLE dbmirror.pending_trans >>>>( >>>> trans_id oid NOT NULL, >>>> fetched bool DEFAULT false, >>>> CONSTRAINT pending_trans_pkey PRIMARY KEY (trans_id) >>>>) >>>>WITHOUT OIDS; >>>> >>>>CREATE TABLE dbmirror.pending_statement >>>>( >>>> id oid NOT NULL DEFAULT nextval('dbmirror.statement_id_seq'::text), >>>> transaction_id oid NOT NULL, >>>> table_name text NOT NULL, >>>> op char NOT NULL, >>>> data text NOT NULL, >>>> CONSTRAINT pending_statement_pkey PRIMARY KEY (id) >>>>) >>>>WITHOUT OIDS; >>>> >>>>CREATE UNIQUE INDEX idx_stmt_tran_id_id >>>> ON dbmirror.pending_statement >>>> USING btree >>>> (transaction_id, id); >>>> >>>>Postgres 8.0.1 on Linux. >>>> >>>>Any Help would be greatly appreciated. >>>> >>>>Regards >>>> >>>>-- >>>>David Mitchell >>>>Software Engineer >>>>Telogis >>>> >>>>---------------------------(end of >> >>broadcast)--------------------------- >> >>>>TIP 8: explain analyze is your friend >> >> >>-- >>David Mitchell >>Software Engineer >>Telogis -- David Mitchell Software Engineer Telogis From pgsql-performance-owner@postgresql.org Tue Jun 28 04:21: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 8956552886 for ; Tue, 28 Jun 2005 02:16:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18157-06 for ; Tue, 28 Jun 2005 05:16:30 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id A0A7252813 for ; Tue, 28 Jun 2005 02:16:28 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j5S5GQun084639 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 27 Jun 2005 23:16:28 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j5S5GQG4018317; Mon, 27 Jun 2005 23:16:26 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j5S5GQYs018316; Mon, 27 Jun 2005 23:16:26 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 27 Jun 2005 23:16:26 -0600 From: Michael Fuhr To: Aditya Damle Cc: pgsql-performance@postgresql.org Subject: Re: LIKE search with ending % not optimized in v8 Message-ID: <20050628051626.GA18240@winnie.fuhr.org> References: <20050622090329.34686.qmail@web32910.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050622090329.34686.qmail@web32910.mail.mud.yahoo.com> 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: 200506/540 X-Sequence-Number: 13177 On Wed, Jun 22, 2005 at 02:03:29AM -0700, Aditya Damle wrote: > > Hello. I believe in earlier versions, a query of the > form > select attrib from ttt where attrib like 'foo%' would > be able to take advantage of an index. I have seen > this in the past. Currently I am using v8.0.3. From > what I can see is that the execultion plan seems to > use a seq scan and to totally ignore the index. Is > this the case? 8.0.3 can certainly use indexes for LIKE queries, but the planner will choose a sequential scan if it thinks that would be faster. Have you vacuumed and analyzed your tables? Could you post the EXPLAIN ANALYZE output of a query, once with enable_seqscan turned on and once with it turned off? See also "Operator Classes" in the "Indexes" chapter of the documentation: http://www.postgresql.org/docs/8.0/static/indexes-opclass.html What locale are you using? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Tue Jun 28 04: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 3BDAC5298D for ; Tue, 28 Jun 2005 02:27:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18860-08 for ; Tue, 28 Jun 2005 05:27:18 +0000 (GMT) Received: from WM12.inbox.com (wm12.inbox.com [208.50.6.12]) by svr1.postgresql.org (Postfix) with SMTP id DD17452949 for ; Tue, 28 Jun 2005 02:27:17 -0300 (ADT) Received: from inbox.com (127.0.0.1:25) by inbox.com with [InBox.Com ESMTP Server] id <506270045080.WM12> for from ; Mon, 27 Jun 2005 9:27:16 PM -0800 Mime-Version: 1.0 Date: Mon, 27 Jun 2005 21:27:14 -0800 Message-ID: <9761F49E8B0.0000087Cs.gnanavel@inbox.com> From: Gnanavel Shanmugam Subject: Re: How can I speed up this function? To: David Mitchell Cc: pgsql-performance@postgresql.org In-Reply-To: <42C0D824.1030105@telogis.com> References: <96fde539a64.0000082as.gnanavel@inbox.com> <96acc448e50.000007fcs.gnanavel@inbox.com> X-Mailer: IBISIT WebMail 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=0.077 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/539 X-Sequence-Number: 13176 I think the following logic will do want you expect FOR statement IN LOOP -- update statement goes here -- if count > 100 and temp <> transaction_id then // reaches here only if the transaction is complete return; else count:=3D count+1; temp:=3Dtransaction_id; end if; end loop; with regards, S.Gnanavel > -----Original Message----- > From: david.mitchell=40telogis.com > Sent: Tue, 28 Jun 2005 16:55:00 +1200 > To: s.gnanavel=40inbox.com > Subject: Re: =5BPERFORM=5D How can I speed up this function? > > The function I have exits the loop when the count hits 100 yes, but the > inner loop can push the count up as high as necessary to select all the > statements for a transaction, so by the time it exits, the count could > be much higher. I do want to limit the statements, but I want to get > enough for complete transactions. > > David > > Gnanavel Shanmugam wrote: > > But in the function you are exiting the loop when the count hits 100. > If you > > do not want to limit the statements then remove the limit clause from > the > > query I've written. > > > > with regards, > > S.Gnanavel > > > > > > > >>-----Original Message----- > >>From: david.mitchell=40telogis.com > >>Sent: Tue, 28 Jun 2005 16:29:32 +1200 > >>To: s.gnanavel=40inbox.com > >>Subject: Re: =5BPERFORM=5D How can I speed up this function? > >> > >>Hi Gnanavel, > >> > >>Thanks, but that will only return at most 100 statements. If there is a > >>transaction with 110 statements then this will not return all the > >>statements for that transaction. We need to make sure that the function > >>returns all the statements for a transaction. > >> > >>Cheers > >> > >>David > >> > >>Gnanavel Shanmugam wrote: > >> > >>>Merge the two select statements like this and try, > >>> > >>>SELECT t.trans_id as ID,s.id, s.transaction_id, s.table_name, s.op, > >> > >>s.data > >> > >>> FROM pending_trans AS t join dbmirror.pending_statement AS s > >>> on (s.transaction_id=3Dt.id) > >>>WHERE t.fetched =3D false order by t.trans_id,s.id limit 100; > >>> > >>> If the above query works in the way you want, then you can also do > the > >>>update > >>>using the same. > >>> > >>>with regards, > >>>S.Gnanavel > >>> > >>> > >>> > >>> > >>>>-----Original Message----- > >>>>From: david.mitchell=40telogis.com > >>>>Sent: Tue, 28 Jun 2005 14:37:34 +1200 > >>>>To: pgsql-performance=40postgresql.org > >>>>Subject: =5BPERFORM=5D How can I speed up this function? > >>>> > >>>>We have the following function in our home grown mirroring package, > but > >>>>it isn't running as fast as we would like. We need to select > statements > >>> > >>>>from the pending_statement table, and we want to select all the > >>> > >>>>statements for a single transaction (pending_trans) in one go (that > is, > >>>>we either select all the statements for a transaction, or none of > >> > >>them). > >> > >>>>We select as many blocks of statements as it takes to top the 100 > >>>>statement limit (so if the last transaction we pull has enough > >>>>statements to put our count at 110, we'll still take it, but then > we're > >>>>done). > >>>> > >>>>Here is our function: > >>>> > >>>>CREATE OR REPLACE FUNCTION dbmirror.get_pending() > >>>> RETURNS SETOF dbmirror.pending_statement AS > >>>>=24BODY=24 > >>>> > >>>>DECLARE > >>>> count INT4; > >>>> transaction RECORD; > >>>> statement dbmirror.pending_statement; > >>>> BEGIN > >>>> count :=3D 0; > >>>> > >>>> FOR transaction IN SELECT t.trans_id as ID > >>>> FROM pending_trans AS t WHERE fetched =3D false > >>>> ORDER BY trans_id LIMIT 50 > >>>> LOOP > >>>> update pending_trans set fetched =3D true where = trans_id =3D > >>>>transaction.id; > >>>> > >>>>=09 FOR statement IN SELECT s.id, s.transaction_id, s.table_name, > >> > >>s.op, > >> > >>>>s.data > >>>> FROM dbmirror.pending_statement AS s > >>>> WHERE s.transaction_id =3D transaction.id > >>>> ORDER BY s.id ASC > >>>> LOOP > >>>> count :=3D count + 1; > >>>> > >>>> RETURN NEXT statement; > >>>> END LOOP; > >>>> > >>>> IF count > 100 THEN > >>>> EXIT; > >>>> END IF; > >>>> END LOOP; > >>>> > >>>> RETURN; > >>>> END;=24BODY=24 > >>>> LANGUAGE 'plpgsql' VOLATILE; > >>>> > >>>>Table Schemas: > >>>> > >>>>CREATE TABLE dbmirror.pending_trans > >>>>( > >>>> trans_id oid NOT NULL, > >>>> fetched bool DEFAULT false, > >>>> CONSTRAINT pending_trans_pkey PRIMARY KEY (trans_id) > >>>>) > >>>>WITHOUT OIDS; > >>>> > >>>>CREATE TABLE dbmirror.pending_statement > >>>>( > >>>> id oid NOT NULL DEFAULT nextval('dbmirror.statement_id_seq'::text), > >>>> transaction_id oid NOT NULL, > >>>> table_name text NOT NULL, > >>>> op char NOT NULL, > >>>> data text NOT NULL, > >>>> CONSTRAINT pending_statement_pkey PRIMARY KEY (id) > >>>>) > >>>>WITHOUT OIDS; > >>>> > >>>>CREATE UNIQUE INDEX idx_stmt_tran_id_id > >>>> ON dbmirror.pending_statement > >>>> USING btree > >>>> (transaction_id, id); > >>>> > >>>>Postgres 8.0.1 on Linux. > >>>> > >>>>Any Help would be greatly appreciated. > >>>> > >>>>Regards > >>>> > >>>>-- > >>>>David Mitchell > >>>>Software Engineer > >>>>Telogis > >>>> > >>>>---------------------------(end of > >> > >>broadcast)--------------------------- > >> > >>>>TIP 8: explain analyze is your friend > >> > >> > >>-- > >>David Mitchell > >>Software Engineer > >>Telogis > > > -- > David Mitchell > Software Engineer > Telogis= From pgsql-performance-owner@postgresql.org Tue Jun 28 03:36: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 850615299C for ; Tue, 28 Jun 2005 02:53:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27335-06 for ; Tue, 28 Jun 2005 05:53: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 358EB52992 for ; Tue, 28 Jun 2005 02:53:26 -0300 (ADT) 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 j5S5rQ8I011127; Tue, 28 Jun 2005 01:53:26 -0400 (EDT) To: Jean-Max Reymond Cc: pgsql-performance@postgresql.org Subject: Re: perl garbage collector In-reply-to: <4b09a0c050627134660b3925@mail.gmail.com> References: <4b09a0c050627134660b3925@mail.gmail.com> Comments: In-reply-to Jean-Max Reymond message dated "Mon, 27 Jun 2005 22:46:48 +0200" Date: Tue, 28 Jun 2005 01:53:26 -0400 Message-ID: <11126.1119938006@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: 200506/538 X-Sequence-Number: 13175 Jean-Max Reymond writes: > I have a stored procedure written in perl and I doubt that perl's > garbage collector is working :-( > after a lot of work, postmaster has a size of 1100 Mb and I think > that the keyword "undef" has no effects. Check the PG list archives --- there's been previous discussion of similar issues. I think we concluded that when Perl is built to use its own private memory allocator, the results of that competing with malloc are not very pretty :-(. You end up with a fragmented memory map and no chance to give anything back to the OS. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 28 03:19: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 76A3852867 for ; Tue, 28 Jun 2005 03:04:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29516-08 for ; Tue, 28 Jun 2005 06:04:28 +0000 (GMT) Received: from mail.nordicbet.com (mail.nordicbet.com [193.69.167.130]) by svr1.postgresql.org (Postfix) with ESMTP id 764EA52838 for ; Tue, 28 Jun 2005 03:04:26 -0300 (ADT) Received: from [221.122.43.98] (helo=tobias.nordicbet.invalid) (Authenticated Sender=tobias@nordicbet.com) by mail.nordicbet.com with esmtpa (Exim 4.50 #1 (Debian)) id 1Dn9BR-0003oc-0K; Tue, 28 Jun 2005 08:03:28 +0200 Received: by tobias.nordicbet.invalid (Postfix, from userid 500) id CDC4FE0E4C; Tue, 28 Jun 2005 14:03:33 +0800 (CST) Date: Tue, 28 Jun 2005 14:03:33 +0800 From: Tobias Brox To: kjelle@bingon.no Cc: pgsql-performance@postgresql.org Subject: Re: Too slow querying a table of 15 million records Message-ID: <20050628060333.GH7652@tobias.exoweb.net> References: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net> Organization: Group Nordicbet 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: 200506/536 X-Sequence-Number: 13173 [kjelle@bingon.no - Tue at 08:33:58PM +0200] > I use FreeBSD 4.11 with PostGreSQL 7.3.8. (...) > database=> explain select date_trunc('hour', time),count(*) as total from > test where p1=53 and time > now() - interval '24 hours' group by > date_trunc order by date_trunc ; I haven't looked through all your email yet, but this phenomena have been up at the list a couple of times. Try replacing "now() - interval '24 hours'" with a fixed time stamp, and see if it helps. pg7 will plan the query without knowledge of what "now() - interval '24 hours'" will compute to. This should be fixed in pg8. -- Tobias Brox, +86-13521622905 Nordicbet, IT dept From pgsql-performance-owner@postgresql.org Tue Jun 28 03:19: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 EDEB052862 for ; Tue, 28 Jun 2005 03:18:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32056-08 for ; Tue, 28 Jun 2005 06:18:45 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1A9DA52818 for ; Tue, 28 Jun 2005 03:18:44 -0300 (ADT) 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 j5S6IiHG011352; Tue, 28 Jun 2005 02:18:44 -0400 (EDT) To: meetesh.karia@alumni.duke.edu Cc: pgsql-performance@postgresql.org Subject: Re: How are text columns stored? In-reply-to: References: Comments: In-reply-to Meetesh Karia message dated "Thu, 23 Jun 2005 12:40:15 +0200" Date: Tue, 28 Jun 2005 02:18:44 -0400 Message-ID: <11351.1119939524@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: 200506/537 X-Sequence-Number: 13174 Meetesh Karia writes: > According to section 8.3 of the doc: > "Long values are also stored in background tables so they do not interfere > with rapid access to the shorter column values." > So, how long does a value have to be to be considered "long"? Several kilobytes. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 28 06:48: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 2DD5652838 for ; Tue, 28 Jun 2005 03:26:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 36376-05 for ; Tue, 28 Jun 2005 06:26:45 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 10A46529BD for ; Tue, 28 Jun 2005 03:26:42 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j5S6QMeE084703 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 28 Jun 2005 00:26:25 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j5S6QMwh018757; Tue, 28 Jun 2005 00:26:22 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j5S6QKbU018756; Tue, 28 Jun 2005 00:26:20 -0600 (MDT) (envelope-from mfuhr) Date: Tue, 28 Jun 2005 00:26:20 -0600 From: Michael Fuhr To: "Chun Yit(Chronos)" Cc: pgsql-performance@postgresql.org Subject: Re: Postgresql7.4.5 running slow on plpgsql function Message-ID: <20050628062620.GB18635@winnie.fuhr.org> References: <000601c577d9$e2658600$a279640a@Beh> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000601c577d9$e2658600$a279640a@Beh> 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: 200506/546 X-Sequence-Number: 13183 On Thu, Jun 23, 2005 at 05:56:52PM +0800, Chun Yit(Chronos) wrote: > > currently we have a function that use together with temp table, it calls > search result function, everytime this function is calling, it will go > through some filter before come out as a result. now we have some major > problem , the first time the function execute, it take about 13 second > second time the function is execute, it take about 17 second, every time > you execute the function the time taken will grow about 4 second, ? may > i know what going on here? since we use function with temp table, so > every statement that related to temp table will using EXECUTE command. Could you post the function? Without knowing what the code is doing it's impossible to say what's happening. Is the temporary table growing on each function call? Does the function delete records from the table on each call, leaving a lot of dead tuples? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Tue Jun 28 06:47: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 40321529D1 for ; Tue, 28 Jun 2005 03:35:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37787-08 for ; Tue, 28 Jun 2005 06:35:36 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id 85BEA5294D for ; Tue, 28 Jun 2005 03:35:35 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050628063512m9100nghhie>; Tue, 28 Jun 2005 06:35:32 +0000 Received: by juju.arbash-meinel.com (Postfix, from userid 505) id 35DE95606A; Tue, 28 Jun 2005 01:35:12 -0500 (CDT) Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 10B4D55FC7; Tue, 28 Jun 2005 01:35:08 -0500 (CDT) Message-ID: <42C0EF9B.3070308@arbash-meinel.com> Date: Tue, 28 Jun 2005 01:35:07 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tobias Brox Cc: kjelle@bingon.no, pgsql-performance@postgresql.org Subject: Re: Too slow querying a table of 15 million records References: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net> <20050628060333.GH7652@tobias.exoweb.net> In-Reply-To: <20050628060333.GH7652@tobias.exoweb.net> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig76D67AF24F1A8A72FBCD848C" 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: 200506/545 X-Sequence-Number: 13182 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig76D67AF24F1A8A72FBCD848C Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Tobias Brox wrote: >[kjelle@bingon.no - Tue at 08:33:58PM +0200] > > >>I use FreeBSD 4.11 with PostGreSQL 7.3.8. >> >> >(...) > > >>database=> explain select date_trunc('hour', time),count(*) as total from >>test where p1=53 and time > now() - interval '24 hours' group by >>date_trunc order by date_trunc ; >> >> > >I haven't looked through all your email yet, but this phenomena have been up >at the list a couple of times. Try replacing "now() - interval '24 hours'" >with a fixed time stamp, and see if it helps. > >pg7 will plan the query without knowledge of what "now() - interval '24 >hours'" will compute to. This should be fixed in pg8. > > > The grandparent was a mailing list double send. Notice the date is 1 week ago. It has already been answered (though your answer is still correct). John =:-> --------------enig76D67AF24F1A8A72FBCD848C 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCwO+bJdeBCYSNAAMRAi1CAKDWsx+D5csdT6oEtuRyeuTB/fhsqACfbGto JR4yWVJ4QQmfzHOfqqns+q0= =trN6 -----END PGP SIGNATURE----- --------------enig76D67AF24F1A8A72FBCD848C-- From pgsql-performance-owner@postgresql.org Tue Jun 28 06:31: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 D0900529CB for ; Tue, 28 Jun 2005 03:41:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38441-10 for ; Tue, 28 Jun 2005 06:41:01 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id C1AEE52A21 for ; Tue, 28 Jun 2005 03:40:59 -0300 (ADT) 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 j5S6euqE011498; Tue, 28 Jun 2005 02:40:57 -0400 (EDT) To: "Karl O. Pinc" Cc: pgsql-performance@postgresql.org Subject: Re: Poor index choice -- multiple indexes of the same columns In-reply-to: <1119913766l.4428l.2l@mofo> References: <1119913766l.4428l.2l@mofo> Comments: In-reply-to "Karl O. Pinc" message dated "Mon, 27 Jun 2005 23:09:26 -0000" Date: Tue, 28 Jun 2005 02:40:56 -0400 Message-ID: <11497.1119940856@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: 200506/544 X-Sequence-Number: 13181 "Karl O. Pinc" writes: > I have a query > select 1 > from census > where date < '1975-9-21' and sname = 'RAD' and status != 'A' > limit 1; > Explain analyze says it always uses the index made by: > CREATE INDEX census_date_sname ON census (date, sname); > this is even after I made the index: > CREATE INDEX census_sname_date ON census (sname, date); I don't believe that any existing release can tell the difference between these two indexes as far as costs go. I just recently added some code to btcostestimate that would cause it to prefer the index on (sname, date) but of course that's not released yet. However: isn't the above query pretty seriously underspecified? With a LIMIT and no ORDER BY, you are asking for a random one of the rows matching the condition. I realize that with "select 1" you may not care much, but adding a suitable ORDER BY would help push the planner towards using the right index. In this case "ORDER BY sname DESC, date DESC" would probably do the trick. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 28 05:33: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 49C80529E5 for ; Tue, 28 Jun 2005 05:33:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64481-02 for ; Tue, 28 Jun 2005 08:33:16 +0000 (GMT) Received: from mailhub1.une.edu.au (mailhub1.une.edu.au [129.180.1.122]) by svr1.postgresql.org (Postfix) with ESMTP id 368D352862 for ; Tue, 28 Jun 2005 05:33:14 -0300 (ADT) Received: from icarus.une.edu.au (icarus.une.edu.au [129.180.47.120]) by mailhub1.une.edu.au (Postfix) with ESMTP id 610E57EA0; Tue, 28 Jun 2005 18:33:16 +1000 (EST) Received: from kgb (unknown [129.180.47.225]) by icarus.une.edu.au (Postfix) with SMTP id 49C02355562; Tue, 28 Jun 2005 18:33:16 +1000 (EST) Date: Tue, 28 Jun 2005 18:36:35 +1000 From: Klint Gore To: David Mitchell Cc: pgsql-performance@postgresql.org Subject: Re: How can I speed up this function? In-Reply-To: <42C0B7EE.4040608@telogis.com> References: <42C0B7EE.4040608@telogis.com> Message-Id: <42C10C1338.6F82KG@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.002 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/543 X-Sequence-Number: 13180 On Tue, 28 Jun 2005 14:37:34 +1200, David Mitchell wrote: > FOR transaction IN SELECT t.trans_id as ID > FROM pending_trans AS t WHERE fetched = false > ORDER BY trans_id LIMIT 50 What the the average number of statements per transaction? if avg > 2 then you could save a small amount of time by lowering the limit. You might also save some time by using FOR UPDATE on the select since the next thing you're going to do is update the value. > FOR statement IN SELECT s.id, s.transaction_id, s.table_name, s.op, > s.data > FROM dbmirror.pending_statement AS s > WHERE s.transaction_id = transaction.id > ORDER BY s.id ASC Have you explained this to make sure it's using the created index? You might need to order by both transaction_id, id. 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 Tue Jun 28 07:54: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 20E905298B for ; Tue, 28 Jun 2005 05:48:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 66792-07 for ; Tue, 28 Jun 2005 08:48:37 +0000 (GMT) Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com [203.22.197.21]) by svr1.postgresql.org (Postfix) with ESMTP id 6FB31529EF for ; Tue, 28 Jun 2005 05:48:34 -0300 (ADT) Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) by houston.familyhealth.com.au (Postfix) with ESMTP id 463C425114; Tue, 28 Jun 2005 16:48:31 +0800 (WST) Received: from [127.0.0.1] (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (Postfix) with ESMTP id 2C06125113; Tue, 28 Jun 2005 16:48:31 +0800 (WST) Message-ID: <42C10F62.8030703@familyhealth.com.au> Date: Tue, 28 Jun 2005 16:50:42 +0800 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: kjelle@bingon.no Cc: pgsql-performance@postgresql.org Subject: Re: Too slow querying a table of 15 million records References: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net> In-Reply-To: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net> 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.063 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/549 X-Sequence-Number: 13186 > database=> explain select date_trunc('hour', time),count(*) as total from > test where p1=53 and time > now() - interval '24 hours' group by > date_trunc order by date_trunc ; Try going: time > '2005-06-28 15:34:00' ie. put in the time 24 hours ago as a literal constant. Chris From pgsql-performance-owner@postgresql.org Tue Jun 28 07:21: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 DBFCB5280A for ; Tue, 28 Jun 2005 06:46:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80513-04 for ; Tue, 28 Jun 2005 09:46:12 +0000 (GMT) Received: from mail.sto.netlight.se (1-1-10-39a.sh.sth.bostream.se [82.182.50.216]) by svr1.postgresql.org (Postfix) with ESMTP id 92CAC52999 for ; Tue, 28 Jun 2005 06:46:04 -0300 (ADT) Received: from prraxp ([192.168.12.76]) by mail.sto.netlight.se (8.11.2/8.11.2) with ESMTP id j5SAYc306375; Tue, 28 Jun 2005 12:34:39 +0200 From: "Praveen Raja" To: "'Jacques Caron'" Cc: Subject: Re: Insert performance vs Table size Date: Tue, 28 Jun 2005 11:50:08 +0200 Message-ID: <002401c57bc6$ca56e2c0$4c0ca8c0@sto.netlight.se> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 In-Reply-To: <6.2.0.14.0.20050627135541.055202c0@wheresmymailserver.com> Importance: Normal 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: 200506/547 X-Sequence-Number: 13184 I assume you took size to mean the row size? What I really meant was does the number of rows a table has affect the performance of new inserts into the table (just INSERTs) all other things remaining constant. Sorry for the confusion. I know that having indexes on the table adds an overhead but again does this overhead increase (for an INSERT operation) with the number of rows the table contains? My instinct says no to both. If I'm wrong can someone explain why the number of rows in a table affects INSERT performance? Thanks again -----Original Message----- From: Jacques Caron [mailto:jc@directinfos.com] Sent: 27 June 2005 14:05 To: Praveen Raja Cc: pgsql-performance@postgresql.org Subject: RE: [PERFORM] Insert performance vs Table size Hi, At 13:50 27/06/2005, Praveen Raja wrote: >Just to clear things up a bit, the scenario that I'm interested in is a >table with a large number of indexes on it (maybe 7-8). If you're after performance you'll want to carefully consider which indexes are really useful and/or redesign your schema so that you can have less indexes on that table. 7 or 8 indexes is quite a lot, and that really has a cost. > In this scenario >other than the overhead of having to maintain the indexes (which I'm >guessing is the same regardless of the size of the table) Definitely not: indexes grow with the size of the table. Depending on what columns you index (and their types), the indexes may be a fraction of the size of the table, or they may be very close in size (in extreme cases they may even be larger). With 7 or 8 indexes, that can be quite a large volume of data to manipulate, especially if the values of the columns inserted can span the whole range of the index (rather than being solely id- or time-based, for instance, in which case index updates are concentrated in a small area of each of the indexes), as this means you'll need to have a majority of the indexes in RAM if you want to maintain decent performance. >does the size of the table play a role in determining insert performance >(and I mean >only insert performance)? In this case, it's really the indexes that'll cause you trouble, though heavily fragmented tables (due to lots of deletes or updates) will also incur a penalty just for the data part of the inserts. Also, don't forget the usual hints if you are going to do lots of inserts: - batch them in large transactions, don't do them one at a time - better yet, use COPY rather than INSERT - in some situations, you might be better of dropping the indexes, doing large batch inserts, then re-creating the indexes. YMMV depending on the existing/new ratio, whether you need to maintain indexed access to the tables, etc. - pay attention to foreign keys Jacques. From pgsql-performance-owner@postgresql.org Tue Jun 28 07:45: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 7910A52A8C for ; Tue, 28 Jun 2005 07:44:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 93530-03 for ; Tue, 28 Jun 2005 10:44:08 +0000 (GMT) Received: from mars.interactivemediafactory.net (mars.imfeurope.net [194.2.222.161]) by svr1.postgresql.org (Postfix) with ESMTP id 6AB2F52A88 for ; Tue, 28 Jun 2005 07:44:06 -0300 (ADT) Received: from JC-8600.directinfos.com (localhost [127.0.0.1]) by mars.interactivemediafactory.net (8.12.11/8.12.11) with ESMTP id j5SAi0dA089177; Tue, 28 Jun 2005 12:44:01 +0200 (CEST) (envelope-from jc@directinfos.com) Message-Id: <6.2.0.14.0.20050628123516.03ac59e0@wheresmymailserver.com> X-Mailer: QUALCOMM Windows Eudora Version 6.2.0.14 Date: Tue, 28 Jun 2005 12:43:47 +0200 To: "Praveen Raja" From: Jacques Caron Subject: Re: Insert performance vs Table size Cc: In-Reply-To: <002401c57bc6$ca56e2c0$4c0ca8c0@sto.netlight.se> References: <6.2.0.14.0.20050627135541.055202c0@wheresmymailserver.com> <002401c57bc6$ca56e2c0$4c0ca8c0@sto.netlight.se> 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.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/548 X-Sequence-Number: 13185 Hi, At 11:50 28/06/2005, Praveen Raja wrote: >I assume you took size to mean the row size? Nope, the size of the table. > What I really meant was >does the number of rows a table has affect the performance of new >inserts into the table (just INSERTs) all other things remaining >constant. Sorry for the confusion. As I said previously, in most cases it does. One of the few cases where it doesn't would be an append-only table, no holes, no indexes, no foreign keys... >I know that having indexes on the table adds an overhead but again does >this overhead increase (for an INSERT operation) with the number of rows >the table contains? It depends on what you are indexing. If the index key is something that grows monotonically (e.g. a unique ID or a timestamp), then the size of the table (and hence of the indexes) should have a very limited influence on the INSERTs. If the index key is anything else (and that must definitely be the case if you have 7 or 8 indexes!), then that means updates will happen all over the indexes, which means a lot of read and write activity, and once the total size of your indexes exceeds what can be cached in RAM, performance will decrease quite a bit. Of course if your keys are concentrated in a few limited areas of the key ranges it might help. >My instinct says no to both. If I'm wrong can someone explain why the >number of rows in a table affects INSERT performance? As described above, maintaining indexes when you "hit" anywhere in said indexes is very costly. The larger the table, the larger the indexes, the higher the number of levels in the trees, etc. As long as it fits in RAM, it shouldn't be a problem. Once you exceed that threshold, you start getting a lot of random I/O, and that's expensive. Again, it depends a lot on your exact schema, the nature of the data, the spread of the different values, etc, but I would believe it's more often the case than not. Jacques. From pgsql-patches-owner@postgresql.org Tue Jun 28 09:54:26 2005 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1525452A06 for ; Tue, 28 Jun 2005 09:54:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19359-08 for ; Tue, 28 Jun 2005 12:54:16 +0000 (GMT) Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) by svr1.postgresql.org (Postfix) with ESMTP id CD25B528D5 for ; Tue, 28 Jun 2005 09:54:15 -0300 (ADT) Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com [24.211.165.134]) (authenticated (0 bits)) by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j5SC7c512569; Tue, 28 Jun 2005 07:07:38 -0500 Message-ID: <42C1485E.3080008@dunslane.net> Date: Tue, 28 Jun 2005 08:53:50 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.7.8-1.3.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luke Lonergan Cc: Alvaro Herrera , Bruce Momjian , Alon Goldshuv , pgsql-patches@postgresql.org Subject: Re: COPY FROM performance improvements 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.025 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/546 X-Sequence-Number: 16278 Luke, Alon OK, I'm going to apply the patch to my copy and try to get my head around it. meanwhile: . we should not be describing things as "old" or "new". The person reading the code might have no knowledge of the history, and should not need to. . we should not have "slow" and "fast" either. We should have "text", "csv" and "binary". IOW, the patch comments look slightly like it is intended for after the fact application rather than incorporation into the main code. Are you looking at putting CSV mode into the fast code? Please let me know if you have questions about that. There are only a few days left to whip this into shape. cheers andrew Luke Lonergan wrote: >Andrew, > > > >>Something strange has happened. I suspect that you've inadvertantly used >>GNU indent or an unpatched BSD indent. pgindent needs a special patched >>BSD indent to work according to the PG standards - see the README >> >> > >OK - phew! I generated new symbols for pgindent and fixed a bug in the awk >scripting within (diff attached) and ran against the CVS tip copy.c and got >only minor changes in formatting that appear to be consistent with the rest >of the code. I pgindent'ed the COPY FROM performance modded code and it >looks good and tests good. > >Only formatting changes to the previous patch for copy.c attached. > >Patch to update pgindent with new symbols and fix a bug in an awk section >(extra \\ in front of a ')'). > >- Luke > > > From pgsql-performance-owner@postgresql.org Tue Jun 28 11:35: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 25D18529E7 for ; Tue, 28 Jun 2005 11:18:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40345-04 for ; Tue, 28 Jun 2005 14:18:02 +0000 (GMT) Received: from web31810.mail.mud.yahoo.com (web31810.mail.mud.yahoo.com [68.142.207.73]) by svr1.postgresql.org (Postfix) with SMTP id 6F4EC528B9 for ; Tue, 28 Jun 2005 11:18:01 -0300 (ADT) Received: (qmail 82240 invoked by uid 60001); 28 Jun 2005 14:18:05 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=InqJAvdOVmEjB4STfJ+LlEtA61/jlTTyjX5Z3L/UWJ0oR3KOyreaeKCV1bjN6n47+xUFWcn5f7NuEg/6lmpgKgTUaZeDGKzPMOr2ql92pkg+5OOkiVdHvVK4PNe/H+Xdi4OcYxYZN64HLW3zHMqY6sdPGaepe61Ru5dUeptkh+4= ; Message-ID: <20050628141805.82238.qmail@web31810.mail.mud.yahoo.com> Received: from [199.103.241.59] by web31810.mail.mud.yahoo.com via HTTP; Tue, 28 Jun 2005 07:18:05 PDT Date: Tue, 28 Jun 2005 07:18:05 -0700 (PDT) From: Erik Westland To: pgsql-performance@postgresql.org 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=4.118 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, FORGED_YAHOO_RCVD, MISSING_SUBJECT X-Spam-Level: **** X-Archive-Number: 200506/551 X-Sequence-Number: 13188 ____________________________________________________ Yahoo! Sports Rekindle the Rivalries. Sign up for Fantasy Football http://football.fantasysports.yahoo.com From pgsql-performance-owner@postgresql.org Tue Jun 28 11: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 120BA52A01 for ; Tue, 28 Jun 2005 11:21:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40514-02 for ; Tue, 28 Jun 2005 14:21:14 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 4F0B7529AA for ; Tue, 28 Jun 2005 11:21:13 -0300 (ADT) 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: tricky query Date: Tue, 28 Jun 2005 10:21:16 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: tricky query thread-index: AcV77KWBagcY5UVsQgG52wG3WgiS/A== From: "Merlin Moncure" To: 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: 200506/550 X-Sequence-Number: 13187 I need a fast way (sql only preferred) to solve the following problem: I need the smallest integer that is greater than zero that is not in the column of a table. In other words, if an 'id' column has values 1,2,3,4,6 and 7, I need a query that returns the value of 5. I've already worked out a query using generate_series (not scalable) and pl/pgsql. An SQL only solution would be preferred, am I missing something obvious? Merlin From pgsql-performance-owner@postgresql.org Tue Jun 28 12:43: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 B2FC452AB6 for ; Tue, 28 Jun 2005 11:26:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39861-07 for ; Tue, 28 Jun 2005 14:26:06 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4269E52A37 for ; Tue, 28 Jun 2005 11:26:03 -0300 (ADT) 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 j5SEPxBE014992; Tue, 28 Jun 2005 10:26:00 -0400 (EDT) To: "Praveen Raja" Cc: "'Jacques Caron'" , pgsql-performance@postgresql.org Subject: Re: Insert performance vs Table size In-reply-to: <002401c57bc6$ca56e2c0$4c0ca8c0@sto.netlight.se> References: <002401c57bc6$ca56e2c0$4c0ca8c0@sto.netlight.se> Comments: In-reply-to "Praveen Raja" message dated "Tue, 28 Jun 2005 11:50:08 +0200" Date: Tue, 28 Jun 2005 10:25:59 -0400 Message-ID: <14991.1119968759@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: 200506/555 X-Sequence-Number: 13192 "Praveen Raja" writes: > I know that having indexes on the table adds an overhead but again does > this overhead increase (for an INSERT operation) with the number of rows > the table contains? Typical index implementations (such as b-tree) have roughly O(log N) cost to insert or lookup a key in an N-entry index. So yes, it grows, though slowly. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 28 12:27: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 CE7DC52A06; Tue, 28 Jun 2005 11:45:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44783-06; Tue, 28 Jun 2005 14:45:21 +0000 (GMT) Received: from notes.beauchamp.loxane.fr (unknown [217.167.112.209]) by svr1.postgresql.org (Postfix) with ESMTP id 035E852A03; Tue, 28 Jun 2005 11:45:19 -0300 (ADT) To: "Merlin Moncure" Cc: pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org Subject: =?iso-8859-1?Q?R=E9f=2E_=3A__tricky_query?= MIME-Version: 1.0 X-Mailer: Lotus Notes Release 5.0.10 March 22, 2002 Message-ID: From: bsimon@loxane.com Date: Tue, 28 Jun 2005 16:50:17 +0200 X-MIMETrack: Serialize by Router on notes/Loxane(Release 5.0.10 |March 22, 2002) at 28/06/2005 16:50:22, Serialize complete at 28/06/2005 16:50:22 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.215 tagged_above=0 required=5 tests=AWL, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200506/554 X-Sequence-Number: 13191 I would suggest something like this, don't know how fast it is ... : SELECT (ID +1) as result FROM my=5Ftable WHERE (ID+1) NOT IN (SELECT ID FROM my=5Ftable) as tmp ORDER BY result asc limit 1; "Merlin Moncure" Envoy=E9 par : pgsql-performance-owner@postgresql.org 28/06/2005 16:21 =20 Pour : cc :=20 Objet : [PERFORM] tricky query I need a fast way (sql only preferred) to solve the following problem: I need the smallest integer that is greater than zero that is not in the column of a table. In other words, if an 'id' column has values 1,2,3,4,6 and 7, I need a query that returns the value of 5. I've already worked out a query using generate=5Fseries (not scalable) and pl/pgsql. An SQL only solution would be preferred, am I missing something obvious? Merlin ---------------------------(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 Tue Jun 28 12:20: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 1EC19528C1 for ; Tue, 28 Jun 2005 12:08:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50917-03 for ; Tue, 28 Jun 2005 15:08:10 +0000 (GMT) Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) by svr1.postgresql.org (Postfix) with ESMTP id 2E2A852848 for ; Tue, 28 Jun 2005 12:08:09 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP id <20050628150804m92008i5hhe>; Tue, 28 Jun 2005 15:08:08 +0000 Received: by juju.arbash-meinel.com (Postfix, from userid 505) id 368D45606A; Tue, 28 Jun 2005 10:08:04 -0500 (CDT) Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 35D2055FCB; Tue, 28 Jun 2005 10:07:51 -0500 (CDT) Message-ID: <42C167C6.5070108@arbash-meinel.com> Date: Tue, 28 Jun 2005 10:07:50 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Merlin Moncure Cc: pgsql-performance@postgresql.org Subject: Re: tricky query References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig993DD4397E8462A824F32F2F" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/553 X-Sequence-Number: 13190 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig993DD4397E8462A824F32F2F Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Merlin Moncure wrote: >I need a fast way (sql only preferred) to solve the following problem: > >I need the smallest integer that is greater than zero that is not in the >column of a table. In other words, if an 'id' column has values >1,2,3,4,6 and 7, I need a query that returns the value of 5. > >I've already worked out a query using generate_series (not scalable) and >pl/pgsql. An SQL only solution would be preferred, am I missing >something obvious? > >Merlin > > Not so bad. Try something like this: SELECT min(id+1) as id_new FROM table WHERE (id+1) NOT IN (SELECT id FROM table); Now, this requires probably a sequential scan, but I'm not sure how you can get around that. Maybe if you got trickier and did some ordering and limits. The above seems to give the right answer, though. I don't know how big you want to scale to. You might try something like: SELECT id+1 as id_new FROM t WHERE (id+1) NOT IN (SELECT id FROM t) ORDER BY id LIMIT 1; John =:-> --------------enig993DD4397E8462A824F32F2F 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCwWfGJdeBCYSNAAMRAsNFAKCdYfJ4aZjw0bNhNnCcugH8qnn2ngCfTWTz Aus1toBGdKn7YRJA8ZePgmg= =JxB0 -----END PGP SIGNATURE----- --------------enig993DD4397E8462A824F32F2F-- From pgsql-performance-owner@postgresql.org Tue Jun 28 12:16: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 E523A529F0 for ; Tue, 28 Jun 2005 12:12:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52715-03 for ; Tue, 28 Jun 2005 15:12:50 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id F196B529BD for ; Tue, 28 Jun 2005 12:12:49 -0300 (ADT) Received: (qmail 29924 invoked by uid 500); 28 Jun 2005 15:12:46 -0000 Date: Tue, 28 Jun 2005 10:12:46 -0500 From: Bruno Wolff III To: Merlin Moncure Cc: pgsql-performance@postgresql.org Subject: Re: tricky query Message-ID: <20050628151246.GA29773@wolff.to> Mail-Followup-To: Bruno Wolff III , Merlin Moncure , pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> User-Agent: Mutt/1.5.6i 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: 200506/552 X-Sequence-Number: 13189 On Tue, Jun 28, 2005 at 10:21:16 -0400, Merlin Moncure wrote: > I need a fast way (sql only preferred) to solve the following problem: > > I need the smallest integer that is greater than zero that is not in the > column of a table. In other words, if an 'id' column has values > 1,2,3,4,6 and 7, I need a query that returns the value of 5. > > I've already worked out a query using generate_series (not scalable) and > pl/pgsql. An SQL only solution would be preferred, am I missing > something obvious? I would expect that using generate series from the 1 to the max (using order by and limit 1 to avoid extra sequential scans) and subtracting out the current list using except and then taking the minium value would be the best way to do this if the list is pretty dense and you don't want to change the structure. If it is sparse than you can do a special check for 1 and if that is present find the first row whose successor is not in the table. That shouldn't be too slow. If you are willing to change the structure you might keep one row for each number and use a flag to mark which ones are empty. If there are relatively few empty rows at any time, then you can create a partial index on the row number for only empty rows. From pgsql-performance-owner@postgresql.org Tue Jun 28 13:57: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 D5DB552A34 for ; Tue, 28 Jun 2005 12:20:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52946-09 for ; Tue, 28 Jun 2005 15:20:33 +0000 (GMT) Received: from ebrsrv01.ebravo.it (host53-205.pool8534.interbusiness.it [85.34.205.53]) by svr1.postgresql.org (Postfix) with ESMTP id 93B0852A15 for ; Tue, 28 Jun 2005 12:20:29 -0300 (ADT) Received: from [192.168.11.103] ([192.168.11.103]) (authenticated) by ebrsrv01.ebravo.it (8.11.6/8.12.5) with ESMTP id j5SFKIY26481; Tue, 28 Jun 2005 17:20:18 +0200 Message-ID: <42C16AAD.4070903@streppone.it> Date: Tue, 28 Jun 2005 17:20:13 +0200 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: it, it-it, en-us, en MIME-Version: 1.0 To: Merlin Moncure Cc: Postgresql Performance Subject: Re: tricky query References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/563 X-Sequence-Number: 13200 Merlin Moncure wrote: > I need a fast way (sql only preferred) to solve the following problem: > I need the smallest integer that is greater than zero that is not in the > column of a table. > > I've already worked out a query using generate_series (not scalable) and > pl/pgsql. An SQL only solution would be preferred, am I missing > something obvious? Probably not, but I thought about this "brute-force" approach... :-) This should work well provided that: - you have a finite number of integers. Your column should have a biggest integer value with a reasonable maximum like 100,000 or 1,000,000. #define YOUR_MAX 99999 - you can accept that query execution time depends on smallest integer found. The bigger the found integer, the slower execution you get. Ok, so: Create a relation "integers" (or whatever) with every single integer from 1 to YOUR_MAX: CREATE TABLE integers (id integer primary key); INSERT INTO integers (id) VALUES (1); INSERT INTO integers (id) VALUES (2); ... INSERT INTO integers (id) VALUES (YOUR_MAX); Create your relation: CREATE TABLE merlin (id integer primary key); Query is simple now: SELECT a.id FROM integers a LEFT JOIN merlin b ON a.id=b.id WHERE b.id IS NULL ORDER BY a.id LIMIT 1; Execution times with 100k tuples in "integers" and 99,999 tuples in "merlin": >\timing Timing is on. >select i.id from integers i left join merlin s on i.id=s.id where s.id is null order by i.id limit 1; 99999 Time: 233.618 ms >insert into merlin (id) values (99999); INSERT 86266614 1 Time: 0.579 ms >delete from merlin where id=241; DELETE 1 Time: 0.726 ms >select i.id from integers i left join merlin s on i.id=s.id where s.id is null order by i.id limit 1; 241 Time: 1.336 ms > -- Cosimo From pgsql-performance-owner@postgresql.org Tue Jun 28 13:50: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 647FB528BB for ; Tue, 28 Jun 2005 12:28:12 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53967-04 for ; Tue, 28 Jun 2005 15:28:03 +0000 (GMT) Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) by svr1.postgresql.org (Postfix) with ESMTP id 2894952835 for ; Tue, 28 Jun 2005 12:28:02 -0300 (ADT) Received: from osgiliath.mathom.us ([70.108.108.63]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IIS002PIWAFG2S9@vms044.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 28 Jun 2005 10:27:52 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 02F14610196 for ; Tue, 28 Jun 2005 11:27:51 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 11778-03-10 for ; Tue, 28 Jun 2005 11:27:50 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id D490260014F; Tue, 28 Jun 2005 11:27:50 -0400 (EDT) Date: Tue, 28 Jun 2005 11:27:50 -0400 From: Michael Stone Subject: read block size To: pgsql-performance@postgresql.org Mail-Followup-To: pgsql-performance@postgresql.org Message-id: <20050628152750.GV9591@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/562 X-Sequence-Number: 13199 Is it possible to tweak the size of a block that postgres tries to read when doing a sequential scan? It looks like it reads in fairly small blocks, and I'd expect a fairly significant boost in i/o performance when doing a large (multi-gig) sequential scan if larger blocks were used. Mike Stone From pgsql-performance-owner@postgresql.org Tue Jun 28 13:35: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 C3748529BD for ; Tue, 28 Jun 2005 12:30:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53364-05 for ; Tue, 28 Jun 2005 15:30:38 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 9714D528C1 for ; Tue, 28 Jun 2005 12:30:35 -0300 (ADT) 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: tricky query Date: Tue, 28 Jun 2005 11:30:34 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2BF5@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] tricky query thread-index: AcV79Ok2G42YSYb4SpidBKrM4cVA4gAAL+Hg From: "Merlin Moncure" To: "Cosimo Streppone" Cc: "Postgresql Performance" 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: 200506/561 X-Sequence-Number: 13198 > Merlin Moncure wrote: >=20 > > I need a fast way (sql only preferred) to solve the following problem: > > I need the smallest integer that is greater than zero that is not in the > > column of a table. > > > > I've already worked out a query using generate_series (not scalable) and > > pl/pgsql. An SQL only solution would be preferred, am I missing > > something obvious? =20 > Probably not, but I thought about this "brute-force" approach... :-) > This should work well provided that: >=20 > - you have a finite number of integers. Your column should have a biggest > integer value with a reasonable maximum like 100,000 or 1,000,000. > #define YOUR_MAX 99999 [...] :-) generate_series function does the same thing only a little bit faster (although less portable). generate_series(m,n) returns set of integers from m to n with time complexity n - m. I use it for cases where I need to increment for something, for example: select now()::date + d from generate_series(0,355) as d; returns days from today until 355 days from now. Merlin From pgsql-performance-owner@postgresql.org Tue Jun 28 13:22: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 BFD6C529EA for ; Tue, 28 Jun 2005 12:39:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56532-07 for ; Tue, 28 Jun 2005 15:39:54 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 37206529B8 for ; Tue, 28 Jun 2005 12:39:54 -0300 (ADT) 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: tricky query Date: Tue, 28 Jun 2005 11:39:53 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2BF8@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] tricky query thread-index: AcV78zGykpxT0qt5S9iTgt0z05VMZwABBqsQ From: "Merlin Moncure" To: "John A Meinel" Cc: "Postgresql Performance" 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: 200506/559 X-Sequence-Number: 13196 > Not so bad. Try something like this: >=20 > SELECT min(id+1) as id_new FROM table > WHERE (id+1) NOT IN (SELECT id FROM table); >=20 > Now, this requires probably a sequential scan, but I'm not sure how you > can get around that. > Maybe if you got trickier and did some ordering and limits. The above > seems to give the right answer, though. it does, but it is still faster than generate_series(), which requires both a seqscan and a materialization of the function. =20 > I don't know how big you want to scale to. big. :) merlin From pgsql-performance-owner@postgresql.org Tue Jun 28 13:07: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 23E78529DC for ; Tue, 28 Jun 2005 12:42:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57506-02 for ; Tue, 28 Jun 2005 15:42:37 +0000 (GMT) Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) by svr1.postgresql.org (Postfix) with ESMTP id 11324529E3 for ; Tue, 28 Jun 2005 12:42:36 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP id <20050628154236m92008hm5fe>; Tue, 28 Jun 2005 15:42:36 +0000 Received: by juju.arbash-meinel.com (Postfix, from userid 505) id 4977B5606A; Tue, 28 Jun 2005 10:42:35 -0500 (CDT) Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id E477155FB6; Tue, 28 Jun 2005 10:42:28 -0500 (CDT) Message-ID: <42C16FE4.2020803@arbash-meinel.com> Date: Tue, 28 Jun 2005 10:42:28 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John A Meinel Cc: Merlin Moncure , pgsql-performance@postgresql.org Subject: Re: tricky query References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> <42C167C6.5070108@arbash-meinel.com> In-Reply-To: <42C167C6.5070108@arbash-meinel.com> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigBF6D632DBA85435B0B471BB4" 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: 200506/558 X-Sequence-Number: 13195 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBF6D632DBA85435B0B471BB4 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit John A Meinel wrote: > Merlin Moncure wrote: > >> I need a fast way (sql only preferred) to solve the following problem: >> >> I need the smallest integer that is greater than zero that is not in the >> column of a table. In other words, if an 'id' column has values >> 1,2,3,4,6 and 7, I need a query that returns the value of 5. >> >> I've already worked out a query using generate_series (not scalable) and >> pl/pgsql. An SQL only solution would be preferred, am I missing >> something obvious? >> >> Merlin >> >> > > Not so bad. Try something like this: > > SELECT min(id+1) as id_new FROM table > WHERE (id+1) NOT IN (SELECT id FROM table); > > Now, this requires probably a sequential scan, but I'm not sure how you > can get around that. > Maybe if you got trickier and did some ordering and limits. The above > seems to give the right answer, though. > > I don't know how big you want to scale to. > > You might try something like: > SELECT id+1 as id_new FROM t > WHERE (id+1) NOT IN (SELECT id FROM t) > ORDER BY id LIMIT 1; > > John > =:-> Well, I was able to improve it to using appropriate index scans. Here is the query: SELECT t1.id+1 as id_new FROM id_test t1 WHERE NOT EXISTS (SELECT t2.id FROM id_test t2 WHERE t2.id = t1.id+1) ORDER BY t1.id LIMIT 1; I created a test table which has 90k randomly inserted rows. And this is what EXPLAIN ANALYZE says: QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=0.00..12.10 rows=1 width=4) (actual time=0.000..0.000 rows=1 loops=1) -> Index Scan using id_test_pkey on id_test t1 (cost=0.00..544423.27 rows=45000 width=4) (actual time=0.000..0.000 rows=1 loops=1) Filter: (NOT (subplan)) SubPlan -> Index Scan using id_test_pkey on id_test t2 (cost=0.00..6.01 rows=1 width=4) (actual time=0.000..0.000 rows=1 loops=15) Index Cond: (id = ($0 + 1)) Total runtime: 0.000 ms (7 rows) The only thing I have is a primary key index on id_test(id); John =:-> --------------enigBF6D632DBA85435B0B471BB4 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCwW/kJdeBCYSNAAMRApBOAKDEkbTzHJyRuY8G5pem30paTdVxRACgtZyC XjeAl8xiAkEGQvTF5PZLokY= =R+bb -----END PGP SIGNATURE----- --------------enigBF6D632DBA85435B0B471BB4-- From pgsql-patches-owner@postgresql.org Tue Jun 28 12:21:28 2005 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4E6F05293B for ; Tue, 28 Jun 2005 11:53:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 45724-10 for ; Tue, 28 Jun 2005 14:53:18 +0000 (GMT) Received: from mail25.sea5.speakeasy.net (mail25.sea5.speakeasy.net [69.17.117.27]) by svr1.postgresql.org (Postfix) with ESMTP id 770C652833 for ; Tue, 28 Jun 2005 11:53:17 -0300 (ADT) Received: (qmail 26228 invoked from network); 28 Jun 2005 14:53:22 -0000 Received: from dsl093-114-095.chi2.dsl.speakeasy.net (HELO mofo.meme.com) ([66.93.114.95]) (envelope-sender ) by mail25.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 28 Jun 2005 14:53:21 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id 656D56E421 for ; Tue, 28 Jun 2005 10:42:32 -0500 (CDT) Date: Tue, 28 Jun 2005 15:42:32 +0000 From: "Karl O. Pinc" Subject: Fwd: Re: [PERFORM] Performance analysis of plpgsql code [kop@meme.com] To: pgsql-patches@postgresql.org References: <1119915045l.4428l.5l@mofo> <20050627233303.GA17069@winnie.fuhr.org> <1119923648l.11411l.0l@mofo> <20050628013419.GA17407@winnie.fuhr.org> <1119927786l.11411l.3l@mofo> In-Reply-To: <1119927786l.11411l.3l@mofo> (from kop@meme.com on Mon Jun 27 22:03:06 2005) X-Mailer: Balsa 2.3.0 Message-Id: <1119973352l.20199l.4l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline 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: 200506/551 X-Sequence-Number: 16283 On 06/27/2005 10:03:06 PM, Karl O. Pinc wrote: On 06/27/2005 08:34:19 PM, Michael Fuhr wrote: > On Tue, Jun 28, 2005 at 01:54:08AM +0000, Karl O. Pinc wrote: > > On 06/27/2005 06:33:03 PM, Michael Fuhr wrote: > > > > >See timeofday(). > > > > That only gives you the time at the start of the transaction, > > so you get no indication of how long anything in the > > transaction takes. > > Did you read the documentation or try it? Perhaps you're thinking > of now(), current_timestamp, and friends, which don't advance during > a transaction; but as the documentation states, "timeofday() returns > the wall-clock time and does advance during transactions." Very sorry. I did not read through the complete documentation. > I just ran tests on versions of PostgreSQL going back to 7.2.8 and > in all of them timeofday() advanced during a transaction. For all your work a documentation patch is appended that I think is easier to read and might avoid this problem in the future. If you don't read all the way through the current cvs version then you might think, as I did, that timeofday() is a CURRENT_TIMESTAMP related function. Sorry, but 3 lines wrap in the patch in my email client. :( Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein --- func.sgml 2005-06-26 17:05:35.000000000 -0500 +++ func.sgml.new 2005-06-27 21:51:05.301097896 -0500 @@ -5787,15 +5787,6 @@ - There is also the function timeofday(), which for historical - reasons returns a text string rather than a timestamp value: - -SELECT timeofday(); -Result: Sat Feb 17 19:07:32.000126 2001 EST - - - - It is important to know that CURRENT_TIMESTAMP and related functions return the start time of the current transaction; their values do not @@ -5803,8 +5794,7 @@ the intent is to allow a single transaction to have a consistent notion of the current time, so that multiple modifications within the same transaction bear the same - time stamp. timeofday() - returns the wall-clock time and does advance during transactions. + time stamp. @@ -5815,6 +5805,18 @@ + There is also the function timeofday() which + returns the wall-clock time and advances during transactions. For + historical reasons timeofday() returns a + text string rather than a timestamp + value: + +SELECT timeofday(); +Result: Sat Feb 17 19:07:32.000126 2001 EST + + + + All the date/time data types also accept the special literal value now to specify the current date and time. Thus, the following three all return the same result: ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein From pgsql-performance-owner@postgresql.org Tue Jun 28 13:01: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 E85AA529D0 for ; Tue, 28 Jun 2005 12:42:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57362-04 for ; Tue, 28 Jun 2005 15:42:44 +0000 (GMT) Received: from colo.samason.me.uk (unknown [69.55.228.22]) by svr1.postgresql.org (Postfix) with ESMTP id 7522A529E2 for ; Tue, 28 Jun 2005 12:42:43 -0300 (ADT) Received: from colo.samason.me.uk (colo [69.55.228.22]) by colo.samason.me.uk (8.12.11/8.12.11) with ESMTP id j5SFgh6O075550 for ; Tue, 28 Jun 2005 16:42:43 +0100 (BST) (envelope-from sam@colo.samason.me.uk) Received: (from sam@localhost) by colo.samason.me.uk (8.12.11/8.12.11/Submit) id j5SFgh1f075544 for pgsql-performance@postgresql.org; Tue, 28 Jun 2005 16:42:43 +0100 (BST) (envelope-from sam) Date: Tue, 28 Jun 2005 16:42:42 +0100 From: Sam Mason To: pgsql-performance@postgresql.org Subject: Re: tricky query Message-ID: <20050628154242.GS62747@colo.samason.me.uk> Mail-Followup-To: Sam Mason , pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> User-Agent: Mutt/1.4.2.1i 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: 200506/557 X-Sequence-Number: 13194 Merlin Moncure wrote: >I've already worked out a query using generate_series (not scalable) and >pl/pgsql. An SQL only solution would be preferred, am I missing >something obvious? I would be tempted to join the table to itself like: SELECT id+1 FROM foo WHERE id > 0 AND i NOT IN (SELECT id-1 FROM foo) LIMIT 1; Seems to work for me. Not sure if that's good enough for you, but it may help. Sam From pgsql-performance-owner@postgresql.org Tue Jun 28 13:01: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 4A45C529B8 for ; Tue, 28 Jun 2005 12:43:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56783-04 for ; Tue, 28 Jun 2005 15:43:31 +0000 (GMT) Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) by svr1.postgresql.org (Postfix) with ESMTP id CB04452965 for ; Tue, 28 Jun 2005 12:43:30 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP id <20050628154330m92008ijtce>; Tue, 28 Jun 2005 15:43:30 +0000 Received: by juju.arbash-meinel.com (Postfix, from userid 505) id BE7F155FB6; Tue, 28 Jun 2005 10:43:29 -0500 (CDT) Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 34EC155FB6; Tue, 28 Jun 2005 10:43:25 -0500 (CDT) Message-ID: <42C1701D.5040102@arbash-meinel.com> Date: Tue, 28 Jun 2005 10:43:25 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Merlin Moncure Cc: Postgresql Performance Subject: Re: tricky query References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BF8@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2BF8@Herge.rcsinc.local> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig7DA275E9AF29CA6DDFA18317" 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: 200506/556 X-Sequence-Number: 13193 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7DA275E9AF29CA6DDFA18317 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Merlin Moncure wrote: >>Not so bad. Try something like this: >> >>SELECT min(id+1) as id_new FROM table >> WHERE (id+1) NOT IN (SELECT id FROM table); >> >>Now, this requires probably a sequential scan, but I'm not sure how >> >> >you > > >>can get around that. >>Maybe if you got trickier and did some ordering and limits. The above >>seems to give the right answer, though. >> >> > >it does, but it is still faster than generate_series(), which requires >both a seqscan and a materialization of the function. > > > >>I don't know how big you want to scale to. >> >> > >big. :) > >merlin > > See my follow up post, which enables an index scan. On my system with 90k rows, it takes no apparent time. (0.000ms) John =:-> --------------enig7DA275E9AF29CA6DDFA18317 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCwXAdJdeBCYSNAAMRAqLMAJ9Ucer9XH+r7hnJ5C1PzwCaYTIA8QCfexE4 haXI6guAmd8mAo/OOQE8BAo= =H76W -----END PGP SIGNATURE----- --------------enig7DA275E9AF29CA6DDFA18317-- From pgsql-performance-owner@postgresql.org Tue Jun 28 13:24: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 9F49952A18 for ; Tue, 28 Jun 2005 13:02:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61563-07 for ; Tue, 28 Jun 2005 16:02:12 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 6A24F52A15 for ; Tue, 28 Jun 2005 13:02:11 -0300 (ADT) 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: tricky query Date: Tue, 28 Jun 2005 12:02:09 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2BFF@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] tricky query thread-index: AcV7+CKGjHA0oJE+Tty7fdXqphgDtAAAdH+g From: "Merlin Moncure" To: "John A Meinel" Cc: "Postgresql Performance" , "elein" 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: 200506/560 X-Sequence-Number: 13197 John Meinel wrote: > See my follow up post, which enables an index scan. On my system with > 90k rows, it takes no apparent time. > (0.000ms) > John > =3D:-> Confirmed. Hats off to you, the above some really wicked querying. IIRC I posted the same question several months ago with no response and had given up on it. I think your solution (smallest X1 not in X) is a good candidate for general bits, so I'm passing this to varlena for review :) SELECT t1.id+1 as id_new FROM id_test t1 WHERE NOT EXISTS (SELECT t2.id FROM id_test t2 WHERE t2.id =3D t1.id+1) ORDER BY t1.id LIMIT 1; Merlin From pgsql-performance-owner@postgresql.org Tue Jun 28 14:43: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 277C952801 for ; Tue, 28 Jun 2005 13:26:19 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67641-04 for ; Tue, 28 Jun 2005 16:26:09 +0000 (GMT) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by svr1.postgresql.org (Postfix) with ESMTP id 13373529E4 for ; Tue, 28 Jun 2005 13:26:05 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20050628162602m9100ngemie>; Tue, 28 Jun 2005 16:26:03 +0000 Received: by juju.arbash-meinel.com (Postfix, from userid 505) id E9FB55606A; Tue, 28 Jun 2005 11:26:01 -0500 (CDT) Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 69E4755FB6; Tue, 28 Jun 2005 11:25:57 -0500 (CDT) Message-ID: <42C17A14.3040100@arbash-meinel.com> Date: Tue, 28 Jun 2005 11:25:56 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Merlin Moncure Cc: Postgresql Performance , elein Subject: Re: tricky query References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BFF@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2BFF@Herge.rcsinc.local> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigCEEFCB2A271606AE3B38C834" 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: 200506/568 X-Sequence-Number: 13205 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigCEEFCB2A271606AE3B38C834 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Merlin Moncure wrote: >John Meinel wrote: > > >>See my follow up post, which enables an index scan. On my system with >>90k rows, it takes no apparent time. >>(0.000ms) >>John >>=:-> >> >> > >Confirmed. Hats off to you, the above some really wicked querying. >IIRC I posted the same question several months ago with no response and >had given up on it. I think your solution (smallest X1 not in X) is a >good candidate for general bits, so I'm passing this to varlena for >review :) > >SELECT t1.id+1 as id_new FROM id_test t1 > WHERE NOT EXISTS > (SELECT t2.id FROM id_test t2 WHERE t2.id = t1.id+1) > ORDER BY t1.id LIMIT 1; > >Merlin > > Just be aware that as your table fills it's holes, this query gets slower and slower. I've been doing some testing. And it starts at 0.00 when the first entry is something like 3, but when you start getting to 16k it starts taking more like 200 ms. So it kind of depends how your table fills (and empties I suppose). The earlier query was slower overall (since it took 460ms to read in the whole table). I filled up the table such that 63713 is the first empty space, and it takes 969ms to run. So actually if your table is mostly full, the first form is better. But if you are going to have 100k rows, with basically random distribution of empties, then the NOT EXISTS works quite well. Just be aware of the tradeoff. I'm pretty sure the WHERE NOT EXISTS will always use a looping structure, and go through the index in order. John =:-> --------------enigCEEFCB2A271606AE3B38C834 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCwXoUJdeBCYSNAAMRAkjLAKDEQ2oVyUsg5sIGaRNZKMNRqfb0SQCdF0Xo JH6KkY4FxhHyCJCYsDm1bZk= =WkpU -----END PGP SIGNATURE----- --------------enigCEEFCB2A271606AE3B38C834-- From pgsql-performance-owner@postgresql.org Tue Jun 28 14:07: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 26A9752A47 for ; Tue, 28 Jun 2005 14:03:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89741-03 for ; Tue, 28 Jun 2005 17:03:01 +0000 (GMT) Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) by svr1.postgresql.org (Postfix) with ESMTP id 892F552A01 for ; Tue, 28 Jun 2005 14:02:59 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP id <20050628170300m92008iri0e>; Tue, 28 Jun 2005 17:03:00 +0000 Received: by juju.arbash-meinel.com (Postfix, from userid 505) id 8EBA85606A; Tue, 28 Jun 2005 12:02:59 -0500 (CDT) Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id 248F655FB6; Tue, 28 Jun 2005 12:02:56 -0500 (CDT) Message-ID: <42C182BF.1050808@arbash-meinel.com> Date: Tue, 28 Jun 2005 12:02:55 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Stone Cc: pgsql-performance@postgresql.org Subject: Re: read block size References: <20050628152750.GV9591@mathom.us> In-Reply-To: <20050628152750.GV9591@mathom.us> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigA803AE2837C26A452F344851" 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: 200506/564 X-Sequence-Number: 13201 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA803AE2837C26A452F344851 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Michael Stone wrote: > Is it possible to tweak the size of a block that postgres tries to read > when doing a sequential scan? It looks like it reads in fairly small > blocks, and I'd expect a fairly significant boost in i/o performance > when doing a large (multi-gig) sequential scan if larger blocks were > used. > > Mike Stone I believe postgres reads in one database page at a time, which defaults to 8k IIRC. If you want bigger, you could recompile and set the default page size to something else. There has been discussion about changing the reading/writing code to be able to handle multiple pages at once, (using something like vread()) but I don't know that it has been implemented. Also, this would hurt cases where you can terminate as sequential scan early. And if the OS is doing it's job right, it will already do some read-ahead for you. John =:-> --------------enigA803AE2837C26A452F344851 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCwYK/JdeBCYSNAAMRAuhMAJ402Fc1BBV7omnC8DFPZGGfMZeZeACgrOBx 8smJXXUGV69jR88p9+cAAmg= =wwvt -----END PGP SIGNATURE----- --------------enigA803AE2837C26A452F344851-- From pgsql-performance-owner@postgresql.org Tue Jun 28 14:11: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 93021529A1 for ; Tue, 28 Jun 2005 14:10:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90319-07 for ; Tue, 28 Jun 2005 17:10:07 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 5BCF752943 for ; Tue, 28 Jun 2005 14:10:06 -0300 (ADT) Received: (qmail 4440 invoked from network); 28 Jun 2005 19:10:27 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 28 Jun 2005 19:10:27 +0200 To: kjelle@bingon.no, pgsql-performance@postgresql.org Subject: Re: Too slow querying a table of 15 million records References: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net> Message-ID: Date: Tue, 28 Jun 2005 19:10:05 +0200 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: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net> User-Agent: Opera M2(BETA2)/8.0 (Linux, build 987) 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: 200506/565 X-Sequence-Number: 13202 > database=> explain select date_trunc('hour', time),count(*) as total from > test where p1=53 and time > now() - interval '24 hours' group by > date_trunc order by date_trunc ; 1. Use CURRENT_TIMESTAMP (which is considered a constant by the planner) instead of now() 2. Create a multicolumn index on (p1,time) or (time,p1) whichever works better From pgsql-performance-owner@postgresql.org Tue Jun 28 14:43: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 9943D52801 for ; Tue, 28 Jun 2005 13:27:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70010-09 for ; Tue, 28 Jun 2005 16:27:30 +0000 (GMT) Received: from mail22.sea5.speakeasy.net (mail22.sea5.speakeasy.net [69.17.117.24]) by svr1.postgresql.org (Postfix) with ESMTP id 7CB82529E3 for ; Tue, 28 Jun 2005 13:27:29 -0300 (ADT) Received: (qmail 14544 invoked from network); 28 Jun 2005 16:27:29 -0000 Received: from dsl093-114-095.chi2.dsl.speakeasy.net (HELO mofo.meme.com) ([66.93.114.95]) (envelope-sender ) by mail22.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 28 Jun 2005 16:27:29 -0000 Received: from mofo (localhost.localdomain [127.0.0.1]) by mofo.meme.com (Postfix) with ESMTP id 060756E421; Tue, 28 Jun 2005 12:16:41 -0500 (CDT) Date: Tue, 28 Jun 2005 17:16:41 +0000 From: "Karl O. Pinc" Subject: Re: Poor index choice -- multiple indexes of the same To: Tom Lane Cc: pgsql-performance@postgresql.org References: <1119913766l.4428l.2l@mofo> <11497.1119940856@sss.pgh.pa.us> In-Reply-To: <11497.1119940856@sss.pgh.pa.us> (from tgl@sss.pgh.pa.us on Tue Jun 28 01:40:56 2005) X-Mailer: Balsa 2.3.0 Message-Id: <1119979001l.20199l.7l@mofo> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; DelSp=Yes; Format=Flowed Content-Disposition: inline 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: 200506/567 X-Sequence-Number: 13204 On 06/28/2005 01:40:56 AM, Tom Lane wrote: > "Karl O. Pinc" writes: > > I have a query > > > select 1 > > from census > > where date < '1975-9-21' and sname = 'RAD' and status != 'A' > > limit 1; > > > Explain analyze says it always uses the index made by: > > > CREATE INDEX census_date_sname ON census (date, sname); > > > this is even after I made the index: > > > CREATE INDEX census_sname_date ON census (sname, date); > > I don't believe that any existing release can tell the difference > between these two indexes as far as costs go. I just recently > added some code to btcostestimate that would cause it to prefer > the index on (sname, date) but of course that's not released yet. > > However: isn't the above query pretty seriously underspecified? > With a LIMIT and no ORDER BY, you are asking for a random one > of the rows matching the condition. I realize that with > "select 1" you may not care much, but adding a suitable ORDER BY > would help push the planner towards using the right index. In > this case "ORDER BY sname DESC, date DESC" would probably do the > trick. Yes, that works. I'd already tried "ORDER BY date DESC", before I first wrote, and that did not work. (I started with no LIMIT either, and tried adding specifications until I gave up. It's very good that the new planner will figure out things by itself.) "ORDER BY sname DESC" works as well. This is a bit odd, as with the constant in the = comparison "ORDER BY date DESC" is the same as "ORDER BY sname DESC, date DESC". I guess that's why I gave up on my attempts to get the planner to use the (sname, date) index before I got to your solution. Thanks everybody for the help. Karl Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein From pgsql-performance-owner@postgresql.org Tue Jun 28 14:27: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 92628529DA for ; Tue, 28 Jun 2005 14:27:04 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03166-01 for ; Tue, 28 Jun 2005 17:27:03 +0000 (GMT) Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by svr1.postgresql.org (Postfix) with ESMTP id D6B98528BD for ; Tue, 28 Jun 2005 14:27:02 -0300 (ADT) Received: from osgiliath.mathom.us ([70.108.108.63]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IIT00GQ41T19594@vms042.mailsrvcs.net> for pgsql-performance@postgresql.org; Tue, 28 Jun 2005 12:27:02 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 2A8FA610196; Tue, 28 Jun 2005 13:27:01 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14240-01-4; Tue, 28 Jun 2005 13:27:01 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 1154D60014F; Tue, 28 Jun 2005 13:27:01 -0400 (EDT) Date: Tue, 28 Jun 2005 13:27:01 -0400 From: Michael Stone Subject: Re: read block size In-reply-to: <42C182BF.1050808@arbash-meinel.com> To: John A Meinel Cc: pgsql-performance@postgresql.org Mail-Followup-To: John A Meinel , pgsql-performance@postgresql.org Message-id: <20050628172701.GW9591@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us References: <20050628152750.GV9591@mathom.us> <42C182BF.1050808@arbash-meinel.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/566 X-Sequence-Number: 13203 On Tue, Jun 28, 2005 at 12:02:55PM -0500, John A Meinel wrote: >There has been discussion about changing the reading/writing code to be >able to handle multiple pages at once, (using something like vread()) >but I don't know that it has been implemented. that sounds promising >Also, this would hurt cases where you can terminate as sequential scan >early. If you're doing a sequential scan of a 10G file in, say, 1M blocks I don't think the performance difference of reading a couple of blocks unnecessarily is going to matter. >And if the OS is doing it's job right, it will already do some >read-ahead for you. The app should have a much better idea of whether it's doing a sequential scan and won't be confused by concurrent activity. Even if the OS does readahead perfectly, you'll still get a with with larger blocks by cutting down on the syscalls. Mike Stone From pgsql-performance-owner@postgresql.org Tue Jun 28 15:49: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 E35F15298E for ; Tue, 28 Jun 2005 14:42:15 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 06117-03 for ; Tue, 28 Jun 2005 17:42:06 +0000 (GMT) Received: from colo.samason.me.uk (unknown [69.55.228.22]) by svr1.postgresql.org (Postfix) with ESMTP id 804755298D for ; Tue, 28 Jun 2005 14:42:05 -0300 (ADT) Received: from colo.samason.me.uk (colo [69.55.228.22]) by colo.samason.me.uk (8.12.11/8.12.11) with ESMTP id j5SHg6Tb065062 for ; Tue, 28 Jun 2005 18:42:06 +0100 (BST) (envelope-from sam@colo.samason.me.uk) Received: (from sam@localhost) by colo.samason.me.uk (8.12.11/8.12.11/Submit) id j5SHg61x065061 for pgsql-performance@postgresql.org; Tue, 28 Jun 2005 18:42:06 +0100 (BST) (envelope-from sam) Date: Tue, 28 Jun 2005 18:42:05 +0100 From: Sam Mason To: pgsql-performance@postgresql.org Subject: Re: tricky query Message-ID: <20050628174205.GT62747@colo.samason.me.uk> Mail-Followup-To: Sam Mason , pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> <42C167C6.5070108@arbash-meinel.com> <42C16FE4.2020803@arbash-meinel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42C16FE4.2020803@arbash-meinel.com> User-Agent: Mutt/1.4.2.1i 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: 200506/570 X-Sequence-Number: 13207 John A Meinel wrote: >SELECT t1.id+1 as id_new FROM id_test t1 > WHERE NOT EXISTS > (SELECT t2.id FROM id_test t2 WHERE t2.id = t1.id+1) > ORDER BY t1.id LIMIT 1; This works well on sparse data, as it only requires as many index access as it takes to find the first gap. The simpler "NOT IN" version that everybody seems to have posted the first time round has a reasonably constant (based on the number of rows, not gap position) startup time but the actual time spent searching for the gap is much lower. I guess the version you use depends on how sparse you expect the data to be. If you expect your query to have to search through more than half the table before finding the gap then you're better off using the "NOT IN" version, otherwise the "NOT EXISTS" version is faster -- on my system anyway. Hope that's interesting! Sam From pgsql-performance-owner@postgresql.org Tue Jun 28 15:15: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 AEA94529DA for ; Tue, 28 Jun 2005 15:14:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12071-08 for ; Tue, 28 Jun 2005 18:14:45 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1669D529C1 for ; Tue, 28 Jun 2005 15:14:44 -0300 (ADT) 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 j5SIEgLi022416; Tue, 28 Jun 2005 14:14:42 -0400 (EDT) To: PFC Cc: kjelle@bingon.no, pgsql-performance@postgresql.org Subject: Re: Too slow querying a table of 15 million records In-reply-to: References: <19310.193.213.27.25.1119378838.squirrel@webmail.s7.itpays.net> Comments: In-reply-to PFC message dated "Tue, 28 Jun 2005 19:10:05 +0200" Date: Tue, 28 Jun 2005 14:14:42 -0400 Message-ID: <22415.1119982482@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: 200506/569 X-Sequence-Number: 13206 PFC writes: > 1. Use CURRENT_TIMESTAMP (which is considered a constant by the planner) > instead of now() Oh? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 28 16:20: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 73CD55297D for ; Tue, 28 Jun 2005 15:47:38 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17173-06 for ; Tue, 28 Jun 2005 18:47:28 +0000 (GMT) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.202]) by svr1.postgresql.org (Postfix) with ESMTP id 4208552849 for ; Tue, 28 Jun 2005 15:47:27 -0300 (ADT) Received: by nproxy.gmail.com with SMTP id x37so244731nfc for ; Tue, 28 Jun 2005 11:47:27 -0700 (PDT) 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:content-disposition:references; b=pE9wQHf2McJICzP+atG/1Cpw+U/1NCe1cE722KfVMYEig2QVkEAFdKOQSsRIJbdeblr+4fx6iWeQM0xMRQ2ap8rTzrgfg0qbh/iU5++JGQl144qlwJTFbFXZUAK8J8qpu/kdofkA/nu74E7E6436rYpHrsHzdZ18eVbQUHoYF3Q= Received: by 10.48.142.11 with SMTP id p11mr167598nfd; Tue, 28 Jun 2005 11:47:27 -0700 (PDT) Received: by 10.48.49.14 with HTTP; Tue, 28 Jun 2005 11:47:27 -0700 (PDT) Message-ID: <4b09a0c0506281147bc4b27f@mail.gmail.com> Date: Tue, 28 Jun 2005 20:47:27 +0200 From: Jean-Max Reymond Reply-To: Jean-Max Reymond To: pgsql-performance@postgresql.org Subject: Re: perl garbage collector In-Reply-To: <11126.1119938006@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4b09a0c050627134660b3925@mail.gmail.com> <11126.1119938006@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.064 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/571 X-Sequence-Number: 13208 2005/6/28, Tom Lane : > Jean-Max Reymond writes: > > I have a stored procedure written in perl and I doubt that perl's > > garbage collector is working :-( > > after a lot of work, postmaster has a size of 1100 Mb and I think > > that the keyword "undef" has no effects. >=20 > Check the PG list archives --- there's been previous discussion of > similar issues. I think we concluded that when Perl is built to use > its own private memory allocator, the results of that competing with > malloc are not very pretty :-(. You end up with a fragmented memory > map and no chance to give anything back to the OS. thanks Tom for your advice. I have read the discussion but a small test is very confusing for me. Consider this function: CREATE FUNCTION jmax() RETURNS integer AS $_$use strict; my $i=3D0; for ($i=3D0; $i<10000;$i++) { my $ch =3D "0123456789"x100000; my $res =3D spi_exec_query("select * from xdb_child where doc_id=3D100 and ele_id=3D3 "); } my $j=3D1;$_$ LANGUAGE plperlu SECURITY DEFINER; ALTER FUNCTION public.jmax() OWNER TO postgres; the line my $ch =3D "0123456789"x100000; is used to allocate 1Mb. the line my $res =3D spi_exec_query("select * from xdb_child where doc_id=3D100 and ele_id=3D3 limit 5"); simulates a query. without spi_exec_quer, the used memory in postmaster is a constant. So, I think that pl/perl manages correctly memory in this case. with spi_exec_query, postmaster grows and grows until the end of the loop.= =20 Si, it seems that spi_exec_query does not release all the memory after each call. For my application (in real life) afer millions of spi_exec_query, it grows up to 1Gb :-( --=20 Jean-Max Reymond CKR Solutions Open Source Nice France http://www.ckr-solutions.com From pgsql-performance-owner@postgresql.org Tue Jun 28 16:48: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 DE1205299F for ; Tue, 28 Jun 2005 16:31:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27450-08 for ; Tue, 28 Jun 2005 19:31:26 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 6D168529B8 for ; Tue, 28 Jun 2005 16:31:24 -0300 (ADT) Received: (qmail 12757 invoked by uid 500); 28 Jun 2005 19:31:23 -0000 Date: Tue, 28 Jun 2005 14:31:23 -0500 From: Bruno Wolff III To: Merlin Moncure Cc: John A Meinel , Postgresql Performance , elein Subject: Re: tricky query Message-ID: <20050628193123.GA12571@wolff.to> Mail-Followup-To: Bruno Wolff III , Merlin Moncure , John A Meinel , Postgresql Performance , elein References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BFF@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2BFF@Herge.rcsinc.local> User-Agent: Mutt/1.5.6i 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: 200506/575 X-Sequence-Number: 13212 On Tue, Jun 28, 2005 at 12:02:09 -0400, Merlin Moncure wrote: > > Confirmed. Hats off to you, the above some really wicked querying. > IIRC I posted the same question several months ago with no response and > had given up on it. I think your solution (smallest X1 not in X) is a > good candidate for general bits, so I'm passing this to varlena for > review :) > > SELECT t1.id+1 as id_new FROM id_test t1 > WHERE NOT EXISTS > (SELECT t2.id FROM id_test t2 WHERE t2.id = t1.id+1) > ORDER BY t1.id LIMIT 1; You need to rework this to check to see if row '1' is missing. The above returns the start of the first gap after the first row that isn't missing. From pgsql-performance-owner@postgresql.org Tue Jun 28 16:41: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 B2C5052A04 for ; Tue, 28 Jun 2005 16:39:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31227-01 for ; Tue, 28 Jun 2005 19:39:27 +0000 (GMT) Received: from smtp1.libero.it (smtp1.libero.it [193.70.192.51]) by svr1.postgresql.org (Postfix) with ESMTP id E5731529E7 for ; Tue, 28 Jun 2005 16:39:26 -0300 (ADT) Received: from localhost (172.16.1.47) by smtp1.libero.it (7.0.027-DD01) id 42C16E9D0000BEAA; Tue, 28 Jun 2005 21:38:53 +0200 Received: from [151.25.86.70] (151.25.86.70) by smtp2.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41BF65E408AB6917; Tue, 28 Jun 2005 21:39:09 +0200 Message-ID: <42C1A5EF.7070505@streppone.it> Date: Tue, 28 Jun 2005 21:33:03 +0200 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: it, it-it, en-us, en MIME-Version: 1.0 To: John A Meinel Cc: Postgresql Performance list Subject: Re: tricky query References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> <42C167C6.5070108@arbash-meinel.com> <42C16FE4.2020803@arbash-meinel.com> In-Reply-To: <42C16FE4.2020803@arbash-meinel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at libero.it serv7 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/572 X-Sequence-Number: 13209 John A Meinel wrote: > John A Meinel wrote: >> Merlin Moncure wrote: >> >>> I need the smallest integer that is greater than zero that is not in the >>> column of a table. In other words, if an 'id' column has values >>> 1,2,3,4,6 and 7, I need a query that returns the value of 5. >> >> [...] > > Well, I was able to improve it to using appropriate index scans. > Here is the query: > > SELECT t1.id+1 as id_new FROM id_test t1 > WHERE NOT EXISTS > (SELECT t2.id FROM id_test t2 WHERE t2.id = t1.id+1) > ORDER BY t1.id LIMIT 1; I'm very interested in this "tricky query". Sorry John, but if I populate the `id_test' relation with only 4 tuples with id values (10, 11, 12, 13), the result of this query is: cosimo=> create table id_test (id integer primary key); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'id_test_pkey' for table 'id_test' CREATE TABLE cosimo=> insert into id_test values (10); -- and 11, 12, 13, 14 INSERT 7457570 1 INSERT 7457571 1 INSERT 7457572 1 INSERT 7457573 1 INSERT 7457574 1 cosimo=> SELECT t1.id+1 as id_new FROM id_test t1 WHERE NOT EXISTS (SELECT t2.id FROM id_test t2 WHERE t2.id = t1.id+1) ORDER BY t1.id LIMIT 1; id_new -------- 15 (1 row) which if I understand correctly, is the wrong answer to the problem. At this point, I'm starting to think I need some sleep... :-) -- Cosimo From pgsql-performance-owner@postgresql.org Tue Jun 28 16:44: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 99AE052801 for ; Tue, 28 Jun 2005 16:36:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28296-08 for ; Tue, 28 Jun 2005 19:36:29 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id E6507529D6 for ; Tue, 28 Jun 2005 16:36:28 -0300 (ADT) 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: tricky query Date: Tue, 28 Jun 2005 15:36:29 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2C07@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: tricky query thread-index: AcV8F/indOeEhIk+T6COhAE+3S2XOAAABcww From: "Merlin Moncure" To: "Bruno Wolff III" Cc: "Postgresql Performance" , "John A Meinel" , "elein" 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: 200506/574 X-Sequence-Number: 13211 > On Tue, Jun 28, 2005 at 12:02:09 -0400, > Merlin Moncure wrote: > > > > Confirmed. Hats off to you, the above some really wicked querying. > > IIRC I posted the same question several months ago with no response and > > had given up on it. I think your solution (smallest X1 not in X) is a > > good candidate for general bits, so I'm passing this to varlena for > > review :) > > > > SELECT t1.id+1 as id_new FROM id_test t1 > > WHERE NOT EXISTS > > (SELECT t2.id FROM id_test t2 WHERE t2.id =3D t1.id+1) > > ORDER BY t1.id LIMIT 1; >=20 > You need to rework this to check to see if row '1' is missing. The > above returns the start of the first gap after the first row that > isn't missing. Correct. =20 In fact, I left out a detail in my original request in that I had a starting value (easily supplied with where clause)...so what I was really looking for was a query which started at a supplied value and looped forwards looking for an empty slot. John's supplied query is a drop in replacement for a plpgsql routine which does exactly this. The main problem with the generate_series approach is that there is no convenient way to determine a supplied upper bound. Also, in some corner cases of my problem domain the performance was not good. Merlin From pgsql-performance-owner@postgresql.org Tue Jun 28 16:44: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 B4355529B8 for ; Tue, 28 Jun 2005 16:42:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31859-01 for ; Tue, 28 Jun 2005 19:42:39 +0000 (GMT) Received: from sccmmhc92.asp.att.net (sccmmhc92.asp.att.net [204.127.203.212]) by svr1.postgresql.org (Postfix) with ESMTP id D493A529AE for ; Tue, 28 Jun 2005 16:42:38 -0300 (ADT) Received: from juju.arbash-meinel.com ([12.214.18.81]) by sccmmhc92.asp.att.net (sccmmhc92) with ESMTP id <20050628194239m92008hnkfe>; Tue, 28 Jun 2005 19:42:39 +0000 Received: by juju.arbash-meinel.com (Postfix, from userid 505) id C99595606A; Tue, 28 Jun 2005 14:42:37 -0500 (CDT) Received: from [192.168.1.11] (mail [192.168.1.1]) by juju.arbash-meinel.com (Postfix) with ESMTP id BCA8055FB6; Tue, 28 Jun 2005 14:42:22 -0500 (CDT) Message-ID: <42C1A81D.1060507@arbash-meinel.com> Date: Tue, 28 Jun 2005 14:42:21 -0500 From: John A Meinel User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Merlin Moncure Cc: Bruno Wolff III , Postgresql Performance , elein Subject: Re: tricky query References: <6EE64EF3AB31D5448D0007DD34EEB3415C2C07@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2C07@Herge.rcsinc.local> X-Enigmail-Version: 0.92.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig8E27A38A36BB7C7B26DF7894" 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: 200506/573 X-Sequence-Number: 13210 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8E27A38A36BB7C7B26DF7894 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Merlin Moncure wrote: >>On Tue, Jun 28, 2005 at 12:02:09 -0400, >> Merlin Moncure wrote: >> >> >>>Confirmed. Hats off to you, the above some really wicked querying. >>>IIRC I posted the same question several months ago with no response >>> >>> >and > > >>>had given up on it. I think your solution (smallest X1 not in X) is >>> >>> >a > > >>>good candidate for general bits, so I'm passing this to varlena for >>>review :) >>> >>>SELECT t1.id+1 as id_new FROM id_test t1 >>> WHERE NOT EXISTS >>> (SELECT t2.id FROM id_test t2 WHERE t2.id = t1.id+1) >>> ORDER BY t1.id LIMIT 1; >>> >>> >>You need to rework this to check to see if row '1' is missing. The >>above returns the start of the first gap after the first row that >>isn't missing. >> >> > >Correct. > >In fact, I left out a detail in my original request in that I had a >starting value (easily supplied with where clause)...so what I was >really looking for was a query which started at a supplied value and >looped forwards looking for an empty slot. John's supplied query is a >drop in replacement for a plpgsql routine which does exactly this. > >The main problem with the generate_series approach is that there is no >convenient way to determine a supplied upper bound. Also, in some >corner cases of my problem domain the performance was not good. > >Merlin > > Actually, if you already have a lower bound, then you can change it to: SELECT t1.id+1 as id_new FROM id_test t1 WHERE t1.id > id_min AND NOT EXISTS (SELECT t2.id FROM id_test t2 WHERE t2.id = t1.id+1) ORDER BY t1.id LIMIT 1; This would actually really help performance if you have a large table and then empty entries start late. On my system, where the first entry is 64k, doing where id > 60000 speeds it up back to 80ms instead of 1000ms. John =:-> --------------enig8E27A38A36BB7C7B26DF7894 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 (Cygwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCwagdJdeBCYSNAAMRAu3aAJ94iU6MAnyzRGS0+GBO6JasQtwlnQCeNQdA 8wbx+wpu3au8H0HtZRWoJEg= =0GN4 -----END PGP SIGNATURE----- --------------enig8E27A38A36BB7C7B26DF7894-- From pgsql-performance-owner@postgresql.org Tue Jun 28 16:52: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 A4215528BB for ; Tue, 28 Jun 2005 16:46:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29837-07 for ; Tue, 28 Jun 2005 19:45:53 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 0157A528B8 for ; Tue, 28 Jun 2005 16:45:52 -0300 (ADT) 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: tricky query Date: Tue, 28 Jun 2005 15:45:53 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2C08@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] tricky query thread-index: AcV8GY0ANwV4sYsRQbWEdcci2CUrJAAACxOQ From: "Merlin Moncure" To: "Cosimo Streppone" Cc: "Postgresql Performance list" , "John A Meinel" 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: 200506/576 X-Sequence-Number: 13213 Cosimo wrote: > I'm very interested in this "tricky query". > Sorry John, but if I populate the `id_test' relation > with only 4 tuples with id values (10, 11, 12, 13), > the result of this query is: >=20 > cosimo=3D> create table id_test (id integer primary key); > NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index > 'id_test_pkey' > for table 'id_test' > CREATE TABLE > cosimo=3D> insert into id_test values (10); -- and 11, 12, 13, 14 > INSERT 7457570 1 > INSERT 7457571 1 > INSERT 7457572 1 > INSERT 7457573 1 > INSERT 7457574 1 > cosimo=3D> SELECT t1.id+1 as id_new FROM id_test t1 WHERE NOT = EXISTS > (SELECT > t2.id FROM id_test t2 WHERE t2.id =3D t1.id+1) ORDER BY t1.id LIMIT 1; > id_new > -------- > 15 > (1 row) >=20 > which if I understand correctly, is the wrong answer to the problem. > At this point, I'm starting to think I need some sleep... :-) Correct, in that John's query returns the first empty slot above an existing filled slot (correct behavior in my case). You could flip things around a bit to get around thist tho. Merlin From pgsql-performance-owner@postgresql.org Tue Jun 28 17:39: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 2E099529EB for ; Tue, 28 Jun 2005 17:39:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44671-01 for ; Tue, 28 Jun 2005 20:39:03 +0000 (GMT) Received: from dd01.profihoster.net (dd01.profihoster.net [80.86.168.71]) by svr1.postgresql.org (Postfix) with ESMTP id BF78D529B4 for ; Tue, 28 Jun 2005 17:39:01 -0300 (ADT) Received: from [192.168.54.33] (Ia1eb.i.pppool.de [85.73.161.235]) by dd01.profihoster.net (Postfix) with ESMTP id F19692381A3 for ; Tue, 28 Jun 2005 22:31:32 +0200 (CEST) Message-ID: <42C1B55E.40405@laliluna.de> Date: Tue, 28 Jun 2005 22:38:54 +0200 From: Sebastian Hennebrueder User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 Cc: pgsql-performance@postgresql.org Subject: Re: tricky query References: <6EE64EF3AB31D5448D0007DD34EEB3415C2BEC@Herge.rcsinc.local> <42C167C6.5070108@arbash-meinel.com> <42C16FE4.2020803@arbash-meinel.com> In-Reply-To: <42C16FE4.2020803@arbash-meinel.com> 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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200506/577 X-Sequence-Number: 13214 John A Meinel schrieb: > John A Meinel wrote: > >> > > Well, I was able to improve it to using appropriate index scans. > Here is the query: > > SELECT t1.id+1 as id_new FROM id_test t1 > WHERE NOT EXISTS > (SELECT t2.id FROM id_test t2 WHERE t2.id = t1.id+1) > ORDER BY t1.id LIMIT 1; > > I created a test table which has 90k randomly inserted rows. And this is > what EXPLAIN ANALYZE says: > > As Cosimo stated the result can be wrong. The result is always wrong when the id with value 1 does not exist. -- Best Regards / Viele Gr��e Sebastian Hennebrueder ---- http://www.laliluna.de Tutorials for JSP, JavaServer Faces, Struts, Hibernate and EJB Get support, education and consulting for these technologies - uncomplicated and cheap. From pgsql-performance-owner@postgresql.org Tue Jun 28 17:39: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 B7AF7529B8 for ; Tue, 28 Jun 2005 17:39:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42793-05 for ; Tue, 28 Jun 2005 20:39:36 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.204]) by svr1.postgresql.org (Postfix) with ESMTP id 2EC30529B4 for ; Tue, 28 Jun 2005 17:39:33 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id j2so389306nzf for ; Tue, 28 Jun 2005 13:39:35 -0700 (PDT) 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:content-disposition:references; b=F31ZANFXye/zpYxDmGETmod177vS0OQNL2RVyVm4VZGwUVc/ISqRr1umeFnwkPBQZpu5J2DO5F1IglxpTJFD5cSx6LW2a2aEsezdRFNFKNR41TsVbpquYYOz8z8ka2+9jxa30EOagP+aW6OJ1/+c/xgDIWCkTYSjwv96+C0ch1s= Received: by 10.36.108.5 with SMTP id g5mr4975721nzc; Tue, 28 Jun 2005 13:39:06 -0700 (PDT) Received: by 10.36.108.17 with HTTP; Tue, 28 Jun 2005 13:39:05 -0700 (PDT) Message-ID: <22455e7050628133978b17cd4@mail.gmail.com> Date: Tue, 28 Jun 2005 13:39:05 -0700 From: Billy extyeightysix Reply-To: Billy extyeightysix To: Postgresql Performance list Subject: optimized counting of web statistics In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3415C2C08@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6EE64EF3AB31D5448D0007DD34EEB3415C2C08@Herge.rcsinc.local> 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: 200506/578 X-Sequence-Number: 13215 Hola folks, I have a web statistics Pg database (user agent, urls, referrer, etc) that is part of an online web survey system. All of the data derived from analyzing web server logs is stored in one large table with each record representing an analyzed webserver log entry. Currently all reports are generated when the logs are being analyzed and before the data ever goes into the large table I mention above. Well, the time has come to build an interface that will allow a user to make ad-hoc queries against the stats and that is why I am emailing the performance list. I need to allow the user to specify any fields and values in a query.=20 For example, "I want to see a report about all users from Germany that have flash installed" or "I want to see a report about all users from Africa that are using FireFox = 1" I do not believe that storing all of the data in one big table is the correct way to go about this. So, I am asking for suggestions, pointers and any kind of info that anyone can share on how to store this data set in an optimized manner. Also, I have created a prototype and done some testing using the colossal table. Actually finding all of the rows that satisfy the query is pretty fast and is not a problem. The bottleneck in the whole process is actually counting each data point (how many times a url was visited, or how many times a url referred the user to the website). So more specifically I am wondering if there is way to store and retrieve the data such that it speeds up the counting of the statistics. Lastly, this will become an open source tool that is akin to urchin, awstats, etc. The difference is that this software is part of a suite of tools for doing online web surveys and it maps web stats to the survey respondent data. This can give web site managers a very clear view of what type of people come to the site and how those types use the site. Thanks in advance, exty From pgsql-performance-owner@postgresql.org Tue Jun 28 17:44: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 92493529F0 for ; Tue, 28 Jun 2005 17:44:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44178-08 for ; Tue, 28 Jun 2005 20:44:15 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.194]) by svr1.postgresql.org (Postfix) with ESMTP id 3729B529BC for ; Tue, 28 Jun 2005 17:44:13 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id z6so384658nzd for ; Tue, 28 Jun 2005 13:44:15 -0700 (PDT) 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:content-disposition:references; b=Y903MBHs/jldu4GmE+DQMus6ZjnqRh02WRmk2FEfrPgOR/AR74LlNoVosHbzMpSVlKjZc4+GiJ1ABMdYzdvUXC2/46/ekwXNrCwU/x+xuEFM4rZA9pgBAJWhrSQyCggvI9HnBangps8VTGnzuXhKyavKj8FEeznM7eKAQzNktLM= Received: by 10.36.32.11 with SMTP id f11mr4988279nzf; Tue, 28 Jun 2005 13:43:47 -0700 (PDT) Received: by 10.36.108.17 with HTTP; Tue, 28 Jun 2005 13:43:46 -0700 (PDT) Message-ID: <22455e7050628134348a74d7c@mail.gmail.com> Date: Tue, 28 Jun 2005 13:43:46 -0700 From: Billy extyeightysix Reply-To: Billy extyeightysix To: Postgresql Performance list Subject: Re: optimized counting of web statistics In-Reply-To: <22455e7050628133978b17cd4@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6EE64EF3AB31D5448D0007DD34EEB3415C2C08@Herge.rcsinc.local> <22455e7050628133978b17cd4@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: 200506/579 X-Sequence-Number: 13216 > The bottleneck in the > whole process is actually counting each data point (how many times a > url was visited, or how many times a url referred the user to the > website). So more specifically I am wondering if there is way to store > and retrieve the data such that it speeds up the counting of the > statistics. This is misleading, the counting is being done by perl. so what is happening is that I am locating all of the rows via a cursor and then calculating the stats using perl hashes. no counting is being in the DB. maybe it would be much faster to count in the db somehow? exty From pgsql-performance-owner@postgresql.org Tue Jun 28 18:55: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 DB4AD5282E for ; Tue, 28 Jun 2005 18:55:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63963-01 for ; Tue, 28 Jun 2005 21:55:43 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by svr1.postgresql.org (Postfix) with ESMTP id 22F5F52825 for ; Tue, 28 Jun 2005 18:55:42 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i21so693554wra for ; Tue, 28 Jun 2005 14:55:44 -0700 (PDT) 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:content-disposition:references; b=MvLZkIXz26X+EMjiK59NTDVFmUiX1zPAfx+m/tWREI1BUxBwXwUBPT7kBrhbQymA2nMZf69kZeVGIyza6w2+VCRVsfoNBqNOrh4HPk8d6r45sW3Je4yougIkKci6w8qvo2mjsytz6ObGG4FYtW2PhyMDE8Lq238+hTptETnIq5M= Received: by 10.54.40.48 with SMTP id n48mr2150wrn; Tue, 28 Jun 2005 14:55:44 -0700 (PDT) Received: by 10.54.22.15 with HTTP; Tue, 28 Jun 2005 14:55:44 -0700 (PDT) Message-ID: Date: Tue, 28 Jun 2005 16:55:44 -0500 From: Matthew Nuzum Reply-To: newz@bearfruit.org To: Billy extyeightysix Subject: Re: optimized counting of web statistics Cc: Postgresql Performance list In-Reply-To: <22455e7050628133978b17cd4@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6EE64EF3AB31D5448D0007DD34EEB3415C2C08@Herge.rcsinc.local> <22455e7050628133978b17cd4@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.079 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/580 X-Sequence-Number: 13217 On 6/28/05, Billy extyeightysix wrote: > Hola folks, >=20 > I have a web statistics Pg database (user agent, urls, referrer, etc) > that is part of an online web survey system. All of the data derived > from analyzing web server logs is stored in one large table with each > record representing an analyzed webserver log entry. >=20 > Currently all reports are generated when the logs are being analyzed > and before the data ever goes into the large table I mention above. > Well, the time has come to build an interface that will allow a user > to make ad-hoc queries against the stats and that is why I am emailing > the performance list. Load your data into a big table, then pre-process into additional tables that have data better organized for running your reports. For example, you may want a table that shows a sum of all hits for each site, for each hour of the day. You may want an additional table that shows the sum of all page views, or maybe sessions for each site for each hour of the day. So, if you manage a single site, each day you will add 24 new records to the sum table. You may want the following fields: site (string) atime (timestamptz) hour_of_day (int) day_of_week (int) total_hits (int8) A record may look like this: site | atime | hour_of_day | day_of_week | total_hits 'www.yoursite.com' '2005-06-28 16:00:00 -0400' 18 2 350 Index all of the fields except total_hits (unless you want a report that shows all hours where hits were greater than x or less than x). Doing: select sum(total_hits) as total_hits from summary_table where atime between now() and (now() - '7 days'::interval); should be pretty fast. You can also normalize your data such as referrers, user agents, etc and create similar tables to the above. In case you haven't guessed, I've already done this very thing. I do my batch processing daily using a python script I've written. I found that trying to do it with pl/pgsql took more than 24 hours to process 24 hours worth of logs. I then used C# and in memory hash tables to drop the time to 2 hours, but I couldn't get mono installed on some of my older servers. Python proved the fastest and I can process 24 hours worth of logs in about 15 minutes. Common reports run in < 1 sec and custom reports run in < 15 seconds (usually). --=20 Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Tue Jun 28 19:10: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 D952752825 for ; Tue, 28 Jun 2005 19:10:10 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59607-10 for ; Tue, 28 Jun 2005 22:10:01 +0000 (GMT) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.194]) by svr1.postgresql.org (Postfix) with ESMTP id 924195287E for ; Tue, 28 Jun 2005 19:09:59 -0300 (ADT) Received: by nproxy.gmail.com with SMTP id x37so250709nfc for ; Tue, 28 Jun 2005 15:10:01 -0700 (PDT) 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:content-disposition:references; b=rwZChMu/fYJgHgJCf0sMWvfj3dBe/TvpIlUY8/XgDRr3Y92/8WDYb7OB5DphExnTthPpTSs5DNw+jBDRYm9LSt09nT32Qy9DdVDjCzU78KAOs85x047ny5UWqFRZMHIcyL9slMFy5cxY2HuM/WJ1yeb1SmIxHNus7fql2XAbF5o= Received: by 10.48.3.12 with SMTP id 12mr171666nfc; Tue, 28 Jun 2005 15:10:01 -0700 (PDT) Received: by 10.48.49.14 with HTTP; Tue, 28 Jun 2005 15:10:01 -0700 (PDT) Message-ID: <4b09a0c0506281510239cbad4@mail.gmail.com> Date: Wed, 29 Jun 2005 00:10:01 +0200 From: Jean-Max Reymond Reply-To: Jean-Max Reymond To: pgsql-performance@postgresql.org Subject: Re: perl garbage collector In-Reply-To: <4b09a0c0506281147bc4b27f@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4b09a0c050627134660b3925@mail.gmail.com> <11126.1119938006@sss.pgh.pa.us> <4b09a0c0506281147bc4b27f@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.059 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/581 X-Sequence-Number: 13218 2005/6/28, Jean-Max Reymond : > For my application (in real life) afer millions of spi_exec_query, it > grows up to 1Gb :-( OK, now in 2 lines: CREATE FUNCTION jmax() RETURNS integer AS $_$use strict; for (my $i=3D0; $i<10000000;$i++) { spi_exec_query("select 'foo'"); } my $j=3D1;$_$ LANGUAGE plperlu SECURITY DEFINER running this test and your postmaster eats a lot of memory. it seems that there is a memory leak in spi_exec_query :-(=20 --=20 Jean-Max Reymond CKR Solutions Open Source Nice France http://www.ckr-solutions.com From pgsql-patches-owner@postgresql.org Tue Jun 28 20:14:52 2005 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AADBD529EA for ; Tue, 28 Jun 2005 20:14:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79104-01 for ; Tue, 28 Jun 2005 23:14:44 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id A051C529DC for ; Tue, 28 Jun 2005 20:14:42 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j5SNEfC08435; Tue, 28 Jun 2005 19:14:41 -0400 (EDT) From: Bruce Momjian Message-Id: <200506282314.j5SNEfC08435@candle.pha.pa.us> Subject: Re: COPY FROM performance improvements In-Reply-To: To: Luke Lonergan Date: Tue, 28 Jun 2005 19:14:41 -0400 (EDT) Cc: Andrew Dunstan , Alvaro Herrera , Alon Goldshuv , pgsql-patches@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=ELM1120000481-106-0_ Content-Transfer-Encoding: 7bit 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: 200506/558 X-Sequence-Number: 16290 --ELM1120000481-106-0_ Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Luke Lonergan wrote: > Patch to update pgindent with new symbols and fix a bug in an awk section > (extra \\ in front of a ')'). Yea, that '\' wasn't needed. I applied the following patch to use // instead of "" for patterns, and removed the unneeded backslash. I will update the typedefs in a separate commit. -- 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 --ELM1120000481-106-0_ Content-Transfer-Encoding: 7bit Content-Type: text/plain Content-Disposition: inline; filename="/bjm/diff" Index: src/tools/pgindent/pgindent =================================================================== RCS file: /cvsroot/pgsql/src/tools/pgindent/pgindent,v retrieving revision 1.73 diff -c -c -r1.73 pgindent *** src/tools/pgindent/pgindent 7 Oct 2004 14:15:50 -0000 1.73 --- src/tools/pgindent/pgindent 28 Jun 2005 23:12:07 -0000 *************** *** 50,62 **** if (NR >= 2) print line1; if (NR >= 2 && ! line2 ~ "^{[ ]*$" && ! line1 !~ "^struct" && ! line1 !~ "^enum" && ! line1 !~ "^typedef" && ! line1 !~ "^extern[ ][ ]*\"C\"" && ! line1 !~ "=" && ! line1 ~ "\)") print "int pgindent_func_no_var_fix;"; line1 = line2; } --- 50,62 ---- if (NR >= 2) print line1; if (NR >= 2 && ! line2 ~ /^{[ ]*$/ && ! line1 !~ /^struct/ && ! line1 !~ /^enum/ && ! line1 !~ /^typedef/ && ! line1 !~ /^extern[ ][ ]*"C"/ && ! line1 !~ /=/ && ! line1 ~ /)/) print "int pgindent_func_no_var_fix;"; line1 = line2; } *************** *** 70,77 **** line2 = $0; if (skips > 0) skips--; ! if (line1 ~ "^#ifdef[ ]*__cplusplus" && ! line2 ~ "^extern[ ]*\"C\"[ ]*$") { print line1; print line2; --- 70,77 ---- line2 = $0; if (skips > 0) skips--; ! if (line1 ~ /^#ifdef[ ]*__cplusplus/ && ! line2 ~ /^extern[ ]*"C"[ ]*$/) { print line1; print line2; *************** *** 81,88 **** line2 = ""; skips = 2; } ! else if (line1 ~ "^#ifdef[ ]*__cplusplus" && ! line2 ~ "^}[ ]*$") { print line1; print "/* Close extern \"C\" */"; --- 81,88 ---- line2 = ""; skips = 2; } ! else if (line1 ~ /^#ifdef[ ]*__cplusplus/ && ! line2 ~ /^}[ ]*$/) { print line1; print "/* Close extern \"C\" */"; *************** *** 1732,1738 **** # work around misindenting of function with no variables defined awk ' { ! if ($0 ~ "^[ ]*int[ ]*pgindent_func_no_var_fix;") { if (getline && $0 != "") print $0; --- 1732,1738 ---- # work around misindenting of function with no variables defined awk ' { ! if ($0 ~ /^[ ]*int[ ]*pgindent_func_no_var_fix;/) { if (getline && $0 != "") print $0; *************** *** 1751,1759 **** # line3 = $0; # if (skips > 0) # skips--; ! # if (line1 ~ " *{$" && ! # line2 ~ " *[^;{}]*;$" && ! # line3 ~ " *}$") # { # print line2; # line2 = ""; --- 1751,1759 ---- # line3 = $0; # if (skips > 0) # skips--; ! # if (line1 ~ / *{$/ && ! # line2 ~ / *[^;{}]*;$/ && ! # line3 ~ / *}$/) # { # print line2; # line2 = ""; *************** *** 1778,1786 **** line3 = $0; if (skips > 0) skips--; ! if (line1 ~ " *{$" && ! line2 ~ "^$" && ! line3 ~ " */\\*$") { print line1; print line3; --- 1778,1786 ---- line3 = $0; if (skips > 0) skips--; ! if (line1 ~ / *{$/ && ! line2 ~ /^$/ && ! line3 ~ / *\/\*$/) { print line1; print line3; *************** *** 1819,1826 **** line2 = $0; if (skips > 0) skips--; ! if (line1 ~ "^$" && ! line2 ~ "^#endif") { print line2; line2 = ""; --- 1819,1826 ---- line2 = $0; if (skips > 0) skips--; ! if (line1 ~ /^$/ && ! line2 ~ /^#endif/) { print line2; line2 = ""; *************** *** 1844,1850 **** line1 = line2; } END { ! if (NR >= 1 && line2 ~ "^#endif") printf "\n"; print line1; }' | --- 1844,1850 ---- line1 = line2; } END { ! if (NR >= 1 && line2 ~ /^#endif/) printf "\n"; print line1; }' | *************** *** 1853,1868 **** # like real functions. awk ' BEGIN {paren_level = 0} { ! if ($0 ~ /^[a-zA-Z_][a-zA-Z_0-9]*[^\(]*$/) { saved_len = 0; saved_lines[++saved_len] = $0; if ((getline saved_lines[++saved_len]) == 0) print saved_lines[1]; else ! if (saved_lines[saved_len] !~ /^[a-zA-Z_][a-zA-Z_0-9]*\(/ || ! saved_lines[saved_len] ~ /^[a-zA-Z_][a-zA-Z_0-9]*\(.*\)$/ || ! saved_lines[saved_len] ~ /^[a-zA-Z_][a-zA-Z_0-9]*\(.*\);$/) { print saved_lines[1]; print saved_lines[2]; --- 1853,1868 ---- # like real functions. awk ' BEGIN {paren_level = 0} { ! if ($0 ~ /^[a-zA-Z_][a-zA-Z_0-9]*[^(]*$/) { saved_len = 0; saved_lines[++saved_len] = $0; if ((getline saved_lines[++saved_len]) == 0) print saved_lines[1]; else ! if (saved_lines[saved_len] !~ /^[a-zA-Z_][a-zA-Z_0-9]*(/ || ! saved_lines[saved_len] ~ /^[a-zA-Z_][a-zA-Z_0-9]*(.*)$/ || ! saved_lines[saved_len] ~ /^[a-zA-Z_][a-zA-Z_0-9]*(.*);$/) { print saved_lines[1]; print saved_lines[2]; *************** *** 1879,1885 **** } for (i=1; i <= saved_len; i++) { ! if (i == 1 && saved_lines[saved_len] ~ /\);$/) { printf "%s", saved_lines[i]; if (substr(saved_lines[i], length(saved_lines[i]),1) != "*") --- 1879,1885 ---- } for (i=1; i <= saved_len; i++) { ! if (i == 1 && saved_lines[saved_len] ~ /);$/) { printf "%s", saved_lines[i]; if (substr(saved_lines[i], length(saved_lines[i]),1) != "*") --ELM1120000481-106-0_-- From pgsql-patches-owner@postgresql.org Tue Jun 28 22:53:35 2005 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 49C5A529BD for ; Tue, 28 Jun 2005 22:53:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04133-08 for ; Wed, 29 Jun 2005 01:53:24 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id 9F87C5295C for ; Tue, 28 Jun 2005 22:53:23 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j5T1rSr26346; Tue, 28 Jun 2005 21:53:28 -0400 (EDT) From: Bruce Momjian Message-Id: <200506290153.j5T1rSr26346@candle.pha.pa.us> Subject: Re: Fwd: Re: [PERFORM] Performance analysis of plpgsql code In-Reply-To: <1119973352l.20199l.4l@mofo> To: "Karl O. Pinc" Date: Tue, 28 Jun 2005 21:53:28 -0400 (EDT) Cc: pgsql-patches@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.713 tagged_above=0 required=5 tests=ADDRESS_IN_SUBJECT, AWL X-Spam-Level: X-Archive-Number: 200506/562 X-Sequence-Number: 16294 Patch applied. Thanks. Your documentation changes can be viewed in five minutes using links on the developer's page, http://www.postgresql.org/developer/testing. --------------------------------------------------------------------------- Karl O. Pinc wrote: > > On 06/27/2005 10:03:06 PM, Karl O. Pinc wrote: > > On 06/27/2005 08:34:19 PM, Michael Fuhr wrote: > > On Tue, Jun 28, 2005 at 01:54:08AM +0000, Karl O. Pinc wrote: > > > On 06/27/2005 06:33:03 PM, Michael Fuhr wrote: > > > > > > >See timeofday(). > > > > > > That only gives you the time at the start of the transaction, > > > so you get no indication of how long anything in the > > > transaction takes. > > > > Did you read the documentation or try it? Perhaps you're thinking > > of now(), current_timestamp, and friends, which don't advance during > > a transaction; but as the documentation states, "timeofday() returns > > the wall-clock time and does advance during transactions." > > Very sorry. I did not read through the complete documentation. > > > I just ran tests on versions of PostgreSQL going back to 7.2.8 and > > in all of them timeofday() advanced during a transaction. > > For all your work a documentation patch is appended that > I think is easier to read and might avoid this problem > in the future. If you don't read all the way through the > current cvs version then you might think, as I did, > that timeofday() is a CURRENT_TIMESTAMP related function. > > Sorry, but 3 lines wrap in the patch > in my email client. :( > > > Karl > Free Software: "You don't pay back, you pay forward." > -- Robert A. Heinlein > > > --- func.sgml 2005-06-26 17:05:35.000000000 -0500 > +++ func.sgml.new 2005-06-27 21:51:05.301097896 -0500 > @@ -5787,15 +5787,6 @@ > > > > - There is also the function timeofday(), which > for historical > - reasons returns a text string rather than a > timestamp value: > - > -SELECT timeofday(); > -Result: Sat Feb 17 > 19:07:32.000126 2001 EST > - > - > - > - > It is important to know that > CURRENT_TIMESTAMP and related functions > return > the start time of the current transaction; their values do not > @@ -5803,8 +5794,7 @@ > the intent is to allow a single transaction to have a consistent > notion of the current time, so that multiple > modifications within the same transaction bear the same > - time stamp. timeofday() > - returns the wall-clock time and does advance during transactions. > + time stamp. > > > > @@ -5815,6 +5805,18 @@ > > > > + There is also the function timeofday() which > + returns the wall-clock time and advances during transactions. For > + historical reasons timeofday() returns a > + text string rather than a timestamp > + value: > + > +SELECT timeofday(); > +Result: Sat Feb 17 > 19:07:32.000126 2001 EST > + > + > + > + > All the date/time data types also accept the special literal value > now to specify the current date and time. > Thus, > the following three all return the same result: > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > > Karl > Free Software: "You don't pay back, you pay forward." > -- Robert A. Heinlein > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > -- 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 Jun 28 23:55: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 BF2F1529DA for ; Tue, 28 Jun 2005 23:54:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23916-10 for ; Wed, 29 Jun 2005 02:54:43 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by svr1.postgresql.org (Postfix) with ESMTP id 2862F5297E for ; Tue, 28 Jun 2005 23:54:42 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i21so719990wra for ; Tue, 28 Jun 2005 19:54:47 -0700 (PDT) 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:content-disposition:references; b=cCBaivcnAI/7vZ7+VHVqfq2ghbyYvts8bq+w3wrUvSMMDsXJMoDUAslaAC7SfTzuQaUxUQCT85FdSY/ImlaxZqMcTix7pduavmfbLGk4Ie2cvvyZUONQ9b5eA62Mx4bK6/L/7CdIrdoL9xj5ic7bd/uu441aE8Bw7X6W25pz7MI= Received: by 10.54.24.3 with SMTP id 3mr19466wrx; Tue, 28 Jun 2005 19:54:47 -0700 (PDT) Received: by 10.54.22.15 with HTTP; Tue, 28 Jun 2005 19:54:47 -0700 (PDT) Message-ID: Date: Tue, 28 Jun 2005 21:54:47 -0500 From: Matthew Nuzum Reply-To: newz@bearfruit.org To: Rudi Starcevic Subject: Re: optimized counting of web statistics Cc: Postgresql Performance list In-Reply-To: <42C2D7B5.4070707@wildcash.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6EE64EF3AB31D5448D0007DD34EEB3415C2C08@Herge.rcsinc.local> <22455e7050628133978b17cd4@mail.gmail.com> <42C2D7B5.4070707@wildcash.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.073 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/583 X-Sequence-Number: 13220 On 6/29/05, Rudi Starcevic wrote: > Hi, >=20 > >I do my batch processing daily using a python script I've written. I > >found that trying to do it with pl/pgsql took more than 24 hours to > >process 24 hours worth of logs. I then used C# and in memory hash > >tables to drop the time to 2 hours, but I couldn't get mono installed > >on some of my older servers. Python proved the fastest and I can > >process 24 hours worth of logs in about 15 minutes. Common reports run > >in < 1 sec and custom reports run in < 15 seconds (usually). > > > > >=20 > When you say you do your batch processing in a Python script do you mean > a you are using 'plpython' inside > PostgreSQL or using Python to execut select statements and crunch the > data 'outside' PostgreSQL? >=20 > Your reply is very interesting. Sorry for not making that clear... I don't use plpython, I'm using an external python program that makes database connections, creates dictionaries and does the normalization/batch processing in memory. It then saves the changes to a textfile which is copied using psql. I've tried many things and while this is RAM intensive, it is by far the fastest aproach I've found. I've also modified the python program to optionally use disk based dictionaries based on (I think) gdb. This signfincantly increases the time to closer to 25 min. ;-) but drops the memory usage by an order of magnitude. To be fair to C# and .Net, I think that python and C# can do it equally fast, but between the time of creating the C# version and the python version I learned some new optimization techniques. I feel that both are powerful languages. (To be fair to python, I can write the dictionary lookup code in 25% (aprox) fewer lines than similar hash table code in C#. I could go on but I think I'm starting to get off topic.) --=20 Matthew Nuzum www.bearfruit.org From pgsql-performance-owner@postgresql.org Wed Jun 29 03:37: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 4263E528D5 for ; Wed, 29 Jun 2005 03:37:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67718-03 for ; Wed, 29 Jun 2005 06:36:55 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.196]) by svr1.postgresql.org (Postfix) with ESMTP id 1D08C52820 for ; Wed, 29 Jun 2005 03:36:53 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id s18so87141nze for ; Tue, 28 Jun 2005 23:36:52 -0700 (PDT) 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:content-disposition:references; b=pzcPfeR2M1/vKtJiHm2s6JtFN3be+xWpoq4TiX19VvJ/CWJ+91bL35ECwlkAa6o5z7Eqi0nPkrZsP1S5yYiCsaN437rm7OJ4uDo5FokAXkbzNmqbSC6Mx9xMkwHw+fS9jwwE5r5rktJodprSmcBn85CHP0LwZz5mxo6vVNtIf3s= Received: by 10.36.222.40 with SMTP id u40mr6353982nzg; Tue, 28 Jun 2005 23:36:52 -0700 (PDT) Received: by 10.36.22.20 with HTTP; Tue, 28 Jun 2005 23:36:52 -0700 (PDT) Message-ID: <758d5e7f05062823361c8840f4@mail.gmail.com> Date: Wed, 29 Jun 2005 08:36:52 +0200 From: Dawid Kuroczko Reply-To: Dawid Kuroczko To: John A Meinel Subject: Re: tricky query Cc: Merlin Moncure , Bruno Wolff III , Postgresql Performance , elein In-Reply-To: <42C1A81D.1060507@arbash-meinel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6EE64EF3AB31D5448D0007DD34EEB3415C2C07@Herge.rcsinc.local> <42C1A81D.1060507@arbash-meinel.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.629 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/584 X-Sequence-Number: 13221 On 6/28/05, John A Meinel wrote: > Actually, if you already have a lower bound, then you can change it to: >=20 > SELECT t1.id+1 as id_new FROM id_test t1 > WHERE t1.id > id_min > AND NOT EXISTS > (SELECT t2.id FROM id_test t2 WHERE t2.id =3D t1.id+1) > ORDER BY t1.id LIMIT 1; >=20 > This would actually really help performance if you have a large table > and then empty entries start late. You can also boost performance by creating a functional index! CREATE UNIQUE INDEX id_test_id1_index ON id_test ((id+1)); ...and then joining two tables and filtering results. PostgreSQL (8.x) will do Merge Full Join which will use both the indexes: SELECT t2.id+1 FROM id_test t1 FULL OUTER JOIN id_test t2 ON (t1.id =3D t2.id+1) WHERE t1.id IS NULL LIMIT 1; Limit (cost=3D0.00..1.52 rows=3D1 width=3D4) -> Merge Full Join (cost=3D0.00..1523122.73 rows=3D999974 width=3D4) Merge Cond: ("outer".id =3D ("inner".id + 1)) Filter: ("outer".id IS NULL) -> Index Scan using id_test_pkey on id_test t1=20 (cost=3D0.00..18455.71 rows=3D999974 width=3D4) -> Index Scan using id_test_id1_index on id_test t2=20 (cost=3D0.00..1482167.60 rows=3D999974 width=3D4) (6 rows) ...the only drawback is having to keep two indexes instead of just one. But for large tables I think it is really worth it For my test case, the times are (1-1000000 range with 26 missing rows): NOT EXISTS -- 670ms NOT IN -- 1800ms indexed FULL OUTER -- 267ms Regards, Dawid PS: Does it qualify for General Bits? ;-))) From pgsql-performance-owner@postgresql.org Wed Jun 29 06:04: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 39AE8529AB for ; Wed, 29 Jun 2005 06:04:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97352-05 for ; Wed, 29 Jun 2005 09:04:22 +0000 (GMT) Received: from titan.ecommit.de (titan.ecommit.de [195.145.58.245]) by svr1.postgresql.org (Postfix) with ESMTP id BE5E0529BC for ; Wed, 29 Jun 2005 06:04:20 -0300 (ADT) Received: from titan.ecommit.de (localhost [127.0.0.1]) by titan.ecommit.de (8.12.6/8.12.6/SuSE Linux 0.6) with ESMTP id j5T94L0F025995; Wed, 29 Jun 2005 11:04:22 +0200 Received: from titan.ecommit.de (root@localhost) by titan.ecommit.de (8.12.6/8.12.6/Submit) with ESMTP id j5T94Ldo025994; Wed, 29 Jun 2005 11:04:21 +0200 Received: from fandelm.ecommit.de (fandelm.tc.de 192.168.252.51) by titan.ecommit.de (Scalix SMTP Relay 9.0.0.26) via ESMTP; Wed, 29 Jun 2005 11:04:20 +0200 (CEST) Date: Wed, 29 Jun 2005 11:02:49 +0200 From: "Martin Fandel" To: Shay Kachlon Cc: pgsql-performance@postgresql.org Message-ID: <1120035769.18693.19.camel@fandelm.ecommit.de> In-Reply-To: <20050629095352.69AB21BFD6@hosting01.net-gurus.net> References: <20050629095352.69AB21BFD6@hosting01.net-gurus.net> Subject: Re: could not receive data from client: Connection timed out Error x-scalix-Hops: 1 X-Mailer: Evolution 2.0.1 Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/586 X-Sequence-Number: 13223 Hi What is your Postgres-Version and with which programming language are you connecting to the db? greetings, Martin Am Mittwoch, den 29.06.2005, 11:49 +0200 schrieb Shay Kachlon: > pgsql-performance@postgresql.org From pgsql-performance-owner@postgresql.org Wed Jun 29 05:49: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 D03DB5299F for ; Wed, 29 Jun 2005 05:49:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94451-10 for ; Wed, 29 Jun 2005 08:49:41 +0000 (GMT) Received: from hosting01.net-gurus.net (hosting01.net-gurus.net [212.150.137.117]) by svr1.postgresql.org (Postfix) with ESMTP id 9F0DF5297F for ; Wed, 29 Jun 2005 05:49:35 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by hosting01.net-gurus.net (Postfix) with ESMTP id A8FBA1C0BC for ; Wed, 29 Jun 2005 10:53:52 +0100 (BST) Received: from hosting01.net-gurus.net ([127.0.0.1]) by localhost (hosting01.net-gurus.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12614-09 for ; Wed, 29 Jun 2005 10:53:52 +0100 (BST) Received: from MGC (unknown [62.90.49.77]) by hosting01.net-gurus.net (Postfix) with ESMTP id 69AB21BFD6 for ; Wed, 29 Jun 2005 10:53:52 +0100 (BST) From: "Shay Kachlon" To: Subject: could not receive data from client: Connection timed out Error Date: Wed, 29 Jun 2005 11:49:24 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000E_01C57CA0.98D366D0" X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcV8j9T5WgEUs7ULRwebnyx2nqwUYQ== Message-Id: <20050629095352.69AB21BFD6@hosting01.net-gurus.net> X-Virus-Scanned: amavisd-new at net-gurus.net 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: 200506/585 X-Sequence-Number: 13222 This is a multi-part message in MIME format. ------=_NextPart_000_000E_01C57CA0.98D366D0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi There, =20 We having some problem with the DB which logs sometimes "could not = receive data from client: Connection timed out" error. =20 We couldn't find when it happens, and why.. =20 Also from the client side (we facing some transaction that comes back = after something like 15 min) BDW: no exceptions on the client. =20 Can any one help me with this ? =20 Shay Kachlon ------=_NextPart_000_000E_01C57CA0.98D366D0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi There,

 

We having some problem with the DB which logs sometimes "could not = receive data from client: Connection timed out" = error.

 

We couldn't find when it happens, and why..

 

Also from the client side (we facing some transaction that comes back after = something like 15 min) BDW: no exceptions on the = client.

 

Can any one help me with this ?

 

Shay Kachlon

------=_NextPart_000_000E_01C57CA0.98D366D0-- From pgsql-performance-owner@postgresql.org Wed Jun 29 09:50: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 1225F52970 for ; Wed, 29 Jun 2005 09:50:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50050-05 for ; Wed, 29 Jun 2005 12:50:36 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id AE28252956 for ; Wed, 29 Jun 2005 09:50:34 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j5TCoNAl086665 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 29 Jun 2005 06:50:26 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j5TCoNR0031317; Wed, 29 Jun 2005 06:50:23 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j5TCoMqs031316; Wed, 29 Jun 2005 06:50:22 -0600 (MDT) (envelope-from mfuhr) Date: Wed, 29 Jun 2005 06:50:22 -0600 From: Michael Fuhr To: "Chun Yit(Chronos)" Cc: pgsql-performance@postgresql.org Subject: Re: Postgresql7.4.5 running slow on plpgsql function Message-ID: <20050629125022.GA31236@winnie.fuhr.org> Reply-To: pgsql-performance@postgresql.org References: <000601c577d9$e2658600$a279640a@Beh> <20050628062620.GB18635@winnie.fuhr.org> <003301c57c63$2bbcfee0$a279640a@Beh> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <003301c57c63$2bbcfee0$a279640a@Beh> 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: 200506/587 X-Sequence-Number: 13224 [Please copy the mailing list on replies so others can contribute to and learn from the discussion.] On Wed, Jun 29, 2005 at 12:29:42PM +0800, Chun Yit(Chronos) wrote: > > Yes, the function will delete records from the temporary table every time > on each call. > if leaving a lot of dead tuples, then how can we solve it? If the function deletes all records from the temporary table then you could use TRUNCATE instead of DELETE. Otherwise you could VACUUM the table between calls to the function (you can't run VACUUM inside a function). -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Wed Jun 29 12: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 B4C54529AA for ; Wed, 29 Jun 2005 12:08:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80210-09 for ; Wed, 29 Jun 2005 15:08:36 +0000 (GMT) Received: from mail.baymountain.com (mail.baymountain.com [8.7.96.19]) by svr1.postgresql.org (Postfix) with SMTP id 2B00D5295A for ; Wed, 29 Jun 2005 12:08:35 -0300 (ADT) Received: (qmail 10591 invoked by uid 504); 29 Jun 2005 15:08:33 -0000 Received: from emil@baymountain.com by mail.baymountain.com by uid 501 with qmail-scanner-1.16 (spamassassin: 2.53. Clear:SA:0(0.0/7.0):. Processed in 0.272865 secs); 29 Jun 2005 15:08:33 -0000 Received: from unknown (HELO briggspack.com) (emil@briggspack.com@24.211.148.77) by mail.baymountain.com with SMTP; 29 Jun 2005 15:08:32 -0000 From: Emil Briggs Reply-To: emil@baymountain.com Organization: Baymountain, Inc. To: pgsql-performance@postgresql.org Subject: Exclusive lock question Date: Wed, 29 Jun 2005 11:08:28 -0400 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: <200506291108.28516.emil@baymountain.com> 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: 200506/588 X-Sequence-Number: 13225 I have been trying to diagnose a performance problem we have been seeing with a postgres application. The performance of the database server is usually quite good but every now and then it slows to a crawl. The output of vmstat does not show excessive CPU usage or disk IO. The output of ps does show that the number of postgres process's that appear to be stuck in some query spikes and in some cases restarting the postgres server is the only way to clear them. While trying to diagnose this problem I ran select * from pg_locks I could understand most of the output but I was wondering what a result like the following indicates relation | database | transaction | pid | mode | granted ----------+----------+-------------+-------+---------------+--------- | | 26052434 | 29411 | ExclusiveLock | t | | 26051641 | 29345 | ExclusiveLock | t | | 26052415 | 29519 | ExclusiveLock | t | | 26052407 | 29381 | ExclusiveLock | t | | 26052432 | 29658 | ExclusiveLock | t When I see the slowdowns there are hundreds of these with no entry for relation or database. Any ideas what is being locked in this case? Emil From pgsql-performance-owner@postgresql.org Wed Jun 29 12:27: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 0FA0552A13 for ; Wed, 29 Jun 2005 12:27:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03334-03 for ; Wed, 29 Jun 2005 15:27:49 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 59ADA529F4 for ; Wed, 29 Jun 2005 12:27:48 -0300 (ADT) 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 j5TFRl3t009799; Wed, 29 Jun 2005 11:27:47 -0400 (EDT) To: emil@baymountain.com Cc: pgsql-performance@postgresql.org Subject: Re: Exclusive lock question In-reply-to: <200506291108.28516.emil@baymountain.com> References: <200506291108.28516.emil@baymountain.com> Comments: In-reply-to Emil Briggs message dated "Wed, 29 Jun 2005 11:08:28 -0400" Date: Wed, 29 Jun 2005 11:27:47 -0400 Message-ID: <9798.1120058867@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: 200506/589 X-Sequence-Number: 13226 Emil Briggs writes: > When I see the slowdowns there are hundreds of these with no entry for > relation or database. Any ideas what is being locked in this case? Per the pg_locks documentation: Every transaction holds an exclusive lock on its transaction ID for its entire duration. If one transaction finds it necessary to wait specifically for another transaction, it does so by attempting to acquire share lock on the other transaction ID. That will succeed only when the other transaction terminates and releases its locks. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jun 28 21:20: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 EF3D0529A1 for ; Tue, 28 Jun 2005 21:20:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88690-06 for ; Wed, 29 Jun 2005 00:19:55 +0000 (GMT) Received: from hummer.onthenet.com.au (hummer.onthenet.com.au [203.13.68.9]) by svr1.postgresql.org (Postfix) with ESMTP id 8BD3F529B8 for ; Tue, 28 Jun 2005 21:19:54 -0300 (ADT) Received: from [127.0.0.1] (imp5.dsl.onthenet.net [203.144.16.135]) by hummer.onthenet.com.au (Postfix) with ESMTP id 4B4FC1A0B2C for ; Wed, 29 Jun 2005 10:19:56 +1000 (EST) Message-ID: <42C2D7B5.4070707@wildcash.com> Date: Wed, 29 Jun 2005 10:17:41 -0700 From: Rudi Starcevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgresql Performance list Subject: Re: optimized counting of web statistics References: <6EE64EF3AB31D5448D0007DD34EEB3415C2C08@Herge.rcsinc.local> <22455e7050628133978b17cd4@mail.gmail.com> In-Reply-To: X-Enigmail-Version: 0.92.0.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=2.329 tagged_above=0 required=5 tests=DATE_IN_FUTURE_12_24 X-Spam-Level: ** X-Archive-Number: 200506/582 X-Sequence-Number: 13219 Hi, >I do my batch processing daily using a python script I've written. I >found that trying to do it with pl/pgsql took more than 24 hours to >process 24 hours worth of logs. I then used C# and in memory hash >tables to drop the time to 2 hours, but I couldn't get mono installed >on some of my older servers. Python proved the fastest and I can >process 24 hours worth of logs in about 15 minutes. Common reports run >in < 1 sec and custom reports run in < 15 seconds (usually). > > When you say you do your batch processing in a Python script do you mean a you are using 'plpython' inside PostgreSQL or using Python to execut select statements and crunch the data 'outside' PostgreSQL? Your reply is very interesting. Thanks. Regards, Rudi. From pgsql-performance-owner@postgresql.org Thu Jun 30 04:24: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 745D452801 for ; Thu, 30 Jun 2005 04:24:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25220-08 for ; Thu, 30 Jun 2005 07:24:11 +0000 (GMT) Received: from h1.bettercom.de (h1.bettercom.de [213.239.194.41]) by svr1.postgresql.org (Postfix) with ESMTP id B79EA52833 for ; Thu, 30 Jun 2005 04:24:08 -0300 (ADT) Received: (qmail 8917 invoked by uid 208); 30 Jun 2005 07:24:09 -0000 Received: from 213.39.204.73 by h1 (envelope-from , uid 0) with qmail-scanner-1.23 (clamdscan: 0.70. spamassassin: 2.63. Clear:RC:1(213.39.204.73):. Processed in 0.205964 secs); 30 Jun 2005 07:24:09 -0000 Received: from unknown (HELO nb-acer.better-com.de) ([213.39.204.73]) (envelope-sender ) by h1.bettercom.de (qmail-ldap-1.03) with SMTP for ; 30 Jun 2005 07:24:08 -0000 Received: (nullmailer pid 9936 invoked by uid 1000); Thu, 30 Jun 2005 07:24:07 -0000 Subject: Vacuum becomes slow X-PGP-Key: http://bettercom.de/misc/3A547DE6.asc X-Face: "d[&>8')a)wbF:+L#^<_cohnX6#m5RCCeKF/6_gD(iQ9bX?xe2~Aq*!')D(1ks`?YhomOYbL3R:{4e4a]qft_]<.q/Lf4hIr,`G+LX33&TYp}XGfe~^5m$28R"$C(EwnB\n8t To: pgsql-performance@postgresql.org From: Martin Lesser Date: Thu, 30 Jun 2005 09:24:06 +0200 Message-ID: <877jgci9yh.fsf@nb-acer.bettercom.de> User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux) 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: 200506/590 X-Sequence-Number: 13227 Hi, the time needed for a daily VACUUM on a table with about 28 mio records increases from day to day. What's the best way to avoid this? A full vacuum will probably take too much time, are there other ways to keep vacuum performant? The database was updated to postgres-8.0 on Jun 04 this year. Between Jun 07 and Jun 30 the time vacuum needed increased from 683 seconds up to 1,663 seconds, the output is posted below. E.g. the time for vacuuming the index of a text-field (i_ids_user) raised from 123 sec to 668 secs. The increase happens each day so this is not a problem of the last run. The number of records in the table in the same time only increased from 27.5 mio to 28.9 mio, the number of records updated daily is about 700,000 to 1,000,000. Regards Martin ================================================================ | Tue Jun 7 04:07:17 CEST 2005 Starting | SET VACUUM_MEM=250000; VACUUM ANALYZE VERBOSE t_ids ---------------------------------------------------------------- INFO: vacuuming "public.t_ids" INFO: index "i_ids_score" now contains 4323671 row versions in 12414 pages DETAIL: 493855 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 1.76s/5.44u sec elapsed 33.22 sec. INFO: index "i_ids_id" now contains 27500002 row versions in 61515 pages DETAIL: 960203 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 8.09s/24.93u sec elapsed 108.43 sec. INFO: index "i_ids_user" now contains 27500002 row versions in 103172 pages DETAIL: 960203 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 14.00s/39.65u sec elapsed 123.47 sec. INFO: "t_ids": removed 960203 row versions in 203369 pages DETAIL: CPU 22.88s/21.72u sec elapsed 294.22 sec. INFO: "t_ids": found 960203 removable, 27500002 nonremovable row versions in 208912 pages DETAIL: 0 dead row versions cannot be removed yet. There were 214149 unused item pointers. 0 pages are entirely empty. CPU 53.02s/93.76u sec elapsed 643.46 sec. INFO: vacuuming "pg_toast.pg_toast_224670" INFO: index "pg_toast_224670_index" now contains 0 row versions in 1 pages DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.01 sec. INFO: "pg_toast_224670": found 0 removable, 0 nonremovable row versions in 0 pages DETAIL: 0 dead row versions cannot be removed yet. There were 0 unused item pointers. 0 pages are entirely empty. CPU 0.00s/0.00u sec elapsed 0.01 sec. INFO: analyzing "public.t_ids" INFO: "t_ids": scanned 90000 of 208912 pages, containing 11846838 live rows and 0 dead rows; 90000 rows in sample, 27499407 estimated total rows VACUUM ---------------------------------------------------------------- | Tue Jun 7 04:18:40 CEST 2005 Job finished after 683 seconds ================================================================ ================================================================ | Thu Jun 30 01:23:33 CEST 2005 Starting | SET VACUUM_MEM=250000; VACUUM ANALYZE VERBOSE t_ids ---------------------------------------------------------------- INFO: vacuuming "public.t_ids" INFO: index "i_ids_score" now contains 4460326 row versions in 29867 pages DETAIL: 419232 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 4.58s/7.72u sec elapsed 368.13 sec. INFO: index "i_ids_id" now contains 28948643 row versions in 68832 pages DETAIL: 795700 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 9.08s/25.29u sec elapsed 151.38 sec. INFO: index "i_ids_user" now contains 28948938 row versions in 131683 pages DETAIL: 795700 index row versions were removed. 0 index pages have been deleted, 0 are currently reusable. CPU 20.10s/43.27u sec elapsed 668.00 sec. INFO: "t_ids": removed 795700 row versions in 206828 pages DETAIL: CPU 23.35s/23.50u sec elapsed 309.19 sec. INFO: "t_ids": found 795700 removable, 28948290 nonremovable row versions in 223145 pages DETAIL: 0 dead row versions cannot be removed yet. There were 906106 unused item pointers. 0 pages are entirely empty. CPU 63.10s/101.96u sec elapsed 1592.00 sec. INFO: vacuuming "pg_toast.pg_toast_224670" INFO: index "pg_toast_224670_index" now contains 0 row versions in 1 pages DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: "pg_toast_224670": found 0 removable, 0 nonremovable row versions in 0 pages DETAIL: 0 dead row versions cannot be removed yet. There were 0 unused item pointers. 0 pages are entirely empty. CPU 0.00s/0.00u sec elapsed 0.02 sec. INFO: analyzing "public.t_ids" INFO: "t_ids": scanned 90000 of 223146 pages, containing 11675055 live rows and 288 dead rows; 90000 rows in sample, 28947131 estimated total rows VACUUM ---------------------------------------------------------------- | Thu Jun 30 01:51:16 CEST 2005 Job finished after 1663 seconds ================================================================ From pgsql-performance-owner@postgresql.org Thu Jun 30 07:31: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 2C8335280D for ; Thu, 30 Jun 2005 07:31:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84492-05 for ; Thu, 30 Jun 2005 10:30:56 +0000 (GMT) Received: from mercury.sde (ns.sde.cz [194.149.124.54]) by svr1.postgresql.org (Postfix) with ESMTP id EBE495280C for ; Thu, 30 Jun 2005 07:30:54 -0300 (ADT) Received: from [10.0.1.2] (pc2.sde [10.0.1.2]) by mercury.sde (8.12.8/8.12.8) with ESMTP id j5UAUsrV025380 for ; Thu, 30 Jun 2005 12:30:54 +0200 Message-ID: <42C3C967.8060605@sde.cz> Date: Thu, 30 Jun 2005 12:28:55 +0200 From: Milan Sekanina User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: ODBC driver over network very slow 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: 200506/591 X-Sequence-Number: 13228 We are running an application that uses psqlodbc driver on Windows XP to connect to a server and for some reason the download of data from the server is very slow. We have created a very simple test application that inserts a larger amount of data into the database and uses a simple "SELECT * from test" to download it back. The INSERT of 10MB takes about 4 seconds, while the SELECT takes almost 5 minutes (with basically nothing else running on both the network and the two computers). If we run the PostgreSQL server on the local machine so that the network is not used, both actions are very fast. Do you have any idea what could be the cause of this behavior? Are there any driver settings/other drivers we should use? We are currently using psqlodbc version 7.03.02.00, but it seems that other versions we tried show the same behavior. We have tweaked the various driver settings but the times remain basically unchanged. Any ideas or hints are warmly welcome. regards Milan From pgsql-performance-owner@postgresql.org Thu Jun 30 09:38: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 2C34652913 for ; Thu, 30 Jun 2005 09:38:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12195-10 for ; Thu, 30 Jun 2005 12:38:45 +0000 (GMT) Received: from mailer.unicite.fr.netcentrex.net (mailer.fr.netcentrex.net [62.161.167.249]) by svr1.postgresql.org (Postfix) with ESMTP id 9DFC7528D5 for ; Thu, 30 Jun 2005 09:38:36 -0300 (ADT) Received: from pventrillon ([192.168.100.85]) by mailer.unicite.fr.netcentrex.net with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id K2220M00; Thu, 30 Jun 2005 14:38:37 +0200 From: "philippe ventrillon" To: "'Colin Taylor'" , Subject: Re: slow simple update? Date: Thu, 30 Jun 2005 14:38:36 +0200 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: <84d3067d0506212312775b3fa3@mail.gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Thread-Index: AcV7os6K1TQboGClTPyHsABEkKN/dgBzP+Fw Message-Id: <20050630123836.9DFC7528D5@svr1.postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.704 tagged_above=0 required=5 tests=AWL, MSGID_FROM_MTA_ID X-Spam-Level: * X-Archive-Number: 200506/592 X-Sequence-Number: 13229 You should provide a bit more details on what happens if you want people to help you. Tipically you will be asked an explain analyze of your query. As a first tip if your table contains much more than 30.000 rows you could try to set up a partial index with thru_date is null condition. regards -- Philippe -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Colin Taylor Sent: mercredi 22 juin 2005 08:13 To: pgsql-performance@postgresql.org Subject: [PERFORM] slow simple update? Hi there, I'm doing an update of ~30,000 rows and she takes about 15mins on pretty good hardware, even just after a vacuum analyze. I was hoping some kind soul could offer some performance advice. Do I just have too many indexes? Or am I missing some trick with the nulls? MY QUERY ======== update bob.product_price set thru_date = '2005-06-22 22:08:49.957' where thru_date is null; MY TABLE ========= Table "bob.product_price" Column | Type | Modifiers -----------------------------+--------------------------+----------- product_id | character varying(20) | not null product_price_type_id | character varying(20) | not null currency_uom_id | character varying(20) | not null product_store_id | character varying(20) | not null from_date | timestamp with time zone | not null thru_date | timestamp with time zone | price | numeric(18,2) | created_date | timestamp with time zone | created_by_user_login | character varying(255) | last_modified_date | timestamp with time zone | last_modified_by_user_login | character varying(255) | last_updated_stamp | timestamp with time zone | last_updated_tx_stamp | timestamp with time zone | created_stamp | timestamp with time zone | created_tx_stamp | timestamp with time zone | Indexes: --------- pk_product_price primary key btree (product_id, product_price_type_id, currency_uom_id, product_store_id, from_date), prdct_prc_txcrts btree (created_tx_stamp), prdct_prc_txstmp btree (last_updated_tx_stamp), prod_price_cbul btree (created_by_user_login), prod_price_cuom btree (currency_uom_id), prod_price_lmbul btree (last_modified_by_user_login), prod_price_prod btree (product_id), prod_price_pst btree (product_store_id), prod_price_type btree (product_price_type_id) Foreign Key constraints: ------------------------- prod_price_prod FOREIGN KEY (product_id) REFERENCES bob.product(product_id) ON UPDATE NO ACTION ON DELETE NO ACTION, prod_price_type FOREIGN KEY (product_price_type_id) REFERENCES bob.product_price_type(product_price_type_id) ON UPDATE NO ACTION ON DELETE NO ACTION, prod_price_cuom FOREIGN KEY (currency_uom_id) REFERENCES bob.uom(uom_id) ON UPDATE NO ACTION ON DELETE NO ACTION, prod_price_pst FOREIGN KEY (product_store_id) REFERENCES bob.product_store(product_store_id) ON UPDATE NO ACTION ON DELETE NO ACTION, prod_price_cbul FOREIGN KEY (created_by_user_login) REFERENCES bob.user_login(user_login_id) ON UPDATE NO ACTION ON DELETE NO ACTION, prod_price_lmbul FOREIGN KEY (last_modified_by_user_login) REFERENCES bob.user_login(user_login_id) ON UPDATE NO ACTION ON DELETE NO ACTION ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Thu Jun 30 10:31: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 2AA675294D for ; Thu, 30 Jun 2005 10:31:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29809-05 for ; Thu, 30 Jun 2005 13:31: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 0A77B528CB for ; Thu, 30 Jun 2005 10:31:09 -0300 (ADT) 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 j5UDV21J018108; Thu, 30 Jun 2005 09:31:02 -0400 (EDT) To: Martin Lesser Cc: pgsql-performance@postgresql.org Subject: Re: Vacuum becomes slow In-reply-to: <877jgci9yh.fsf@nb-acer.bettercom.de> References: <877jgci9yh.fsf@nb-acer.bettercom.de> Comments: In-reply-to Martin Lesser message dated "Thu, 30 Jun 2005 09:24:06 +0200" Date: Thu, 30 Jun 2005 09:31:01 -0400 Message-ID: <18107.1120138261@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: 200506/593 X-Sequence-Number: 13230 Martin Lesser writes: > the time needed for a daily VACUUM on a table with about 28 mio records > increases from day to day. My guess is that the original timings were artificially low because the indexes were in nearly perfect physical order, and as that condition degrades over time, it takes longer for VACUUM to scan them. If that's the right theory, the runtime should level off soon, and maybe you don't need to do anything. You could REINDEX periodically but I think the time taken to do that would probably be more than you want to spend (especially since REINDEX locks out writes where VACUUM does not). You should check that your FSM settings are large enough, but given that the table itself doesn't seem to be bloating, that's probably not the issue. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 30 10:48: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 0301552952 for ; Thu, 30 Jun 2005 10:48:17 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32013-09 for ; Thu, 30 Jun 2005 13:48: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 623FC52913 for ; Thu, 30 Jun 2005 10:48:15 -0300 (ADT) 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 j5UDmJsf018272; Thu, 30 Jun 2005 09:48:19 -0400 (EDT) To: Milan Sekanina Cc: pgsql-performance@postgresql.org Subject: Re: ODBC driver over network very slow In-reply-to: <42C3C967.8060605@sde.cz> References: <42C3C967.8060605@sde.cz> Comments: In-reply-to Milan Sekanina message dated "Thu, 30 Jun 2005 12:28:55 +0200" Date: Thu, 30 Jun 2005 09:48:19 -0400 Message-ID: <18271.1120139299@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: 200506/594 X-Sequence-Number: 13231 Milan Sekanina writes: > We are running an application that uses psqlodbc driver on Windows XP to > connect to a server and for some reason the download of data from the > server is very slow. We have created a very simple test application that > inserts a larger amount of data into the database and uses a simple > "SELECT * from test" to download it back. The INSERT of 10MB takes about > 4 seconds, while the SELECT takes almost 5 minutes (with basically > nothing else running on both the network and the two computers). If we > run the PostgreSQL server on the local machine so that the network is > not used, both actions are very fast. I seem to recall having seen similar reports not involving ODBC at all. Try searching the mailing-list archives, but I think the cases we solved involved getting rid of third-party add-ons to the Windows TCP stack. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 30 11:10: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 F35915293C for ; Thu, 30 Jun 2005 11:10:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38432-07 for ; Thu, 30 Jun 2005 14:10:24 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 7D32F529C2 for ; Thu, 30 Jun 2005 11:10:22 -0300 (ADT) 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: ODBC driver over network very slow Date: Thu, 30 Jun 2005 10:10:25 -0400 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3415C2C49@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] ODBC driver over network very slow thread-index: AcV9ensts2R1jVDCRKmuHK8B7eIxqwAAlVaA From: "Merlin Moncure" To: "Tom Lane" Cc: , "Milan Sekanina" 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: 200506/595 X-Sequence-Number: 13232 > Milan Sekanina writes: > > We are running an application that uses psqlodbc driver on Windows XP to > > connect to a server and for some reason the download of data from the > > server is very slow. We have created a very simple test application that > > inserts a larger amount of data into the database and uses a simple > > "SELECT * from test" to download it back. The INSERT of 10MB takes about > > 4 seconds, while the SELECT takes almost 5 minutes (with basically > > nothing else running on both the network and the two computers). If we > > run the PostgreSQL server on the local machine so that the network is > > not used, both actions are very fast. >=20 > I seem to recall having seen similar reports not involving ODBC at all. > Try searching the mailing-list archives, but I think the cases we solved > involved getting rid of third-party add-ons to the Windows TCP stack. IIRC there was a TCP related fix in the odbc driver related to performance with large buffers. I'd suggest trying a newer odbc driver first. Merlin=20 dave page wrote ([odbc] 500 times slower) >=20 > My collegue spent some time to dig the following case and it=20 > looks like=20 > Nagle algorithm and delayed ACKs related problem. > In psqlodbc.h > #define SOCK_BUFFER_SIZE 4096 >=20 > I changed that value to 8192 and driver works fine for me. > I am not sure why this change helps. Err, no neither am I. Why do you think it's got something to do with Nagle/delayed ACKs? The only thing that instantly rings bells for me is that the max size of a text field is 8190 bytes at present (which really should be increased, if not removed altogether), which won't fit in the default buffer. But then, I wouldn't expect to see the performance drop you describe with a 4096 byte buffer, only one much smaller. From pgsql-performance-owner@postgresql.org Thu Jun 30 11:47: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 B90A2529D1 for ; Thu, 30 Jun 2005 11:47:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02813-05 for ; Thu, 30 Jun 2005 14:47:25 +0000 (GMT) Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.91]) by svr1.postgresql.org (Postfix) with ESMTP id 2315652956 for ; Thu, 30 Jun 2005 11:47:21 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Thu, 30 Jun 2005 09:47:25 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.2 Date: Thu, 30 Jun 2005 09:47:19 -0500 From: "Kevin Grittner" To: , Cc: , Subject: Re: ODBC driver over network very slow Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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: 200506/596 X-Sequence-Number: 13233 I was hesitant to jump in on this because I am new to PostgreSQL and haven't seen this problem with _it_, but I have seen this with the Sybase database products. You can configure Sybase to disable the Nagle algorithm. If you don't, any query which returns rows too big to fit in their network buffer will be painfully slow. Increasing the buffer size can help with an individual query, but it just reduces the scope of the problem. What you really want to do is make sure that TCP_NODELAY is set for the connection, to disable the Nagle algorithm; it just doesn't seem to be appropriate for returning query results. How this issue comes into play in PostgreSQL is beyond my ken, but hopefully this observation is helpful to someone. -Kevin >>> "Merlin Moncure" 06/30/05 9:10 AM >>> > My collegue spent some time to dig the following case and it > looks like > Nagle algorithm and delayed ACKs related problem. > In psqlodbc.h > #define SOCK_BUFFER_SIZE 4096 > > I changed that value to 8192 and driver works fine for me. > I am not sure why this change helps. Err, no neither am I. Why do you think it's got something to do with Nagle/delayed ACKs? From pgsql-performance-owner@postgresql.org Thu Jun 30 12:42: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 64A92529B8 for ; Thu, 30 Jun 2005 12:42:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55013-09 for ; Thu, 30 Jun 2005 15:42:10 +0000 (GMT) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.198]) by svr1.postgresql.org (Postfix) with ESMTP id 4F61452988 for ; Thu, 30 Jun 2005 12:42:07 -0300 (ADT) Received: by nproxy.gmail.com with SMTP id x37so35381nfc for ; Thu, 30 Jun 2005 08:42:06 -0700 (PDT) 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:content-disposition; b=Pl+rV01CVO8iPZtNPmQLO2pRYOu8J1zcYZQSXV0T4MWcTIBPrtY7ah484RHMA0lgjrRM8WqWy8A4GTL6ChrjNGyEKZ4E8mKZ4xSzYROzbSK/dsR9B/MYVcKzUjOdYIsh8VOXmz0hTT7+hbKF9gVMQi+XhdHq+Bt1KvnUqWsxtIo= Received: by 10.48.3.12 with SMTP id 12mr24883nfc; Thu, 30 Jun 2005 08:42:06 -0700 (PDT) Received: by 10.48.49.14 with HTTP; Thu, 30 Jun 2005 08:42:06 -0700 (PDT) Message-ID: <4b09a0c050630084260f12728@mail.gmail.com> Date: Thu, 30 Jun 2005 17:42:06 +0200 From: Jean-Max Reymond Reply-To: Jean-Max Reymond To: pgsql-performance@postgresql.org Subject: start time very high Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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: 200506/597 X-Sequence-Number: 13234 hi, I have two computers, one laptop (1.5 GHz, 512 Mb RAM, 1 disk 4200) and one big Sun (8Gb RAM, 2 disks SCSI). On my laptop, I have this EXPLAIN ANALYZE Sort (cost=3D7.56..7.56 rows=3D1 width=3D28) (actual time=3D0.187..0.187= =20 rows=3D0 loops=3D1) Sort Key: evolution, indx -> Index Scan using index_xdb_child on xdb_child c1 =20 (cost=3D0.00..7.55 rows=3D1 width=3D28) (actual time=3D0.045..0.045 rows=3D= 0 loops=3D1) Index Cond: ((doc_id =3D 100) AND (ele_id =3D 1) AND (isremoved = =3D 0)) Filter: (evolution =3D (subplan)) SubPlan -> Aggregate (cost=3D3.78..3.78 rows=3D1 width=3D4) (never exe= cuted) -> Index Scan using index_xdb_child on xdb_child c2 =20 (cost=3D0.00..3.77 rows=3D1 width=3D4) (never executed) Index Cond: ((doc_id =3D 100) AND (ele_id =3D 1)) Filter: ((evolution <=3D 0) AND (child_id =3D $0) AN= D=20 (child_class =3D $1)) Total runtime: 0.469 ms (11 rows) and on the SUN: "Sort (cost=3D7.56..7.56 rows=3D1 width=3D28) (actual time=3D26.335..26.33= 5 rows=3D0 loops=3D1)" " Sort Key: evolution, indx" " -> Index Scan using index_xdb_child on xdb_child c1=20 (cost=3D0.00..7.55 rows=3D1 width=3D28) (actual time=3D26.121..26.121 rows= =3D0 loops=3D1)" " Index Cond: ((doc_id =3D 100) AND (ele_id =3D 1) AND (isremoved = =3D 0))" " Filter: (evolution =3D (subplan))" " SubPlan" " -> Aggregate (cost=3D3.78..3.78 rows=3D1 width=3D4) (never exe= cuted)" " -> Index Scan using index_xdb_child on xdb_child c2=20 (cost=3D0.00..3.77 rows=3D1 width=3D4) (never executed)" " Index Cond: ((doc_id =3D 100) AND (ele_id =3D 1))" " Filter: ((evolution <=3D 0) AND (child_id =3D $0) AND (child_class =3D $1))" "Total runtime: 26.646 ms" so the request run in 26.646 ms on the Sun and 0.469ms on my laptop :-(=20 the database are the same, vacuumed and I think the Postgres (8.0.3) are well configured. The Sun has two disks and use the TABLESPACE to have index on one disk and data's on the other disk. It seems that the cost of the first sort is very high on the Sun. How is it possible ? the request: explain analyze select * from XDB_CHILD c1 where c1.doc_id =3D 100 and c1.ele_id =3D 1 and c1.isremoved =3D 0 and c1.evolution =3D (select max(evolution) from XDB_CHILD c2 where c2.doc_id=3D1= 00 and c2.ele_id=3D1 and c2.evolution<= =3D0 and c2.child_id=3Dc1.child_id and c2.child_class=3Dc1.child_class) ORDER BY c1.evolution, c1.indx --=20 Jean-Max Reymond CKR Solutions Open Source Nice France http://www.ckr-solutions.com From pgsql-performance-owner@postgresql.org Thu Jun 30 13:23: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 C62BB52A0F for ; Thu, 30 Jun 2005 13:23:33 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31468-05 for ; Thu, 30 Jun 2005 16:23:23 +0000 (GMT) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.200]) by svr1.postgresql.org (Postfix) with ESMTP id 67EA9529E7 for ; Thu, 30 Jun 2005 13:23:22 -0300 (ADT) Received: by nproxy.gmail.com with SMTP id x37so37189nfc for ; Thu, 30 Jun 2005 09:23:22 -0700 (PDT) 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:content-disposition:references; b=iYdV3x9Ixh059xKPVP+uxhp1OxuBNusmQkMuPjkwqBG6Ch59rgYR9oLcKL7905N9nsIIVqqQD4TUl3l5JJvDN30hnIInBj+Gb+ESaPcWmn/+/shEzbcaWeMVrKPNxC1/XZyE7kcnEqqxQ7rLrnAQ/9jGka2e0R8DAor0g/5Q1Yk= Received: by 10.48.239.10 with SMTP id m10mr26028nfh; Thu, 30 Jun 2005 09:23:22 -0700 (PDT) Received: by 10.48.49.14 with HTTP; Thu, 30 Jun 2005 09:23:22 -0700 (PDT) Message-ID: <4b09a0c0506300923622887d@mail.gmail.com> Date: Thu, 30 Jun 2005 18:23:22 +0200 From: Jean-Max Reymond Reply-To: Jean-Max Reymond To: pgsql-performance@postgresql.org Subject: Re: start time very high In-Reply-To: <4b09a0c050630084260f12728@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <4b09a0c050630084260f12728@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/598 X-Sequence-Number: 13235 2005/6/30, Jean-Max Reymond : > so the request run in 26.646 ms on the Sun and 0.469ms on my laptop :-( > the database are the same, vacuumed and I think the Postgres (8.0.3) > are well configured. > The Sun has two disks and use the TABLESPACE to have index on one disk > and data's on the other disk. > It seems that the cost of the first sort is very high on the Sun. > How is it possible ? may be data's not loaded in memory but on disk ? --=20 Jean-Max Reymond CKR Solutions Open Source Nice France http://www.ckr-solutions.com From pgsql-performance-owner@postgresql.org Thu Jun 30 15:59: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 8EA405294F for ; Thu, 30 Jun 2005 15:59:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 81955-08 for ; Thu, 30 Jun 2005 18:59:16 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id CA1A5528A6 for ; Thu, 30 Jun 2005 15:59:15 -0300 (ADT) 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 7554028; Thu, 30 Jun 2005 12:01:24 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Jean-Max Reymond Subject: Re: start time very high Date: Thu, 30 Jun 2005 12:01:27 -0700 User-Agent: KMail/1.8 Cc: pgsql-performance@postgresql.org References: <4b09a0c050630084260f12728@mail.gmail.com> In-Reply-To: <4b09a0c050630084260f12728@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200506301201.27519.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.046 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/599 X-Sequence-Number: 13236 Jean-Max, > I have two computers, one laptop (1.5 GHz, 512 Mb RAM, 1 disk 4200) > and one big Sun (8Gb RAM, 2 disks SCSI). Did you run each query several times? It looks like the index is cached on one server and not on the other. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Jun 30 18:01: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 55B5E5293C for ; Thu, 30 Jun 2005 18:01:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21875-03 for ; Thu, 30 Jun 2005 21:01:28 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 102B65280D for ; Thu, 30 Jun 2005 18:01:27 -0300 (ADT) 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 j5UL1SUe021581; Thu, 30 Jun 2005 17:01:28 -0400 (EDT) To: Jean-Max Reymond Cc: pgsql-performance@postgresql.org Subject: Re: start time very high In-reply-to: <4b09a0c050630084260f12728@mail.gmail.com> References: <4b09a0c050630084260f12728@mail.gmail.com> Comments: In-reply-to Jean-Max Reymond message dated "Thu, 30 Jun 2005 17:42:06 +0200" Date: Thu, 30 Jun 2005 17:01:28 -0400 Message-ID: <21580.1120165288@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: 200506/600 X-Sequence-Number: 13237 Jean-Max Reymond writes: > so the request run in 26.646 ms on the Sun and 0.469ms on my laptop :-( > the database are the same, vacuumed and I think the Postgres (8.0.3) > are well configured. Are you sure they're both vacuumed? The Sun machine's behavior seems consistent with the idea of a lot of dead rows in its copy of the table. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 30 19:24: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 6B59352956 for ; Thu, 30 Jun 2005 19:24:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40218-01 for ; Thu, 30 Jun 2005 22:24:53 +0000 (GMT) Received: from calvin.surfutopia.net (calvin.surfutopia.net [67.120.245.34]) by svr1.postgresql.org (Postfix) with ESMTP id 3EC03528B8 for ; Thu, 30 Jun 2005 19:24:49 -0300 (ADT) Received: by calvin.surfutopia.net (Postfix, from userid 1000) id 51F04F240; Thu, 30 Jun 2005 15:24:51 -0700 (PDT) Date: Thu, 30 Jun 2005 15:24:51 -0700 From: John Mendenhall To: pgsql-performance@postgresql.org Subject: ported application having performance issues Message-ID: <20050630222451.GA17628@calvin.surfutopia.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: 200506/601 X-Sequence-Number: 13238 pgsql performance gurus, We ported an application from oracle to postgresql. We are experiencing an approximately 50% performance hit. I am in the process of isolating the problem. I have searched the internet (google) and tried various things. Only one thing seems to work. I am trying to find out if our solution is the only option, or if I am doing something terribly wrong. The original application runs on the following: hw: cpu0: SUNW,UltraSPARC-IIi (upaid 0 impl 0x12 ver 0x12 clock 302 MHz) mem = 393216K (0x18000000) sw: Solaris 5.6 Oracle 7.3.2.2.0 Apache 1.3.27 Perl 5.004_04 mod_perl 1.27 DBI 1.20 DBD::Oracle 1.12 The ported application runs on the following: hw: unix: [ID 389951 kern.info] mem = 262144K (0x10000000) rootnex: [ID 466748 kern.info] root nexus = Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 360MHz) sw: Solaris 5.9 PostgreSQL 7.4.6 Apache 1.3.33 Perl 5.8.6 mod_perl 1.29 DBI 1.46 DBD::Pg 1.40.1 Based on assistance from another list, we have tried the following: (1) Upgraded DBD::Pg to current version 1.43 (2) Ensured all tables are analyzed regularly (3) Setting some memory options in postgresql.conf (4) Located a handful of slow queries by setting log_min_duration_statement to 250. Future options we will consider are: (1) Attempting other option settings, like random_page_cost (2) Upgrading db server to current version 8.0.3 With our handful of slow queries, we have done several iterations of changes to determine what will address the issues. We have broken this down to the direction of a join and setting the enable_seqscan to off. The table definitions are at the bottom of this e-mail. There is one large table (contacts) and one smaller table (lead_requests). The final SQL is as follows: SELECT c.id AS contact_id, lr.id AS lead_request_id FROM lead_requests lr JOIN contacts c ON (c.id = lr.contact_id) WHERE c.partner_id IS NULL ORDER BY contact_id I ran this query against freshly vacuum analyzed tables. The first run is as follows: db=> explain analyze SELECT db-> c.id AS contact_id, db-> lr.id AS lead_request_id db-> FROM db-> lead_requests lr db-> JOIN contacts c ON (c.id = lr.contact_id) db-> WHERE db-> c.partner_id IS NULL db-> ORDER BY db-> contact_id db-> ; LOG: duration: 4618.133 ms statement: explain analyze SELECT c.id AS contact_id, lr.id AS lead_request_id FROM lead_requests lr JOIN contacts c ON (c.id = lr.contact_id) WHERE c.partner_id IS NULL ORDER BY contact_id QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (cost=4272.84..4520.82 rows=1230 width=21) (actual time=3998.771..4603.739 rows=699 loops=1) Merge Cond: ("outer".contact_id = "inner".id) -> Index Scan using lead_requests_contact_id_idx on lead_requests lr (cost=0.00..74.09 rows=1435 width=21) (actual time=0.070..22.431 rows=1430 loops=1) -> Sort (cost=4272.84..4352.28 rows=31775 width=11) (actual time=3998.554..4130.067 rows=32640 loops=1) Sort Key: c.id -> Seq Scan on contacts c (cost=0.00..1896.77 rows=31775 width=11) (actual time=0.040..326.135 rows=32501 loops=1) Filter: (partner_id IS NULL) Total runtime: 4611.323 ms (8 rows) As you can see, run time over 4 seconds. Then, I set enable_seqscan = off. db=> set enable_seqscan=off; SET Then I ran the exact same query: db=> explain analyze SELECT db-> c.id AS contact_id, db-> lr.id AS lead_request_id db-> FROM db-> lead_requests lr db-> JOIN contacts c ON (c.id = lr.contact_id) db-> WHERE db-> c.partner_id IS NULL db-> ORDER BY db-> contact_id db-> ; LOG: duration: 915.304 ms statement: explain analyze SELECT c.id AS contact_id, lr.id AS lead_request_id FROM lead_requests lr JOIN contacts c ON (c.id = lr.contact_id) WHERE c.partner_id IS NULL ORDER BY contact_id QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (cost=0.00..4749.84 rows=1230 width=21) (actual time=0.213..901.315 rows=699 loops=1) Merge Cond: ("outer".contact_id = "inner".id) -> Index Scan using lead_requests_contact_id_idx on lead_requests lr (cost=0.00..74.09 rows=1435 width=21) (actual time=0.073..21.448 rows=1430 loops=1) -> Index Scan using contacts_pkey on contacts c (cost=0.00..4581.30 rows=31775 width=11) (actual time=0.038..524.217 rows=32640 loops=1) Filter: (partner_id IS NULL) Total runtime: 903.638 ms (6 rows) Under 1 second. Excellent. The contacts table has 30000+ records. The lead_requests table has just around 1500 records. I want the query to start with the join at the lead_requests table since the number is so much smaller. So, bottom line is this: In order to get the performance to an acceptable level (I can live with under 1 second, though less time would be better), do I have to set enable_seqscan to off every time I run this query? Is there a better or more acceptable way to handle this? Thank you very much in advance for any pointers you can provide. And, if this is the wrong forum for this question, please let me know and I'll ask it elsewhere. JohnM ----- table definitions ----- ----- db=> \d contacts Table "db.contacts" Column | Type | Modifiers ------------------------------+-----------------------------+----------- id | numeric(38,0) | not null db_id | character varying(32) | firstname | character varying(64) | lastname | character varying(64) | company | character varying(128) | email | character varying(256) | phone | character varying(64) | address | character varying(128) | city | character varying(128) | state | character varying(32) | postalcode | character varying(16) | country | character varying(2) | not null contact_info_modified | character(1) | token_id | numeric(38,0) | status_id | numeric(38,0) | status_last_modified | timestamp without time zone | notes | character varying(2000) | demo_schedule | timestamp without time zone | partner_id | numeric(38,0) | prev_partner_id | numeric(38,0) | prev_prev_partner_id | numeric(38,0) | site_last_visited | timestamp without time zone | source_id | numeric(4,0) | demo_requested | timestamp without time zone | sourcebook_requested | timestamp without time zone | zip | numeric(8,0) | suffix | numeric(8,0) | feedback_request_sent | timestamp without time zone | products_sold | character varying(512) | other_brand | character varying(512) | printsample_requested | timestamp without time zone | indoor_media_sample | timestamp without time zone | outdoor_media_sample | timestamp without time zone | printers_owned | character varying(256) | business_type | character varying(256) | printers_owned2 | character varying(256) | contact_quality_id | numeric(38,0) | est_annual_value | numeric(38,2) | likelyhood_of_closing | numeric(38,0) | priority | numeric(38,0) | business_type_id | numeric(38,0) | lead_last_modified | timestamp without time zone | lead_value | numeric(38,2) | channel_contact_flag | character(1) | request_status_last_modified | timestamp without time zone | master_key_number | numeric(38,0) | master_key_token | character varying(32) | current_media_cust | character(1) | kodak_media_id | numeric(38,0) | printer_sample_id | numeric(38,0) | quantity_used_id | numeric(38,0) | rip_used_id | numeric(38,0) | language_code | character varying(3) | region_id | numeric(38,0) | not null lead_deleted | timestamp without time zone | last_request_set_status_id | numeric(38,0) | address2 | character varying(128) | media_usage_id | numeric(38,0) | Indexes: "contacts_pkey" primary key, btree (id) "contacts_partner_id_idx" btree (partner_id) "contacts_partner_id_null_idx" btree (partner_id) WHERE (partner_id IS NULL) "contacts_token_id_idx" btree (token_id) Check constraints: "sys_c0050644" CHECK (country IS NOT NULL) "sys_c0050643" CHECK (id IS NOT NULL) "sys_c0050645" CHECK (region_id IS NOT NULL) Triggers: insert_master_key BEFORE INSERT ON contacts FOR EACH ROW EXECUTE PROCEDURE pg_fct_insert_master_key() ----- ----- db=> \d lead_requests Table "db.lead_requests" Column | Type | Modifiers -----------------------+-----------------------------+----------- id | numeric(38,0) | not null contact_id | numeric(38,0) | not null request_id | numeric(38,0) | not null date_requested | timestamp without time zone | not null must_update_by | timestamp without time zone | date_satisfied | timestamp without time zone | status_id | numeric(38,0) | request_scheduled | timestamp without time zone | session_log_id | numeric(38,0) | notes | character varying(2000) | status_last_modified | timestamp without time zone | reminder_last_sent | timestamp without time zone | data | character varying(2000) | fulfillment_status_id | numeric(38,0) | Indexes: "lead_requests_pkey" primary key, btree (id) "lead_requests_contact_id_idx" btree (contact_id) "lead_requests_request_id_idx" btree (request_id) Check constraints: "sys_c0049877" CHECK (request_id IS NOT NULL) "sys_c0049876" CHECK (contact_id IS NOT NULL) "sys_c0049878" CHECK (date_requested IS NOT NULL) ----- -- John Mendenhall john@surfutopia.net surf utopia internet services From pgsql-performance-owner@postgresql.org Thu Jun 30 19:35: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 34EC952956 for ; Thu, 30 Jun 2005 19:35:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42223-02 for ; Thu, 30 Jun 2005 22:35:36 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 73F455281B for ; Thu, 30 Jun 2005 19:35:36 -0300 (ADT) Received: from [192.168.1.52] (fc1smp [66.93.38.87]) (authenticated bits=0) by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id j5UMZdoQ015762; Thu, 30 Jun 2005 15:35:39 -0700 Message-ID: <42C473BA.9090305@commandprompt.com> Date: Thu, 30 Jun 2005 15:35:38 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0.2-1.3.3 (X11/20050513) X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Mendenhall Cc: pgsql-performance@postgresql.org Subject: Re: ported application having performance issues References: <20050630222451.GA17628@calvin.surfutopia.net> In-Reply-To: <20050630222451.GA17628@calvin.surfutopia.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.85.1/960/Tue Jun 28 21:31:06 2005 on hosting.commandprompt.com X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.015 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/602 X-Sequence-Number: 13239 > Thank you very much in advance for any pointers you can > provide. And, if this is the wrong forum for this question, > please let me know and I'll ask it elsewhere. I think you may want to increase your statistics_target plus make sure you are running analyze. explain anaylze would do. Sincerely, Joshua D. Drake > > JohnM > > > > > > ----- > table definitions > ----- > > ----- > db=> \d contacts > Table "db.contacts" > Column | Type | Modifiers > ------------------------------+-----------------------------+----------- > id | numeric(38,0) | not null > db_id | character varying(32) | > firstname | character varying(64) | > lastname | character varying(64) | > company | character varying(128) | > email | character varying(256) | > phone | character varying(64) | > address | character varying(128) | > city | character varying(128) | > state | character varying(32) | > postalcode | character varying(16) | > country | character varying(2) | not null > contact_info_modified | character(1) | > token_id | numeric(38,0) | > status_id | numeric(38,0) | > status_last_modified | timestamp without time zone | > notes | character varying(2000) | > demo_schedule | timestamp without time zone | > partner_id | numeric(38,0) | > prev_partner_id | numeric(38,0) | > prev_prev_partner_id | numeric(38,0) | > site_last_visited | timestamp without time zone | > source_id | numeric(4,0) | > demo_requested | timestamp without time zone | > sourcebook_requested | timestamp without time zone | > zip | numeric(8,0) | > suffix | numeric(8,0) | > feedback_request_sent | timestamp without time zone | > products_sold | character varying(512) | > other_brand | character varying(512) | > printsample_requested | timestamp without time zone | > indoor_media_sample | timestamp without time zone | > outdoor_media_sample | timestamp without time zone | > printers_owned | character varying(256) | > business_type | character varying(256) | > printers_owned2 | character varying(256) | > contact_quality_id | numeric(38,0) | > est_annual_value | numeric(38,2) | > likelyhood_of_closing | numeric(38,0) | > priority | numeric(38,0) | > business_type_id | numeric(38,0) | > lead_last_modified | timestamp without time zone | > lead_value | numeric(38,2) | > channel_contact_flag | character(1) | > request_status_last_modified | timestamp without time zone | > master_key_number | numeric(38,0) | > master_key_token | character varying(32) | > current_media_cust | character(1) | > kodak_media_id | numeric(38,0) | > printer_sample_id | numeric(38,0) | > quantity_used_id | numeric(38,0) | > rip_used_id | numeric(38,0) | > language_code | character varying(3) | > region_id | numeric(38,0) | not null > lead_deleted | timestamp without time zone | > last_request_set_status_id | numeric(38,0) | > address2 | character varying(128) | > media_usage_id | numeric(38,0) | > Indexes: > "contacts_pkey" primary key, btree (id) > "contacts_partner_id_idx" btree (partner_id) > "contacts_partner_id_null_idx" btree (partner_id) WHERE (partner_id IS NULL) > "contacts_token_id_idx" btree (token_id) > Check constraints: > "sys_c0050644" CHECK (country IS NOT NULL) > "sys_c0050643" CHECK (id IS NOT NULL) > "sys_c0050645" CHECK (region_id IS NOT NULL) > Triggers: > insert_master_key BEFORE INSERT ON contacts FOR EACH ROW EXECUTE PROCEDURE pg_fct_insert_master_key() > ----- > > ----- > db=> \d lead_requests > Table "db.lead_requests" > Column | Type | Modifiers > -----------------------+-----------------------------+----------- > id | numeric(38,0) | not null > contact_id | numeric(38,0) | not null > request_id | numeric(38,0) | not null > date_requested | timestamp without time zone | not null > must_update_by | timestamp without time zone | > date_satisfied | timestamp without time zone | > status_id | numeric(38,0) | > request_scheduled | timestamp without time zone | > session_log_id | numeric(38,0) | > notes | character varying(2000) | > status_last_modified | timestamp without time zone | > reminder_last_sent | timestamp without time zone | > data | character varying(2000) | > fulfillment_status_id | numeric(38,0) | > Indexes: > "lead_requests_pkey" primary key, btree (id) > "lead_requests_contact_id_idx" btree (contact_id) > "lead_requests_request_id_idx" btree (request_id) > Check constraints: > "sys_c0049877" CHECK (request_id IS NOT NULL) > "sys_c0049876" CHECK (contact_id IS NOT NULL) > "sys_c0049878" CHECK (date_requested IS NOT NULL) > ----- > > -- Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240 PostgreSQL Replication, Consulting, Custom Programming, 24x7 support Managed Services, Shared and Dedicated Hosting Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/ From pgsql-performance-owner@postgresql.org Thu Jun 30 19:43: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 ECC1052802 for ; Thu, 30 Jun 2005 19:43:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 40673-10 for ; Thu, 30 Jun 2005 22:43: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 D839052A17 for ; Thu, 30 Jun 2005 19:43:32 -0300 (ADT) 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 j5UMhY78022504; Thu, 30 Jun 2005 18:43:34 -0400 (EDT) To: John Mendenhall Cc: pgsql-performance@postgresql.org Subject: Re: ported application having performance issues In-reply-to: <20050630222451.GA17628@calvin.surfutopia.net> References: <20050630222451.GA17628@calvin.surfutopia.net> Comments: In-reply-to John Mendenhall message dated "Thu, 30 Jun 2005 15:24:51 -0700" Date: Thu, 30 Jun 2005 18:43:34 -0400 Message-ID: <22503.1120171414@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: 200506/603 X-Sequence-Number: 13240 John Mendenhall writes: > Merge Join (cost=4272.84..4520.82 rows=1230 width=21) (actual time=3998.771..4603.739 rows=699 loops=1) > Merge Cond: ("outer".contact_id = "inner".id) > -> Index Scan using lead_requests_contact_id_idx on lead_requests lr (cost=0.00..74.09 rows=1435 width=21) (actual time=0.070..22.431 rows=1430 loops=1) > -> Sort (cost=4272.84..4352.28 rows=31775 width=11) (actual time=3998.554..4130.067 rows=32640 loops=1) > Sort Key: c.id > -> Seq Scan on contacts c (cost=0.00..1896.77 rows=31775 width=11) (actual time=0.040..326.135 rows=32501 loops=1) > Filter: (partner_id IS NULL) > Total runtime: 4611.323 ms Hmm ... even on a SPARC, it doesn't seem like it should take 4 seconds to sort 30000 rows. You can certainly see that the planner is not expecting that (it's estimating a sort cost comparable to the scan cost, which if true would put this in the sub-second ballpark). Does increasing sort_mem help? Have you considered using some other datatype than "numeric" for your keys? Numeric may be fast on Oracle but it's not amazingly fast on Postgres. bigint would be better, if you don't really need 38 digits; if you do, I'd be inclined to think about plain char or varchar keys. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jun 30 20:58: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 1D5D3528A6 for ; Thu, 30 Jun 2005 20:58:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54666-07 for ; Thu, 30 Jun 2005 23:58:21 +0000 (GMT) Received: from calvin.surfutopia.net (calvin.surfutopia.net [67.120.245.34]) by svr1.postgresql.org (Postfix) with ESMTP id CD2C252812 for ; Thu, 30 Jun 2005 20:58:19 -0300 (ADT) Received: by calvin.surfutopia.net (Postfix, from userid 1000) id B7337F230; Thu, 30 Jun 2005 16:58:21 -0700 (PDT) Date: Thu, 30 Jun 2005 16:58:21 -0700 From: John Mendenhall To: pgsql-performance@postgresql.org Subject: Re: ported application having performance issues Message-ID: <20050630235821.GA2163@calvin.surfutopia.net> References: <20050630222451.GA17628@calvin.surfutopia.net> <42C473BA.9090305@commandprompt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42C473BA.9090305@commandprompt.com> 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: 200506/604 X-Sequence-Number: 13241 pgsql performance gurus, I truly appreciate the suggestions provided. I have tried each one separately to determine the best fit. I have included results for each suggestion. I have also included my entire postgresql.conf file so you can see our base configuration. Each result is based on an in-session variable setting, so it only affected the current session. (1) Increase the default_statistics_target, run vacuum, analyze on each table for each setting The default setting is 10. I tried the following settings, with the corresponding results: default_statistics_target = 10 time approximately 4500ms default_statistics_target = 100 time approximately 3900ms default_statistics_target = 500 time approximately 3900ms default_statistics_target = 1000 time approximately 3900ms So, this option does not quite get us there. (2) Increase sort_mem value The current setting for sort_mem is 2048. sort_mem = 2048 time approximately 4500ms sort_mem = 8192 time approximately 2750ms sort_mem = 16384 time approximately 2650ms sort_mem = 1024 time approximately 1000ms Interesting to note... When I set sort_mem to 1024, the plan started the join with the lead_requests table and used the contacts index. None of the above attempts used this. (3) Decrease random_page_cost, increase effective_cache_size The default setting for random_page_cost is 4. Our setting for effective_cache_size is 2048. random_page_cost = 4, effective_cache_size = 2048 time approximately 4500ms random_page_cost = 3, effective_cache_size = 2048 time approximately 1050ms random_page_cost = 3, effective_cache_size = 4096 time approximately 1025ms The decrease of random_page_cost to 3 caused the plan to work properly, using the lead_requests table as a join starting point and using the contacts index. ***** It appears we learned the following: (a) For some reason, setting the sort_mem smaller than our current setting caused things to work correctly. (b) Lowering random_page_cost causes things to work correctly. This brings up the following questions: (i) What is the ideal configuration for this query to work? (ii) Will this ideal configuration work for all our other queries, or is this specific to this query only? (iii) Should I try additional variable changes, or lower/raise the variables I have already changed even more? Thanks again for the suggestions provided. And, thanks in advance for any additional thoughts or suggestions. JohnM :::::::::::::: postgresql.conf :::::::::::::: ----- # ----------------------------- # PostgreSQL configuration file # ----------------------------- # # This file consists of lines of the form: # # name = value # # (The '=' is optional.) White space may be used. Comments are introduced # with '#' anywhere on a line. The complete list of option names and # allowed values can be found in the PostgreSQL documentation. The # commented-out settings shown in this file represent the default values. # # Any option can also be given as a command line switch to the # postmaster, e.g. 'postmaster -c log_connections=on'. Some options # can be changed at run-time with the 'SET' SQL command. # # This file is read on postmaster startup and when the postmaster # receives a SIGHUP. If you edit the file on a running system, you have # to SIGHUP the postmaster for the changes to take effect, or use # "pg_ctl reload". #--------------------------------------------------------------------------- # CONNECTIONS AND AUTHENTICATION #--------------------------------------------------------------------------- # - Connection Settings - tcpip_socket = false max_connections = 128 # note: increasing max_connections costs about 500 bytes of shared # memory per connection slot, in addition to costs from shared_buffers # and max_locks_per_transaction. #superuser_reserved_connections = 2 #port = 5432 #unix_socket_directory = '' #unix_socket_group = '' #unix_socket_permissions = 0777 # octal #virtual_host = '' # what interface to listen on; defaults to any #rendezvous_name = '' # defaults to the computer name # - Security & Authentication - #authentication_timeout = 60 # 1-600, in seconds #ssl = false #password_encryption = true #krb_server_keyfile = '' #db_user_namespace = false #--------------------------------------------------------------------------- # RESOURCE USAGE (except WAL) #--------------------------------------------------------------------------- # - Memory - shared_buffers = 4096 # min 16, at least max_connections*2, 8KB each sort_mem = 2048 # min 64, size in KB #vacuum_mem = 8192 # min 1024, size in KB # - Free Space Map - #max_fsm_pages = 20000 # min max_fsm_relations*16, 6 bytes each #max_fsm_relations = 1000 # min 100, ~50 bytes each # - Kernel Resource Usage - #max_files_per_process = 1000 # min 25 #preload_libraries = '' #--------------------------------------------------------------------------- # WRITE AHEAD LOG #--------------------------------------------------------------------------- # - Settings - #fsync = true # turns forced synchronization on or off #wal_sync_method = fsync # the default varies across platforms: # fsync, fdatasync, open_sync, or open_datasync #wal_buffers = 8 # min 4, 8KB each # - Checkpoints - #checkpoint_segments = 3 # in logfile segments, min 1, 16MB each #checkpoint_timeout = 300 # range 30-3600, in seconds #checkpoint_warning = 30 # 0 is off, in seconds #commit_delay = 0 # range 0-100000, in microseconds #commit_siblings = 5 # range 1-1000 #--------------------------------------------------------------------------- # QUERY TUNING #--------------------------------------------------------------------------- # - Planner Method Enabling - #enable_hashagg = true #enable_hashjoin = true #enable_indexscan = true #enable_mergejoin = true #enable_nestloop = true #enable_seqscan = true #enable_sort = true #enable_tidscan = true # - Planner Cost Constants - effective_cache_size = 2048 # typically 8KB each #random_page_cost = 4 # units are one sequential page fetch cost #cpu_tuple_cost = 0.01 # (same) #cpu_index_tuple_cost = 0.001 # (same) #cpu_operator_cost = 0.0025 # (same) # - Genetic Query Optimizer - #geqo = true #geqo_threshold = 11 #geqo_effort = 1 #geqo_generations = 0 #geqo_pool_size = 0 # default based on tables in statement, # range 128-1024 #geqo_selection_bias = 2.0 # range 1.5-2.0 # - Other Planner Options - #default_statistics_target = 10 # range 1-1000 #from_collapse_limit = 8 #join_collapse_limit = 8 # 1 disables collapsing of explicit JOINs #--------------------------------------------------------------------------- # ERROR REPORTING AND LOGGING #--------------------------------------------------------------------------- # - Syslog - syslog = 1 # range 0-2; 0=stdout; 1=both; 2=syslog syslog_facility = 'LOCAL0' syslog_ident = 'postgres' # - When to Log - client_min_messages = log # Values, in order of decreasing detail: # debug5, debug4, debug3, debug2, debug1, # log, info, notice, warning, error log_min_messages = info # Values, in order of decreasing detail: # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, log, fatal, # panic log_error_verbosity = verbose # terse, default, or verbose messages log_min_error_statement = info # Values in order of increasing severity: # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, panic(off) log_min_duration_statement = 250 # Log all statements whose # execution time exceeds the value, in # milliseconds. Zero prints all # queries. Minus-one disables. silent_mode = false # DO NOT USE without Syslog! # - What to Log - #debug_print_parse = false #debug_print_rewritten = false #debug_print_plan = false debug_pretty_print = true log_connections = true #log_duration = true #log_pid = false #log_statement = true log_timestamp = true #log_hostname = false #log_source_port = false #--------------------------------------------------------------------------- # RUNTIME STATISTICS #--------------------------------------------------------------------------- # - Statistics Monitoring - #log_parser_stats = false #log_planner_stats = false #log_executor_stats = false #log_statement_stats = false # - Query/Index Statistics Collector - #stats_start_collector = true #stats_command_string = false #stats_block_level = false #stats_row_level = false #stats_reset_on_server_start = true #--------------------------------------------------------------------------- # CLIENT CONNECTION DEFAULTS #--------------------------------------------------------------------------- # - Statement Behavior - #search_path = '$user,public' # schema names #check_function_bodies = true #default_transaction_isolation = 'read committed' #default_transaction_read_only = false #statement_timeout = 0 # 0 is disabled, in milliseconds # - Locale and Formatting - #datestyle = 'iso, mdy' #timezone = unknown # actually, defaults to TZ environment setting #australian_timezones = false #extra_float_digits = 0 # min -15, max 2 #client_encoding = sql_ascii # actually, defaults to database encoding # These settings are initialized by initdb -- they may be changed lc_messages = 'C' # locale for system error message strings lc_monetary = 'C' # locale for monetary formatting lc_numeric = 'C' # locale for number formatting lc_time = 'C' # locale for time formatting # - Other Defaults - #explain_pretty_print = true #dynamic_library_path = '$libdir' #max_expr_depth = 10000 # min 10 #--------------------------------------------------------------------------- # LOCK MANAGEMENT #--------------------------------------------------------------------------- #deadlock_timeout = 1000 # in milliseconds #max_locks_per_transaction = 64 # min 10, ~260*max_connections bytes each #--------------------------------------------------------------------------- # VERSION/PLATFORM COMPATIBILITY #--------------------------------------------------------------------------- # - Previous Postgres Versions - #add_missing_from = true #regex_flavor = advanced # advanced, extended, or basic #sql_inheritance = true # - Other Platforms & Clients - #transform_null_equals = false ----- -- John Mendenhall john@surfutopia.net surf utopia internet services