Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 6BF982E0042 for ; Thu, 24 Apr 2008 16:57:45 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 48286-06 for ; Thu, 24 Apr 2008 16:57:41 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from 27.mail-out.ovh.net (27.mail-out.ovh.net [91.121.30.210]) by developer.postgresql.org (Postfix) with SMTP id 8CFD32E003B for ; Thu, 24 Apr 2008 16:57:41 -0300 (ADT) Received: (qmail 31692 invoked by uid 503); 24 Apr 2008 21:44:34 -0000 Received: from gw2.ovh.net (HELO mail174.ha.ovh.net) (213.251.189.202) by 27.mail-out.ovh.net with SMTP; 24 Apr 2008 21:44:34 -0000 Received: from b0.ovh.net (HELO queue-out) (213.186.33.50) by b0.ovh.net with SMTP; 24 Apr 2008 19:57:40 -0000 Received: from par69-8-88-161-102-87.fbx.proxad.net (HELO apollo13.peufeu.com) (88.161.102.87) by ns0.ovh.net with SMTP; 24 Apr 2008 19:57:39 -0000 Date: Thu, 24 Apr 2008 22:02:40 +0200 To: "Nikolas Everett" Subject: Re: Question about disk IO an index use and seeking advice From: PFC Cc: pgsql-performance@postgresql.org Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 References: Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: User-Agent: Opera Mail/9.24 (Linux) X-Ovh-Remote: 88.161.102.87 (par69-8-88-161-102-87.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|H 0.5/N X-Ovh-Tracer-Id: 18393263828306298416 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.718 tagged_above=0 required=5 tests=AWL=0.718 X-Spam-Level: X-Archive-Number: 200804/364 X-Sequence-Number: 29857 > An index scan looks through the index and pulls in each pages as it sees > it. > A bitmap index scan looks through the index and makes a sorted list of > all > the pages it needs and then the bitmap heap scan reads all the pages. > If your data is scattered then you may as well do the index scan, but if > your data is sequential-ish then you should do the bitmap index scan. > > Is that right? Where can I learn more? I've read That's about it, yes. If your bitmap has large holes, it will seek, but if it has little holes, readahead will work. Hence, fast, and good. On indexscan, readahead doesn't help since the hits are pretty random. If you have N rows in the index with the same date, in which order whill they get scanned ? There is no way to know that, and no way to be sure this order corresponds to physical order on disk. > About clustering: I know that CLUSTER takes an exclusive lock on the > table. At present, users can query the table at any time, so I'm not > allowed to take an exclusive lock for more than a few seconds. Then, CLUSTER is out. > Could I > achieve the same thing by creating a second copy of the table and then > swapping the first copy out for the second? I think something like that > would fit in my time frames If the archive table is read-only, then yes, you can do this. . > About partitioning: I can definitely see how having the data in more > manageable chunks would allow me to do things like clustering. It will > definitely make vacuuming easier. > > About IO speeds: The db is always under some kind of load. I actually > get > scared if the load average isn't at least 2. Could I try to run > something > like bonnie++ to get some real load numbers? I'm sure that would cripple > the system while it is running, but if it only takes a few seconds that > would be ok. > > There were updates running while I was running the test. The WAL log is > on > the hardware raid 10. Moving it from the software raid 5 almost doubled > our > insert performance. Normal ; fsync on a RAID5-6 is bad, bad. You have battery backed up cache ? > Thanks again, > > --Nik