From pgsql-performance-owner@postgresql.org Mon Dec 2 10:47:04 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 870D347668E for ; Mon, 2 Dec 2002 10:47:02 -0500 (EST) Received: from gatefox.foxi.nl (a194-109-246-192.adsl.xs4all.nl [194.109.246.192]) by postgresql.org (Postfix) with ESMTP id 16E614765FE for ; Mon, 2 Dec 2002 10:44:13 -0500 (EST) Received: from techfox (techfox.foxi [192.168.0.79]) by gatefox.foxi.nl (8.10.2/8.10.2) with ESMTP id gB2FiGJ07432 for ; Mon, 2 Dec 2002 16:44:16 +0100 Content-Type: text/plain; charset="iso-8859-15" From: "ir. F.T.M. van Vugt bc." Organization: Foxi Consultants in Technology To: Postgresql performance Subject: v7.2.3 versus v7.3 -> huge performance penalty for JOIN with UNION Date: Mon, 2 Dec 2002 16:45:55 +0100 User-Agent: KMail/1.4.3 References: <1037036692.29703.213.camel@CPE-144-132-182-167> <1037074231.29703.234.camel@CPE-144-132-182-167> <1037076680.66615.21.camel@jester> In-Reply-To: <1037076680.66615.21.camel@jester> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212021645.55032.ftm.van.vugt@foxi.nl> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/1 X-Sequence-Number: 417 L.S. The query below runs 10-20 times slower under v7.3 than it did under v7.2.3: - hardware is the same - standard install of postgresql, both version had stats-collection enabled - v7.2.3 had no multibyte and no locale, obviously v7.3 does - *very* recent vacuum analyse I expected some overhead due to the enabled mulitbyte, but not this much.. = ;( BTW, there are a few other queries that are performing *real* slow, but I'm= =20 hoping this one will give away a cause for the overall problem... Could anybody offer an idea? trial=3D# explain analyse select foo.*, c.id from (select *, 't' from lijst01_table union all=20 select *, 't' from lijst02_table union all=20 select *, 'f' from lijst03_table union all=20 select *, 'f' from lijst04_table union all=20 select *, 't' from lijst04b_table ) as foo inner join creditor c=20 on foo.dflt_creditor_id =3D c.old_creditor_id order by old_id; * foo.dflt_creditor_id is of type varchar(20) * c.old_creditor_id is of type text The plan below shows something weird is happening during the join, but I ca= n't=20 explain it. TIA, Frank. QUERY PL= AN ---------------------------------------------------------------------------= --------------------------------------------------------------------- Sort (cost=3D54103.74..54116.18 rows=3D4976 width=3D498) (actual=20 time=3D234595.27..234607.58 rows=3D4976 loops=3D1) Sort Key: foo.old_id -> Nested Loop (cost=3D0.00..53798.19 rows=3D4976 width=3D498) (actual= =20 time=3D7559.20..234476.70 rows=3D4976 loops=3D1) Join Filter: ("inner".dflt_creditor_id =3D=20 ("outer".old_creditor_id)::text) -> Seq Scan on creditor c (cost=3D0.00..8.27 rows=3D227 width=3D= 14)=20 (actual time=3D0.05..7.35 rows=3D227 loops=3D1) -> Subquery Scan foo (cost=3D0.00..174.76 rows=3D4976 width=3D15= 0)=20 (actual time=3D0.25..969.47 rows=3D4976 loops=3D227) -> Append (cost=3D0.00..174.76 rows=3D4976 width=3D150) (a= ctual=20 time=3D0.20..658.14 rows=3D4976 loops=3D227) -> Subquery Scan "*SELECT* 1" (cost=3D0.00..2.46 row= s=3D46=20 width=3D145) (actual time=3D0.19..6.26 rows=3D46 loops=3D227) -> Seq Scan on lijst01_table (cost=3D0.00..2.4= 6=20 rows=3D46 width=3D145) (actual time=3D0.10..3.40 rows=3D46 loops=3D227) -> Subquery Scan "*SELECT* 2" (cost=3D0.00..30.62=20 rows=3D862 width=3D150) (actual time=3D0.16..111.38 rows=3D862 loops=3D227) -> Seq Scan on lijst02_table (cost=3D0.00..30.= 62=20 rows=3D862 width=3D150) (actual time=3D0.09..59.79 rows=3D862 loops=3D227) -> Subquery Scan "*SELECT* 3" (cost=3D0.00..48.63=20 rows=3D1363 width=3D148) (actual time=3D0.16..166.98 rows=3D1363 loops=3D22= 7) -> Seq Scan on lijst03_table (cost=3D0.00..48.= 63=20 rows=3D1363 width=3D148) (actual time=3D0.09..87.45 rows=3D1363 loops=3D227) -> Subquery Scan "*SELECT* 4" (cost=3D0.00..92.03=20 rows=3D2703 width=3D134) (actual time=3D0.15..338.66 rows=3D2703 loops=3D22= 7) -> Seq Scan on lijst04_table (cost=3D0.00..92.= 03=20 rows=3D2703 width=3D134) (actual time=3D0.09..176.41 rows=3D2703 loops=3D22= 7) -> Subquery Scan "*SELECT* 5" (cost=3D0.00..1.02 row= s=3D2=20 width=3D134) (actual time=3D0.16..0.28 rows=3D2 loops=3D227) -> Seq Scan on lijst04b_table (cost=3D0.00..1.= 02=20 rows=3D2 width=3D134) (actual time=3D0.09..0.16 rows=3D2 loops=3D227) Total runtime: 234624.07 msec (18 rows) From pgsql-performance-owner@postgresql.org Mon Dec 2 11:02:29 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4C528476469 for ; Mon, 2 Dec 2002 11:02:27 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 1F151475FDE for ; Mon, 2 Dec 2002 11:00:08 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 18IszV-0004nG-00 for ; Mon, 02 Dec 2002 11:00:13 -0500 Date: Mon, 2 Dec 2002 11:00:12 -0500 From: Andrew Sullivan To: Postgresql performance Subject: Re: v7.2.3 versus v7.3 -> huge performance penalty for JOIN with UNION Message-ID: <20021202110012.G12906@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , Postgresql performance References: <1037036692.29703.213.camel@CPE-144-132-182-167> <1037074231.29703.234.camel@CPE-144-132-182-167> <1037076680.66615.21.camel@jester> <200212021645.55032.ftm.van.vugt@foxi.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200212021645.55032.ftm.van.vugt@foxi.nl>; from ftm.van.vugt@foxi.nl on Mon, Dec 02, 2002 at 04:45:55PM +0100 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/2 X-Sequence-Number: 418 On Mon, Dec 02, 2002 at 04:45:55PM +0100, ir. F.T.M. van Vugt bc. wrote: > L.S. > > The query below runs 10-20 times slower under v7.3 than it did under v7.2.3: > - v7.2.3 had no multibyte and no locale, obviously v7.3 does Are you using the C locale? If it was not enabled in 7.2.3, I believe it was using C anyway; if you have some other locale, it's now getting picked up, and that might be the source of the slower performance (?). A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Mon Dec 2 11:14:32 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BE70847646B for ; Mon, 2 Dec 2002 11:14:31 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id D1F674760D5 for ; Mon, 2 Dec 2002 11:13:46 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB2GDips018913; Mon, 2 Dec 2002 11:13:45 -0500 (EST) To: "ir. F.T.M. van Vugt bc." Cc: Postgresql performance Subject: Re: v7.2.3 versus v7.3 -> huge performance penalty for JOIN with UNION In-reply-to: <200212021645.55032.ftm.van.vugt@foxi.nl> References: <1037036692.29703.213.camel@CPE-144-132-182-167> <1037074231.29703.234.camel@CPE-144-132-182-167> <1037076680.66615.21.camel@jester> <200212021645.55032.ftm.van.vugt@foxi.nl> Comments: In-reply-to "ir. F.T.M. van Vugt bc." message dated "Mon, 02 Dec 2002 16:45:55 +0100" Date: Mon, 02 Dec 2002 11:13:44 -0500 Message-ID: <18912.1038845624@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/3 X-Sequence-Number: 419 "ir. F.T.M. van Vugt bc." writes: > The query below runs 10-20 times slower under v7.3 than it did under v7.2.3: I don't suppose you have explain output for it from 7.2.3? It seems strange to me that the thing is picking a nestloop join here. Either merge or hash would make more sense ... oh, but wait: > inner join creditor c > on foo.dflt_creditor_id = c.old_creditor_id > * foo.dflt_creditor_id is of type varchar(20) > * c.old_creditor_id is of type text IIRC, merge and hash only work on plain Vars --- the implicit type coercion from varchar to text is what's putting the kibosh on a more intelligent join plan. Can you fix your table declarations to agree on the datatype? If you don't want to change the tables, another possibility is something like select foo.*, c.id from (select *, dflt_creditor_id::text as key, 't' from lijst01_table union all select *, dflt_creditor_id::text as key, 't' from lijst02_table union all select *, dflt_creditor_id::text as key, 'f' from lijst03_table union all select *, dflt_creditor_id::text as key, 'f' from lijst04_table union all select *, dflt_creditor_id::text as key, 't' from lijst04b_table ) as foo inner join creditor c on foo.key = c.old_creditor_id order by old_id; ie, force the type coercion to occur down inside the union, not at the join. This doesn't explain the slowdown from 7.2.3, though --- it had the same deficiency. (I am hoping to get around to fixing it for 7.4.) It could easy be that --enable-locale explains the slowdown. Are you running 7.4 in C locale, or something else? Comparisons in locales like en_US can be *way* slower than in C locale. You can use pg_controldata to check this for sure. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 2 12:18:53 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4651E475EDF for ; Mon, 2 Dec 2002 12:18:53 -0500 (EST) Received: from gatefox.foxi.nl (a194-109-246-192.adsl.xs4all.nl [194.109.246.192]) by postgresql.org (Postfix) with ESMTP id 266464763B6 for ; Mon, 2 Dec 2002 12:18:29 -0500 (EST) Received: from techfox (techfox.foxi [192.168.0.79]) by gatefox.foxi.nl (8.10.2/8.10.2) with ESMTP id gB2HIRJ22951; Mon, 2 Dec 2002 18:18:27 +0100 Content-Type: text/plain; charset="iso-8859-15" From: "ir. F.T.M. van Vugt bc." Organization: Foxi Consultants in Technology To: Tom Lane , Andrew Sullivan Subject: Re: v7.2.3 versus v7.3 -> huge performance penalty for JOIN with UNION Date: Mon, 2 Dec 2002 18:20:06 +0100 User-Agent: KMail/1.4.3 References: <1037036692.29703.213.camel@CPE-144-132-182-167> <200212021645.55032.ftm.van.vugt@foxi.nl> <18912.1038845624@sss.pgh.pa.us> In-Reply-To: <18912.1038845624@sss.pgh.pa.us> Cc: Postgresql performance MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212021820.06380.ftm.van.vugt@foxi.nl> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/4 X-Sequence-Number: 420 Wow, the speed at which you guys are responding never ceases to amaze me ! TL> I don't suppose you have explain output for it from 7.2.3? Nope, sorry 'bout that. BTW, the performance comparison was not a 'hard' (measured) number, but a= =20 watch-timed conclusion on a complete run of a conversiontool this query is= =20 part of. TL> It seems strange to me that the thing is picking a nestloop join here. TL> oh, but wait: the implicit type coercion from varchar to text is what's TL> putting the kibosh on a more intelligent join plan. You're abolutely right, I'm back in business when putting a type coercion= =20 inside the union: trial=3D# explain select foo.*, c.id from QUERY PLAN ---------------------------------------------------------------------------= ---------------------- Sort (cost=3D588.66..601.10 rows=3D4976 width=3D530) Sort Key: foo.old_id -> Hash Join (cost=3D8.84..283.12 rows=3D4976 width=3D530) Hash Cond: ("outer"."key" =3D "inner".old_creditor_id) -> Subquery Scan foo (cost=3D0.00..174.76 rows=3D4976 width=3D15= 0) -> Append (cost=3D0.00..174.76 rows=3D4976 width=3D150) (as opposed to: (cost=3D54103.74..54116.18 rows=3D4976 width=3D498)) > This doesn't explain the slowdown from 7.2.3, though --- it had the same > deficiency. (I am hoping to get around to fixing it for 7.4.) Mmm, that's weird. Could be caused by somebody over here who has done 'work= '=20 on some queries... ;( =3D> I'll check on that, if I can be absolutely sure= the=20 7.2.3 version planned *this* query differently, I'll let you know. Sorry=20 'bout that.... AS> It could easy be that --enable-locale explains the slowdown. Are you AS> running 7.4 in C locale, or something else? On v7.2.3. I wasn't doing anything with locale. The v7.3 put 'POSIX' into the postgresql.conf file, changing that into 'C'= =20 didn't seem to make any difference. AS> Comparisons in locales like en_US can be *way* slower than in C locale. AS> You can use pg_controldata to check this for sure. O.K. this seems to help a lot as well ! I'll have to take a look at both ISO C and POSIX locale, 'cause I wouldn't= =20 have expected it to make such a difference... On the original v7.3, pg_controldata returned 'posix', upon changing the=20 postgresql.conf it confirmed the change to 'C'. This resulted in: POSIX_trial=3D# explain analyse select foo.*, c.id from=20 QUERY PLAN ---------------------------------------------------------------------------= -------------------------------------------------------------------- Sort (cost=3D588.66..601.10 rows=3D4976 width=3D530) (actual time=3D2482.= 51..2530.54=20 rows=3D4976 loops=3D1) Total runtime: 2636.15 msec C_trial=3D# explain analyse select foo.*, c.id from=20 QUERY PLAN ---------------------------------------------------------------------------= ------------------------------------------------------------------- Sort (cost=3D588.66..601.10 rows=3D4976 width=3D530) (actual time=3D1537.= 05..1549.34=20 rows=3D4976 loops=3D1) Total runtime: 1567.76 msec Hey, I'm happy ;-) Thanks a lot !!! Frank. From pgsql-performance-owner@postgresql.org Mon Dec 2 13:54:05 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F078347671C for ; Mon, 2 Dec 2002 13:54:03 -0500 (EST) Received: from o2.hostbaby.com (o2.hostbaby.com [208.187.29.121]) by postgresql.org (Postfix) with SMTP id 74214476CA4 for ; Mon, 2 Dec 2002 13:30:48 -0500 (EST) Received: (qmail 11478 invoked from network); 2 Dec 2002 18:30:50 -0000 Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 2 Dec 2002 18:30:50 -0000 Received: from 216.80.95.13 (Hostbaby Webmail authenticated user typea@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 2 Dec 2002 10:30:50 -0800 (PST) Message-ID: <49486.216.80.95.13.1038853850.squirrel@www.l-i-e.com> Date: Mon, 2 Dec 2002 10:30:50 -0800 (PST) Subject: From: To: X-Priority: 3 Importance: Normal X-Mailer: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/5 X-Sequence-Number: 421 [I hope job postings are kosher...] I need help optimizing a PostgreSQL application: Full-text search ~17,000 records Articles (text) are about 10K long on average, ranging from 0 to 278K. I don't know if we need to throw more RAM, more hard drive, more comparison RAM in postmaster.conf or build a concordance or if this is just not something that can be done within our budget. I can't even seem to get the PostgreSQL profiling output using "-s" in the startup of postmaster and client to determine what the db engine is doing. I don't understand why PostgreSQL sometimes chooses not to use the existing INDEXes to do an index scan instead of sequential scan -- Does it really think sequential will be faster, or does it eliminate an index scan because there won't be enough hard drive or swap space to do it? Currently, full text search queries take on the order of 2 minutes to execute. We need them to be happening in 5 seconds, if at all possible. Unfortunately, this needs to happen EARLY THIS WEEK, if at all possible. Contact me off-list with some idea of price/availability/references if you are interested in taking on this task. THANKS! From pgsql-performance-owner@postgresql.org Mon Dec 2 14:39:04 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 515B4475C8B for ; Mon, 2 Dec 2002 14:39:03 -0500 (EST) Received: from jester.senspire.com (unknown [216.208.117.7]) by postgresql.org (Postfix) with ESMTP id 0EAAE476CD9 for ; Mon, 2 Dec 2002 14:19:46 -0500 (EST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by jester.senspire.com (8.12.6/8.12.6) with ESMTP id gB2JKcWK060281; Mon, 2 Dec 2002 14:20:39 -0500 (EST) (envelope-from rbt@rbt.ca) Subject: Re: From: Rod Taylor To: typea@l-i-e.com Cc: Pgsql Performance In-Reply-To: <49486.216.80.95.13.1038853850.squirrel@www.l-i-e.com> References: <49486.216.80.95.13.1038853850.squirrel@www.l-i-e.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-TvAEIQlCUT7Ufwiyw113" Organization: Message-Id: <1038856838.46704.42.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 02 Dec 2002 14:20:38 -0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/6 X-Sequence-Number: 422 --=-TvAEIQlCUT7Ufwiyw113 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > I don't understand why PostgreSQL sometimes chooses not to use the > existing INDEXes to do an index scan instead of sequential scan -- Does it > really think sequential will be faster, or does it eliminate an index scan Yes, and it's generally right. > because there won't be enough hard drive or swap space to do it? Nope. Simply because of time it takes to read from the disk. An index scan makes ~ 1 read per tuple and sequential scans make one per page (gross simplification). > Currently, full text search queries take on the order of 2 minutes to > execute. > We need them to be happening in 5 seconds, if at all possible. How about a couple of explains of the queries. What kind of tuning have you done in postgresql.conf. Whats your hardware like? Have you partitioned the data to separate disks in any way? Are you doing mostly (all?) reads? Some writes? Perhaps clustering? Is this on 7.2 or 7.3? What is the Locale? C or en_US or something else? --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-TvAEIQlCUT7Ufwiyw113 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQA967KG6DETLow6vwwRAjv4AJ9ac6S80DEiYF6iT2lHrgIPKvDEnACcC2fQ YJX8qImLBzislTzj83ryUBM= =Lf/b -----END PGP SIGNATURE----- --=-TvAEIQlCUT7Ufwiyw113-- From pgsql-performance-owner@postgresql.org Mon Dec 2 15:55:21 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 16D4747638D for ; Mon, 2 Dec 2002 15:55:21 -0500 (EST) Received: from o2.hostbaby.com (o2.hostbaby.com [208.187.29.121]) by postgresql.org (Postfix) with SMTP id 00EE2476676 for ; Mon, 2 Dec 2002 15:45:39 -0500 (EST) Received: (qmail 60841 invoked from network); 2 Dec 2002 20:45:43 -0000 Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 2 Dec 2002 20:45:42 -0000 Received: from 216.80.95.13 (Hostbaby Webmail authenticated user typea@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 2 Dec 2002 12:45:43 -0800 (PST) Message-ID: <50235.216.80.95.13.1038861943.squirrel@www.l-i-e.com> Date: Mon, 2 Dec 2002 12:45:43 -0800 (PST) Subject: Re: From: To: In-Reply-To: <1038856838.46704.42.camel@jester> References: <49486.216.80.95.13.1038853850.squirrel@www.l-i-e.com> <1038856838.46704.42.camel@jester> X-Priority: 3 Importance: Normal Cc: X-Mailer: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/7 X-Sequence-Number: 423 >> I don't understand why PostgreSQL sometimes chooses not to use the >> existing INDEXes to do an index scan instead of sequential scan -- >> Does it really think sequential will be faster, or does it eliminate >> an index scan > > Yes, and it's generally right. > >> because there won't be enough hard drive or swap space to do it? > > Nope. Simply because of time it takes to read from the disk. An index > scan makes ~ 1 read per tuple and sequential scans make one per page > (gross simplification). Hmmm. An "index" is apparently nothing like I expected it to be... Here I thought it would be some quick hash-table small data-set lookup with a reference to the OID -- and that most of the hash tables could just be loaded in one fell swoop. Oh well. >> Currently, full text search queries take on the order of 2 minutes to >> execute. >> We need them to be happening in 5 seconds, if at all possible. > > How about a couple of explains of the queries. Explains were posted previously, but I'll do a couple more. At its simplest, this takes 30 seconds: explain select article.* from article where lower(text) like '%einstein%'; NOTICE: QUERY PLAN: Seq Scan on article (cost=0.00..1155.01 rows=1 width=216) Or, slightly more complex: explain SELECT DISTINCT *, 0 + (0 + 10 * (lower(title) like '%einstein%') ::int + 10 * (lower(author_flattened) like '%einstein%') ::int + 30 * (lower(subject_flattened) like '%einstein%') ::int + 30 * (lower(text) LIKE '%einstein%') ::int + 9 * (substring(lower(title), 1, 20) like '%einstein%') ::int + 25 * (substring(lower(text), 1, 20) LIKE '%einstein%') ::int ) AS points FROM article WHERE TRUE AND (FALSE OR (lower(title) like '%einstein%') OR (lower(author_flattened) like '%einstein%') OR (lower(subject_flattened) like '%einstein%') OR (lower(text) LIKE '%einstein%') ) ORDER BY points desc, volume, number, article.article LIMIT 10, 0; NOTICE: QUERY PLAN: Limit (cost=1418.03..1418.08 rows=1 width=216) -> Unique (cost=1418.03..1418.08 rows=1 width=216) -> Sort (cost=1418.03..1418.03 rows=1 width=216) -> Seq Scan on article (cost=0.00..1418.02 rows=1 width=216) > What kind of tuning have > you done in postgresql.conf. None. Never really understood what that one memory setting would affect... And the rest of the options seemed to be about logging output (which I also can't seem to crank up to the level of getting query analysis out). I RTFM, but actually comprehending what was written ... :-^ > Whats your hardware like? processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 11 model name : Intel(R) Pentium(R) III CPU family 1400MHz stepping : 1 cpu MHz : 1406.005 cache size : 512 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse bogomips : 2804.94 total: used: free: shared: buffers: cached: Mem: 921235456 736669696 184565760 749568 75321344 592257024 Swap: 2097143808 15368192 2081775616 MemTotal: 899644 kB MemFree: 180240 kB MemShared: 732 kB Buffers: 73556 kB Cached: 573896 kB SwapCached: 4480 kB Active: 433776 kB Inact_dirty: 182208 kB Inact_clean: 36680 kB Inact_target: 229376 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 899644 kB LowFree: 180240 kB SwapTotal: 2047992 kB SwapFree: 2032984 kB > Have you > partitioned the data to separate disks in any way? No, except when attempting to do the PostgreSQL contrib/fulltextindex we clustered the _fti table by loading it in word order. > Are you doing mostly (all?) reads? Some writes? Perhaps clustering? Mostly reads. Some writes by: Admin fixing typos, adding new articles Nightly cron jobs to "flatten" large-scale JOINs into text contatenations (We could get rid of that and go back to the JOINs, now that we've figured out that it's really the full text search that's killing us, not the JOINs) > Is this on 7.2 or 7.3? 7.1.3 > What is the Locale? C or en_US or something > else? AFAIK, we didn't do anything to alter the locale from whatever the default would be... From pgsql-performance-owner@postgresql.org Mon Dec 2 16:21:55 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1AB284763B2 for ; Mon, 2 Dec 2002 16:21:52 -0500 (EST) Received: from rh72.home.ee (adsl1030.estpak.ee [213.168.29.11]) by postgresql.org (Postfix) with ESMTP id 1522947637E for ; Mon, 2 Dec 2002 16:18:33 -0500 (EST) Received: from rh72.home.ee (localhost.localdomain [127.0.0.1]) by rh72.home.ee (8.12.5/8.12.5) with ESMTP id gB2LIUA8002852; Tue, 3 Dec 2002 02:18:31 +0500 Received: (from hannu@localhost) by rh72.home.ee (8.12.5/8.12.5/Submit) id gB2LIFBD002850; Tue, 3 Dec 2002 02:18:15 +0500 X-Authentication-Warning: rh72.home.ee: hannu set sender to hannu@tm.ee using -f Subject: Re: From: Hannu Krosing To: typea@l-i-e.com Cc: pgsql-performance@postgresql.org, rbt@rbt.ca In-Reply-To: <50235.216.80.95.13.1038861943.squirrel@www.l-i-e.com> References: <49486.216.80.95.13.1038853850.squirrel@www.l-i-e.com> <1038856838.46704.42.camel@jester> <50235.216.80.95.13.1038861943.squirrel@www.l-i-e.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1038863893.1942.3.camel@rh72.home.ee> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 03 Dec 2002 02:18:14 +0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/8 X-Sequence-Number: 424 typea@l-i-e.com kirjutas T, 03.12.2002 kell 01:45: > Explains were posted previously, but I'll do a couple more. > > At its simplest, this takes 30 seconds: > > explain select article.* from article where lower(text) like '%einstein%'; > NOTICE: QUERY PLAN: > > Seq Scan on article (cost=0.00..1155.01 rows=1 width=216) searches with LIKE use indexes only when the like expression starts with a string (like 'einstein%') and even then only if in C locale. You should check out some real full-text index add-ons, like contrib/tsearch or construct your own using your imagination plus contrib/intarray and contrib/intagg :) --------------- Hannu From pgsql-performance-owner@postgresql.org Mon Dec 2 18:49:34 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 43EFB475D01 for ; Mon, 2 Dec 2002 18:49:32 -0500 (EST) Received: from gatefox.foxi.nl (a194-109-246-192.adsl.xs4all.nl [194.109.246.192]) by postgresql.org (Postfix) with ESMTP id A4125475E60 for ; Mon, 2 Dec 2002 18:49:28 -0500 (EST) Received: from techfox (techfox.foxi [192.168.0.79]) by gatefox.foxi.nl (8.10.2/8.10.2) with ESMTP id gB2NnPJ26253; Tue, 3 Dec 2002 00:49:25 +0100 Content-Type: text/plain; charset="us-ascii" From: "ir. F.T.M. van Vugt bc." Organization: Foxi Consultants in Technology To: Tom Lane Subject: Re: v7.2.3 versus v7.3 -> huge performance penalty for JOIN with UNION Date: Tue, 3 Dec 2002 00:51:03 +0100 User-Agent: KMail/1.4.3 Cc: Postgresql performance MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212030051.03635.ftm.van.vugt@foxi.nl> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/9 X-Sequence-Number: 425 (Should probably be in [SQL] by now....) I've changed my table declarations to agree on the datatypes and only one= =20 simular problem with an update-query doesn't seem to be solved. (see plan below) * the concatenation in the lbar select can't be avoided, it's just the way = the=20 data is =3D> this does result in a resulting type 'text', AFAIK * the aux_address.old_id is also of type 'text' Still, the planner does a nested loop here against large costs... ;( Any hints on this (last) one....? TIA, Frank. trial=3D# explain update address set region_id =3D lbar.region_id from (select debtor_id || '-' || address_seqnr as id, region_id from list_base_regions) as lbar, aux_address aa=20 where lbar.id =3D aa.old_id and address.id =3D aa.id; QUERY PLAN ---------------------------------------------------------------------------= ------------------------------------------- Merge Join (cost=3D1.07..65.50 rows=3D3 width=3D253) Merge Cond: ("outer".id =3D "inner".id) -> Nested Loop (cost=3D0.00..643707.03 rows=3D3980 width=3D28) Join Filter: (((("inner".debtor_id)::text || '-'::text) ||=20 ("inner".address_seqnr)::text) =3D "outer".old_id) -> Index Scan using aux_address_idx2 on aux_address aa=20=20 (cost=3D0.00..81.88 rows=3D3989 width=3D16) -> Seq Scan on list_base_regions (cost=3D0.00..71.80 rows=3D3980= =20 width=3D12) -> Sort (cost=3D1.07..1.08 rows=3D3 width=3D225) Sort Key: address.id -> Seq Scan on address (cost=3D0.00..1.05 rows=3D3 width=3D225) Filter: ((id =3D 1) IS NOT TRUE) (10 rows) From pgsql-performance-owner@postgresql.org Mon Dec 2 22:56:05 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A2DD4475CC7 for ; Mon, 2 Dec 2002 22:56:03 -0500 (EST) Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) by postgresql.org (Postfix) with ESMTP id 079ED475CC4 for ; Mon, 2 Dec 2002 22:56:03 -0500 (EST) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao04.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021203035607.TWFK1248.lakemtao04.cox.net@[192.168.1.1]> for ; Mon, 2 Dec 2002 22:56:07 -0500 Subject: Re: From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <49486.216.80.95.13.1038853850.squirrel@www.l-i-e.com> References: <49486.216.80.95.13.1038853850.squirrel@www.l-i-e.com> Content-Type: text/plain Organization: Message-Id: <1038887764.4660.49.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 02 Dec 2002 21:56:04 -0600 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/10 X-Sequence-Number: 426 On Mon, 2002-12-02 at 12:30, typea@l-i-e.com wrote: > [I hope job postings are kosher...] > > I need help optimizing a PostgreSQL application: > > Full-text search > ~17,000 records > Articles (text) are about 10K long on average, ranging from 0 to 278K. > > I don't know if we need to throw more RAM, more hard drive, more > comparison RAM in postmaster.conf or build a concordance or if this is > just not something that can be done within our budget. > > I can't even seem to get the PostgreSQL profiling output using "-s" in the > startup of postmaster and client to determine what the db engine is doing. > > I don't understand why PostgreSQL sometimes chooses not to use the > existing INDEXes to do an index scan instead of sequential scan -- Does it > really think sequential will be faster, or does it eliminate an index scan > because there won't be enough hard drive or swap space to do it? > > Currently, full text search queries take on the order of 2 minutes to > execute. > We need them to be happening in 5 seconds, if at all possible. > > Unfortunately, this needs to happen EARLY THIS WEEK, if at all possible. > > Contact me off-list with some idea of price/availability/references if you > are interested in taking on this task. After reading the thread to see that your box has what looks like 1GB RAM, and firing up bc(1) to see that 17K articles each of which is ~10KB == 166MB, it seems to this simple mind that given enough buffers, you could suck all of the articles into the buffers. Thus, no more disk IO, but boy would it burn up the CPU! Also, I think that I might write some sort of "book index pre-processor" to run against each article, to create, for each article, a list of words plus byte offsets. (Some tweaking would have to occur in order to handle capitalization vagaries. Probably capitalize all "index words".) (Yes, this method has the limitation of [sub-]word searches instead of arbitrary string searches, Then, insert all that data into a 3rd table (T_LOOKUP) whose structure is: val TEXT (primary key) article_name TEXT byte_offset INTEGER Then, 'EINSTEIN%' queries would go against T_LOOKUP instead of the articles table. -- +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "they love our milk and honey, but preach about another | | way of living" | | Merle Haggard, "The Fighting Side Of Me" | +------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Dec 3 00:46:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D376D475E20 for ; Tue, 3 Dec 2002 00:46:39 -0500 (EST) Received: from cs.uoregon.edu (vitalstatistix.cs.uoregon.edu [128.223.4.19]) by postgresql.org (Postfix) with ESMTP id 292EC475CC7 for ; Tue, 3 Dec 2002 00:46:39 -0500 (EST) Received: from ix.cs.uoregon.edu (ix.cs.uoregon.edu [128.223.4.21]) by cs.uoregon.edu (8.11.0/8.11.0) with ESMTP id gB35kij03782 for ; Mon, 2 Dec 2002 21:46:44 -0800 (PST) Date: Mon, 2 Dec 2002 21:46:43 -0800 (PST) From: li li To: Subject: Is there any limitations In-Reply-To: <1038887764.4660.49.camel@haggis> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/11 X-Sequence-Number: 427 for the maximum number of tables in a database. I'm thinking about separating a table with up to millions of rows into several tables with the same set of columns to speed up some complex queries. As the size of the original table is increasing fast, I want to get it separated once the size grows up to a limit. So there will be a large amount of tables (having same structure) in a database. Is there any potential performance problem with this design? Thanks. Li Li From pgsql-performance-owner@postgresql.org Tue Dec 3 00:59:48 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8281F475CC7 for ; Tue, 3 Dec 2002 00:59:47 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id CD98E475A09 for ; Tue, 3 Dec 2002 00:59:46 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB35xipd020528; Tue, 3 Dec 2002 00:59:45 -0500 (EST) To: "ir. F.T.M. van Vugt bc." Cc: Postgresql performance Subject: Re: v7.2.3 versus v7.3 -> huge performance penalty for JOIN with UNION In-reply-to: <200212030051.03635.ftm.van.vugt@foxi.nl> References: <200212030051.03635.ftm.van.vugt@foxi.nl> Comments: In-reply-to "ir. F.T.M. van Vugt bc." message dated "Tue, 03 Dec 2002 00:51:03 +0100" Date: Tue, 03 Dec 2002 00:59:44 -0500 Message-ID: <20527.1038895184@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/12 X-Sequence-Number: 428 "ir. F.T.M. van Vugt bc." writes: > Any hints on this (last) one....? > -> Nested Loop (cost=0.00..643707.03 rows=3980 width=28) > Join Filter: (((("inner".debtor_id)::text || '-'::text) || > ("inner".address_seqnr)::text) = "outer".old_id) Looks to me like debtor_id and address_seqnr are not text type, but are being compared to things that are text. Hard to tell exactly what's going on though --- I suppose this query is getting rewritten by a rule? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 3 04:38:25 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3EC794763E3 for ; Tue, 3 Dec 2002 04:38:24 -0500 (EST) Received: from gatefox.foxi.nl (a194-109-246-192.adsl.xs4all.nl [194.109.246.192]) by postgresql.org (Postfix) with ESMTP id A1C8A475DD0 for ; Tue, 3 Dec 2002 04:36:33 -0500 (EST) Received: from techfox (techfox.foxi [192.168.0.79]) by gatefox.foxi.nl (8.10.2/8.10.2) with ESMTP id gB39aWJ09319; Tue, 3 Dec 2002 10:36:32 +0100 Content-Type: text/plain; charset="iso-8859-15" From: "Frank van Vugt" Organization: Foxi Consultants in Technology To: Tom Lane Subject: Re: v7.2.3 versus v7.3 -> huge performance penalty for JOIN with UNION Date: Tue, 3 Dec 2002 10:38:10 +0100 User-Agent: KMail/1.4.3 References: <200212030051.03635.ftm.van.vugt@foxi.nl> <20527.1038895184@sss.pgh.pa.us> In-Reply-To: <20527.1038895184@sss.pgh.pa.us> Cc: Postgresql performance MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212031038.10860.ftm.van.vugt@foxi.nl> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/13 X-Sequence-Number: 429 > > Any hints on this (last) one....? > > -> Nested Loop (cost=3D0.00..643707.03 rows=3D3980 width=3D28) > > Join Filter: (((("inner".debtor_id)::text || '-'::text) || > > ("inner".address_seqnr)::text) =3D "outer".old_id) > > Looks to me like debtor_id and address_seqnr are not text type, but are > being compared to things that are text.=20 They were coerced, yes, but changing those original types helps only so muc= h: * lbar.debtor_id is of type text * lbar.address_seqnr is of type text * aa.old_id is of type text trial=3D# explain update address set region_id =3D lbar.region_id from=20 (select debtor_id || '-' || address_seqnr as f_id, region_id from list_base_regions) as lbar, aux_address aa where lbar.f_id =3D aa.old_id and address.id =3D aa.id; Since the left side of the join clause is composed out of three concatenate= d=20 text-parts resulting in one single piece of type text, I'd expect the plann= er=20 to avoid the nested loop. Still: QUERY PLAN ---------------------------------------------------------------------------= ----------------------------- Merge Join (cost=3D1.07..16.07 rows=3D1 width=3D309) Merge Cond: ("outer".id =3D "inner".id) -> Nested Loop (cost=3D0.00..149669.38 rows=3D1000 width=3D84) Join Filter: ((("inner".debitor_id || '-'::text) ||=20 "inner".address_seqnr) =3D "outer".old_id) -> Index Scan using aux_address_idx2 on aux_address aa=20=20 (cost=3D0.00..81.88 rows=3D3989 width=3D16) -> Seq Scan on list_base_regions (cost=3D0.00..20.00 rows=3D1000= =20 width=3D68) -> Sort (cost=3D1.07..1.08 rows=3D3 width=3D225) Sort Key: address.id -> Seq Scan on address (cost=3D0.00..1.05 rows=3D3 width=3D225) Filter: ((id =3D 1) IS NOT TRUE) (10 rows) > Hard to tell exactly what's going on though Does this help? NB: it seems the data types part of the manual doesn't enlighten me on this= =20 subject, any suggestions where to find more input? Regards, Frank. From pgsql-performance-owner@postgresql.org Tue Dec 3 07:35:14 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E5802475E88 for ; Tue, 3 Dec 2002 07:35:12 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id B71AB475CC4 for ; Tue, 3 Dec 2002 07:34:01 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 18JCFY-0001dO-00 for ; Tue, 03 Dec 2002 07:34:04 -0500 Date: Tue, 3 Dec 2002 07:34:04 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Is there any limitations Message-ID: <20021203073404.A5868@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <1038887764.4660.49.camel@haggis> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from lili@cs.uoregon.edu on Mon, Dec 02, 2002 at 09:46:43PM -0800 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/14 X-Sequence-Number: 430 On Mon, Dec 02, 2002 at 09:46:43PM -0800, li li wrote: > > for the maximum number of tables in a database. For practical purposes, probably not. > to get it separated once the size grows up to a limit. So there > will be a large amount of tables (having same structure) in a database. Is > there any potential performance problem with this design? It depends on what you're going to do. If the idea is to join across the tables, it'll probably perform worse than just ahving a large table. OTOH, if what you're doing is, say, archiving from time to time, it doesn't seem unreasonable. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Tue Dec 3 08:41:18 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1BC1C475D3B for ; Tue, 3 Dec 2002 08:41:17 -0500 (EST) Received: from nic-nts1.nic.parallel.ltd.uk (parallel1.demon.co.uk [194.222.145.131]) by postgresql.org (Postfix) with ESMTP id AEA67475D01 for ; Tue, 3 Dec 2002 08:41:15 -0500 (EST) Received: by nic-nts1.nic.parallel.ltd.uk with Internet Mail Service (5.5.2656.59) id ; Tue, 3 Dec 2002 13:41:18 -0000 Message-ID: From: Nikk Anderson To: pgsql-performance@postgresql.org Subject: Re: Is there any limitations Date: Tue, 3 Dec 2002 13:41:14 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C29AD1.A64901C0" X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/15 X-Sequence-Number: 431 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C29AD1.A64901C0 Content-Type: text/plain; charset="iso-8859-1" Hi Li Li, > > I'm thinking about separating a table with up to millions of rows into > several tables with the same set of columns to speed up some complex > queries. I thought of doing this recently, as queries were taking so long. Instead of breaking the table up, we clustered the data. This physically moves all the data by key close to each other on disk (sounds kind of like defragging a disk). This boosts query responses no end - for example our table has ~ 10 million rows, a query that was taking 45 seconds to return, now takes 7 seconds. To keep the table tidy, we run the cluster regularly. > As the size of the original table is increasing fast, I want > to get it separated once the size grows up to a limit. So there > will be a large amount of tables (having same structure) in a > database. Is > there any potential performance problem with this design? > I think the problems would mainly be in management, as you would have to keep track of the new table names, key names, and index names. Nikk ------_=_NextPart_001_01C29AD1.A64901C0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [PERFORM] Is there any limitations

Hi Li Li,

>
> I'm thinking about separating a table with up to mi= llions of rows into
> several tables with the same set of columns to spee= d up some complex
> queries.

I thought of doing this recently, as queries were taking = so long.  Instead of breaking the table up, we clustered the data.&nbs= p; This physically moves all the data by key close to each other on disk (s= ounds kind of like defragging a disk).  This boosts query responses no= end - for example our table has ~ 10 million rows, a query that was taking= 45 seconds to return, now takes 7 seconds.  To keep the table tidy, w= e run the cluster regularly.

> As the size of the original table is increasing fast= , I want
> to get it separated once the size grows up to a lim= it. So there
> will be a large amount of tables (having same struc= ture) in a
> database. Is
> there any potential performance problem with this d= esign?
>

I think the problems would mainly be in management, as yo= u would have to keep track of the new table names, key names, and index nam= es. 

Nikk

------_=_NextPart_001_01C29AD1.A64901C0-- From pgsql-performance-owner@postgresql.org Tue Dec 3 09:35:21 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0B4E5475E77 for ; Tue, 3 Dec 2002 09:35:20 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 5BC2C475D99 for ; Tue, 3 Dec 2002 09:35:19 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB3EZGpd023157; Tue, 3 Dec 2002 09:35:16 -0500 (EST) To: "Frank van Vugt" Cc: Postgresql performance Subject: Re: v7.2.3 versus v7.3 -> huge performance penalty for JOIN with UNION In-reply-to: <200212031038.10860.ftm.van.vugt@foxi.nl> References: <200212030051.03635.ftm.van.vugt@foxi.nl> <20527.1038895184@sss.pgh.pa.us> <200212031038.10860.ftm.van.vugt@foxi.nl> Comments: In-reply-to "Frank van Vugt" message dated "Tue, 03 Dec 2002 10:38:10 +0100" Date: Tue, 03 Dec 2002 09:35:16 -0500 Message-ID: <23156.1038926116@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/16 X-Sequence-Number: 432 "Frank van Vugt" writes: > Since the left side of the join clause is composed out of three concatenated > text-parts resulting in one single piece of type text, I'd expect the > planner to avoid the nested loop. Probably not, since the first thing it does is to flatten the sub-select, leaving it with a concatenation expression in the WHERE-clause. (I was too sleepy last night to realize that you were comparing a concatenation to old_id, rather than making two separate comparisons :-() We really need to fix the planner to be able to do merge/hash on "arbitrary expression = arbitrary expression", not only "Var = Var". IIRC, this is doable in principle, but there are a few routines that would need to be improved. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 3 10:23:39 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2747847653B for ; Tue, 3 Dec 2002 10:23:35 -0500 (EST) Received: from gatefox.foxi.nl (a194-109-246-192.adsl.xs4all.nl [194.109.246.192]) by postgresql.org (Postfix) with ESMTP id 14372475E77 for ; Tue, 3 Dec 2002 10:22:11 -0500 (EST) Received: from techfox (techfox.foxi [192.168.0.79]) by gatefox.foxi.nl (8.10.2/8.10.2) with ESMTP id gB3FMCJ14631; Tue, 3 Dec 2002 16:22:12 +0100 Content-Type: text/plain; charset="iso-8859-15" From: Frank van Vugt Organization: Foxi Consultants in Technology To: Tom Lane Subject: Re: v7.2.3 versus v7.3 -> huge performance penalty for JOIN with UNION Date: Tue, 3 Dec 2002 16:23:51 +0100 User-Agent: KMail/1.4.3 References: <200212030051.03635.ftm.van.vugt@foxi.nl> <200212031038.10860.ftm.van.vugt@foxi.nl> <23156.1038926116@sss.pgh.pa.us> In-Reply-To: <23156.1038926116@sss.pgh.pa.us> Cc: Postgresql performance MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212031623.51513.ftm.van.vugt@foxi.nl> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/17 X-Sequence-Number: 433 > Probably not, since the first thing it does is to flatten the > sub-select, leaving it with a concatenation expression in the > WHERE-clause.=20 Ah, I see. So, I'll just split this thingy into two seperate queries, starting with=20 creating a temp table containing the straight subselect results. > We really need to fix the planner to be able to do merge/hash on > "arbitrary expression =3D arbitrary expression", not only "Var =3D Var". I can get around it, so I'm not complaining ;-) Tom, thanks a *lot* for the prompt responses !! Best, Frank. From pgsql-performance-owner@postgresql.org Tue Dec 3 14:12:01 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BB36C475E45 for ; Tue, 3 Dec 2002 14:12:00 -0500 (EST) Received: from alpha.cpons.com (unknown [209.235.53.98]) by postgresql.org (Postfix) with ESMTP id 4B09F47669C for ; Tue, 3 Dec 2002 14:11:23 -0500 (EST) Received: from bgunter2 (localhost.localdomain [127.0.0.1]) by alpha.cpons.com (8.12.5/8.12.5) with SMTP id gB3JBXXr012485 for ; Tue, 3 Dec 2002 14:11:33 -0500 Message-ID: <006701c29aff$d10048f0$8c3c3d0a@bgunter2> From: "Ben Gunter" To: Subject: v7.3 planner and user-defined functions Date: Tue, 3 Dec 2002 14:11:43 -0500 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/18 X-Sequence-Number: 434 I am having some problems with user-defined functions in version 7.3. The planner seems to refuse to use an index that I have created when I define an SQL function that should take advantage of it. The thing that is driving me nuts is that if I take the SQL from the function definition and run it exactly as it is, replacing the parameters with real values, then it does use the index and performs beautifully. I never saw this problem until I upgraded from 7.2.3 to 7.3. At the bottom of this email, I have included a psql test input file and the results. I have an index on zip_locs(dist1,dist2,dist3,dist4). I'm joining a table of about 350,000 rows (mytable) against another table of about 42,000 rows (zip_locs) on a ZIP code. The ZIP fields in both tables are indexed as well. The functions zip_dist[1234](varchar) return the respective dist[1234] value for the given ZIP code. The zip_lat(varchar) and zip_lng(varchar) functions return the latitude and longitude for the given ZIP code, respectively. All these functions are immutable so they have virtually no effect on the speed of the query. The point of the query is to get a count of records in mytable that are within a certain distance of a given ZIP code. When I do the explicit SELECT, it uses the aforementioned index and then filters on the result of the earth_distance(real,real,real,real) function. When I run the radiuscount(varchar,real) function, it apparently does a sequential scan instead of using the index. I have tried rewriting this query every way I know how, but nothing seems to work. Can anybody help me with this? Here is the psql input file I'm using to demonstrate: ******************* CREATE OR REPLACE FUNCTION radiuscount(varchar, real) RETURNS bigint AS ' SELECT COUNT(*) FROM mytable JOIN zip_locs ON zip = zip_code WHERE dist1 BETWEEN zip_dist1($1) - $2::real AND zip_dist1($1) + $2::real AND dist2 BETWEEN zip_dist2($1) - $2::real AND zip_dist2($1) + $2::real AND dist3 BETWEEN zip_dist3($1) - $2::real AND zip_dist3($1) + $2::real AND dist4 BETWEEN zip_dist4($1) - $2::real AND zip_dist4($1) + $2::real AND earth_distance(zip_lat($1), zip_lng($1), lat, lng) < $2::real ' LANGUAGE 'SQL' STABLE RETURNS NULL ON NULL INPUT ; \timing \a \t \echo \echo 'NOT using the function' SELECT COUNT(*) AS radiuscount FROM mytable JOIN zip_locs ON zip = zip_code WHERE dist1 BETWEEN zip_dist1('30096') - 20::real AND zip_dist1('30096') + 20::real AND dist2 BETWEEN zip_dist2('30096') - 20::real AND zip_dist2('30096') + 20::real AND dist3 BETWEEN zip_dist3('30096') - 20::real AND zip_dist3('30096') + 20::real AND dist4 BETWEEN zip_dist4('30096') - 20::real AND zip_dist4('30096') + 20::real AND earth_distance(zip_lat('30096'), zip_lng('30096'), lat, lng) < 20::real ; \echo \echo 'Using the function' select radiuscount('30096',20); ******************* And here is the output: ******************* CREATE FUNCTION Timing is on. Output format is unaligned. Showing only tuples. NOT using the function 2775 Time: 584.02 ms Using the function 2775 Time: 11693.56 ms ******************* From pgsql-performance-owner@postgresql.org Tue Dec 3 15:03:07 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B29D8476D08 for ; Tue, 3 Dec 2002 15:03:06 -0500 (EST) Received: from cs.uoregon.edu (vitalstatistix.cs.uoregon.edu [128.223.4.19]) by postgresql.org (Postfix) with ESMTP id 231D6476998 for ; Tue, 3 Dec 2002 14:49:05 -0500 (EST) Received: from ix.cs.uoregon.edu (ix.cs.uoregon.edu [128.223.4.21]) by cs.uoregon.edu (8.11.0/8.11.0) with ESMTP id gB3Jn3j01029; Tue, 3 Dec 2002 11:49:04 -0800 (PST) Date: Tue, 3 Dec 2002 11:49:03 -0800 (PST) From: li li To: Andrew Sullivan Cc: Subject: Re: Is there any limitations In-Reply-To: <20021203073404.A5868@mail.libertyrms.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/19 X-Sequence-Number: 435 > > It depends on what you're going to do. If the idea is to join across > the tables, it'll probably perform worse than just ahving a large > table. OTOH, if what you're doing is, say, archiving from time to > time, it doesn't seem unreasonable. > The purpose for this design is to avoid record lookup in a huge table. I expect to see the query results in, say, one minute, by searching a much smaller table (not join across multiple tables). Thanks and regards. Li Li From pgsql-performance-owner@postgresql.org Tue Dec 3 15:26:23 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 139E7476959 for ; Tue, 3 Dec 2002 15:26:22 -0500 (EST) Received: from cs.uoregon.edu (vitalstatistix.cs.uoregon.edu [128.223.4.19]) by postgresql.org (Postfix) with ESMTP id 90034476F14 for ; Tue, 3 Dec 2002 15:06:14 -0500 (EST) Received: from ix.cs.uoregon.edu (ix.cs.uoregon.edu [128.223.4.21]) by cs.uoregon.edu (8.11.0/8.11.0) with ESMTP id gB3K69j03038; Tue, 3 Dec 2002 12:06:10 -0800 (PST) Date: Tue, 3 Dec 2002 12:06:09 -0800 (PST) From: li li To: Nikk Anderson Cc: Subject: Re: Is there any limitations In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/20 X-Sequence-Number: 436 Hi Nikk, > I thought of doing this recently, as queries were taking so long. Instead > of breaking the table up, we clustered the data. This physically moves all > the data by key close to each other on disk (sounds kind of like defragging > a disk). This boosts query responses no end - for example our table has ~ > 10 million rows, a query that was taking 45 seconds to return, now takes 7 > seconds. To keep the table tidy, we run the cluster regularly. > I've clustered the data with a non-key attribute. Now the query time is about couple of minutes, but I expect less than one minute. Is there any trick in using cluster? I found that the primary key disappeared after clustering. Or it's better to cluster with primary key? My primary key is a composite. I picked one attribute as cluster key. > > As the size of the original table is increasing fast, I want > > to get it separated once the size grows up to a limit. So there > > will be a large amount of tables (having same structure) in a > > database. Is > > there any potential performance problem with this design? > > > > I think the problems would mainly be in management, as you would have to > keep track of the new table names, key names, and index names. > You are right. I have to keep track of these table names. However, I don't see any necessity for key names or index names. Because, as I metioned above, all these tables have exactly same structure. Thanks for quick response. Li Li From pgsql-performance-owner@postgresql.org Wed Dec 4 04:30:00 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 942C0475FB5 for ; Wed, 4 Dec 2002 04:29:56 -0500 (EST) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by postgresql.org (Postfix) with ESMTP id D77DC475EEE for ; Wed, 4 Dec 2002 04:29:54 -0500 (EST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-30.mail.demon.net with esmtp (Exim 3.35 #1) id 18JVqt-000A2o-0U; Wed, 04 Dec 2002 09:29:55 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id A2E1F1685A; Wed, 4 Dec 2002 09:29:54 +0000 (GMT) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id F058A16858; Wed, 4 Dec 2002 09:29:53 +0000 (GMT) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton To: li li Subject: Re: Is there any limitations Date: Wed, 4 Dec 2002 09:29:53 +0000 User-Agent: KMail/1.4.3 Cc: References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212040929.53514.richardh@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/21 X-Sequence-Number: 437 On Tuesday 03 Dec 2002 7:49 pm, li li wrote: > > It depends on what you're going to do. If the idea is to join across > > the tables, it'll probably perform worse than just ahving a large > > table. OTOH, if what you're doing is, say, archiving from time to > > time, it doesn't seem unreasonable. > > The purpose for this design is to avoid record lookup in a huge table. > I expect to see the query results in, say, one minute, by searching a much > smaller table (not join across multiple tables). > > Thanks and regards. If you only want *most* queries to finish in one minute - I've used two tab= les=20 in the past. One for recent info (which is what most of my users wanted) an= d=20 one for older info (which only got accessed rarely). You're only union-ing= =20 two tables then and you can cluster the older table as mentioned elsewhere. --=20 Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Dec 4 05:29:24 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1A94C475D00 for ; Wed, 4 Dec 2002 05:29:23 -0500 (EST) Received: from localhost.localdomain (sein.itera.ee [194.126.109.126]) by postgresql.org (Postfix) with ESMTP id 0AAAD4759AF for ; Wed, 4 Dec 2002 05:29:22 -0500 (EST) Received: (from hannu@localhost) by localhost.localdomain (8.11.6/8.11.6) id gB4CNgx27746; Wed, 4 Dec 2002 12:23:42 GMT X-Authentication-Warning: localhost.localdomain: hannu set sender to hannu@tm.ee using -f Subject: Re: Is there any limitations From: Hannu Krosing To: Richard Huxton Cc: li li , pgsql-performance@postgresql.org In-Reply-To: <200212040929.53514.richardh@archonet.com> References: <200212040929.53514.richardh@archonet.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039004621.26887.20.camel@huli> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 04 Dec 2002 12:23:41 +0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/22 X-Sequence-Number: 438 On Wed, 2002-12-04 at 09:29, Richard Huxton wrote: > On Tuesday 03 Dec 2002 7:49 pm, li li wrote: > > > It depends on what you're going to do. If the idea is to join across > > > the tables, it'll probably perform worse than just ahving a large > > > table. OTOH, if what you're doing is, say, archiving from time to > > > time, it doesn't seem unreasonable. > > > > The purpose for this design is to avoid record lookup in a huge table. > > I expect to see the query results in, say, one minute, by searching a much > > smaller table (not join across multiple tables). > > > > Thanks and regards. > > If you only want *most* queries to finish in one minute - I've used two tables > in the past. One for recent info (which is what most of my users wanted) and > one for older info (which only got accessed rarely). You're only union-ing > two tables then and you can cluster the older table as mentioned elsewhere. ANother approach could be to have index on timestamp field (which should be naturally clustered) and search in recent data only. If the problem is simply too much data returned, you could use LIMIT. -- Hannu Krosing From pgsql-performance-owner@postgresql.org Wed Dec 4 15:36:39 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E68F34769CE for ; Wed, 4 Dec 2002 15:36:37 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id 567AC475FB8 for ; Wed, 4 Dec 2002 15:31:10 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gB4KUKOm027969; Wed, 4 Dec 2002 13:30:35 -0700 (MST) Date: Wed, 4 Dec 2002 13:28:46 -0700 (MST) From: "scott.marlowe" To: eric soroos Cc: Subject: Re: Low Budget Performance, Part 2 In-Reply-To: <30995191.1173642930@[4.42.179.151]> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/23 X-Sequence-Number: 439 On Thu, 28 Nov 2002, eric soroos wrote: > The rotational speed difference is 40% (10k/7.2k), and the TPS > difference is about 60% (50/30 or 40/25) I would suggest that areal density / xfer rate off the platters is the REAL issue, not rotational speed. Rotational speed really only has a small effect on the wait time for the heads to get in position, whereas xfer rate off the platters is much more important. My older 7200RPM 2Gig and 4Gig UW SCSI drives are no match for my more modern 40 Gig 5400 RPM IDE drive, which has much higher areal density and xfer rate off the platters. While it may not spin as fast, the bits / cm2 are MUCH higher on that drive, and I can get around 15 megs a second off of it with bonnie++. The older 4 gig UW drives can hardly break 5 Megs a second xfer rate. Of course, on the drives you're testing, it is quite likely that the xfer rate on the 10k rpm drives are noticeably higher than the xfer rate on the 7200 rpm IDE drives, so that is likely the reason for the better performance. From pgsql-performance-owner@postgresql.org Wed Dec 4 19:30:32 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8304D475FD3 for ; Wed, 4 Dec 2002 19:30:28 -0500 (EST) Received: from pd3mo1so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id C3D5D4763C9 for ; Wed, 4 Dec 2002 19:30:24 -0500 (EST) Received: from pd4mr2so.prod.shaw.ca (pd4mr2so-qfe3.prod.shaw.ca [10.0.141.213]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6M00BQZEJK0F@l-daemon> for pgsql-performance@postgresql.org; Wed, 04 Dec 2002 17:26:08 -0700 (MST) Received: from pn2ml6so.prod.shaw.ca (pn2ml6so-qfe0.prod.shaw.ca [10.0.121.150]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6M00A7VEJKQE@l-daemon> for pgsql-performance@postgresql.org; Wed, 04 Dec 2002 17:26:08 -0700 (MST) Received: from kimiko (h24-78-132-76.vc.shawcable.net [24.78.132.76]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with SMTP id <0H6M000G0EJJNI@l-daemon> for pgsql-performance@postgresql.org; Wed, 04 Dec 2002 17:26:08 -0700 (MST) Date: Wed, 04 Dec 2002 16:26:14 -0800 From: Vernon Wu Subject: Is a better way to have the same result of this query? To: pgsql-performance@postgresql.org Reply-To: vernonw@gatewaytech.com Message-id: MIME-version: 1.0 X-Mailer: Opera 6.05 build 1140 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT X-Priority: 3 (Normal) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/24 X-Sequence-Number: 440 I have the following query: SELECT p.userid, p.year, a.country, a.province, a.city FROM profile p, account a WHERE p.userid=a.userid AND (p.year BETWEEN 1961 AND 1976) AND a.country='CA' AND a.province='BC' AND p.gender='f' AND p.userid NOT IN (SELECT b.userid FROM block b WHERE b.personid='Joe') AND block.userid IS NOT NULL AND p.userid IN (SELECT f.userid FROM preference f, profile p1 WHERE p1.userid='Joe' AND 2002-p1.year BETWEEN f.minage AND f.maxage) In plain English, it is that Joe finds females between the ages in the location who is not in the block table, while Joe's age is between what they prefer. The query plan is the followings: Nested Loop (cost=0.00..127.12 rows=995 width=894) -> Nested Loop (cost=0.00..97.17 rows=1 width=894) -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) -> Index Scan using pk_profile on profile p (cost=0.00..72.16 rows=1 width=605) SubPlan -> Materialize (cost=22.50..22.50 rows=5 width=55) -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55 ) -> Materialize (cost=44.82..44.82 rows=111 width=89) -> Nested Loop (cost=0.00..44.82 rows=111 width=89) -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) -> Seq Scan on preference f (cost=0.00..20.00 rows=1000 width=77) -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) It seems take quite long to run this query. How to optimise the query? Thanks for your input. Vernon From pgsql-performance-owner@postgresql.org Thu Dec 5 00:27:58 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C753B475EAE for ; Thu, 5 Dec 2002 00:27:56 -0500 (EST) Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) by postgresql.org (Postfix) with ESMTP id 7F179475C98 for ; Thu, 5 Dec 2002 00:26:46 -0500 (EST) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao04.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021205052651.QJQQ1248.lakemtao04.cox.net@[192.168.1.1]> for ; Thu, 5 Dec 2002 00:26:51 -0500 Subject: Re: Is a better way to have the same result of this From: Ron Johnson To: PgSQL Performance ML In-Reply-To: References: Content-Type: text/plain Organization: Message-Id: <1039066008.11433.3.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 04 Dec 2002 23:26:48 -0600 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/25 X-Sequence-Number: 441 On Wed, 2002-12-04 at 18:26, Vernon Wu wrote: > I have the following query: > > SELECT p.userid, p.year, a.country, a.province, a.city > FROM profile p, account a > WHERE p.userid=a.userid AND > (p.year BETWEEN 1961 AND 1976) AND > a.country='CA' AND > a.province='BC' AND > p.gender='f' AND > p.userid NOT IN (SELECT b.userid FROM block b WHERE b.personid='Joe') AND > block.userid IS NOT NULL AND > p.userid IN > (SELECT f.userid FROM preference f, profile p1 WHERE p1.userid='Joe' AND 2002-p1.year BETWEEN > f.minage AND f.maxage) > > In plain English, it is that > > Joe finds females between the ages in the location who is not in the block table, while Joe's age is between what they > prefer. > > The query plan is the followings: > > Nested Loop (cost=0.00..127.12 rows=995 width=894) > -> Nested Loop (cost=0.00..97.17 rows=1 width=894) > -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) > -> Index Scan using pk_profile on profile p (cost=0.00..72.16 rows=1 width=605) > SubPlan > -> Materialize (cost=22.50..22.50 rows=5 width=55) > -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55 > ) > -> Materialize (cost=44.82..44.82 rows=111 width=89) > -> Nested Loop (cost=0.00..44.82 rows=111 width=89) > -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) > -> Seq Scan on preference f (cost=0.00..20.00 rows=1000 width=77) > -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) > > It seems take quite long to run this query. How to optimise the query? > > Thanks for your input. > > Vernon What kind of indexes, if any, do you have on, and what is the cardinality of account, block and preference? What version of Postgres are you using? How much shared memory and buffers are you using? -- +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "they love our milk and honey, but preach about another | | way of living" | | Merle Haggard, "The Fighting Side Of Me" | +------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Dec 5 04:51:10 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6CB1B475F28 for ; Thu, 5 Dec 2002 04:51:09 -0500 (EST) Received: from mediaexch01.mediaburst.co.uk (unknown [213.130.128.235]) by postgresql.org (Postfix) with ESMTP id 94974475EAE for ; Thu, 5 Dec 2002 04:51:08 -0500 (EST) content-class: urn:content-classes:message Subject: ORDER BY ... LIMIT.. performance MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Thu, 5 Dec 2002 09:51:09 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.4712.0 Message-ID: <94B61ED0D8770A4A98A3DBD72DBBA1F821A80A@mediaexch01.mediaburst.co.uk> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: ORDER BY ... LIMIT.. performance Thread-Index: AcKcQ9WzyLHpZ4aeQwGhQ6hQL3I1Pg== From: "john cartmell" To: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/26 X-Sequence-Number: 442 I am not sure whether this is a know problem but we discovered this the other day. We are using PostgreSQL 7.2.1 on Redhat 7.3. The table has about over a million rows (~1.4). The query concerned is of the form SELECT * FROM tblCompany WHERE lower(companyname) like 'company%' ORDER BY companyname LIMIT 20,0 There is a functional index lower(companyname) for the like clause. Without the LIMIT clause the query takes approximately 3-5 seconds to return. If total number of rows returned without the LIMIT clause is greater than 20 records, then the above query also takes th same amount of time. But if the the total number of rows is 20 or less then the time taken for the above query to return goes up to 20-30 seconds. Has anyone else come across this. We have managed to get round it by performing a count first and only performing the LIMIT if there are enough rows but surely the query should be able to do this itself! John Cartmell From pgsql-performance-owner@postgresql.org Thu Dec 5 05:01:20 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CA3B8475C98 for ; Thu, 5 Dec 2002 05:01:17 -0500 (EST) Received: from ns1.tudelft.nl (ns1.tudelft.nl [130.161.180.1]) by postgresql.org (Postfix) with ESMTP id 31E68475BC3 for ; Thu, 5 Dec 2002 05:01:17 -0500 (EST) Received: from CONVERSION-DAEMON.mailhost2.tudelft.nl by mailhost2.tudelft.nl (PMDF V6.1-1 #40925) id <0H6N00601564TK@mailhost2.tudelft.nl> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 11:01:18 +0100 (MET) Received: from listserv.tudelft.nl (listserv.tudelft.nl [130.161.180.33]) by mailhost2.tudelft.nl (PMDF V6.1-1 #40925) with ESMTP id <0H6N0027C564P8@mailhost2.tudelft.nl>; Thu, 05 Dec 2002 11:01:16 +0100 (MET) Received: from oli.tudelft.nl (oli244.rolahola.tudelft.nl [130.161.67.244]) by listserv.tudelft.nl (8.12.5/8.12.5) with ESMTP id gB5A1FFx012879; Thu, 05 Dec 2002 11:01:16 +0100 (MET) Date: Thu, 05 Dec 2002 11:01:15 +0100 From: Jochem van Dieten Subject: Re: Is a better way to have the same result of this query? In-reply-to: To: vernonw@gatewaytech.com Cc: pgsql-performance@postgresql.org Message-id: <3DEF23EB.1060603@oli.tudelft.nl> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2) Gecko/20021126 References: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/27 X-Sequence-Number: 443 Vernon Wu wrote: > > SELECT p.userid, p.year, a.country, a.province, a.city > FROM profile p, account a > WHERE p.userid=a.userid AND > (p.year BETWEEN 1961 AND 1976) AND > a.country='CA' AND > a.province='BC' AND > p.gender='f' AND > p.userid NOT IN (SELECT b.userid FROM block b WHERE b.personid='Joe') AND > block.userid IS NOT NULL AND > p.userid IN > (SELECT f.userid FROM preference f, profile p1 WHERE p1.userid='Joe' AND 2002-p1.year BETWEEN > f.minage AND f.maxage) You might want to flatten this into more joins and less subqueries, especially since you are using IN which is not very optimized: SELECT p.userid, p.year, a.country, a.province, a.city FROM profile p, account a, preference f, profile p1 WHERE f.userid = p.userid AND p.userid=a.userid AND (p.year BETWEEN 1961 AND 1976) AND a.country='CA' AND a.province='BC' AND p.gender='f' AND p.userid NOT IN (SELECT b.userid FROM block b WHERE b.personid='Joe') AND block.userid IS NOT NULL AND p1.userid='Joe' AND 2002-p1.year BETWEEN f.minage AND f.maxage Also, I am not sure about the NOT IN. If you can rewrite it using EXISTS try that, it might be faster. > Nested Loop (cost=0.00..127.12 rows=995 width=894) > -> Nested Loop (cost=0.00..97.17 rows=1 width=894) > -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) > -> Index Scan using pk_profile on profile p (cost=0.00..72.16 rows=1 width=605) > SubPlan > -> Materialize (cost=22.50..22.50 rows=5 width=55) > -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55 > ) > -> Materialize (cost=44.82..44.82 rows=111 width=89) > -> Nested Loop (cost=0.00..44.82 rows=111 width=89) > -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) > -> Seq Scan on preference f (cost=0.00..20.00 rows=1000 width=77) rows=1000 usually indicates you didn't vacuum analyze. Did you? > -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) And to add to Vernons questions: if you are using PostgreSQL 7.2 or later, please send us the EXPLAIN ANALYZE output. Jochem From pgsql-performance-owner@postgresql.org Thu Dec 5 11:30:47 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 946FD476875 for ; Thu, 5 Dec 2002 11:30:45 -0500 (EST) Received: from cpcolosmtp (unknown [208.252.194.251]) by postgresql.org (Postfix) with SMTP id F1D92476861 for ; Thu, 5 Dec 2002 11:30:26 -0500 (EST) Received: FROM mail-west.gensler.com BY cpcolosmtp ; Thu Dec 05 08:21:51 2002 -0800 Received: from cpg2wsb (192.168.100.30) by mail-west.gensler.com (FirstClass Mail Server v6.1) with SMTP (Sender: eric_theis@gensler.com) transient id 675; Thu, 05 Dec 2002 08:33:13 -0800 From: "Eric Theis" To: Subject: Index question with LIKE keyword Date: Thu, 5 Dec 2002 08:34:14 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/28 X-Sequence-Number: 444 I have a question about some strange behavior on what should be a rather easy issue. I am not getting the query plan that I expect given the query and the indexes. I have a table with the following structure: CREATE TABLE tblCompany( intCmpID serial NOT NULL, vchCmpName varchar(60) NOT NULL, vchCmpAltName varchar(100) NULL, vchCmpPrevName varchar(60) NULL, intCmpParentID int NULL, intCmpOwnerEmpID int NOT NULL, dateCmpMaintained datetime NOT NULL, chrCmpStatus char(1) NOT NULL, intModifiedBy int NOT NULL, dateModifiedOn datetime NOT NULL, CONSTRAINT pkCompany PRIMARY KEY (intCmpID) ) ; It has the following index: CREATE INDEX idxCompany1 ON tblCompany(vchCmpName); When I run the following query in Postgres, I get the results I expect: CRMDB=> explain select * from tblCompany where vchCmpName = 'Gensler'; NOTICE: QUERY PLAN: Index Scan using idxcompany1 on tblcompany (cost=0.00..5.21 rows=1 width=212) EXPLAIN This work under both Windows and Linux. When I run the following query under Windows, I get what I expect: CRMDB=> explain select * from tblCompany where vchcmpname like 'Gensler%'; NOTICE: QUERY PLAN: Index Scan using idxcompany1 on tblcompany (cost=0.00..17.07 rows=1 width=201) EXPLAIN However, when I run the same query under Linux, I get this: CRMDB=> explain select * from tblCompany where vchCmpName like 'Gensler%'; NOTICE: QUERY PLAN: Seq Scan on tblcompany (cost=100000000.00..100000002.01 rows=1 width=212) EXPLAIN I really don't understand why this is happening, but I am hoping that someone on this list has an idea. The versions of Postgres that I am using are Windows 7.2.2 and Linux 7.2.1 and 7.2.2. The Windows version is the compiled version that comes with Cygwin and the Linux versions are the RPMs that come with Redhat 7.3, Mandrake 9.0 and the Redhat 7.3 RPM from the Postgres site. If anyone has an ideas suggestions I would really appreciate it. TIA Eric From pgsql-performance-owner@postgresql.org Thu Dec 5 11:48:30 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BEA7E4761DB for ; Thu, 5 Dec 2002 11:48:28 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 8CE41476800 for ; Thu, 5 Dec 2002 11:47:24 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id B6332D600; Thu, 5 Dec 2002 08:47:29 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id ABDEE5C02; Thu, 5 Dec 2002 08:47:29 -0800 (PST) Date: Thu, 5 Dec 2002 08:47:29 -0800 (PST) From: Stephan Szabo To: Eric Theis Cc: Subject: Re: Index question with LIKE keyword In-Reply-To: Message-ID: <20021205084537.A2049-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/29 X-Sequence-Number: 445 On Thu, 5 Dec 2002, Eric Theis wrote: > This work under both Windows and Linux. > > When I run the following query under Windows, I get what I expect: > CRMDB=> explain select * from tblCompany where vchcmpname like 'Gensler%'; > NOTICE: QUERY PLAN: > > Index Scan using idxcompany1 on tblcompany (cost=0.00..17.07 rows=1 > width=201) > > EXPLAIN > > However, when I run the same query under Linux, I get this: > CRMDB=> explain select * from tblCompany where vchCmpName like 'Gensler%'; > NOTICE: QUERY PLAN: > > Seq Scan on tblcompany (cost=100000000.00..100000002.01 rows=1 width=212) > > EXPLAIN > > I really don't understand why this is happening, but I am hoping that > someone on this list has an idea. The versions of Postgres that I am using > are Windows 7.2.2 and Linux 7.2.1 and 7.2.2. The Windows version is the > compiled version that comes with Cygwin and the Linux versions are the RPMs > that come with Redhat 7.3, Mandrake 9.0 and the Redhat 7.3 RPM from the > Postgres site. > > If anyone has an ideas suggestions I would really appreciate it. The linux box is probably not running in "C" locale (or at least initdb wasn't run in "C" locale). The optimization for using indexes on like currently only works in that locale (because there are issues in some/many other locales that makes the transformation invalid). There's been talk about this issue on (I think) -general (or if not there then -hackers) recently. From pgsql-performance-owner@postgresql.org Thu Dec 5 13:45:24 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8CFE34762AB for ; Thu, 5 Dec 2002 13:45:22 -0500 (EST) Received: from pd3mo2so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id C28404761DD for ; Thu, 5 Dec 2002 13:45:19 -0500 (EST) Received: from pd6mr4so.prod.shaw.ca (pd6mr4so-qfe3.prod.shaw.ca [10.0.141.219]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6N00DFXTFFNS@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 11:45:15 -0700 (MST) Received: from pn2ml10so.prod.shaw.ca (pn2ml10so-qfe0.prod.shaw.ca [10.0.121.80]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6N004DTTFGJ6@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 11:45:16 -0700 (MST) Received: from kimiko (h24-78-132-76.vc.shawcable.net [24.78.132.76]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with SMTP id <0H6N008OLTFE04@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 11:45:16 -0700 (MST) Date: Thu, 05 Dec 2002 10:44:34 -0800 From: Vernon Wu Subject: Re: Is a better way to have the same result of this query? In-reply-to: <3DEF23EB.1060603@oli.tudelft.nl> To: Jochem van Dieten Cc: pgsql-performance@postgresql.org Reply-To: vernonw@gatewaytech.com Message-id: MIME-version: 1.0 X-Mailer: Opera 6.05 build 1140 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Priority: 3 (Normal) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/30 X-Sequence-Number: 446 Jochem, Thanks for your suggestion/information. The followings are the analyise outcomes after I did some modifications with the query. My finding is that the new query does improve the performance according to the plan. The actual time is reversed might due to the fact the test data is very small (the machine is a very old one by the way). The userid is the key for all tables and the gender is indexed. Do I also index the country and province to improve the preformance? The modified query with the suggested flatting query. Nested Loop (cost=0.00..91.97 rows=995 width=445) (actual time=1.00..3.00 rows=2 loops=1) -> Nested Loop (cost=0.00..62.02 rows=1 width=445) (actual time=1.00..3.00 rows=2 loops=1) -> Nested Loop (cost=0.00..34.68 rows=1 width=378) (actual time=1.00..3.00 rows=3 loops=1) -> Nested Loop (cost=0.00..29.84 rows=1 width=366) (actual time=1.00..3.00 rows=3 loops=1) -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) (actual time=0.00..0.00 rows=3 loops=1) -> Index Scan using pk_preference on preference f (cost=0.00..4.82 rows=1 width=77) (actual time= 0.67..1.00 rows=1 loops=3) -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) (actual time=0.00..0.00 rows= 1 loops=3) -> Index Scan using pk_profile on profile p (cost=0.00..27.33 rows=1 width=67) (actual time=0.00..0.00 rows=1 loops=3) SubPlan -> Materialize (cost=22.50..22.50 rows=5 width=55) (actual time=0.00..0.00 rows=0 loops=2) -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55) (actual time=0.00..0.00 rows=0 loops=1) -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) (actual time=0.00..0.00 rows=1 loops=2) Total runtime: 5.00 msec After replacing "p.userid NOT IN" with "NOT EXISTS": Result (cost=0.00..61.56 rows=995 width=445) (actual time=3.00..4.00 rows=2 loops=1) InitPlan -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55) (actual time=0.00..0.00 rows=0 loops=1) -> Nested Loop (cost=0.00..61.56 rows=995 width=445) (actual time=3.00..4.00 rows=2 loops=1) -> Nested Loop (cost=0.00..31.61 rows=1 width=445) (actual time=3.00..4.00 rows=2 loops=1) -> Nested Loop (cost=0.00..26.77 rows=1 width=433) (actual time=2.00..3.00 rows=2 loops=1) -> Nested Loop (cost=0.00..21.93 rows=1 width=356) (actual time=2.00..2.00 rows=2 loops=1) -> Index Scan using profile_sex_idx on profile p (cost=0.00..17.09 rows=1 width=67) (actual time= 1.00..1.00 rows=2 loops=1) -> Index Scan using pk_account on account a (cost=0.00..4.83 rows=1 width=289) (actual time= 0.50..0.50 rows=1 loops=2) -> Index Scan using pk_preference on preference f (cost=0.00..4.82 rows=1 width=77) (actual time= 0.50..0.50 rows=1 loops=2) -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) (actual time=0.50..0.50 rows= 1 loops=2) -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) (actual time=0.00..0.00 rows=1 loops=2) Total runtime: 7.00 msec After vacuum analyze: Result (cost=3.19..5.29 rows=1 width=91) (actual time=3.00..4.00 rows=2 loops=1) InitPlan -> Seq Scan on block b (cost=0.00..1.01 rows=1 width=7) (actual time=0.00..0.00 rows=0 loops=1) -> Nested Loop (cost=3.19..5.29 rows=1 width=91) (actual time=3.00..4.00 rows=2 loops=1) -> Hash Join (cost=3.19..4.27 rows=1 width=91) (actual time=3.00..3.00 rows=2 loops=1) -> Hash Join (cost=2.13..3.20 rows=1 width=72) (actual time=2.00..2.00 rows=3 loops=1) -> Seq Scan on account a (cost=0.00..1.04 rows=3 width=31) (actual time=1.00..1.00 rows=3 loops=1) -> Hash (cost=2.13..2.13 rows=1 width=41) (actual time=0.00..0.00 rows=0 loops=1) -> Nested Loop (cost=0.00..2.13 rows=1 width=41) (actual time=0.00..0.00 rows=3 loops=1) -> Seq Scan on profile p1 (cost=0.00..1.04 rows=1 width=12) (actual time=0.00..0.00 rows=1 loops=1) -> Seq Scan on preference f (cost=0.00..1.03 rows=3 width=29) (actual time=0.00..0.00 rows=3 loops=1) -> Hash (cost=1.05..1.05 rows=2 width=19) (actual time=1.00..1.00 rows=0 loops=1) -> Seq Scan on profile p (cost=0.00..1.05 rows=2 width=19) (actual time=1.00..1.00 rows=2 loops=1) -> Seq Scan on block (cost=0.00..1.01 rows=1 width=0) (actual time=0.00..0.00 rows=1 loops=2) Total runtime: 7.00 msec The original query Nested Loop (cost=0.00..127.12 rows=995 width=894) (actual time=1.00..2.00 rows=2 loops=1) -> Nested Loop (cost=0.00..97.17 rows=1 width=894) (actual time=1.00..1.00 rows=2 loops=1) -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) (actual time=0.00..0.00 rows=3 loops=1) -> Index Scan using pk_profile on profile p (cost=0.00..72.16 rows=1 width=605) (actual time=0.33..0.33 rows=1 loops=3) SubPlan -> Materialize (cost=22.50..22.50 rows=5 width=55) (actual time=0.00..0.00 rows=0 loops=2) -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55) (actual time=0.00..0.00 rows=0 loops=1) -> Materialize (cost=44.82..44.82 rows=111 width=89) (actual time=0.50..0.50 rows=1 loops=2) -> Nested Loop (cost=0.00..44.82 rows=111 width=89) (actual time=0.00..0.00 rows=3 loops=1) -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) (actual time= 0.00..0.00 rows=1 loops=1) -> Seq Scan on preference f (cost=0.00..20.00 rows=1000 width=77) (actual time=0.00..0.00 rows= 3 loops=1) -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) (actual time=0.00..0.00 rows=1 loops=2) Total runtime: 4.00 msec After replacing "p.userid NOT IN" with "NOT EXISTS": Result (cost=0.00..104.62 rows=995 width=894) (actual time=1.00..2.00 rows=2 loops=1) InitPlan -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55) (actual time=0.00..0.00 rows=0 loops=1) -> Nested Loop (cost=0.00..104.62 rows=995 width=894) (actual time=1.00..1.00 rows=2 loops=1) -> Nested Loop (cost=0.00..74.67 rows=1 width=894) (actual time=1.00..1.00 rows=2 loops=1) -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) (actual time=0.00..0.00 rows=3 loops=1) -> Index Scan using pk_profile on profile p (cost=0.00..49.66 rows=1 width=605) (actual time=0.33..0.33 rows=1 loops=3) SubPlan -> Materialize (cost=44.82..44.82 rows=111 width=89) (actual time=0.50..0.50 rows=1 loops=2) -> Nested Loop (cost=0.00..44.82 rows=111 width=89) (actual time=0.00..1.00 rows=3 loops=1) -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) (actual time= 0.00..0.00 rows=1 loops=1) -> Seq Scan on preference f (cost=0.00..20.00 rows=1000 width=77) (actual time=0.00..1.00 rows=3 loops=1) -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) (actual time=0.00..0.00 rows=1 loops=2) Total runtime: 4.00 msec After vacuum analyze: Result (cost=7.30..9.39 rows=1 width=63) (actual time=3.00..3.00 rows=2 loops=1) InitPlan -> Seq Scan on block b (cost=0.00..1.01 rows=1 width=7) (actual time=0.00..0.00 rows=0 loops=1) -> Nested Loop (cost=7.30..9.39 rows=1 width=63) (actual time=3.00..3.00 rows=2 loops=1) -> Seq Scan on block (cost=0.00..1.01 rows=1 width=0) (actual time=0.00..0.00 rows=1 loops=1) -> Materialize (cost=8.37..8.37 rows=1 width=63) (actual time=3.00..3.00 rows=2 loops=1) -> Hash Join (cost=7.30..8.37 rows=1 width=63) (actual time=2.00..3.00 rows=2 loops=1) -> Seq Scan on account a (cost=0.00..1.04 rows=3 width=31) (actual time=0.00..0.00 rows=3 loops=1) -> Hash (cost=7.30..7.30 rows=1 width=32) (actual time=2.00..2.00 rows=0 loops=1) -> Index Scan using profile_sex_idx on profile p (cost=0.00..7.30 rows=1 width=32) (actual time= 2.00..2.00 rows=2 loops=1) SubPlan -> Materialize (cost=2.13..2.13 rows=1 width=41) (actual time=0.50..0.50 rows=1 loops=2) -> Nested Loop (cost=0.00..2.13 rows=1 width=41) (actual time=1.00..1.00 rows=3 loops=1) -> Seq Scan on profile p1 (cost=0.00..1.04 rows=1 width=12) (actual time=0.00..0.00 rows=1 loops=1) -> Seq Scan on preference f (cost=0.00..1.03 rows=3 width=29) (actual time=0.00..0.00 rows=3 loops=1) Total runtime: 4.00 msec 12/5/2002 2:01:15 AM, Jochem van Dieten wrote: >Vernon Wu wrote: >> >> SELECT p.userid, p.year, a.country, a.province, a.city >> FROM profile p, account a >> WHERE p.userid=a.userid AND >> (p.year BETWEEN 1961 AND 1976) AND >> a.country='CA' AND >> a.province='BC' AND >> p.gender='f' AND >> p.userid NOT IN (SELECT b.userid FROM block b WHERE b.personid='Joe') AND >> block.userid IS NOT NULL AND >> p.userid IN >> (SELECT f.userid FROM preference f, profile p1 WHERE p1.userid='Joe' AND 2002-p1.year BETWEEN >> f.minage AND f.maxage) > >You might want to flatten this into more joins and less subqueries, >especially since you are using IN which is not very optimized: > >SELECT p.userid, p.year, a.country, a.province, a.city >FROM profile p, account a, preference f, profile p1 >WHERE > f.userid = p.userid AND > p.userid=a.userid AND > (p.year BETWEEN 1961 AND 1976) AND > a.country='CA' AND > a.province='BC' AND > p.gender='f' AND > p.userid NOT IN (SELECT b.userid FROM block b WHERE b.personid='Joe') AND > block.userid IS NOT NULL AND > p1.userid='Joe' AND > 2002-p1.year BETWEEN f.minage AND f.maxage > >Also, I am not sure about the NOT IN. If you can rewrite it using EXISTS >try that, it might be faster. > > >> Nested Loop (cost=0.00..127.12 rows=995 width=894) >> -> Nested Loop (cost=0.00..97.17 rows=1 width=894) >> -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) >> -> Index Scan using pk_profile on profile p (cost=0.00..72.16 rows=1 width=605) >> SubPlan >> -> Materialize (cost=22.50..22.50 rows=5 width=55) >> -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55 >> ) >> -> Materialize (cost=44.82..44.82 rows=111 width=89) >> -> Nested Loop (cost=0.00..44.82 rows=111 width=89) >> -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) >> -> Seq Scan on preference f (cost=0.00..20.00 rows=1000 width=77) > >rows=1000 usually indicates you didn't vacuum analyze. Did you? > >> -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) > >And to add to Vernons questions: if you are using PostgreSQL 7.2 or >later, please send us the EXPLAIN ANALYZE output. > >Jochem > > From pgsql-performance-owner@postgresql.org Thu Dec 5 14:18:43 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4D2F9476992 for ; Thu, 5 Dec 2002 14:18:39 -0500 (EST) Received: from pd3mo2so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id 0D5344766EF for ; Thu, 5 Dec 2002 14:12:37 -0500 (EST) Received: from pd2mr3so.prod.shaw.ca (pd2mr3so-ser.prod.shaw.ca [10.0.141.108]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6N00MN8UIXGW@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 12:08:57 -0700 (MST) Received: from pn2ml8so.prod.shaw.ca (pn2ml8so-qfe0.prod.shaw.ca [10.0.121.152]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6N00LB1UIYYU@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 12:08:58 -0700 (MST) Received: from kimiko (h24-78-132-76.vc.shawcable.net [24.78.132.76]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with SMTP id <0H6N00GKNUIXJM@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 12:08:58 -0700 (MST) Date: Thu, 05 Dec 2002 11:08:17 -0800 From: Vernon Wu Subject: Re: Is a better way to have the same result of this In-reply-to: <1039066008.11433.3.camel@haggis> To: PgSQL Performance ML , Ron Johnson Reply-To: vernonw@gatewaytech.com Message-id: MIME-version: 1.0 X-Mailer: Opera 6.05 build 1140 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT X-Priority: 3 (Normal) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/31 X-Sequence-Number: 447 Ron, The gender is indexed. Each user has account and preference, but not necessary block. I am currently seeking for query optimisation, not system configuration optimisation 12/4/2002 9:26:48 PM, Ron Johnson wrote: >On Wed, 2002-12-04 at 18:26, Vernon Wu wrote: >> I have the following query: >> >> SELECT p.userid, p.year, a.country, a.province, a.city >> FROM profile p, account a >> WHERE p.userid=a.userid AND >> (p.year BETWEEN 1961 AND 1976) AND >> a.country='CA' AND >> a.province='BC' AND >> p.gender='f' AND >> p.userid NOT IN (SELECT b.userid FROM block b WHERE b.personid='Joe') AND >> block.userid IS NOT NULL AND >> p.userid IN >> (SELECT f.userid FROM preference f, profile p1 WHERE p1.userid='Joe' AND 2002-p1.year BETWEEN >> f.minage AND f.maxage) >> >> In plain English, it is that >> >> Joe finds females between the ages in the location who is not in the block table, while Joe's age is between what they >> prefer. >> >> The query plan is the followings: >> >> Nested Loop (cost=0.00..127.12 rows=995 width=894) >> -> Nested Loop (cost=0.00..97.17 rows=1 width=894) >> -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) >> -> Index Scan using pk_profile on profile p (cost=0.00..72.16 rows=1 width=605) >> SubPlan >> -> Materialize (cost=22.50..22.50 rows=5 width=55) >> -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55 >> ) >> -> Materialize (cost=44.82..44.82 rows=111 width=89) >> -> Nested Loop (cost=0.00..44.82 rows=111 width=89) >> -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) >> -> Seq Scan on preference f (cost=0.00..20.00 rows=1000 width=77) >> -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) >> >> It seems take quite long to run this query. How to optimise the query? >> >> Thanks for your input. >> >> Vernon > >What kind of indexes, if any, do you have on, and what is the >cardinality of account, block and preference? > >What version of Postgres are you using? > >How much shared memory and buffers are you using? > >-- >+------------------------------------------------------------+ >| Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | >| Jefferson, LA USA http://members.cox.net/ron.l.johnson | >| | >| "they love our milk and honey, but preach about another | >| way of living" | >| Merle Haggard, "The Fighting Side Of Me" | >+------------------------------------------------------------+ > > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Thu Dec 5 14:59:54 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BF334476CD7 for ; Thu, 5 Dec 2002 14:59:53 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 2535F47688E for ; Thu, 5 Dec 2002 14:35:36 -0500 (EST) Received: from klaster.net (ph239.krakow.cvx.ppp.tpnet.pl [217.99.208.239]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id DD06D2B25F; Thu, 5 Dec 2002 20:21:23 +0100 (CET) Message-ID: <3DEFAAF7.6040000@klaster.net> Date: Thu, 05 Dec 2002 20:37:27 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: vernonw@gatewaytech.com Cc: PgSQL Performance ML , Ron Johnson Subject: Re: Is a better way to have the same result of this References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/32 X-Sequence-Number: 448 Vernon Wu wrote: > Ron, > > The gender is indexed. Each user has account and preference, but not necessary block. Indexing on gender won't speed up your query - it can even slow it down. You have probably 50% of "f" and 50% of "m". Using index on gender will divide your potential answers by 2. Make index on columns, which excludes much more useless rows. I think you can create index on: - block/personid - profile/userid I read in Postgres documentation(but didn't try) that you can also change "id NOT IN (select id" to "not exists select * where id=". It may help also. Do user have more than one account or preference? If no, you can change "not in" into "inner/outer join" which are the best ones. Regards, Tomasz Myrta From pgsql-performance-owner@postgresql.org Thu Dec 5 15:13:16 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A165E476AB2 for ; Thu, 5 Dec 2002 15:13:15 -0500 (EST) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id 973194760A2 for ; Thu, 5 Dec 2002 14:45:21 -0500 (EST) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id OAA28735; Thu, 5 Dec 2002 14:45:21 -0500 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma028733; Thu, 5 Dec 02 14:44:51 -0500 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id OAA04710; Thu, 5 Dec 2002 14:43:30 -0500 Message-ID: <3DEFACD6.A9573026@nsd.ca> Date: Thu, 05 Dec 2002 14:45:26 -0500 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: vernonw@gatewaytech.com Cc: PgSQL Performance ML , Ron Johnson Subject: Re: Is a better way to have the same result of this References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/33 X-Sequence-Number: 449 It is now common knowledge that the IN clause should be rewriten as an EXISTS. SELECT p.userid, p.year, a.country, a.province, a.city FROM profile p, account a WHERE p.userid=a.userid AND (p.year BETWEEN 1961 AND 1976) AND a.country='CA' AND a.province='BC' AND p.gender='f' AND NOT EXISTS ( SELECT 1 FROM block b WHERE b.personid='Joe' AND p.userid = b.userid) AND block.userid IS NOT NULL AND EXISTS ( SELECT 1 FROM preference f, profile p1 WHERE p1.userid='Joe' AND p.userid = f.userif AND 2002-p1.year BETWEEN f.minage AND f.maxage); Vernon Wu wrote: > > Ron, > > The gender is indexed. Each user has account and preference, but not necessary block. > > I am currently seeking for query optimisation, not system configuration optimisation > > 12/4/2002 9:26:48 PM, Ron Johnson wrote: > > >On Wed, 2002-12-04 at 18:26, Vernon Wu wrote: > >> I have the following query: > >> > >> SELECT p.userid, p.year, a.country, a.province, a.city > >> FROM profile p, account a > >> WHERE p.userid=a.userid AND > >> (p.year BETWEEN 1961 AND 1976) AND > >> a.country='CA' AND > >> a.province='BC' AND > >> p.gender='f' AND > >> p.userid NOT IN (SELECT b.userid FROM block b WHERE b.personid='Joe') AND > >> block.userid IS NOT NULL AND > >> p.userid IN > >> (SELECT f.userid FROM preference f, profile p1 WHERE p1.userid='Joe' AND 2002-p1.year BETWEEN > >> f.minage AND f.maxage) > >> > >> In plain English, it is that > >> > >> Joe finds females between the ages in the location who is not in the block table, while Joe's age is between what > they > >> prefer. > >> > >> The query plan is the followings: > >> > >> Nested Loop (cost=0.00..127.12 rows=995 width=894) > >> -> Nested Loop (cost=0.00..97.17 rows=1 width=894) > >> -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) > >> -> Index Scan using pk_profile on profile p (cost=0.00..72.16 rows=1 width=605) > >> SubPlan > >> -> Materialize (cost=22.50..22.50 rows=5 width=55) > >> -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55 > >> ) > >> -> Materialize (cost=44.82..44.82 rows=111 width=89) > >> -> Nested Loop (cost=0.00..44.82 rows=111 width=89) > >> -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) > >> -> Seq Scan on preference f (cost=0.00..20.00 rows=1000 width=77) > >> -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) > >> From pgsql-performance-owner@postgresql.org Thu Dec 5 15:23:47 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A27D1476B8E for ; Thu, 5 Dec 2002 15:23:45 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 9CF87476BF3 for ; Thu, 5 Dec 2002 14:57:49 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 18K286-0002HK-00 for ; Thu, 05 Dec 2002 14:57:50 -0500 Date: Thu, 5 Dec 2002 14:57:50 -0500 From: Andrew Sullivan To: PgSQL Performance ML Subject: Re: Is a better way to have the same result of this Message-ID: <20021205145750.V4800@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , PgSQL Performance ML References: <1039066008.11433.3.camel@haggis> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from vernonw@gatewaytech.com on Thu, Dec 05, 2002 at 11:08:17AM -0800 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/34 X-Sequence-Number: 450 On Thu, Dec 05, 2002 at 11:08:17AM -0800, Vernon Wu wrote: > Ron, > > The gender is indexed. Given that gender only has two (? Very few, anyway) values, I can't believe an index will be much use: it's not very selective. Maybe combining several columns in one index will help you. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Thu Dec 5 16:16:26 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 72C0F476CDF for ; Thu, 5 Dec 2002 16:16:21 -0500 (EST) Received: from pd4mo2so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id 9F018476DCE for ; Thu, 5 Dec 2002 15:35:47 -0500 (EST) Received: from pd3mr3so.prod.shaw.ca (pd3mr3so-ser.prod.shaw.ca [10.0.141.179]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6N007OGYJOZD@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 13:35:48 -0700 (MST) Received: from pn2ml5so.prod.shaw.ca (pn2ml5so-qfe0.prod.shaw.ca [10.0.121.149]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6N00FRIYJO0U@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 13:35:48 -0700 (MST) Received: from kimiko (h24-78-132-76.vc.shawcable.net [24.78.132.76]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with SMTP id <0H6N00CKIYJMJ6@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 13:35:48 -0700 (MST) Date: Thu, 05 Dec 2002 12:35:08 -0800 From: Vernon Wu Subject: Re: Is a better way to have the same result of this In-reply-to: <3DEFACD6.A9573026@nsd.ca> To: Jean-Luc Lachance Cc: PgSQL Performance ML Reply-To: vernonw@gatewaytech.com Message-id: MIME-version: 1.0 X-Mailer: Opera 6.05 build 1140 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Priority: 3 (Normal) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/35 X-Sequence-Number: 451 I just learnt the "common knowledge" about four hourse ago. That does help to improve the performance indeed according to the explain command. 12/5/2002 11:45:26 AM, Jean-Luc Lachance wrote: >It is now common knowledge that the IN clause should be rewriten as an >EXISTS. > >SELECT p.userid, p.year, a.country, a.province, a.city >FROM profile p, account a >WHERE p.userid=a.userid AND > (p.year BETWEEN 1961 AND 1976) AND > a.country='CA' AND > a.province='BC' AND > p.gender='f' AND > NOT EXISTS ( SELECT 1 FROM block b WHERE b.personid='Joe' AND p.userid >= b.userid) AND > block.userid IS NOT NULL AND > EXISTS ( SELECT 1 FROM preference f, profile p1 > WHERE p1.userid='Joe' AND p.userid = f.userif AND > 2002-p1.year BETWEEN f.minage AND f.maxage); > > > >Vernon Wu wrote: >> >> Ron, >> >> The gender is indexed. Each user has account and preference, but not necessary block. >> >> I am currently seeking for query optimisation, not system configuration optimisation >> >> 12/4/2002 9:26:48 PM, Ron Johnson wrote: >> >> >On Wed, 2002-12-04 at 18:26, Vernon Wu wrote: >> >> I have the following query: >> >> >> >> SELECT p.userid, p.year, a.country, a.province, a.city >> >> FROM profile p, account a >> >> WHERE p.userid=a.userid AND >> >> (p.year BETWEEN 1961 AND 1976) AND >> >> a.country='CA' AND >> >> a.province='BC' AND >> >> p.gender='f' AND >> >> p.userid NOT IN (SELECT b.userid FROM block b WHERE b.personid='Joe') AND >> >> block.userid IS NOT NULL AND >> >> p.userid IN >> >> (SELECT f.userid FROM preference f, profile p1 WHERE p1.userid='Joe' AND 2002-p1.year BETWEEN >> >> f.minage AND f.maxage) >> >> >> >> In plain English, it is that >> >> >> >> Joe finds females between the ages in the location who is not in the block table, while Joe's age is between what >> they >> >> prefer. >> >> >> >> The query plan is the followings: >> >> >> >> Nested Loop (cost=0.00..127.12 rows=995 width=894) >> >> -> Nested Loop (cost=0.00..97.17 rows=1 width=894) >> >> -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) >> >> -> Index Scan using pk_profile on profile p (cost=0.00..72.16 rows=1 width=605) >> >> SubPlan >> >> -> Materialize (cost=22.50..22.50 rows=5 width=55) >> >> -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55 >> >> ) >> >> -> Materialize (cost=44.82..44.82 rows=111 width=89) >> >> -> Nested Loop (cost=0.00..44.82 rows=111 width=89) >> >> -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) >> >> -> Seq Scan on preference f (cost=0.00..20.00 rows=1000 width=77) >> >> -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) >> >> > >---------------------------(end of broadcast)--------------------------- >TIP 5: Have you checked our extensive FAQ? > >http://www.postgresql.org/users-lounge/docs/faq.html > From pgsql-performance-owner@postgresql.org Thu Dec 5 16:21:02 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3C588476D28 for ; Thu, 5 Dec 2002 16:21:01 -0500 (EST) Received: from rtlocal.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by postgresql.org (Postfix) with SMTP id A7F94476F42 for ; Thu, 5 Dec 2002 15:37:09 -0500 (EST) Received: (qmail 28530 invoked from network); 5 Dec 2002 20:28:00 -0000 Received: from unknown (HELO system67.trade-india-local.com) (192.168.0.67) by infocom-236-129-del.trade-india.com with SMTP; 5 Dec 2002 20:28:00 -0000 From: "Rajesh Kumar Mallah." Organization: Infocom Network Limited. To: pgsql-performance@postgresql.org Subject: Filesystem optimisation for postgresql tables and WAL logs on linux. Date: Fri, 6 Dec 2002 02:11:27 +0530 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200212060211.27728.mallah@trade-india.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/36 X-Sequence-Number: 452 Hi, I have got there SCSIs HDDs for the postgresql Box i plan to install OS on 1st , 2nd for tables and indexes and third for pg_xlog. Bruce Momjian's "H/W Perf tuning" on http://www.ca.postgresql.org/docs/momjian/hw_performance/node11.html recommends 8k blocksize for the filesystem which is same as the page size. On linux ext2 fs (on my server) 4096 is the default blocak size and 8192 bytes is not supported. but man mkfs.ext2 on linux mentions an option -T which is: -T fs-type Specify how the filesystem is going to be used, so that mke2fs can chose optimal filesystem parameters for that use. The supported filesystem types are: news one inode per 4kb block largefile one inode per megabyte largefile4 one inode per 4 megabytes is the above relevent as far as optimisation for filesystem for tables is concerned? Also for the pg_xlog drive is a particular block size more favourable then others? regds mallah. -- Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace. From pgsql-performance-owner@postgresql.org Thu Dec 5 16:53:03 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0D8F6476AA4 for ; Thu, 5 Dec 2002 16:53:01 -0500 (EST) Received: from pd6mo2so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id DFEE5476AE1 for ; Thu, 5 Dec 2002 15:58:53 -0500 (EST) Received: from pd5mr3so.prod.shaw.ca (pd5mr3so-qfe3.prod.shaw.ca [10.0.141.144]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6N00IE0ZM7X7@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 13:58:55 -0700 (MST) Received: from pn2ml9so.prod.shaw.ca (pn2ml9so-qfe0.prod.shaw.ca [10.0.121.7]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6N00DKKZM74K@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 13:58:55 -0700 (MST) Received: from kimiko (h24-78-132-76.vc.shawcable.net [24.78.132.76]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with SMTP id <0H6N00IVAZM68E@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 13:58:54 -0700 (MST) Date: Thu, 05 Dec 2002 12:58:13 -0800 From: Vernon Wu Subject: Re: Is a better way to have the same result of this In-reply-to: <3DEFB898.3050602@klaster.net> To: Tomasz Myrta Cc: pgsql-performance@postgresql.org Reply-To: vernonw@gatewaytech.com Message-id: <5A6KF0NHNMGEJG7XRYWL1X8X8.3defbde5@kimiko> MIME-version: 1.0 X-Mailer: Opera 6.05 build 1140 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Priority: 3 (Normal) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/37 X-Sequence-Number: 453 Tomasz, I am under the impression that a primary key field is automically as a unique index. It seems to be correct after I verify it with the page http://www.commandprompt.com/ppbook/index.lxp?lxpwrap=c13329%2ehtm#CREATINGANINDEX Thanks for bringing up the question. Vernon 12/5/2002 12:35:36 PM, Tomasz Myrta wrote: >Vernon Wu wrote: > >> The personid is a foreign key in the block table, and the the userid >> is the key of the profile table. So, both are indexed >> by nature (if I don't make a mistake). > >What kind of nature? Did you create indexes for these fields? Postgres >doesn't create indexes by itself - even if field is a primary key. You >have to do it on your own. I think also, that Postgres doesn't use index >for tables having less then 200 rows - sequence scan is faster. >Regards, >Tomasz Myrta > > > From pgsql-performance-owner@postgresql.org Thu Dec 5 16:56:54 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1D491476857 for ; Thu, 5 Dec 2002 16:56:53 -0500 (EST) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id 64013476DCD for ; Thu, 5 Dec 2002 16:04:22 -0500 (EST) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id QAA29559; Thu, 5 Dec 2002 16:04:22 -0500 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma029557; Thu, 5 Dec 02 16:03:52 -0500 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id QAA05392; Thu, 5 Dec 2002 16:02:31 -0500 Message-ID: <3DEFBF5C.656EADA2@nsd.ca> Date: Thu, 05 Dec 2002 16:04:28 -0500 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: vernonw@gatewaytech.com Cc: PgSQL Performance ML Subject: Re: Is a better way to have the same result of this References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/38 X-Sequence-Number: 454 Good for you! Too bad the parser does not know about it... Vernon Wu wrote: > > I just learnt the "common knowledge" about four hourse ago. That does help to improve the performance indeed > according to the explain command. > > 12/5/2002 11:45:26 AM, Jean-Luc Lachance wrote: > > >It is now common knowledge that the IN clause should be rewriten as an > >EXISTS. > > > >SELECT p.userid, p.year, a.country, a.province, a.city > >FROM profile p, account a > >WHERE p.userid=a.userid AND > > (p.year BETWEEN 1961 AND 1976) AND > > a.country='CA' AND > > a.province='BC' AND > > p.gender='f' AND > > NOT EXISTS ( SELECT 1 FROM block b WHERE b.personid='Joe' AND p.userid > >= b.userid) AND > > block.userid IS NOT NULL AND > > EXISTS ( SELECT 1 FROM preference f, profile p1 > > WHERE p1.userid='Joe' AND p.userid = f.userif AND > > 2002-p1.year BETWEEN f.minage AND f.maxage); > > > > > > > >Vernon Wu wrote: > >> > >> Ron, > >> > >> The gender is indexed. Each user has account and preference, but not necessary block. > >> > >> I am currently seeking for query optimisation, not system configuration optimisation > >> > >> 12/4/2002 9:26:48 PM, Ron Johnson wrote: > >> > >> >On Wed, 2002-12-04 at 18:26, Vernon Wu wrote: > >> >> I have the following query: > >> >> > >> >> SELECT p.userid, p.year, a.country, a.province, a.city > >> >> FROM profile p, account a > >> >> WHERE p.userid=a.userid AND > >> >> (p.year BETWEEN 1961 AND 1976) AND > >> >> a.country='CA' AND > >> >> a.province='BC' AND > >> >> p.gender='f' AND > >> >> p.userid NOT IN (SELECT b.userid FROM block b WHERE b.personid='Joe') AND > >> >> block.userid IS NOT NULL AND > >> >> p.userid IN > >> >> (SELECT f.userid FROM preference f, profile p1 WHERE p1.userid='Joe' AND 2002-p1.year BETWEEN > >> >> f.minage AND f.maxage) > >> >> > >> >> In plain English, it is that > >> >> > >> >> Joe finds females between the ages in the location who is not in the block table, while Joe's age is between what > >> they > >> >> prefer. > >> >> > >> >> The query plan is the followings: > >> >> > >> >> Nested Loop (cost=0.00..127.12 rows=995 width=894) > >> >> -> Nested Loop (cost=0.00..97.17 rows=1 width=894) > >> >> -> Seq Scan on account a (cost=0.00..25.00 rows=1 width=289) > >> >> -> Index Scan using pk_profile on profile p (cost=0.00..72.16 rows=1 width=605) > >> >> SubPlan > >> >> -> Materialize (cost=22.50..22.50 rows=5 width=55) > >> >> -> Seq Scan on block b (cost=0.00..22.50 rows=5 width=55 > >> >> ) > >> >> -> Materialize (cost=44.82..44.82 rows=111 width=89) > >> >> -> Nested Loop (cost=0.00..44.82 rows=111 width=89) > >> >> -> Index Scan using pk_profile on profile p1 (cost=0.00..4.82 rows=1 width=12) > >> >> -> Seq Scan on preference f (cost=0.00..20.00 rows=1000 width=77) > >> >> -> Seq Scan on block (cost=0.00..20.00 rows=995 width=0) > >> >> > > > >---------------------------(end of broadcast)--------------------------- > >TIP 5: Have you checked our extensive FAQ? > > > >http://www.postgresql.org/users-lounge/docs/faq.html > > From pgsql-performance-owner@postgresql.org Thu Dec 5 17:00:47 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4C6ED476C0C for ; Thu, 5 Dec 2002 17:00:45 -0500 (EST) Received: from ns1.tudelft.nl (ns1.tudelft.nl [130.161.180.1]) by postgresql.org (Postfix) with ESMTP id 34441476E67 for ; Thu, 5 Dec 2002 16:06:06 -0500 (EST) Received: from CONVERSION-DAEMON.mailhost2.tudelft.nl by mailhost2.tudelft.nl (PMDF V6.1-1 #40925) id <0H6N00201ZY4RS@mailhost2.tudelft.nl> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 22:06:07 +0100 (MET) Received: from listserv.tudelft.nl (listserv.tudelft.nl [130.161.180.33]) by mailhost2.tudelft.nl (PMDF V6.1-1 #40925) with ESMTP id <0H6N0007PZY4ND@mailhost2.tudelft.nl>; Thu, 05 Dec 2002 22:06:04 +0100 (MET) Received: from oli.tudelft.nl (oli244.rolahola.tudelft.nl [130.161.67.244]) by listserv.tudelft.nl (8.12.5/8.12.5) with ESMTP id gB5L63Fx029706; Thu, 05 Dec 2002 22:06:04 +0100 (MET) Date: Thu, 05 Dec 2002 22:06:03 +0100 From: Jochem van Dieten Subject: Re: Is a better way to have the same result of this query? In-reply-to: To: vernonw@gatewaytech.com Cc: pgsql-performance@postgresql.org Message-id: <3DEFBFBB.1060601@oli.tudelft.nl> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2) Gecko/20021126 References: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/39 X-Sequence-Number: 455 Vernon Wu wrote: > > The followings are the analyise outcomes after I did some modifications with the query. My finding is that the new query > does improve the performance according to the plan. The actual time is reversed might due to the fact the test data is > very small (the machine is a very old one by the way). The userid is the key for all tables and the gender is indexed. Do I > also index the country and province to improve the preformance? You start by using a dataset of realistic size. Sorry, but if the actual time is < 10.00 ms it is rather pointless to optimize further since chance is going to be the biggest factor. And the IN/EXISTS difference is dependent on dataset size. Jochem From pgsql-performance-owner@postgresql.org Thu Dec 5 17:21:14 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 009AD47628D for ; Thu, 5 Dec 2002 17:21:13 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id EB066477077 for ; Thu, 5 Dec 2002 16:18:07 -0500 (EST) Received: from klaster.net (pj160.krakow.cvx.ppp.tpnet.pl [217.99.210.160]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 2CFAB2B25F; Thu, 5 Dec 2002 22:03:57 +0100 (CET) Message-ID: <3DEFC2FE.2070702@klaster.net> Date: Thu, 05 Dec 2002 22:19:58 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: vernonw@gatewaytech.com Cc: pgsql-performance@postgresql.org Subject: Re: Is a better way to have the same result of this References: <5A6KF0NHNMGEJG7XRYWL1X8X8.3defbde5@kimiko> In-Reply-To: <5A6KF0NHNMGEJG7XRYWL1X8X8.3defbde5@kimiko> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/40 X-Sequence-Number: 456 Vernon Wu wrote: > Tomasz, > > I am under the impression that a primary key field is automically as a > unique index. It seems to be correct after I verify it > with the page > http://www.commandprompt.com/ppbook/index.lxp?lxpwrap=c13329%2ehtm#CREATINGANINDEX You are right. Primary key creates unique index. I use sometimes Pgadmin and it doesn't show these indexes :-( Tomasz Myrta From pgsql-performance-owner@postgresql.org Thu Dec 5 17:27:02 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C5104476D32 for ; Thu, 5 Dec 2002 17:27:00 -0500 (EST) Received: from pd3mo1so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id 4FD48476CF0 for ; Thu, 5 Dec 2002 16:23:55 -0500 (EST) Received: from pd4mr2so.prod.shaw.ca (pd4mr2so-qfe3.prod.shaw.ca [10.0.141.213]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6O009MY0RW7Z@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 14:23:56 -0700 (MST) Received: from pn2ml8so.prod.shaw.ca (pn2ml8so-qfe0.prod.shaw.ca [10.0.121.152]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6O00ALK0RWLO@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 14:23:56 -0700 (MST) Received: from kimiko (h24-78-132-76.vc.shawcable.net [24.78.132.76]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with SMTP id <0H6O00ICJ0RVZF@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 14:23:56 -0700 (MST) Date: Thu, 05 Dec 2002 13:23:16 -0800 From: Vernon Wu Subject: Re: Is a better way to have the same result of this query? In-reply-to: <3DEFBFBB.1060601@oli.tudelft.nl> To: Jochem van Dieten Cc: pgsql-performance@postgresql.org Reply-To: vernonw@gatewaytech.com Message-id: MIME-version: 1.0 X-Mailer: Opera 6.05 build 1140 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Priority: 3 (Normal) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/41 X-Sequence-Number: 457 12/5/2002 1:06:03 PM, Jochem van Dieten wrote: >You start by using a dataset of realistic size. Sorry, but if the actual >time is < 10.00 ms it is rather pointless to optimize further since >chance is going to be the biggest factor. And the IN/EXISTS difference >is dependent on dataset size. > Do you mean that using "EXIST" is not necessary out-perform using 'IN" even the "explain" say so? What is the right size for those two key words? Thanks for your very hepful information. Vernon From pgsql-performance-owner@postgresql.org Thu Dec 5 17:51:52 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 37526476116 for ; Thu, 5 Dec 2002 17:51:51 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 401D747653C for ; Thu, 5 Dec 2002 17:00:11 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB5M0Apd002708; Thu, 5 Dec 2002 17:00:10 -0500 (EST) To: "john cartmell" Cc: pgsql-performance@postgresql.org Subject: Re: ORDER BY ... LIMIT.. performance In-reply-to: <94B61ED0D8770A4A98A3DBD72DBBA1F821A80A@mediaexch01.mediaburst.co.uk> References: <94B61ED0D8770A4A98A3DBD72DBBA1F821A80A@mediaexch01.mediaburst.co.uk> Comments: In-reply-to "john cartmell" message dated "Thu, 05 Dec 2002 09:51:09 +0000" Date: Thu, 05 Dec 2002 17:00:09 -0500 Message-ID: <2707.1039125609@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/42 X-Sequence-Number: 458 "john cartmell" writes: > Without the LIMIT clause the query takes approximately 3-5 seconds to > return. > If total number of rows returned without the LIMIT clause is greater > than 20 records, then the above query also takes th same amount of time. > But if the the total number of rows is 20 or less then the time taken > for the above query to return goes up to 20-30 seconds. What does EXPLAIN (or better EXPLAIN ANALYZE) show for these various cases? Evidently the planner is shifting to a different plan because of the small LIMIT, but with no details it's hard to say anything useful. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 5 18:00:01 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2DBA5476515 for ; Thu, 5 Dec 2002 17:59:59 -0500 (EST) Received: from ns1.tudelft.nl (ns1.tudelft.nl [130.161.180.1]) by postgresql.org (Postfix) with ESMTP id E3437476861 for ; Thu, 5 Dec 2002 17:05:58 -0500 (EST) Received: from CONVERSION-DAEMON.mailhost2.tudelft.nl by mailhost2.tudelft.nl (PMDF V6.1-1 #40925) id <0H6O006012PYWF@mailhost2.tudelft.nl> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 23:06:00 +0100 (MET) Received: from listserv.tudelft.nl (listserv.tudelft.nl [130.161.180.33]) by mailhost2.tudelft.nl (PMDF V6.1-1 #40925) with ESMTP id <0H6O000GG2PYND@mailhost2.tudelft.nl>; Thu, 05 Dec 2002 23:05:58 +0100 (MET) Received: from oli.tudelft.nl (oli244.rolahola.tudelft.nl [130.161.67.244]) by listserv.tudelft.nl (8.12.5/8.12.5) with ESMTP id gB5M5vFx003374; Thu, 05 Dec 2002 23:05:58 +0100 (MET) Date: Thu, 05 Dec 2002 23:05:57 +0100 From: Jochem van Dieten Subject: Re: Is a better way to have the same result of this query? In-reply-to: To: vernonw@gatewaytech.com Cc: pgsql-performance@postgresql.org Message-id: <3DEFCDC5.9050906@oli.tudelft.nl> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2) Gecko/20021126 References: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/43 X-Sequence-Number: 459 Vernon Wu wrote: > 12/5/2002 1:06:03 PM, Jochem van Dieten wrote: > >>You start by using a dataset of realistic size. Sorry, but if the actual >>time is < 10.00 ms it is rather pointless to optimize further since >>chance is going to be the biggest factor. And the IN/EXISTS difference >>is dependent on dataset size. > > Do you mean that using "EXIST" is not necessary out-perform using 'IN" even the "explain" say so? What is the right > size for those two key words? IIRC, IN might be faster on small datasets, but EXISTS is faster on big ones. So you have to optimize with a dataset that resembles the actual dataset you will be using in production as close as possible. I don't know what the size is at which one gets faster as the other. Jochem From pgsql-performance-owner@postgresql.org Thu Dec 5 18:10:08 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4D01A476284 for ; Thu, 5 Dec 2002 18:10:02 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 15AD3476EED for ; Thu, 5 Dec 2002 17:21:39 -0500 (EST) Received: from [216.135.165.74] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.1) with HTTP id 2023168; Thu, 05 Dec 2002 14:21:18 -0800 From: "Josh Berkus" Subject: Re: ORDER BY ... LIMIT.. performance To: "john cartmell" , X-Mailer: CommuniGate Pro Web Mailer v.4.0.1 Date: Thu, 05 Dec 2002 14:21:18 -0800 Message-ID: In-Reply-To: <94B61ED0D8770A4A98A3DBD72DBBA1F821A80A@mediaexch01.mediaburst.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/44 X-Sequence-Number: 460 John, > I am not sure whether this is a know problem but we discovered this > the > other day. > We are using PostgreSQL 7.2.1 on Redhat 7.3. First of all, there are a few bug-fixes between 7.2.1 and 7.2.3. One relates to backups, and another to security. So you should upgrade to 7.2.3 immediately -- no init or restore from backup required (not version 7.3, which has some significant changes). > The table has about over a million rows (~1.4). > > The query concerned is of the form > > SELECT * > FROM tblCompany > WHERE lower(companyname) like 'company%' > ORDER BY companyname > LIMIT 20,0 > > There is a functional index lower(companyname) for the like clause. > > Without the LIMIT clause the query takes approximately 3-5 seconds to > return. > If total number of rows returned without the LIMIT clause is greater > than 20 records, then the above query also takes th same amount of > time. > But if the the total number of rows is 20 or less then the time taken > for the above query to return goes up to 20-30 seconds. Has anyone > else > come across this. We have managed to get round it by performing a > count > first and only performing the LIMIT if there are enough rows but > surely > the query should be able to do this itself! This seems very odd. Please do the following: 1) Post an EXPLAIN ANALYZE statement for the above query, with limit, that returns in 3-5 seconds. 2) Post an EXPLAIN ANALYZE for a query that returns slowly (20-30 seconds). Thanks! -Josh From pgsql-performance-owner@postgresql.org Thu Dec 5 18:23:29 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2DDB5476F37 for ; Thu, 5 Dec 2002 18:23:26 -0500 (EST) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id 18A12476B25 for ; Thu, 5 Dec 2002 17:42:58 -0500 (EST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id gB5MgnF18632; Thu, 5 Dec 2002 17:42:49 -0500 (EST) From: Bruce Momjian Message-Id: <200212052242.gB5MgnF18632@candle.pha.pa.us> Subject: Re: Filesystem optimisation for postgresql tables and WAL In-Reply-To: <200212060211.27728.mallah@trade-india.com> To: "Rajesh Kumar Mallah." Date: Thu, 5 Dec 2002 17:42:49 -0500 (EST) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/45 X-Sequence-Number: 461 I don't remember saying they should match, it is just that it is nice if it does, but I don't think it would make any major difference in performance. In fact, some use 32k pages sizes, and get a performance boost, and clearly don't have 32k file system blocks. --------------------------------------------------------------------------- Rajesh Kumar Mallah. wrote: > > Hi, > > > I have got there SCSIs HDDs for the postgresql Box > i plan to install OS on 1st , 2nd for tables and indexes and third > for pg_xlog. > > Bruce Momjian's "H/W Perf tuning" on > http://www.ca.postgresql.org/docs/momjian/hw_performance/node11.html > recommends 8k blocksize for the filesystem which is same as the page size. > > On linux ext2 fs (on my server) 4096 is the default blocak size and 8192 bytes > is not supported. > > but man mkfs.ext2 on linux mentions an option -T which is: > -T fs-type > Specify how the filesystem is going to be used, so that mke2fs can chose optimal filesystem parameters for that > use. The supported filesystem types are: > news one inode per 4kb block > largefile one inode per megabyte > largefile4 one inode per 4 megabytes > > is the above relevent as far as optimisation for filesystem for tables is concerned? > > Also for the pg_xlog drive is a particular block size more favourable then others? > > > regds > mallah. > > > > > > > -- > Rajesh Kumar Mallah, > Project Manager (Development) > Infocom Network Limited, New Delhi > phone: +91(11)6152172 (221) (L) ,9811255597 (M) > > Visit http://www.trade-india.com , > India's Leading B2B eMarketplace. > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > -- 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 Thu Dec 5 18:58:55 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 39873476176 for ; Thu, 5 Dec 2002 18:58:53 -0500 (EST) Received: from pd6mo2so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id E5E5C476978 for ; Thu, 5 Dec 2002 18:20:26 -0500 (EST) Received: from pd3mr3so.prod.shaw.ca (pd3mr3so-ser.prod.shaw.ca [10.0.141.179]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6O00EIJ65LHV@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 16:20:09 -0700 (MST) Received: from pn2ml2so.prod.shaw.ca (pn2ml2so-qfe0.prod.shaw.ca [10.0.121.146]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6O00GBW65LLJ@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 16:20:09 -0700 (MST) Received: from kimiko (h24-78-132-76.vc.shawcable.net [24.78.132.76]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with SMTP id <0H6O00MCE65KHJ@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 16:20:09 -0700 (MST) Date: Thu, 05 Dec 2002 15:19:29 -0800 From: Vernon Wu Subject: Re: Is a better way to have the same result of this In-reply-to: <20021205145750.V4800@mail.libertyrms.com> To: PgSQL Performance ML , Andrew Sullivan Reply-To: vernonw@gatewaytech.com Message-id: MIME-version: 1.0 X-Mailer: Opera 6.05 build 1140 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Priority: 3 (Normal) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/46 X-Sequence-Number: 462 Andrew, Following your suggestion, I have combined the year field with the gender to create a multicolumn index. That shall be better than indexing gender alone. I also create a multicolumn index (country, province, city) for the account table. Would you suggest indexing all possible fields such as ethnicity, religion , education, employment in the profile table; or based on what queries I run, to have some multicolumn indexes? BTW, do you get a lot of snow in Toronto these few days? Veronon 12/5/2002 11:57:50 AM, Andrew Sullivan wrote: >On Thu, Dec 05, 2002 at 11:08:17AM -0800, Vernon Wu wrote: >> Ron, >> >> The gender is indexed. > >Given that gender only has two (? Very few, anyway) values, I can't >believe an index will be much use: it's not very selective. Maybe >combining several columns in one index will help you. > >A > >-- >---- >Andrew Sullivan 204-4141 Yonge Street >Liberty RMS Toronto, Ontario Canada > M2P 2A8 > +1 416 646 3304 x110 > > >---------------------------(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 Dec 5 20:10:58 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F09EE4767B8 for ; Thu, 5 Dec 2002 20:10:54 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 871514771F5 for ; Thu, 5 Dec 2002 18:56:19 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 18K5qw-0007nq-00 for ; Thu, 05 Dec 2002 18:56:22 -0500 Date: Thu, 5 Dec 2002 18:56:22 -0500 From: Andrew Sullivan To: PgSQL Performance ML Subject: Re: Is a better way to have the same result of this Message-ID: <20021205185622.B29425@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , PgSQL Performance ML References: <3DEFBF5C.656EADA2@nsd.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3DEFBF5C.656EADA2@nsd.ca>; from jllachan@nsd.ca on Thu, Dec 05, 2002 at 04:04:28PM -0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/47 X-Sequence-Number: 463 On Thu, Dec 05, 2002 at 04:04:28PM -0500, Jean-Luc Lachance wrote: > Good for you! Too bad the parser does not know about it... LAst I heard, there was a problem about providing a rigourous mathematical proof that NOT EXISTS and NOT IN are really the same. If you can prove it, I'm sure people would be pleased. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Thu Dec 5 20:11:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0C96B476E8E for ; Thu, 5 Dec 2002 20:11:37 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 64BB0476E93 for ; Thu, 5 Dec 2002 18:58:32 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 18K5t5-0007qf-00 for ; Thu, 05 Dec 2002 18:58:35 -0500 Date: Thu, 5 Dec 2002 18:58:35 -0500 From: Andrew Sullivan To: PgSQL Performance ML Subject: Re: Is a better way to have the same result of this Message-ID: <20021205185835.C29425@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , PgSQL Performance ML References: <20021205145750.V4800@mail.libertyrms.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from vernonw@gatewaytech.com on Thu, Dec 05, 2002 at 03:19:29PM -0800 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/48 X-Sequence-Number: 464 On Thu, Dec 05, 2002 at 03:19:29PM -0800, Vernon Wu wrote: > Andrew, > > Would you suggest indexing all possible fields such as ethnicity, > religion , education, employment in the profile table; or based on > what queries I run, to have some multicolumn indexes? Never index anything more than you need. There is a fairly serious penalty at insertion time for indexes, so you can reduce some overhead that way. Note, too, that index space is not recaptured by Postgres's VACUUM, which imposes a small performance cost, but can be a real disk-gobbler if you're not careful. > BTW, do you get a lot of snow in Toronto these few days? We had some a few weeks ago. It's pretty clear right now. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Thu Dec 5 20:26:13 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 86824476082 for ; Thu, 5 Dec 2002 20:26:12 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id C4EA7476699 for ; Thu, 5 Dec 2002 19:21:18 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gB60KeHB018897; Thu, 5 Dec 2002 17:20:40 -0700 (MST) Date: Thu, 5 Dec 2002 17:18:10 -0700 (MST) From: "scott.marlowe" To: Vernon Wu Cc: PgSQL Performance ML , Andrew Sullivan Subject: Re: Is a better way to have the same result of this In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/49 X-Sequence-Number: 465 On Thu, 5 Dec 2002, Vernon Wu wrote: > Andrew, > > Following your suggestion, I have combined the year field with the gender to create a multicolumn index. That shall be > better than indexing gender alone. I also create a multicolumn index (country, province, city) for the account table. > > Would you suggest indexing all possible fields such as ethnicity, religion , education, employment in the profile table; or > based on what queries I run, to have some multicolumn indexes? > > BTW, do you get a lot of snow in Toronto these few days? Vernon, just so you know, for multi-column indexes to be useful in Postgresql, the columns need to be used in the same order they are declared in the index if you are using them for an order by. select * from table order by sex, age; could use the index create column table_sex_age on table (sex,age); but would not use the index create column table_age_sex on table (age,sex); However, the order in a where clause portion doesn't really seem to matter, so select * from table where sex='m' and age>=38 and select * from table where age>=38 and sex='m' should both be able to use the index. also, you can use functional indexes, but the arguments in the where clause need the same basic form to be useful. So, if you commonly make a select like this: select * from table where age>50 and age<=59; then you could make a functional index like : create index table_age_50_59 on table (age) where age>50 and age<=59; However, the query select * from table where age>50 and age<=58; Wouldn't use that index, since the age <= part doesn't match up. It could possible use a generic index on age though, i.e. one like create index table_age on table (age); But that index will be larger than the partial one, and so the planner may skip using it and use a seq scan instead. Hard to say until your database is populated with some representational test data. Since these indexes will be only a small fraction of the total data, it will often be advantageous to use them with a query. After you have a set of test data, then you can start looking at tuning random page cost and such to make your hardware perform properly for individual queries. Well, hope that helps. From pgsql-performance-owner@postgresql.org Thu Dec 5 20:41:53 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EFF12476D59 for ; Thu, 5 Dec 2002 20:41:50 -0500 (EST) Received: from pd6mo1so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by postgresql.org (Postfix) with ESMTP id 4D6FA476F4D for ; Thu, 5 Dec 2002 19:44:35 -0500 (EST) Received: from pd2mr2so.prod.shaw.ca (pd2mr2so-ser.prod.shaw.ca [10.0.141.109]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6O00EMPA2EQO@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 17:44:38 -0700 (MST) Received: from pn2ml10so.prod.shaw.ca (pn2ml10so-qfe0.prod.shaw.ca [10.0.121.80]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with ESMTP id <0H6O00J6PA2ETH@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 17:44:38 -0700 (MST) Received: from kimiko (h24-78-132-76.vc.shawcable.net [24.78.132.76]) by l-daemon (iPlanet Messaging Server 5.1 HotFix 0.8 (built May 12 2002)) with SMTP id <0H6O00BQ0A2CUI@l-daemon> for pgsql-performance@postgresql.org; Thu, 05 Dec 2002 17:44:38 -0700 (MST) Date: Thu, 05 Dec 2002 16:43:58 -0800 From: Vernon Wu Subject: Re: Is a better way to have the same result of this In-reply-to: To: "scott.marlowe" Cc: PgSQL Performance ML Reply-To: vernonw@gatewaytech.com Message-id: MIME-version: 1.0 X-Mailer: Opera 6.05 build 1140 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT X-Priority: 3 (Normal) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/50 X-Sequence-Number: 466 12/5/2002 4:18:10 PM, "scott.marlowe" wrote: >Vernon, just so you know, for multi-column indexes to be useful in >Postgresql, the columns need to be used in the same order they are >declared in the index if you are using them for an order by. > >select * from table order by sex, age; > >could use the index > >create column table_sex_age on table (sex,age); > >but would not use the index > >create column table_age_sex on table (age,sex); > I haven't have this case yet, might apply for some queries soon. >However, the order in a where clause portion doesn't really seem to >matter, so > >select * from table where sex='m' and age>=38 > >and > >select * from table where age>=38 and sex='m' > >should both be able to use the index. > >also, you can use functional indexes, but the arguments in the where >clause need the same basic form to be useful. So, if you commonly make a >select like this: > >select * from table where age>50 and age<=59; > >then you could make a functional index like : > >create index table_age_50_59 on table (age) where age>50 and age<=59; > >However, the query > >select * from table where age>50 and age<=58; > >Wouldn't use that index, since the age <= part doesn't match up. It could >possible use a generic index on age though, i.e. one like > >create index table_age on table (age); > I didn't know the functional index. Thanks for the eductional information. >But that index will be larger than the partial one, and so the planner may >skip using it and use a seq scan instead. Hard to say until your database >is populated with some representational test data. > >Since these indexes will be only a small fraction of the total data, it >will often be advantageous to use them with a query. > >After you have a set of test data, then you can start looking at tuning >random page cost and such to make your hardware perform properly for >individual queries. Well, hope that helps. > > I will do some fine query tuning in the final test phase. Right now, I want to make sure the table design and queries are on the right track. That indeed helps. Thanks, Vernon From pgsql-performance-owner@postgresql.org Thu Dec 5 23:14:30 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2AF6D4760D4 for ; Thu, 5 Dec 2002 23:14:29 -0500 (EST) Received: from jester.senspire.com (CPE00508b028d7d-CM00803785c5e0.cpe.net.cable.rogers.com [24.103.51.175]) by postgresql.org (Postfix) with ESMTP id 11821476161 for ; Thu, 5 Dec 2002 23:10:41 -0500 (EST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by jester.senspire.com (8.12.6/8.12.6) with ESMTP id gB64BjbQ084749 for ; Thu, 5 Dec 2002 23:11:45 -0500 (EST) (envelope-from rbt@rbt.ca) Subject: ALTER TABLE .. < ADD | DROP > OIDS From: Rod Taylor To: Pgsql Performance Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-U5J8yk+fuKbWRg+PXlC7" Organization: Message-Id: <1039147904.72042.71.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 05 Dec 2002 23:11:45 -0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/51 X-Sequence-Number: 467 --=-U5J8yk+fuKbWRg+PXlC7 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I wish to create an alter command which will allow a table to have OIDs added or removed. The tricky part appears to be changing the tuples themselves. I believe if I pull the same trick that cluster does (create new file, copy tuples, etc) it can be done fairly easily. First, set up pg_class appropriately (oid flag). Second, copy out tuples from oldfile to newfile, running a heap_deformtuple() -> heap_formtuple() process on each. Since heap_deformtuple only deals with positive numbered attributes (non-system attributes) this should be safe to do on a mis-configured relation. heap_formtuple completes the dirty work of setting up the OID column appropriately. --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-U5J8yk+fuKbWRg+PXlC7 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQA98COA6DETLow6vwwRApekAJoCuYNtAm1bfUmqNUF66ndyx4j4rQCghd6Z YLF8oi8kpxFaIUWZeVmXdhY= =6Hsp -----END PGP SIGNATURE----- --=-U5J8yk+fuKbWRg+PXlC7-- From pgsql-performance-owner@postgresql.org Fri Dec 6 00:00:26 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 115DB4763E5 for ; Fri, 6 Dec 2002 00:00:26 -0500 (EST) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id 344904763AF for ; Fri, 6 Dec 2002 00:00:19 -0500 (EST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id gB650El12702; Fri, 6 Dec 2002 00:00:14 -0500 (EST) From: Bruce Momjian Message-Id: <200212060500.gB650El12702@candle.pha.pa.us> Subject: Re: ALTER TABLE .. < ADD | DROP > OIDS In-Reply-To: <1039147904.72042.71.camel@jester> To: Rod Taylor Date: Fri, 6 Dec 2002 00:00:14 -0500 (EST) Cc: Pgsql Performance X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/52 X-Sequence-Number: 468 OK, patch applied and tested. --------------------------------------------------------------------------- Rod Taylor wrote: -- Start of PGP signed section. > I wish to create an alter command which will allow a table to have OIDs > added or removed. > > > The tricky part appears to be changing the tuples themselves. I believe > if I pull the same trick that cluster does (create new file, copy > tuples, etc) it can be done fairly easily. > > First, set up pg_class appropriately (oid flag). > > Second, copy out tuples from oldfile to newfile, running a > heap_deformtuple() -> heap_formtuple() process on each. Since > heap_deformtuple only deals with positive numbered attributes > (non-system attributes) this should be safe to do on a mis-configured > relation. heap_formtuple completes the dirty work of setting up the OID > column appropriately. > > -- > Rod Taylor > > PGP Key: http://www.rbt.ca/rbtpub.asc -- End of PGP section, PGP failed! -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Fri Dec 6 00:10:12 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B22CF476980 for ; Fri, 6 Dec 2002 00:10:11 -0500 (EST) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id 78DA34764BF for ; Fri, 6 Dec 2002 00:08:02 -0500 (EST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id gB6582a13580; Fri, 6 Dec 2002 00:08:02 -0500 (EST) From: Bruce Momjian Message-Id: <200212060508.gB6582a13580@candle.pha.pa.us> Subject: Re: ALTER TABLE .. < ADD | DROP > OIDS In-Reply-To: <200212060500.gB650El12702@candle.pha.pa.us> To: Bruce Momjian Date: Fri, 6 Dec 2002 00:08:02 -0500 (EST) Cc: Rod Taylor , Pgsql Performance X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/53 X-Sequence-Number: 469 Bruce Momjian wrote: > > OK, patch applied and tested. Sorry, wrong email. I meant to say that his previous ALTER DOMAIN patch had been applied with the new file now supplied. > > --------------------------------------------------------------------------- > > Rod Taylor wrote: > -- Start of PGP signed section. > > I wish to create an alter command which will allow a table to have OIDs > > added or removed. > > > > > > The tricky part appears to be changing the tuples themselves. I believe > > if I pull the same trick that cluster does (create new file, copy > > tuples, etc) it can be done fairly easily. > > > > First, set up pg_class appropriately (oid flag). > > > > Second, copy out tuples from oldfile to newfile, running a > > heap_deformtuple() -> heap_formtuple() process on each. Since > > heap_deformtuple only deals with positive numbered attributes > > (non-system attributes) this should be safe to do on a mis-configured > > relation. heap_formtuple completes the dirty work of setting up the OID > > column appropriately. > > > > -- > > Rod Taylor > > > > PGP Key: http://www.rbt.ca/rbtpub.asc > -- End of PGP section, PGP failed! > > -- > 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Fri Dec 6 06:33:23 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0C4E84763EA for ; Fri, 6 Dec 2002 06:33:23 -0500 (EST) Received: from mediaexch01.mediaburst.co.uk (unknown [213.130.128.235]) by postgresql.org (Postfix) with ESMTP id 4676C4763B0 for ; Fri, 6 Dec 2002 06:32:02 -0500 (EST) content-class: urn:content-classes:message Subject: Re: ORDER BY ... LIMIT.. performance MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Fri, 6 Dec 2002 11:32:04 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.4712.0 Message-ID: <94B61ED0D8770A4A98A3DBD72DBBA1F82132F4@mediaexch01.mediaburst.co.uk> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: RE: [PERFORM] ORDER BY ... LIMIT.. performance Thread-Index: AcKdGxlBaiJtI3FbQMW+89o+BxBKQw== From: "john cartmell" To: "Josh Berkus" , "Tom Lane" Cc: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/54 X-Sequence-Number: 470 > 1) Post an EXPLAIN ANALYZE statement for the above query, with limit, > that returns in 3-5 seconds. > 2) Post an EXPLAIN ANALYZE for a query that returns slowly (20-30 > seconds). The query: SELECT * FROM tblcompany WHERE lower(companyname) like 'a g m%' ORDER BY companyname; returns 20 rows. Its EXPLAIN ANALYZE is as follows: NOTICE: QUERY PLAN: Sort (cost=3D64196.18..64196.18 rows=3D6339 width=3D224) (actual time=3D2274.64..2274.66 rows=3D20 loops=3D1) -> Seq Scan on tblcompany (cost=3D0.00..63795.86 rows=3D6339 width=3D224) (actual time=3D1023.37..2274.41 rows=3D20 loops=3D1) Total runtime: 2274.78 msec When limit is 19: EXPLAIN ANALYZE SELECT * FROM tblcompany WHERE lower(companyname) like 'a g m%' ORDER BY companyname LIMIT 19,0; NOTICE: QUERY PLAN: Limit (cost=3D0.00..4621.68 rows=3D19 width=3D223) (actual time=3D561.20..563.11 rows=3D19 loops=3D1) -> Index Scan using idx_tblcompany_companyname on tblcompany (cost=3D0.00..1542006.83 rows=3D6339 width=3D223) (actual time=3D561.19..56= 3.07 rows=3D20 loops=3D1) Total runtime: 563.22 msec But when it is 20: EXPLAIN ANALYZE SELECT * FROM tblcompany WHERE lower(companyname) like 'a g m%' ORDER BY companyname LIMIT 20,0; NOTICE: QUERY PLAN: Limit (cost=3D0.00..4864.92 rows=3D20 width=3D223) (actual time=3D559.58..21895.02 rows=3D20 loops=3D1) -> Index Scan using idx_tblcompany_companyname on tblcompany (cost=3D0.00..1542006.83 rows=3D6339 width=3D223) (actual time=3D559.57..21894.97 rows=3D20 loops=3D1) Total runtime: 21895.13 msec Admitedly the query without the limit has a different query plan but the last two don't and yet vary wildly. John Cartmell From pgsql-performance-owner@postgresql.org Fri Dec 6 12:31:43 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8B13647616F for ; Fri, 6 Dec 2002 12:31:42 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 1B76D475EE2 for ; Fri, 6 Dec 2002 12:30:58 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.1) with HTTP id 2024223 for ; Fri, 06 Dec 2002 09:30:46 -0800 From: "Josh Berkus" Subject: Speeding up aggregates To: pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.4.0.1 Date: Fri, 06 Dec 2002 09:30:46 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/55 X-Sequence-Number: 471 Folks, One of Postgres' poorest performing areas is aggregates. This is the unfortunate side effect of our fully extensible aggregate and type system. However, I thought that the folks on this list might have a few tips on making aggregates perform faster. Here's mine: Aggregate Caching Table This is a brute-force approach. However, if you have a table with a million records for which users *frequently* ask for grand totals or counts, it can work fine. A simple example: Table client_case_counts ( client_id INT NOT NULL REFERENCES clients(client_id) ON DELETE CASCADE; no_cases INT NOT NULL DEFAULT 0 ); Then create triggers: Function tf_maintain_client_counts () returns opaque as ' BEGIN UPDATE client_case_counts SET no_cases = no_cases + 1 WHERE client_id = NEW.client_id; INSERT INTO client_case_counts ( client_id, no_cases ) VALUES ( NEW.client_id, 1 ) WHERE NOT EXISTS (SELECT client_id FROM client_case_counts ccc2 WHERE ccc2.client_id = NEW.client_id); RETURN NEW; END;' LANGUAGE 'plpgsql'; Trigger tg_maintain_client_counts ON INSERT INTO cases FOR EACH ROW EXECUTE tf_maintain_client_counts(); etc. While effective, this approach is costly in terms of update/insert processing. It is also limited to whatever aggregate requests you have anticipated ... it does no good for aggregates over a user-defined range. What have other Postgres users done to speed up aggregates on large tables? -Josh Berkus From pgsql-performance-owner@postgresql.org Fri Dec 6 13:13:06 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 363F8476994 for ; Fri, 6 Dec 2002 13:13:03 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id 39E464762CF for ; Fri, 6 Dec 2002 13:12:25 -0500 (EST) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1470717; Fri, 06 Dec 2002 10:52:11 -0800 Message-ID: <3DF0E825.7020400@joeconway.com> Date: Fri, 06 Dec 2002 10:10:45 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Speeding up aggregates References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/56 X-Sequence-Number: 472 Josh Berkus wrote: > While effective, this approach is costly in terms of update/insert > processing. It is also limited to whatever aggregate requests you have > anticipated ... it does no good for aggregates over a user-defined > range. I think this is where Oracle's materialized views come into play. > > What have other Postgres users done to speed up aggregates on large > tables? I've found that in most real life applications, expensive aggregate queries tend to be needed for management reporting, which does not need to be based on up-to-the-second fresh data. Normally for these types of reports a summary through say last night at midnight is perfectly adequate. The simplest solution in these cases is to build a table to hold your partially or completely summarized data, then report off of that. Use cron to refresh these summary tables at convenient times (daily, every 2 hours, or whatever). Joe From pgsql-performance-owner@postgresql.org Fri Dec 6 13:16:23 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 66A534762E3 for ; Fri, 6 Dec 2002 13:16:18 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 26978476A47; Fri, 6 Dec 2002 13:14:05 -0500 (EST) Received: by davinci.ethosmedia.com (CommuniGate Pro PIPE 4.0.1) with PIPE id 2024311; Fri, 06 Dec 2002 10:13:48 -0800 X-Spam-Status: Scanner Called Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.1) with HTTP id 2024310; Fri, 06 Dec 2002 10:13:40 -0800 From: "Josh Berkus" Subject: Re: ORDER BY ... LIMIT.. performance To: "john cartmell" , "Josh Berkus" , "Tom Lane" Cc: X-Mailer: CommuniGate Pro Web Mailer v.4.0.1 Date: Fri, 06 Dec 2002 10:13:40 -0800 Message-ID: In-Reply-To: <94B61ED0D8770A4A98A3DBD72DBBA1F82132F4@mediaexch01.mediaburst.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Spam-Status: No, hits=-3.1 required=6.0 tests=IN_REP_TO, ORDER_STATUS, AWL version=2.20 X-Spam-Level: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/57 X-Sequence-Number: 473 John, > But when it is 20: > EXPLAIN ANALYZE SELECT * FROM tblcompany WHERE > lower(companyname) like 'a g m%' ORDER BY companyname LIMIT 20,0; > NOTICE: QUERY PLAN: > > Limit (cost=0.00..4864.92 rows=20 width=223) (actual > time=559.58..21895.02 rows=20 loops=1) > -> Index Scan using idx_tblcompany_companyname on tblcompany > (cost=0.00..1542006.83 rows=6339 width=223) (actual > time=559.57..21894.97 rows=20 loops=1) > Total runtime: 21895.13 msec That's extremely odd. From the look of it, Postgres is taking an extra 18 seconds just to find that 20th row. Does this table expereince very frequent deletions and updates, or perhaps mass record replacement from a file? Try running VACUUM FULL ANALYZE, and possibly even REINDEX on idx_tblcompany_companyname. Massive numbers of dead tuples could account for this performance irregularity. -Josh From pgsql-performance-owner@postgresql.org Fri Dec 6 15:21:08 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1D117476614 for ; Fri, 6 Dec 2002 15:21:06 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id ED849476899 for ; Fri, 6 Dec 2002 15:19:03 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB6KJ4pd012610; Fri, 6 Dec 2002 15:19:04 -0500 (EST) To: Rod Taylor Cc: Pgsql Performance Subject: Re: ALTER TABLE .. < ADD | DROP > OIDS In-reply-to: <1039147904.72042.71.camel@jester> References: <1039147904.72042.71.camel@jester> Comments: In-reply-to Rod Taylor message dated "05 Dec 2002 23:11:45 -0500" Date: Fri, 06 Dec 2002 15:19:04 -0500 Message-ID: <12609.1039205944@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/58 X-Sequence-Number: 474 Rod Taylor writes: > I wish to create an alter command which will allow a table to have OIDs > added or removed. > The tricky part appears to be changing the tuples themselves. Are you sure you need to? Methinks the lazy approach of letting them auto-adjust on next UPDATE should work as well for OIDs as for user columns. There might be a few places that look at the pg_class.relhasoids field where they should be examining the tuple header has-oid bit, but I don't think there are many. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 6 15:35:48 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6F338476A38 for ; Fri, 6 Dec 2002 15:35:47 -0500 (EST) Received: from jester.senspire.com (unknown [216.208.117.7]) by postgresql.org (Postfix) with ESMTP id 4912C47616F for ; Fri, 6 Dec 2002 15:34:35 -0500 (EST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by jester.senspire.com (8.12.6/8.12.6) with ESMTP id gB6KZWeN079623; Fri, 6 Dec 2002 15:35:32 -0500 (EST) (envelope-from rbt@rbt.ca) Subject: Re: ALTER TABLE .. < ADD | DROP > OIDS From: Rod Taylor To: Tom Lane Cc: Pgsql Performance In-Reply-To: <12609.1039205944@sss.pgh.pa.us> References: <1039147904.72042.71.camel@jester> <12609.1039205944@sss.pgh.pa.us> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-WrBgibmCewsZK2AFACUq" Organization: Message-Id: <1039206932.2742.85.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 06 Dec 2002 15:35:32 -0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/59 X-Sequence-Number: 475 --=-WrBgibmCewsZK2AFACUq Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 2002-12-06 at 15:19, Tom Lane wrote: > Rod Taylor writes: > > I wish to create an alter command which will allow a table to have OIDs > > added or removed. >=20 > > The tricky part appears to be changing the tuples themselves. > There might be a few places that look at the pg_class.relhasoids > field where they should be examining the tuple header has-oid bit, > but I don't think there are many. Ok.. If you think thats safe, I'll give it a try. I was afraid that the system would confuse itself if the table had mix and matched tuples in it. New tuples without oids, old tuples with. That helps DROP OID. How about ADD OID? --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-WrBgibmCewsZK2AFACUq Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQA98QoT6DETLow6vwwRAq2uAJ989FUZKLZ4u+w28HtBVGA5GnvuqgCfff2N px0ogNUS6fGgm8nifO2tdzE= =PiyK -----END PGP SIGNATURE----- --=-WrBgibmCewsZK2AFACUq-- From pgsql-performance-owner@postgresql.org Fri Dec 6 15:50:17 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A43944769B1 for ; Fri, 6 Dec 2002 15:50:16 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 97B8C475CBC for ; Fri, 6 Dec 2002 15:46:19 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB6Kk5pd012846; Fri, 6 Dec 2002 15:46:05 -0500 (EST) To: "Josh Berkus" Cc: pgsql-performance@postgresql.org Subject: Re: Speeding up aggregates In-reply-to: References: Comments: In-reply-to "Josh Berkus" message dated "Fri, 06 Dec 2002 09:30:46 -0800" Date: Fri, 06 Dec 2002 15:46:05 -0500 Message-ID: <12845.1039207565@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/60 X-Sequence-Number: 476 "Josh Berkus" writes: > What have other Postgres users done to speed up aggregates on large > tables? FWIW, I've implemented hashed aggregation in CVS tip. I have not had the time to try to benchmark it, but I'd be interested if anyone can run some tests on 7.4devel. Eliminating the need for a SORT step should help aggregations over large datasets. Note that even though there's no SORT, the sort_mem setting is used to determine the allowable hashtable size, so a too-small sort_mem might discourage the planner from selecting hashed aggregation. Use EXPLAIN to see which query plan gets chosen. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 6 16:06:30 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 819DA4764CB for ; Fri, 6 Dec 2002 16:06:29 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id A2FC8475CE5 for ; Fri, 6 Dec 2002 16:04:59 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB6L50pd013036; Fri, 6 Dec 2002 16:05:00 -0500 (EST) To: Rod Taylor Cc: Pgsql Performance Subject: Re: ALTER TABLE .. < ADD | DROP > OIDS In-reply-to: <1039206932.2742.85.camel@jester> References: <1039147904.72042.71.camel@jester> <12609.1039205944@sss.pgh.pa.us> <1039206932.2742.85.camel@jester> Comments: In-reply-to Rod Taylor message dated "06 Dec 2002 15:35:32 -0500" Date: Fri, 06 Dec 2002 16:05:00 -0500 Message-ID: <13034.1039208700@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/61 X-Sequence-Number: 477 Rod Taylor writes: > Ok.. If you think thats safe, I'll give it a try. I was afraid that the > system would confuse itself if the table had mix and matched tuples in > it. New tuples without oids, old tuples with. Manfred's original implementation would have failed (since it didn't have a tuple-header hasoid bit). I think I got all the places that should consult the header bit, but there may be some left; you'll need to test. > That helps DROP OID. How about ADD OID? What about it? I think it'll work just like adding a column, except that OID will probably read as 0 not NULL if the row hasn't been updated yet. (You could probably make it read as NULL if you wanted though.) regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 6 16:24:17 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CC5B6476358 for ; Fri, 6 Dec 2002 16:24:16 -0500 (EST) Received: from jester.senspire.com (unknown [216.208.117.7]) by postgresql.org (Postfix) with ESMTP id ACB714764CF for ; Fri, 6 Dec 2002 16:23:03 -0500 (EST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by jester.senspire.com (8.12.6/8.12.6) with ESMTP id gB6LO0eN079726; Fri, 6 Dec 2002 16:24:00 -0500 (EST) (envelope-from rbt@rbt.ca) Subject: Re: ALTER TABLE .. < ADD | DROP > OIDS From: Rod Taylor To: Tom Lane Cc: Pgsql Performance In-Reply-To: <13034.1039208700@sss.pgh.pa.us> References: <1039147904.72042.71.camel@jester> <12609.1039205944@sss.pgh.pa.us> <1039206932.2742.85.camel@jester> <13034.1039208700@sss.pgh.pa.us> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-H82xUzXuVssYXVTNwJdE" Organization: Message-Id: <1039209840.2742.142.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 06 Dec 2002 16:24:00 -0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/62 X-Sequence-Number: 478 --=-H82xUzXuVssYXVTNwJdE Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > > That helps DROP OID. How about ADD OID? >=20 > What about it? I think it'll work just like adding a column, except > that OID will probably read as 0 not NULL if the row hasn't been updated > yet. (You could probably make it read as NULL if you wanted though.) Good point. I forgot new columns were empty by default. --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-H82xUzXuVssYXVTNwJdE Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQA98RVv6DETLow6vwwRAg/XAJ9MMd4a8HfeV6Za8FlDCAtbTTS58QCZAQTb eHGSTCaOwx8OFWomrnpd6RM= =OALq -----END PGP SIGNATURE----- --=-H82xUzXuVssYXVTNwJdE-- From pgsql-performance-owner@postgresql.org Fri Dec 6 16:29:46 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A683F47620C for ; Fri, 6 Dec 2002 16:29:45 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 715784760A9 for ; Fri, 6 Dec 2002 16:28:20 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB6LSIpd013211; Fri, 6 Dec 2002 16:28:18 -0500 (EST) To: "john cartmell" Cc: "Josh Berkus" , pgsql-performance@postgresql.org Subject: Re: ORDER BY ... LIMIT.. performance In-reply-to: <94B61ED0D8770A4A98A3DBD72DBBA1F82132F4@mediaexch01.mediaburst.co.uk> References: <94B61ED0D8770A4A98A3DBD72DBBA1F82132F4@mediaexch01.mediaburst.co.uk> Comments: In-reply-to "john cartmell" message dated "Fri, 06 Dec 2002 11:32:04 +0000" Date: Fri, 06 Dec 2002 16:28:18 -0500 Message-ID: <13210.1039210098@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/63 X-Sequence-Number: 479 "john cartmell" writes: > The query: > SELECT * FROM tblcompany WHERE lower(companyname) like 'a g m%' ORDER BY > companyname; > returns 20 rows. ^^^^^^^^^^^^^^^ Ahh, light dawns. > When limit is 19: > EXPLAIN ANALYZE SELECT * FROM tblcompany WHERE > lower(companyname) like 'a g m%' ORDER BY companyname LIMIT 19,0; > NOTICE: QUERY PLAN: > Limit (cost=0.00..4621.68 rows=19 width=223) (actual > time=561.20..563.11 rows=19 loops=1) > -> Index Scan using idx_tblcompany_companyname on tblcompany > (cost=0.00..1542006.83 rows=6339 width=223) (actual time=561.19..563.07 > rows=20 loops=1) > Total runtime: 563.22 msec > But when it is 20: > EXPLAIN ANALYZE SELECT * FROM tblcompany WHERE > lower(companyname) like 'a g m%' ORDER BY companyname LIMIT 20,0; > NOTICE: QUERY PLAN: > Limit (cost=0.00..4864.92 rows=20 width=223) (actual > time=559.58..21895.02 rows=20 loops=1) > -> Index Scan using idx_tblcompany_companyname on tblcompany > (cost=0.00..1542006.83 rows=6339 width=223) (actual > time=559.57..21894.97 rows=20 loops=1) > Total runtime: 21895.13 msec The problem here is that in current releases, the Limit plan node tries to fetch one more row than requested (you can see this in the actual rowcounts for the first example). So in your second example, the base indexscan is actually being run to completion before the Limit gives up. And since that scan is being used for ordering, not for implementing the WHERE clause, it visits all the rows. (When you leave off LIMIT, the planner chooses a plan that's more amenable to fetching all the data...) I recently revised the Limit logic so that it doesn't fetch the extra row. This takes more code, but you're not the first to complain of the old behavior. It'll be in 7.4, or if you're brave you could probably apply the diff to 7.3. In the meantime, a more appropriate query would be SELECT * FROM tblcompany WHERE lower(companyname) like 'a g m%' ORDER BY lower(companyname) LIMIT whatever so that an index on lower(companyname) could be used both for the WHERE clause and for the ordering. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 6 16:34:26 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 346134760CE for ; Fri, 6 Dec 2002 16:34:25 -0500 (EST) Received: from rh72.home.ee (adsl1030.estpak.ee [213.168.29.11]) by postgresql.org (Postfix) with ESMTP id 7CBA3476603 for ; Fri, 6 Dec 2002 16:32:32 -0500 (EST) Received: from rh72.home.ee (localhost.localdomain [127.0.0.1]) by rh72.home.ee (8.12.5/8.12.5) with ESMTP id gB6LWCum002101; Sat, 7 Dec 2002 02:32:12 +0500 Received: (from hannu@localhost) by rh72.home.ee (8.12.5/8.12.5/Submit) id gB6LW6A5002099; Sat, 7 Dec 2002 02:32:06 +0500 X-Authentication-Warning: rh72.home.ee: hannu set sender to hannu@tm.ee using -f Subject: Re: Speeding up aggregates From: Hannu Krosing To: Tom Lane Cc: Josh Berkus , pgsql-performance@postgresql.org In-Reply-To: <12845.1039207565@sss.pgh.pa.us> References: <12845.1039207565@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039210325.2069.9.camel@rh72.home.ee> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 07 Dec 2002 02:32:06 +0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/64 X-Sequence-Number: 480 Tom Lane kirjutas L, 07.12.2002 kell 01:46: > "Josh Berkus" writes: > > What have other Postgres users done to speed up aggregates on large > > tables? > > FWIW, I've implemented hashed aggregation in CVS tip. Great! This should also make it easier to implement all kinds of GROUP BY ROLLUP|CUBE|GROUPING SETS|() queries. Do you have any near-term plans for doing them ? > I have not had > the time to try to benchmark it, but I'd be interested if anyone can > run some tests on 7.4devel. Eliminating the need for a SORT step > should help aggregations over large datasets. Is there a variable to set that would disable one or another, like we currently have for disabling various join strategies ? > Note that even though there's no SORT, the sort_mem setting is used > to determine the allowable hashtable size, so a too-small sort_mem > might discourage the planner from selecting hashed aggregation. Do you mean that hashed aggregation can't overflow to disk, or would it just be too slow ? -- Hannu Krosing From pgsql-performance-owner@postgresql.org Fri Dec 6 16:43:03 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B7921476614 for ; Fri, 6 Dec 2002 16:43:01 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 93377476296 for ; Fri, 6 Dec 2002 16:42:46 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB6Lgkpd013360; Fri, 6 Dec 2002 16:42:46 -0500 (EST) To: Hannu Krosing Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Speeding up aggregates In-reply-to: <1039210325.2069.9.camel@rh72.home.ee> References: <12845.1039207565@sss.pgh.pa.us> <1039210325.2069.9.camel@rh72.home.ee> Comments: In-reply-to Hannu Krosing message dated "07 Dec 2002 02:32:06 +0500" Date: Fri, 06 Dec 2002 16:42:46 -0500 Message-ID: <13359.1039210966@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/65 X-Sequence-Number: 481 Hannu Krosing writes: > This should also make it easier to implement all kinds of GROUP BY > ROLLUP|CUBE|GROUPING SETS|() queries. > Do you have any near-term plans for doing them ? Not me. > Is there a variable to set that would disable one or another, like we > currently have for disabling various join strategies ? enable_hashagg. I didn't think about one to prevent the old style. >> Note that even though there's no SORT, the sort_mem setting is used >> to determine the allowable hashtable size, so a too-small sort_mem >> might discourage the planner from selecting hashed aggregation. > Do you mean that hashed aggregation can't overflow to disk, or would it > just be too slow ? I didn't write any code to let it overflow to disk --- didn't seem likely to be useful. (You're probably better off with a sort-based aggregation if there are too many distinct grouping keys.) regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 6 16:50:45 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1AEF847607D for ; Fri, 6 Dec 2002 16:50:45 -0500 (EST) Received: from rh72.home.ee (adsl1030.estpak.ee [213.168.29.11]) by postgresql.org (Postfix) with ESMTP id 401E0476603 for ; Fri, 6 Dec 2002 16:50:01 -0500 (EST) Received: from rh72.home.ee (localhost.localdomain [127.0.0.1]) by rh72.home.ee (8.12.5/8.12.5) with ESMTP id gB6Lnwum002271; Sat, 7 Dec 2002 02:49:59 +0500 Received: (from hannu@localhost) by rh72.home.ee (8.12.5/8.12.5/Submit) id gB6LnwCI002269; Sat, 7 Dec 2002 02:49:58 +0500 X-Authentication-Warning: rh72.home.ee: hannu set sender to hannu@tm.ee using -f Subject: Re: Speeding up aggregates From: Hannu Krosing To: Tom Lane Cc: Josh Berkus , pgsql-performance@postgresql.org In-Reply-To: <1039210325.2069.9.camel@rh72.home.ee> References: <12845.1039207565@sss.pgh.pa.us> <1039210325.2069.9.camel@rh72.home.ee> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039211397.2067.18.camel@rh72.home.ee> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 07 Dec 2002 02:49:58 +0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/66 X-Sequence-Number: 482 Hannu Krosing kirjutas L, 07.12.2002 kell 02:32: > Tom Lane kirjutas L, 07.12.2002 kell 01:46: > > "Josh Berkus" writes: > > > What have other Postgres users done to speed up aggregates on large > > > tables? > > > > FWIW, I've implemented hashed aggregation in CVS tip. > > Great! > > This should also make it easier to implement all kinds of GROUP BY > ROLLUP|CUBE|GROUPING SETS|() queries. Of these only ROLLUP can be done in one scan after sort, all others would generally require several scans without hashing. I just noticed that we don't even have a TODO for this. I think this would be a good TODO item. Bruce, could you add: * Add ROLLUP, CUBE, GROUPING SETS options to GROUP BY They are all defined in SQL99 p.79 Some more background info (from a quick Google search) a very short overview: http://www.neddo.com/dm3e/sql3&olap.html more thorough guide for DB2: http://www.student.math.uwaterloo.ca/~cs448/db2_doc/html/db2s0/frame3.htm#db2s0279 ----------------- Hannu From pgsql-performance-owner@postgresql.org Fri Dec 6 16:55:55 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B4C014760A9 for ; Fri, 6 Dec 2002 16:55:53 -0500 (EST) Received: from rh72.home.ee (adsl1030.estpak.ee [213.168.29.11]) by postgresql.org (Postfix) with ESMTP id 045234768EF for ; Fri, 6 Dec 2002 16:55:47 -0500 (EST) Received: from rh72.home.ee (localhost.localdomain [127.0.0.1]) by rh72.home.ee (8.12.5/8.12.5) with ESMTP id gB6Ltium002290; Sat, 7 Dec 2002 02:55:44 +0500 Received: (from hannu@localhost) by rh72.home.ee (8.12.5/8.12.5/Submit) id gB6LtiNK002288; Sat, 7 Dec 2002 02:55:44 +0500 X-Authentication-Warning: rh72.home.ee: hannu set sender to hannu@tm.ee using -f Subject: Re: Speeding up aggregates From: Hannu Krosing To: Tom Lane Cc: Josh Berkus , pgsql-performance@postgresql.org In-Reply-To: <13359.1039210966@sss.pgh.pa.us> References: <12845.1039207565@sss.pgh.pa.us> <1039210325.2069.9.camel@rh72.home.ee> <13359.1039210966@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039211743.2069.25.camel@rh72.home.ee> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 07 Dec 2002 02:55:44 +0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/68 X-Sequence-Number: 484 Tom Lane kirjutas L, 07.12.2002 kell 02:42: > Hannu Krosing writes: > > This should also make it easier to implement all kinds of GROUP BY > > ROLLUP|CUBE|GROUPING SETS|() queries. > > > Do you have any near-term plans for doing them ? > > Not me. I'll try to look into it then. No promises about when it will be ready ;) > > Is there a variable to set that would disable one or another, like we > > currently have for disabling various join strategies ? > > enable_hashagg. I didn't think about one to prevent the old style. > > >> Note that even though there's no SORT, the sort_mem setting is used > >> to determine the allowable hashtable size, so a too-small sort_mem > >> might discourage the planner from selecting hashed aggregation. > > > Do you mean that hashed aggregation can't overflow to disk, or would it > > just be too slow ? > > I didn't write any code to let it overflow to disk --- didn't seem > likely to be useful. (You're probably better off with a sort-based > aggregation if there are too many distinct grouping keys.) For simple GROUP BY this is most likely so, but for CUBE or GROUPING SETS it may still be faster to overflow to disk than to do N passes over data different ordering. Of course we could use a combined approach here - do it the old way (sort) for main body + run a parallel hashed aggregation for other, out of order groups. ------------ Hannu From pgsql-performance-owner@postgresql.org Fri Dec 6 16:58:55 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2F6C04760A9 for ; Fri, 6 Dec 2002 16:58:54 -0500 (EST) Received: from rh72.home.ee (adsl1030.estpak.ee [213.168.29.11]) by postgresql.org (Postfix) with ESMTP id 10311476B04 for ; Fri, 6 Dec 2002 16:57:34 -0500 (EST) Received: from rh72.home.ee (localhost.localdomain [127.0.0.1]) by rh72.home.ee (8.12.5/8.12.5) with ESMTP id gB6LvWum002305; Sat, 7 Dec 2002 02:57:32 +0500 Received: (from hannu@localhost) by rh72.home.ee (8.12.5/8.12.5/Submit) id gB6LvVVt002303; Sat, 7 Dec 2002 02:57:31 +0500 X-Authentication-Warning: rh72.home.ee: hannu set sender to hannu@tm.ee using -f Subject: Re: Speeding up aggregates From: Hannu Krosing To: Tom Lane Cc: Josh Berkus , pgsql-performance@postgresql.org In-Reply-To: <13359.1039210966@sss.pgh.pa.us> References: <12845.1039207565@sss.pgh.pa.us> <1039210325.2069.9.camel@rh72.home.ee> <13359.1039210966@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039211851.2069.27.camel@rh72.home.ee> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 07 Dec 2002 02:57:31 +0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/69 X-Sequence-Number: 485 Tom Lane kirjutas L, 07.12.2002 kell 02:42: > Hannu Krosing writes: > > Is there a variable to set that would disable one or another, like we > > currently have for disabling various join strategies ? > > enable_hashagg. I didn't think about one to prevent the old style. could be handy for testing. -- Hannu Krosing From pgsql-performance-owner@postgresql.org Fri Dec 6 16:55:24 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 283414760CE for ; Fri, 6 Dec 2002 16:55:23 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id F0184476735 for ; Fri, 6 Dec 2002 16:54:46 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2270105; Fri, 06 Dec 2002 13:54:32 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Tom Lane Subject: Re: Speeding up aggregates Date: Fri, 6 Dec 2002 13:58:02 -0800 X-Mailer: KMail [version 1.4] Cc: pgsql-performance@postgresql.org References: <12845.1039207565@sss.pgh.pa.us> In-Reply-To: <12845.1039207565@sss.pgh.pa.us> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212061358.03002.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/67 X-Sequence-Number: 483 Tom, > FWIW, I've implemented hashed aggregation in CVS tip. I have not had > the time to try to benchmark it, but I'd be interested if anyone can > run some tests on 7.4devel. Eliminating the need for a SORT step > should help aggregations over large datasets. I'd love to, but I am still too much of a tyro to build Postgres from CVS.= =20=20=20 As soon as there's a tarball of 7.4devel, I'll build it and run comparisons. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Dec 6 18:07:09 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 655DF4760A9 for ; Fri, 6 Dec 2002 18:07:08 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 9FA8C47607D for ; Fri, 6 Dec 2002 18:07:07 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB6N78pd013970; Fri, 6 Dec 2002 18:07:08 -0500 (EST) To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org Subject: Re: Speeding up aggregates In-reply-to: <200212061358.03002.josh@agliodbs.com> References: <12845.1039207565@sss.pgh.pa.us> <200212061358.03002.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Fri, 06 Dec 2002 13:58:02 -0800" Date: Fri, 06 Dec 2002 18:07:08 -0500 Message-ID: <13969.1039216028@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/70 X-Sequence-Number: 486 Josh Berkus writes: > I'd love to, but I am still too much of a tyro to build Postgres from CVS. > As soon as there's a tarball of 7.4devel, I'll build it and run comparisons. There should be a nightly snapshot tarball on the FTP server. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 6 18:33:10 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A2DA1476967 for ; Fri, 6 Dec 2002 18:33:09 -0500 (EST) Received: from office.nextbus.com (ns.nextbus.com [64.164.28.194]) by postgresql.org (Postfix) with ESMTP id 0C8F8476ABD for ; Fri, 6 Dec 2002 18:32:00 -0500 (EST) Received: from visor.corp.nextbus.com (visor.corp.nextbus.com [192.168.1.109]) by office.nextbus.com (Postfix) with ESMTP id 7DD4D4F87B for ; Fri, 6 Dec 2002 15:32:00 -0800 (PST) Received: from localhost (laurette@localhost) by visor.corp.nextbus.com (8.11.2/8.8.7) with ESMTP id gB6NW1h07899 for ; Fri, 6 Dec 2002 15:32:01 -0800 X-Authentication-Warning: visor.corp.nextbus.com: laurette owned process doing -bs Date: Fri, 6 Dec 2002 15:32:01 -0800 (PST) From: Laurette Cisneros X-X-Sender: laurette@visor.corp.nextbus.com To: pgsql-performance@postgresql.org Subject: query question Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/71 X-Sequence-Number: 487 Silly question (and just because I would like to know exactly why): This query: select distinct x, y from table1 t join table2 t2 using (col1) order by x; is *slower* than this query: select disting x, y from table1 where col1 = (select col1 from table2) ORDER BY x; Is this because in the latter case the select col1 is cached? Ooo, I would love to have a web page full of these tidbits (along with how to get around the max and min aggregates and why as an example..., etc.)! Thanks, -- Laurette Cisneros The Database Group (510) 420-3137 NextBus Information Systems, Inc. www.nextbus.com ---------------------------------- There is more to life than just SQL. From pgsql-performance-owner@postgresql.org Fri Dec 6 19:35:39 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 858E24760F8 for ; Fri, 6 Dec 2002 19:35:37 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 1A9EE47649B for ; Fri, 6 Dec 2002 19:35:01 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2270420; Fri, 06 Dec 2002 16:34:47 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Laurette Cisneros , pgsql-performance@postgresql.org Subject: Re: query question Date: Fri, 6 Dec 2002 16:38:18 -0800 X-Mailer: KMail [version 1.4] References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212061638.18529.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/72 X-Sequence-Number: 488 Laurette, > This query: > select distinct x, y=20 > from table1 t=20 > join table2 t2 > using (col1)=20 > order by x; >=20 > is *slower* than this query: >=20 > select disting x, y=20 > from table1=20 > where col1 =3D (select col1 from table2)=20 > ORDER BY x; >=20 > Is this because in the latter case the select col1 is cached? Yes. For all of the following structures: where x =3D (select col from table) where x IN (select col from table) where x NOT IN (select col from table) where x !=3D ANY(select col from table) etc., ... Postgres must process the full subquery, return the results, and compar= e=20 all of the results as individual values against the reference column.=20=20 However, if you re-wrote the query as: select distint x, y=20 from table1=20 where EXISTS (select col1 from table2 where table2.col1 =3D table1.col1) ORDER BY x; ... then Postgres would be able to use JOIN optimizations to evaluate the= =20 subquery and pull a subset of relevant records or even use an index, making= =20 the query *much* faster. > Ooo, I would love to have a web page full of these tidbits (along with ho= w=20 > to get around the max and min aggregates and why as an example..., etc.)! Um: http://techdocs.postgresql.org/guides/ Add your own Wiki page! --=20 -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco From pgsql-performance-owner@postgresql.org Fri Dec 6 20:51:27 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 66ED0475D0D for ; Fri, 6 Dec 2002 20:51:25 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id C809E475B84 for ; Fri, 6 Dec 2002 20:51:24 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2270581; Fri, 06 Dec 2002 17:51:13 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Tom Lane Subject: Re: Speeding up aggregates Date: Fri, 6 Dec 2002 17:54:43 -0800 X-Mailer: KMail [version 1.4] Cc: pgsql-performance@postgresql.org References: <200212061358.03002.josh@agliodbs.com> <13969.1039216028@sss.pgh.pa.us> In-Reply-To: <13969.1039216028@sss.pgh.pa.us> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212061754.43566.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/73 X-Sequence-Number: 489 Tom, We have a winner on simple aggregates: Version 7.2.3: explain analyze select client_id, count(*) from case_clients group by=20 client_id; NOTICE: QUERY PLAN: Aggregate (cost=3D11892.51..12435.75 rows=3D10865 width=3D4) (actual=20 time=3D1162.27..1569.40 rows=3D436 loops=3D1) -> Group (cost=3D11892.51..12164.13 rows=3D108648 width=3D4) (actual=20 time=3D1162.24..1477.70 rows=3D108648 loops=3D1) -> Sort (cost=3D11892.51..11892.51 rows=3D108648 width=3D4) (actu= al=20 time=3D1162.22..1280.64 rows=3D108648 loops=3D1) -> Seq Scan on case_clients (cost=3D0.00..2804.48 rows=3D10= 8648=20 width=3D4) (actual time=3D0.07..283.14 rows=3D108648 loops=3D1) Total runtime: 2387.87 msec Versus Version 7.4devel: explain analyze select client_id, count(*) from case_clients group by=20 client_id; QUERY PLAN ---------------------------------------------------------------------------= ---------------------------------------------- HashAggregate (cost=3D3289.72..3289.84 rows=3D46 width=3D4) (actual=20 time=3D447.80..448.71 rows=3D436 loops=3D1) -> Seq Scan on case_clients (cost=3D0.00..2746.48 rows=3D108648 width= =3D4)=20 (actual time=3D0.08..267.45 rows=3D108648 loops=3D1) Total runtime: 473.77 msec (3 rows) However, more complex queries involving aggregates seem to be unable to mak= e=20 use of the hashaggregate. I'll get back to you when I know what the=20 breakpoint is. --=20 -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco From pgsql-performance-owner@postgresql.org Fri Dec 6 21:22:19 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9E2E547603C for ; Fri, 6 Dec 2002 21:22:18 -0500 (EST) Received: from mail.digicamp.com (ns1.digicamp.com [216.38.142.76]) by postgresql.org (Postfix) with SMTP id D7F38476027 for ; Fri, 6 Dec 2002 21:22:17 -0500 (EST) Received: (qmail 15722 invoked from network); 7 Dec 2002 02:16:43 -0000 Received: from localhost (HELO digicamp.com) (127.0.0.1) by localhost with SMTP; 7 Dec 2002 02:16:43 -0000 Received: from 168.103.211.137 (SquirrelMail authenticated user fred@digicamp.com) by mail.digicamp.com with HTTP; Fri, 6 Dec 2002 18:16:43 -0800 (PST) Message-ID: <64850.168.103.211.137.1039227403.squirrel@mail.digicamp.com> Date: Fri, 6 Dec 2002 18:16:43 -0800 (PST) Subject: Query optimization From: "Fred Moyer" To: X-XheaderVersion: 1.1 X-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.1) Gecko/20021104 Chimera/0.6 X-Priority: 3 Importance: Normal Cc: Reply-To: fred@digicamp.com X-Mailer: SquirrelMail (version 1.2.8) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/74 X-Sequence-Number: 490 Greetings! I am trying to find a way to optimize this query and have hit a wall. The database size is 2.9 GB and contains 1 million records. The system is a dual xeon 1 ghz P3 with 4 GB ram, 2 of it shared memory. Redhat linux kernel 2.4.18-5 ext3fs. I'm hoping I haven't hit the limit of the hardware or os but here's all the relevant info. Questions, comments, solutions would be greatly appreciated. 11696 postgres 25 0 1084M 1.1G 562M R 99.9 28.6 2:36 postmaster Postgresql.conf settings shared_buffers = 250000 sort_mem = 1048576 # min 32 vacuum_mem = 128000 # min 1024 wal_files = 64 # range 0-64 enable_seqscan = false enable_indexscan = true enable_tidscan = true enable_sort = true enable_nestloop = true enable_mergejoin = true enable_hashjoin = true [postgres@db1 base]$ cat /proc/sys/kernel/shmmax 2192000000 database=# explain analyze SELECT active,registrant,name FROM person WHERE object.active = 1 AND object.registrant = 't' ORDER BY UPPER(object.name) DESC LIMIT 10 OFFSET 0; NOTICE: QUERY PLAN: Limit (cost=nan..nan rows=10 width=2017) (actual time=204790.82..204790.84 rows=10 loops=1) -> Sort (cost=nan..nan rows=1032953 width=2017) (actual time=204790.81..204790.82 rows=11 loops=1) -> Index Scan using registrant__object__idx on object (cost=0.00..81733.63 rows=1032953 width=2017) (actual time=0.14..94509.14 rows=1032946 loops=1) Total runtime: 205125.75 msec NOTICE: QUERY PLAN: Limit (cost=nan..nan rows=10 width=2017) (actual time=204790.82..204790.84 rows=10 loops=1) -> Sort (cost=nan..nan rows=1032953 width=2017) (actual time=204790.81..204790.82 rows=11 loops=1) -> Index Scan using registrant__object__idx on object (cost=0.00..81733.63 rows=1032953 width=2017) (actual time=0.14..94509.14 rows=1032946 loops=1) Total runtime: 205125.75 msec From pgsql-performance-owner@postgresql.org Sat Dec 7 10:48:34 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C1217475BF9 for ; Sat, 7 Dec 2002 10:48:32 -0500 (EST) Received: from lakemtao03.cox.net (lakemtao03.cox.net [68.1.17.242]) by postgresql.org (Postfix) with ESMTP id 1D8A8475AD7 for ; Sat, 7 Dec 2002 10:48:32 -0500 (EST) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao03.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021207154837.NTAC2204.lakemtao03.cox.net@[192.168.1.1]> for ; Sat, 7 Dec 2002 10:48:37 -0500 Subject: Re: Speeding up aggregates From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <12845.1039207565@sss.pgh.pa.us> References: <12845.1039207565@sss.pgh.pa.us> Content-Type: text/plain Organization: Message-Id: <1039276116.17192.4.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 07 Dec 2002 09:48:36 -0600 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/75 X-Sequence-Number: 491 On Fri, 2002-12-06 at 14:46, Tom Lane wrote: > "Josh Berkus" writes: > > What have other Postgres users done to speed up aggregates on large > > tables? > > FWIW, I've implemented hashed aggregation in CVS tip. I have not had > the time to try to benchmark it, but I'd be interested if anyone can > run some tests on 7.4devel. Eliminating the need for a SORT step > should help aggregations over large datasets. > > Note that even though there's no SORT, the sort_mem setting is used > to determine the allowable hashtable size, so a too-small sort_mem > might discourage the planner from selecting hashed aggregation. > Use EXPLAIN to see which query plan gets chosen. Hi. What exactly is "hashed aggregation"? >From Josh Berkus' email with the EXPLAIN data, it still looks like supporting indexes aren't used, so are you still scanning the table? -- +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "they love our milk and honey, but preach about another | | way of living" | | Merle Haggard, "The Fighting Side Of Me" | +------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Sat Dec 7 12:15:25 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B54B4475A71 for ; Sat, 7 Dec 2002 12:15:24 -0500 (EST) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by postgresql.org (Postfix) with ESMTP id C3907476094 for ; Sat, 7 Dec 2002 12:15:02 -0500 (EST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 18KiXj-0005qp-0U; Sat, 07 Dec 2002 17:15:07 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id A559517A86; Sat, 7 Dec 2002 17:13:09 +0000 (GMT) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 10B33179C1; Sat, 7 Dec 2002 17:13:09 +0000 (GMT) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: fred@digicamp.com, Subject: Re: Query optimization Date: Sat, 7 Dec 2002 17:13:08 +0000 User-Agent: KMail/1.4.3 Cc: References: <64850.168.103.211.137.1039227403.squirrel@mail.digicamp.com> In-Reply-To: <64850.168.103.211.137.1039227403.squirrel@mail.digicamp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212071713.09092.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/76 X-Sequence-Number: 492 On Saturday 07 Dec 2002 2:16 am, Fred Moyer wrote: > > database=3D# explain analyze SELECT active,registrant,name FROM person WH= ERE > object.active =3D 1 AND object.registrant =3D 't' ORDER BY UPPER(object.n= ame) > DESC LIMIT 10 OFFSET 0; > NOTICE: QUERY PLAN: What's the connection between "person" and "object"? Looks like an=20 unconstrained join from here. Schema and count(*) for both and details of= =20 indexes would be useful. > Limit (cost=3Dnan..nan rows=3D10 width=3D2017) (actual ^^^^^^^^ Never seen this "nan" before - presumably Not A Number, but I don't know wh= y=20 the planner generates it > time=3D204790.82..204790.84 rows=3D10 loops=3D1) > -> Sort (cost=3Dnan..nan rows=3D1032953 width=3D2017) (actual > time=3D204790.81..204790.82 rows=3D11 loops=3D1) > -> Index Scan using registrant__object__idx on object > (cost=3D0.00..81733.63 rows=3D1032953 width=3D2017) (actual > time=3D0.14..94509.14 rows=3D1032946 loops=3D1) > Total runtime: 205125.75 msec Without seeing schema details difficult to suggest much. If it's this=20 particular query that's the problem you might try a partial index CREATE INDEX foo_object_idx ON object (upper(object.name)) WHERE active=3D1= AND=20 registrant=3D't'; See CREATE INDEX in the manuals for details. --=20 Richard Huxton From pgsql-performance-owner@postgresql.org Sat Dec 7 15:16:39 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9CB6D47592C for ; Sat, 7 Dec 2002 15:16:36 -0500 (EST) Received: from mail.digicamp.com (ns1.digicamp.com [216.38.142.76]) by postgresql.org (Postfix) with SMTP id 7E36E4758F1 for ; Sat, 7 Dec 2002 15:16:35 -0500 (EST) Received: (qmail 13615 invoked from network); 7 Dec 2002 20:10:41 -0000 Received: from localhost (HELO digicamp.com) (127.0.0.1) by localhost with SMTP; 7 Dec 2002 20:10:41 -0000 Received: from 168.103.211.137 (SquirrelMail authenticated user fred@digicamp.com) by mail.digicamp.com with HTTP; Sat, 7 Dec 2002 12:10:41 -0800 (PST) Message-ID: <55900.168.103.211.137.1039291841.squirrel@mail.digicamp.com> Date: Sat, 7 Dec 2002 12:10:41 -0800 (PST) Subject: Re: Query optimization From: "Fred Moyer" To: X-XheaderVersion: 1.1 X-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.1) Gecko/20021104 Chimera/0.6 In-Reply-To: <200212071713.09092.dev@archonet.com> References: <64850.168.103.211.137.1039227403.squirrel@mail.digicamp.com> <200212071713.09092.dev@archonet.com> X-Priority: 3 Importance: Normal Cc: , Reply-To: fred@digicamp.com X-Mailer: SquirrelMail (version 1.2.8) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/77 X-Sequence-Number: 493 Ikes, they are the same, a cut and paste error. Sorry about that. No joins involved, one table with 1 million records, about 255 rows, only about 10% of the rows contain data in this particular instance. object is indexed on active, registrant, and name as well as UPPER(name). Postgres version is 7.2.3 Here is the relevant table info (some schema details omitted for brevity) id | numeric(10,0) | not null default nextval('seq_object' ::text) name | character varying(64) | registrant | boolean | active | numeric(1,0) | not null default 1 registrant__object__idx active__object__idx, name__object__idx, upper_name__object__idx, id__object__idx, Primary key: pk_object__id db=# select count(*) from count; count --------- 1032953 (1 row) db=# explain analyze select count(*) from object; NOTICE: QUERY PLAN: Aggregate (cost=100073270.91..100073270.91 rows=1 width=0) (actual time=3085.51..3085.51 rows=1 loops=1) -> Seq Scan on object (cost=100000000.00..100070688.53 rows=1032953 width=0) (actual time=0.01..2008.51 rows=1032953 loops=1) Total runtime: 3085.62 msec EXPLAIN > On Saturday 07 Dec 2002 2:16 am, Fred Moyer wrote: >> >> database=# explain analyze SELECT active,registrant,name FROM object >> WHERE object.active = 1 AND object.registrant = 't' ORDER BY >> UPPER(object.name) DESC LIMIT 10 OFFSET 0; >> NOTICE: QUERY PLAN: > > What's the connection between "person" and "object"? Looks like an > unconstrained join from here. Schema and count(*) for both and details > of indexes would be useful. > >> Limit (cost=nan..nan rows=10 width=2017) (actual > ^^^^^^^^ > Never seen this "nan" before - presumably Not A Number, but I don't know > why the planner generates it > >> time=204790.82..204790.84 rows=10 loops=1) >> -> Sort (cost=nan..nan rows=1032953 width=2017) (actual >> time=204790.81..204790.82 rows=11 loops=1) >> -> Index Scan using registrant__object__idx on object >> (cost=0.00..81733.63 rows=1032953 width=2017) (actual >> time=0.14..94509.14 rows=1032946 loops=1) >> Total runtime: 205125.75 msec > > Without seeing schema details difficult to suggest much. If it's this > particular query that's the problem you might try a partial index > > CREATE INDEX foo_object_idx ON object (upper(object.name)) WHERE > active=1 AND registrant='t'; > > See CREATE INDEX in the manuals for details. > > -- > Richard Huxton > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org Fred Moyer Digital Campaigns, Inc. From pgsql-performance-owner@postgresql.org Sat Dec 7 15:43:02 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0842A47611C for ; Sat, 7 Dec 2002 15:42:58 -0500 (EST) Received: from ns1.tudelft.nl (ns1.tudelft.nl [130.161.180.1]) by postgresql.org (Postfix) with ESMTP id E24F5475AAC for ; Sat, 7 Dec 2002 15:41:59 -0500 (EST) Received: from CONVERSION-DAEMON.mailhost2.tudelft.nl by mailhost2.tudelft.nl (PMDF V6.1-1 #40925) id <0H6R00A01O5YBN@mailhost2.tudelft.nl> for pgsql-performance@postgresql.org; Sat, 07 Dec 2002 21:42:00 +0100 (MET) Received: from listserv.tudelft.nl (listserv.tudelft.nl [130.161.180.33]) by mailhost2.tudelft.nl (PMDF V6.1-1 #40925) with ESMTP id <0H6R007AWO5Y35@mailhost2.tudelft.nl>; Sat, 07 Dec 2002 21:41:58 +0100 (MET) Received: from oli.tudelft.nl (oli244.rolahola.tudelft.nl [130.161.67.244]) by listserv.tudelft.nl (8.12.5/8.12.5) with ESMTP id gB7KfvFx009400; Sat, 07 Dec 2002 21:41:58 +0100 (MET) Date: Sat, 07 Dec 2002 21:41:57 +0100 From: Jochem van Dieten Subject: Re: Query optimization In-reply-to: <64850.168.103.211.137.1039227403.squirrel@mail.digicamp.com> To: fred@digicamp.com Cc: pgsql-performance@postgresql.org Message-id: <3DF25D15.6060006@oli.tudelft.nl> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2) Gecko/20021126 References: <64850.168.103.211.137.1039227403.squirrel@mail.digicamp.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/78 X-Sequence-Number: 494 Fred Moyer wrote: > > I am trying to find a way to optimize this query and have hit a wall. The > database size is 2.9 GB and contains 1 million records. > Postgresql.conf settings > shared_buffers = 250000 This looks awfull high to me. 25000 might be better to give more room to the OS disk-caching. Bit of a waste if PostgreSQL and the OS start caching exactly the same blocks. Trying is the only way to find a good setting. > sort_mem = 1048576 # min 32 > vacuum_mem = 128000 # min 1024 > wal_files = 64 # range 0-64 > enable_seqscan = false Why disable seqscan? For any query that is not particularly selective this will mean a performance hit. > enable_indexscan = true > enable_tidscan = true > enable_sort = true > enable_nestloop = true > enable_mergejoin = true > enable_hashjoin = true > database=# explain analyze SELECT active,registrant,name FROM person WHERE > object.active = 1 AND object.registrant = 't' ORDER BY UPPER(object.name) > DESC LIMIT 10 OFFSET 0; > NOTICE: QUERY PLAN: > > Limit (cost=nan..nan rows=10 width=2017) (actual > time=204790.82..204790.84 rows=10 loops=1) > -> Sort (cost=nan..nan rows=1032953 width=2017) (actual > time=204790.81..204790.82 rows=11 loops=1) > -> Index Scan using registrant__object__idx on object > (cost=0.00..81733.63 rows=1032953 width=2017) (actual > time=0.14..94509.14 rows=1032946 loops=1) > Total runtime: 205125.75 msec I think this is an example of a not particularly selective query. If I read it correctly, pretty much every row satisfies the predicates object.active = 1 AND object.registrant = 't' (how much do not satisfy these predicates?). Jochem From pgsql-performance-owner@postgresql.org Sun Dec 8 08:49:30 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D06CB4760E5 for ; Sun, 8 Dec 2002 08:49:27 -0500 (EST) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by postgresql.org (Postfix) with ESMTP id 12603474E61 for ; Sun, 8 Dec 2002 08:48:54 -0500 (EST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-30.mail.demon.net with esmtp (Exim 3.35 #1) id 18L1ni-0001Xd-0U; Sun, 08 Dec 2002 13:48:57 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 3D71B16ADE; Sun, 8 Dec 2002 13:48:41 +0000 (GMT) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 73C9115D69; Sun, 8 Dec 2002 13:48:40 +0000 (GMT) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: fred@digicamp.com Subject: Re: Query optimization Date: Sun, 8 Dec 2002 13:48:44 +0000 User-Agent: KMail/1.4.3 Cc: , References: <64850.168.103.211.137.1039227403.squirrel@mail.digicamp.com> <200212071713.09092.dev@archonet.com> <55900.168.103.211.137.1039291841.squirrel@mail.digicamp.com> In-Reply-To: <55900.168.103.211.137.1039291841.squirrel@mail.digicamp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212081348.44370.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/79 X-Sequence-Number: 495 On Saturday 07 Dec 2002 8:10 pm, Fred Moyer wrote: > Ikes, they are the same, a cut and paste error. Sorry about that. No > joins involved, one table with 1 million records, about 255 rows, only > about 10% of the rows contain data in this particular instance. > > object is indexed on active, registrant, and name as well as UPPER(name). > Postgres version is 7.2.3 I think Jochem's got it with "enable_seqscan" - you've disabled scans so th= e=20 planner is checking one million index entries - bad idea. Try Jochem's=20 suggestion of re-enabling seqscan and see if that helps things along. > db=3D# select count(*) from count; > count > --------- > 1032953 > >> time=3D204790.82..204790.84 rows=3D10 loops=3D1) > >> -> Sort (cost=3Dnan..nan rows=3D1032953 width=3D2017) (actual > >> time=3D204790.81..204790.82 rows=3D11 loops=3D1) > >> -> Index Scan using registrant__object__idx on object > >> (cost=3D0.00..81733.63 rows=3D1032953 width=3D2017) (actual > >> time=3D0.14..94509.14 rows=3D1032946 loops=3D1) > >> Total runtime: 205125.75 msec --=20 Richard Huxton From pgsql-performance-owner@postgresql.org Sun Dec 8 14:33:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 37968475E75 for ; Sun, 8 Dec 2002 14:33:32 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id 6B0B9475E45 for ; Sun, 8 Dec 2002 14:33:31 -0500 (EST) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1473081; Sun, 08 Dec 2002 12:13:22 -0800 Message-ID: <3DF39E2A.4010802@joeconway.com> Date: Sun, 08 Dec 2002 11:31:54 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Speeding up aggregates References: <12845.1039207565@sss.pgh.pa.us> In-Reply-To: <12845.1039207565@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/80 X-Sequence-Number: 496 Tom Lane wrote: > FWIW, I've implemented hashed aggregation in CVS tip. I have not had > the time to try to benchmark it, but I'd be interested if anyone can > run some tests on 7.4devel. Eliminating the need for a SORT step > should help aggregations over large datasets. > > Note that even though there's no SORT, the sort_mem setting is used > to determine the allowable hashtable size, so a too-small sort_mem > might discourage the planner from selecting hashed aggregation. > Use EXPLAIN to see which query plan gets chosen. > Here's some tests on a reasonable sized (and real life as opposed to contrived) dataset: parts=# set enable_hashagg to off; SET parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv i, iwhs w where i.part_id = w.part_id group by i.part_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- GroupAggregate (cost=11111.93..11744.90 rows=35528 width=36) (actual time=2799.40..3140.17 rows=34575 loops=1) -> Sort (cost=11111.93..11293.31 rows=72553 width=36) (actual time=2799.35..2896.43 rows=72548 loops=1) Sort Key: i.part_id -> Hash Join (cost=1319.10..5254.45 rows=72553 width=36) (actual time=157.72..1231.01 rows=72548 loops=1) Hash Cond: ("outer".part_id = "inner".part_id) -> Seq Scan on iwhs w (cost=0.00..2121.53 rows=72553 width=22) (actual time=0.01..286.80 rows=72553 loops=1) -> Hash (cost=1230.28..1230.28 rows=35528 width=14) (actual time=157.50..157.50 rows=0 loops=1) -> Seq Scan on inv i (cost=0.00..1230.28 rows=35528 width=14) (actual time=0.02..88.00 rows=35528 loops=1) Total runtime: 3168.73 msec (9 rows) parts=# set enable_hashagg to on; SET parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv i, iwhs w where i.part_id = w.part_id group by i.part_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=5617.22..5706.04 rows=35528 width=36) (actual time=1507.89..1608.32 rows=34575 loops=1) -> Hash Join (cost=1319.10..5254.45 rows=72553 width=36) (actual time=153.46..1231.34 rows=72548 loops=1) Hash Cond: ("outer".part_id = "inner".part_id) -> Seq Scan on iwhs w (cost=0.00..2121.53 rows=72553 width=22) (actual time=0.01..274.74 rows=72553 loops=1) -> Hash (cost=1230.28..1230.28 rows=35528 width=14) (actual time=153.21..153.21 rows=0 loops=1) -> Seq Scan on inv i (cost=0.00..1230.28 rows=35528 width=14) (actual time=0.03..84.67 rows=35528 loops=1) Total runtime: 1661.53 msec (7 rows) parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv i, iwhs w where i.part_id = w.part_id group by i.part_id having sum(w.qty_oh) > 0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- GroupAggregate (cost=11111.93..12015.10 rows=35528 width=36) (actual time=2823.65..3263.16 rows=4189 loops=1) Filter: (sum(qty_oh) > 0::double precision) -> Sort (cost=11111.93..11293.31 rows=72553 width=36) (actual time=2823.40..2926.07 rows=72548 loops=1) Sort Key: i.part_id -> Hash Join (cost=1319.10..5254.45 rows=72553 width=36) (actual time=156.39..1240.61 rows=72548 loops=1) Hash Cond: ("outer".part_id = "inner".part_id) -> Seq Scan on iwhs w (cost=0.00..2121.53 rows=72553 width=22) (actual time=0.01..290.47 rows=72553 loops=1) -> Hash (cost=1230.28..1230.28 rows=35528 width=14) (actual time=156.16..156.16 rows=0 loops=1) -> Seq Scan on inv i (cost=0.00..1230.28 rows=35528 width=14) (actual time=0.02..86.95 rows=35528 loops=1) Total runtime: 3282.27 msec (10 rows) Note that similar to Josh, I saw a nice improvement when using the HashAggregate on the simpler case, but as soon as I added a HAVING clause the optimizer switched back to GroupAggregate. I'll try to play around with this a bit more later today. Joe From pgsql-performance-owner@postgresql.org Sun Dec 8 14:39:26 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3DA90475B47 for ; Sun, 8 Dec 2002 14:39:25 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id 3008D47580B for ; Sun, 8 Dec 2002 14:39:24 -0500 (EST) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1473082; Sun, 08 Dec 2002 12:19:15 -0800 Message-ID: <3DF39F8B.4050801@joeconway.com> Date: Sun, 08 Dec 2002 11:37:47 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Speeding up aggregates References: <12845.1039207565@sss.pgh.pa.us> In-Reply-To: <12845.1039207565@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/81 X-Sequence-Number: 497 Tom Lane wrote: > Note that even though there's no SORT, the sort_mem setting is used > to determine the allowable hashtable size, so a too-small sort_mem > might discourage the planner from selecting hashed aggregation. > Use EXPLAIN to see which query plan gets chosen. > Just to follow up on my last post, I did indeed find that bumping up sort_mem caused a switch back to HashAggregate, and a big improvement: parts=# show sort_mem ; sort_mem ---------- 8192 (1 row) parts=# set sort_mem to 32000; SET parts=# show sort_mem ; sort_mem ---------- 32000 (1 row) parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv i, iwhs w where i.part_id = w.part_id group by i.part_id having sum(w.qty_oh) > 0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=5254.46..5432.10 rows=35528 width=36) (actual time=1286.89..1399.36 rows=4189 loops=1) Filter: (sum(qty_oh) > 0::double precision) -> Hash Join (cost=1319.10..4710.31 rows=72553 width=36) (actual time=163.36..947.54 rows=72548 loops=1) Hash Cond: ("outer".part_id = "inner".part_id) -> Seq Scan on iwhs w (cost=0.00..2121.53 rows=72553 width=22) (actual time=0.01..266.20 rows=72553 loops=1) -> Hash (cost=1230.28..1230.28 rows=35528 width=14) (actual time=162.70..162.70 rows=0 loops=1) -> Seq Scan on inv i (cost=0.00..1230.28 rows=35528 width=14) (actual time=0.04..88.98 rows=35528 loops=1) Total runtime: 1443.93 msec (8 rows) parts=# set sort_mem to 8192; SET parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv i, iwhs w where i.part_id = w.part_id group by i.part_id having sum(w.qty_oh) > 0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- GroupAggregate (cost=11111.93..12015.10 rows=35528 width=36) (actual time=2836.98..3261.66 rows=4189 loops=1) Filter: (sum(qty_oh) > 0::double precision) -> Sort (cost=11111.93..11293.31 rows=72553 width=36) (actual time=2836.73..2937.78 rows=72548 loops=1) Sort Key: i.part_id -> Hash Join (cost=1319.10..5254.45 rows=72553 width=36) (actual time=155.42..1258.40 rows=72548 loops=1) Hash Cond: ("outer".part_id = "inner".part_id) -> Seq Scan on iwhs w (cost=0.00..2121.53 rows=72553 width=22) (actual time=0.01..308.57 rows=72553 loops=1) -> Hash (cost=1230.28..1230.28 rows=35528 width=14) (actual time=155.19..155.19 rows=0 loops=1) -> Seq Scan on inv i (cost=0.00..1230.28 rows=35528 width=14) (actual time=0.02..86.82 rows=35528 loops=1) Total runtime: 3281.75 msec (10 rows) So when it gets used, HashAggregate has provided a factor of two improvement on this test case at least. Nice work, Tom! Joe From pgsql-performance-owner@postgresql.org Mon Dec 9 01:39:06 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EA375476422 for ; Mon, 9 Dec 2002 01:39:05 -0500 (EST) Received: from geulph.frogspace.net (geulph.frogspace.net [64.6.226.2]) by postgresql.org (Postfix) with ESMTP id 6498A4763B7 for ; Mon, 9 Dec 2002 01:38:22 -0500 (EST) Received: from [150.203.127.65] (helo=leda) by geulph.frogspace.net with smtp (Exim 3.36 #5) id 18LHYG-0003uN-00 for pgsql-performance@postgresql.org; Sun, 08 Dec 2002 22:38:00 -0800 Message-ID: <007501c29f4c$8e30f820$417fcb96@anu.edu.au> From: "Kalle Barck-Holst" To: Subject: is insertion and movement times are correlated to the size of the database? Date: Mon, 9 Dec 2002 07:30:48 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/82 X-Sequence-Number: 498 Hi I am doing a research project on real time robotics and wanted to have the = postgres as a database to save measurements we aggregate when running our r= obots. A common operation we do is insertion and movements of measurements within = tables. But it seams as if insertion and movement times are correlated to t= he size of the database. Can this be possible? IE inserting into a large da= tabase takes longer time than into a small database. I'd be grateful for comments on the reason for this. Carl Barck-Holst Carl och Josefine Barck-Holst =D6stermalms g 84 11450 Stockholm 08 6679904 Carl 070-2642506 Josefine 073-9648103 From pgsql-performance-owner@postgresql.org Mon Dec 9 03:22:25 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 822D84758DC for ; Mon, 9 Dec 2002 03:22:23 -0500 (EST) Received: from localhost.localdomain (sein.itera.ee [194.126.109.126]) by postgresql.org (Postfix) with ESMTP id 4D8B547580B for ; Mon, 9 Dec 2002 03:22:22 -0500 (EST) Received: (from hannu@localhost) by localhost.localdomain (8.11.6/8.11.6) id gB9AG2407554; Mon, 9 Dec 2002 10:16:02 GMT X-Authentication-Warning: localhost.localdomain: hannu set sender to hannu@tm.ee using -f Subject: Re: Speeding up aggregates From: Hannu Krosing To: Joe Conway Cc: Tom Lane , Josh Berkus , pgsql-performance@postgresql.org In-Reply-To: <3DF39E2A.4010802@joeconway.com> References: <12845.1039207565@sss.pgh.pa.us> <3DF39E2A.4010802@joeconway.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039428960.7415.3.camel@huli> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 09 Dec 2002 10:16:01 +0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/83 X-Sequence-Number: 499 On Sun, 2002-12-08 at 19:31, Joe Conway wrote: > parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv > i, iwhs w where i.part_id = w.part_id group by i.part_id having sum(w.qty_oh) > 0; > QUERY PLAN ... > Total runtime: 3282.27 msec > (10 rows) > > > Note that similar to Josh, I saw a nice improvement when using the > HashAggregate on the simpler case, but as soon as I added a HAVING clause the > optimizer switched back to GroupAggregate. > > I'll try to play around with this a bit more later today. Try turning the having into subquery + where: explain analyze select * from ( select i.part_id, sum(w.qty_oh) as total_oh from inv i, iwhs w where i.part_id = w.part_id group by i.part_id) sub where total_oh > 0; -- Hannu Krosing From pgsql-performance-owner@postgresql.org Mon Dec 9 06:36:10 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6DF794758DC for ; Mon, 9 Dec 2002 06:36:06 -0500 (EST) Received: from spike.esolution.pl (spike.esolution.pl [217.11.134.154]) by postgresql.org (Postfix) with ESMTP id 0393D47580B for ; Mon, 9 Dec 2002 06:35:53 -0500 (EST) Received: from pd171.warszawa.cvx.ppp.tpnet.pl ([213.76.99.171] helo=depesz.pl) by spike.esolution.pl with esmtp (Exim 4.10) id 18LMBj-0001rK-00 for pgsql-performance@postgresql.org; Mon, 09 Dec 2002 12:35:07 +0100 Received: from depesz by depesz.pl with local (Exim 3.36 #1) id 18LM9H-0000IT-00 for pgsql-performance@postgresql.org; Mon, 09 Dec 2002 12:32:31 +0100 Date: Mon, 9 Dec 2002 12:32:31 +0100 From: Hubert depesz Lubaczewski To: pgsql-performance@postgresql.org Subject: questions about disk configurations Message-ID: <20021209113231.GA1113@depesz.pl> Reply-To: depesz@depesz.pl Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.4i 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?= X-Operating-System: Linux 2.4.18 i686 Pentium_III_(Coppermine) X-Spam-Score: 0.8 (/) X-Scanner: exiscan for exim4 (http://duncanthrax.net/exiscan/) *18LMBj-0001rK-00*3Okpi7YYmwI* X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/84 X-Sequence-Number: 500 hi i have a question about best harddisk configuration for postgresql performance. of course i know that: - scsi is better than ide - 2 disks are better than 1 - 3 disks are better than 2 i know that with 3 disks one should move xlog to one drive, index files to second and tables to third. that's clear. but: will making software raid on this discs provide performance increase or decrease? which raid (0,1,5,10?) is best for postgresql? maybe it differs when it comes to different datatypes (i.e. raid "X" is best for indices, but "Y" best for tables). i'd like to know what are the options to store all this information (xlog, indices and tables). what configurations are best, what medium and what should be avoided at all cost. hope you can help me, and sorry for my english. depesz -- hubert depesz lubaczewski http://www.depesz.pl/ ------------------------------------------------------------------------ M�j Bo�e, spraw abym milcza�, dop�ki si� nie upewni�, �e naprawd� mam co� do powiedzenia. (c) 1998 depesz From pgsql-performance-owner@postgresql.org Mon Dec 9 07:02:15 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EE2964758DC for ; Mon, 9 Dec 2002 07:02:13 -0500 (EST) Received: from gluggsi.fortytwo.ch (zux006-044-193.adsl.green.ch [81.6.44.193]) by postgresql.org (Postfix) with ESMTP id A8AF647580B for ; Mon, 9 Dec 2002 07:02:12 -0500 (EST) Received: from altfrangg.fortytwo.ch (altfrangg.fortytwo.ch [192.168.1.17]) by gluggsi.fortytwo.ch (Postfix) with ESMTP id C4FDC1808 for ; Mon, 9 Dec 2002 13:01:58 +0100 (CET) Received: by altfrangg.fortytwo.ch (Postfix, from userid 1000) id 27EE814350; Mon, 9 Dec 2002 13:01:58 +0100 (CET) Subject: Re: questions about disk configurations From: Adrian 'Dagurashibanipal' von Bidder To: pgsql-performance@postgresql.org In-Reply-To: <20021209113231.GA1113@depesz.pl> References: <20021209113231.GA1113@depesz.pl> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-s1FNMu7G/AyOtw8D/8u6" Organization: Message-Id: <1039435317.819.36.camel@altfrangg.fortytwo.ch> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 09 Dec 2002 13:01:58 +0100 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/85 X-Sequence-Number: 501 --=-s1FNMu7G/AyOtw8D/8u6 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2002-12-09 at 12:32, Hubert depesz Lubaczewski wrote: > hi > i have a question about best harddisk configuration for postgresql > performance. [...] Yo! A bit more data is needed before anybody can give you more help: - what is your budget? - how big will your databases be? - what's the read/write ratio? Even then you'll not get any good recipes, because there aren't any. You'll have to do benchmarks yourself. A few fundamental things that are probably true for most: - more RAM is always good. Independent from the disc architecture - if an access isn't going to the disc at all, it's always good. (if you're mostly writing this may be lessened). - always carefully tune the postgres installation (random page cost, sort mem, shared buffers, ... - all depend on your system and you application) - as you correctly said: distribute the load on many spindles. On a busy database, 4*20G is probably faster than 1*80G beyound this, experiences vary. RAID1 and RAID5 are rated differently by different people - and especially with RAID5 there are (I think) really performance differencies between the various products. RAID0 is fastest, of course, but you probably care for your data. For equally good implementations, RAID1 and RAID5 may have similar speed, especially if the RAID controller for RAID5 has enough RAM. If the active dataset on a RAID5 is bigger than the available caching RAM, write performance sucks as a single block write requires 2 reads and 2 writes. If the RAID5 controller has enough RAM (and a decent implementation), write performance can be almost equal to RAID1 (2 writes for a single block write). So far -- vbi --=20 this email is protected by a digital signature: http://fortytwo.ch/gpg NOTE: keyserver bugs! get my key here: https://fortytwo.ch/gpg/92082481 --=-s1FNMu7G/AyOtw8D/8u6 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iHMEABECADMFAj30hjUsGmh0dHA6Ly9mb3J0eXR3by5jaC9sZWdhbC9ncGcvZW1h aWwuMjAwMjA4MjIACgkQi6Qxi+Wn99bIxwCgvZA99TfBmTA/b0urlakcM3ZUuiwA njrqjNNJuChuqyF8dv/C7J1eytgt =OL0k -----END PGP SIGNATURE----- Signature policy: http://fortytwo.ch/legal/gpg/email.20020822 --=-s1FNMu7G/AyOtw8D/8u6-- From pgsql-performance-owner@postgresql.org Mon Dec 9 08:05:01 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7C59047580B for ; Mon, 9 Dec 2002 08:04:59 -0500 (EST) Received: from jester.senspire.com (CPE00508b028d7d-CM00803785c5e0.cpe.net.cable.rogers.com [24.103.51.175]) by postgresql.org (Postfix) with ESMTP id 0508E474E5C for ; Mon, 9 Dec 2002 08:04:58 -0500 (EST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by jester.senspire.com (8.12.6/8.12.6) with ESMTP id gB9D4wTZ078244; Mon, 9 Dec 2002 08:04:58 -0500 (EST) (envelope-from rbt@rbt.ca) Subject: Re: is insertion and movement times are correlated to From: Rod Taylor To: Kalle Barck-Holst Cc: Pgsql Performance In-Reply-To: <007501c29f4c$8e30f820$417fcb96@anu.edu.au> References: <007501c29f4c$8e30f820$417fcb96@anu.edu.au> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-D/VAFAfQxXqwzZXhofAj" Organization: Message-Id: <1039439098.79804.219.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 09 Dec 2002 08:04:58 -0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/86 X-Sequence-Number: 502 --=-D/VAFAfQxXqwzZXhofAj Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2002-12-09 at 01:30, Kalle Barck-Holst wrote: > Hi >=20 > I am doing a research project on real time robotics and wanted to have th= e postgres as a database to save measurements we aggregate when running our= robots. >=20 > A common operation we do is insertion and movements of measurements withi= n tables. But it seams as if insertion and movement times are correlated to= the size of the database. Can this be possible? IE inserting into a large = database takes longer time than into a small database. If there are any indexes or constraints, then definitely. The insert really doesn't have additional overhead for the size of the DB, but the work involved for most constraints and indexes do. --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-D/VAFAfQxXqwzZXhofAj Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQA99JT56DETLow6vwwRAsjFAJ9Cod1dGZsw5TIDzidGl0lBHkCT6QCfdN3q EEnoBvd8CNP/uvaxqMTTHSM= =iLez -----END PGP SIGNATURE----- --=-D/VAFAfQxXqwzZXhofAj-- From pgsql-performance-owner@postgresql.org Mon Dec 9 14:49:32 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9F29F47636B for ; Mon, 9 Dec 2002 14:49:30 -0500 (EST) Received: from spike.esolution.pl (spike.esolution.pl [217.11.134.154]) by postgresql.org (Postfix) with ESMTP id 705764762FD for ; Mon, 9 Dec 2002 14:45:44 -0500 (EST) Received: from ql77.neoplus.adsl.tpnet.pl ([80.50.72.77] helo=depesz.pl) by spike.esolution.pl with esmtp (Exim 4.10) id 18LTqJ-0004LE-00; Mon, 09 Dec 2002 20:45:27 +0100 Received: from depesz by depesz.pl with local (Exim 3.36 #1) id 18LNb7-000195-00; Mon, 09 Dec 2002 14:05:21 +0100 Date: Mon, 9 Dec 2002 14:05:21 +0100 From: Hubert depesz Lubaczewski To: Adrian 'Dagurashibanipal' von Bidder , pgsql-performance@postgresql.org Subject: Re: questions about disk configurations Message-ID: <20021209130521.GA4372@depesz.pl> Reply-To: depesz@depesz.pl References: <20021209113231.GA1113@depesz.pl> <1039435317.819.36.camel@altfrangg.fortytwo.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1039435317.819.36.camel@altfrangg.fortytwo.ch> User-Agent: Mutt/1.4i 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?= X-Operating-System: Linux 2.4.18 i686 Pentium_III_(Coppermine) X-Spam-Score: -2.6 (--) X-Scanner: exiscan for exim4 (http://duncanthrax.net/exiscan/) *18LTqJ-0004LE-00*dKbfjFIReaA* X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/88 X-Sequence-Number: 504 On Mon, Dec 09, 2002 at 01:01:58PM +0100, Adrian 'Dagurashibanipal' von Bidder wrote: > A bit more data is needed before anybody can give you more help: > - what is your budget? > - how big will your databases be? > - what's the read/write ratio? my question as for now is purely theoretical. i'm not asking about any specific situation, but me may talk about medium sized web size. budget is irrelevant (i'd like to talk *only* about harddrives, not memory, architescure and so on). > - as you correctly said: distribute the load on many spindles. On a > busy database, 4*20G is probably faster than 1*80G as i said: i know that 3 disks are bettar than 1 (as for postgres installation, because system data and swap should be on 4th disc - but this is obvious). > beyound this, experiences vary. RAID1 and RAID5 are rated differently by > different people - and especially with RAID5 there are (I think) really > performance differencies between the various products. RAID0 is fastest, > of course, but you probably care for your data. that's exactly what i'm asking about: which raid is best suited for which data amongst out 3 sets (xlog, tables, indices). or maybe for some types of data single disc is better than raid for some strange reason? is it better to (when having 2 discs) setup raid 0/1 or to use tham separatelly as xlog/tables? depesz -- hubert depesz lubaczewski http://www.depesz.pl/ ------------------------------------------------------------------------ M�j Bo�e, spraw abym milcza�, dop�ki si� nie upewni�, �e naprawd� mam co� do powiedzenia. (c) 1998 depesz From pgsql-performance-owner@postgresql.org Mon Dec 9 13:14:03 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CD49A4763ED for ; Mon, 9 Dec 2002 13:13:59 -0500 (EST) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id 19EEC4761C4 for ; Mon, 9 Dec 2002 13:10:04 -0500 (EST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id gB9I9VK05778; Mon, 9 Dec 2002 13:09:31 -0500 (EST) From: Bruce Momjian Message-Id: <200212091809.gB9I9VK05778@candle.pha.pa.us> Subject: Re: Speeding up aggregates In-Reply-To: <1039211397.2067.18.camel@rh72.home.ee> To: Hannu Krosing Date: Mon, 9 Dec 2002 13:09:31 -0500 (EST) Cc: Tom Lane , Josh Berkus , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/87 X-Sequence-Number: 503 Added. --------------------------------------------------------------------------- Hannu Krosing wrote: > Hannu Krosing kirjutas L, 07.12.2002 kell 02:32: > > Tom Lane kirjutas L, 07.12.2002 kell 01:46: > > > "Josh Berkus" writes: > > > > What have other Postgres users done to speed up aggregates on large > > > > tables? > > > > > > FWIW, I've implemented hashed aggregation in CVS tip. > > > > Great! > > > > This should also make it easier to implement all kinds of GROUP BY > > ROLLUP|CUBE|GROUPING SETS|() queries. > > Of these only ROLLUP can be done in one scan after sort, all others > would generally require several scans without hashing. > > > I just noticed that we don't even have a TODO for this. I think this > would be a good TODO item. > > Bruce, could you add: > > * Add ROLLUP, CUBE, GROUPING SETS options to GROUP BY > > > They are all defined in SQL99 p.79 > > > Some more background info (from a quick Google search) > > a very short overview: > http://www.neddo.com/dm3e/sql3&olap.html > > > more thorough guide for DB2: > http://www.student.math.uwaterloo.ca/~cs448/db2_doc/html/db2s0/frame3.htm#db2s0279 > > > ----------------- > Hannu > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 From pgsql-performance-owner@postgresql.org Mon Dec 9 14:51:23 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8E0A347603A for ; Mon, 9 Dec 2002 14:51:22 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 31D904763B7 for ; Mon, 9 Dec 2002 14:49:35 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2273504; Mon, 09 Dec 2002 11:49:37 -0800 Content-Type: text/plain; charset="iso-8859-2" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: depesz@depesz.pl, pgsql-performance@postgresql.org Subject: Re: questions about disk configurations Date: Mon, 9 Dec 2002 11:53:03 -0800 X-Mailer: KMail [version 1.4] References: <20021209113231.GA1113@depesz.pl> In-Reply-To: <20021209113231.GA1113@depesz.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212091153.03762.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/89 X-Sequence-Number: 505 Depesz, > i have a question about best harddisk configuration for postgresql > performance. > of course i know that: > - scsi is better than ide > - 2 disks are better than 1 > - 3 disks are better than 2 >=20 > i know that with 3 disks one should move xlog to one drive, index files > to second and tables to third. > that's clear. Er, no, it's not. In fact, for a 3-disk config, I reccommend: Disk 1: OS, swap, system logs Disk 2: Data + Indexes Disk 3: Transaction Log > but: > will making software raid on this discs provide performance increase or > decrease? Hardware RAID can improve *read* performance, particilarly RAIDs 1, 01, and= =20 10. For writing, the best you can do is having it not inhibit performance.= =20=20=20 The general testament is that *software* RAID does not improve things at al= l;=20 actually, the best that can be said for Linux Software RAID 1 is that it do= es=20 not harm performance much. > i'd like to know what are the options to store all this information > (xlog, indices and tables). what configurations are best, what medium > and what should be avoided at all cost. Ask specific questions. If you want the full performance tutorial, you'd h= ave=20 to pay a steep fee for 1-3 days of training. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Dec 9 15:00:34 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A9063475E13 for ; Mon, 9 Dec 2002 15:00:32 -0500 (EST) Received: from hal.istation.com (unknown [65.120.151.132]) by postgresql.org (Postfix) with ESMTP id F1147475C22 for ; Mon, 9 Dec 2002 15:00:31 -0500 (EST) Received: from sauron (sauron.istation.com [65.120.151.174]) (authenticated) by hal.istation.com (8.11.6/8.11.6) with ESMTP id gB9K0Uv13447 for ; Mon, 9 Dec 2002 14:00:30 -0600 Reply-To: From: "Keith Bottner" To: Subject: Re: questions about disk configurations Date: Mon, 9 Dec 2002 14:00:32 -0600 Organization: istation.com Message-ID: <001c01c29fbd$a14e6520$ae977841@istation.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.3416 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 In-Reply-To: <20021209130521.GA4372@depesz.pl> Importance: Normal X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/90 X-Sequence-Number: 506 I don't know whether you have read this link but it was helpful to me. http://www.ca.postgresql.org/docs/momjian/hw_performance/0.html It discusses PostgreSQL Hardware Performance Tuning. Hope it helps! Keith Bottner -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Hubert depesz Lubaczewski Sent: Monday, December 09, 2002 7:05 AM To: Adrian 'Dagurashibanipal' von Bidder; pgsql-performance@postgresql.org Subject: Re: [PERFORM] questions about disk configurations On Mon, Dec 09, 2002 at 01:01:58PM +0100, Adrian 'Dagurashibanipal' von Bidder wrote: > A bit more data is needed before anybody can give you more help: > - what is your budget? > - how big will your databases be? > - what's the read/write ratio? my question as for now is purely theoretical. i'm not asking about any specific situation, but me may talk about medium sized web size. budget is irrelevant (i'd like to talk *only* about harddrives, not memory, architescure and so on). > - as you correctly said: distribute the load on many spindles. On a=20 > busy database, 4*20G is probably faster than 1*80G as i said: i know that 3 disks are bettar than 1 (as for postgres installation, because system data and swap should be on 4th disc - but this is obvious). > beyound this, experiences vary. RAID1 and RAID5 are rated differently=20 > by different people - and especially with RAID5 there are (I think)=20 > really performance differencies between the various products. RAID0 is > fastest, of course, but you probably care for your data. that's exactly what i'm asking about: which raid is best suited for which data amongst out 3 sets (xlog, tables, indices). or maybe for some types of data single disc is better than raid for some strange reason? is it better to (when having 2 discs) setup raid 0/1 or to use tham separatelly as xlog/tables? depesz --=20 hubert depesz lubaczewski http://www.depesz.pl/ ------------------------------------------------------------------------ M=F3j Bo=BFe, spraw abym milcza=B3, dop=F3ki si=EA nie upewni=EA, =BFe na= prawd=EA mam co=B6 do powiedzenia. (c) 1998 depesz ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From pgsql-performance-owner@postgresql.org Mon Dec 9 15:47:30 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D82E3476414 for ; Mon, 9 Dec 2002 15:47:28 -0500 (EST) Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) by postgresql.org (Postfix) with ESMTP id 89AB747640E for ; Mon, 9 Dec 2002 15:46:41 -0500 (EST) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao02.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021209204640.UQAY2203.lakemtao02.cox.net@[192.168.1.1]> for ; Mon, 9 Dec 2002 15:46:40 -0500 Subject: Re: questions about disk configurations From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <20021209130521.GA4372@depesz.pl> References: <20021209113231.GA1113@depesz.pl> <1039435317.819.36.camel@altfrangg.fortytwo.ch> <20021209130521.GA4372@depesz.pl> Content-Type: text/plain Organization: Message-Id: <1039466800.27242.51.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 09 Dec 2002 14:46:40 -0600 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/91 X-Sequence-Number: 507 On Mon, 2002-12-09 at 07:05, Hubert depesz Lubaczewski wrote: > On Mon, Dec 09, 2002 at 01:01:58PM +0100, Adrian 'Dagurashibanipal' von Bidder wrote: > > A bit more data is needed before anybody can give you more help: > > - what is your budget? > > - how big will your databases be? > > - what's the read/write ratio? > > my question as for now is purely theoretical. i'm not asking about any > specific situation, but me may talk about medium sized web size. budget > is irrelevant (i'd like to talk *only* about harddrives, not memory, > architescure and so on). What is "medium sized web"? The *system* *is* important!! Stuffing your box with RAM may, in fact, override your disks, if the RAM caches enough. > > - as you correctly said: distribute the load on many spindles. On a > > busy database, 4*20G is probably faster than 1*80G > > as i said: i know that 3 disks are bettar than 1 (as for postgres > installation, because system data and swap should be on 4th disc - but > this is obvious). > > > beyound this, experiences vary. RAID1 and RAID5 are rated differently by > > different people - and especially with RAID5 there are (I think) really > > performance differencies between the various products. RAID0 is fastest, > > of course, but you probably care for your data. > > that's exactly what i'm asking about: which raid is best suited for > which data amongst out 3 sets (xlog, tables, indices). or maybe for some > types of data single disc is better than raid for some strange reason? > is it better to (when having 2 discs) setup raid 0/1 or to use tham > separatelly as xlog/tables? These are *GENERALITIES*!!!! _All_ is dependent on which SCSI controller you choose, and how much cache it has!!!!!!!! - RAID0 does *great* at both reading and writing, but everyone knows that it is insecure. - RAID1 does better than JBOD at reading and writing, but not as good as RAID0. - RAID01 and RAID10 do just about as good as RAID0. - RAID5 does great with reads, but bad with writes, *unless* the controller has *lots* of cache. Then, write speeds are great. Slightly off topic: if I have Important Data, then I would not trust a caching controlller unless it has a battery backup. Unfortunately, the only "caching controlllers with battery backup" that I've seen are pretty expensive... -- +------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "they love our milk and honey, but preach about another | | way of living" | | Merle Haggard, "The Fighting Side Of Me" | +------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Mon Dec 9 16:12:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 31E9347650E for ; Mon, 9 Dec 2002 16:12:36 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id 5B9104764CA for ; Mon, 9 Dec 2002 16:05:54 -0500 (EST) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1474243; Mon, 09 Dec 2002 13:45:03 -0800 Message-ID: <3DF50552.8030603@joeconway.com> Date: Mon, 09 Dec 2002 13:04:18 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Hannu Krosing Cc: Tom Lane , Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Speeding up aggregates References: <12845.1039207565@sss.pgh.pa.us> <3DF39E2A.4010802@joeconway.com> <1039428960.7415.3.camel@huli> In-Reply-To: <1039428960.7415.3.camel@huli> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/92 X-Sequence-Number: 508 Hannu Krosing wrote: > On Sun, 2002-12-08 at 19:31, Joe Conway wrote: > > >>parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv >>i, iwhs w where i.part_id = w.part_id group by i.part_id having sum(w.qty_oh) > 0; >> QUERY PLAN > > ... > >> Total runtime: 3282.27 msec >>(10 rows) >> >> >>Note that similar to Josh, I saw a nice improvement when using the >>HashAggregate on the simpler case, but as soon as I added a HAVING clause the >>optimizer switched back to GroupAggregate. >> >>I'll try to play around with this a bit more later today. > > > Try turning the having into subquery + where: > > explain analyze > select * from ( > select i.part_id, sum(w.qty_oh) as total_oh > from inv i, iwhs w > where i.part_id = w.part_id > group by i.part_id) sub > where total_oh > 0; > Pretty much the same result. See below. Joe ====================================== parts=# set sort_mem to 8000; SET parts=# explain analyze select * from (select i.part_id, sum(w.qty_oh) as total_oh from inv i, iwhs w where i.part_id = w.part_id group by i.part_id) sub where total_oh > 0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- Subquery Scan sub (cost=11111.93..12015.10 rows=35528 width=36) (actual time=2779.16..3212.46 rows=4189 loops=1) -> GroupAggregate (cost=11111.93..12015.10 rows=35528 width=36) (actual time=2779.15..3202.97 rows=4189 loops=1) Filter: (sum(qty_oh) > 0::double precision) -> Sort (cost=11111.93..11293.31 rows=72553 width=36) (actual time=2778.90..2878.33 rows=72548 loops=1) Sort Key: i.part_id -> Hash Join (cost=1319.10..5254.45 rows=72553 width=36) (actual time=155.80..1235.32 rows=72548 loops=1) Hash Cond: ("outer".part_id = "inner".part_id) -> Seq Scan on iwhs w (cost=0.00..2121.53 rows=72553 width=22) (actual time=0.01..282.38 rows=72553 loops=1) -> Hash (cost=1230.28..1230.28 rows=35528 width=14) (actual time=155.56..155.56 rows=0 loops=1) -> Seq Scan on inv i (cost=0.00..1230.28 rows=35528 width=14) (actual time=0.02..86.69 rows=35528 loops=1) Total runtime: 3232.84 msec (11 rows) parts=# set sort_mem to 12000; SET parts=# explain analyze select * from (select i.part_id, sum(w.qty_oh) as total_oh from inv i, iwhs w where i.part_id = w.part_id group by i.part_id) sub where total_oh > 0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- Subquery Scan sub (cost=5617.22..5794.86 rows=35528 width=36) (actual time=1439.24..1565.47 rows=4189 loops=1) -> HashAggregate (cost=5617.22..5794.86 rows=35528 width=36) (actual time=1439.23..1555.65 rows=4189 loops=1) Filter: (sum(qty_oh) > 0::double precision) -> Hash Join (cost=1319.10..5073.07 rows=72553 width=36) (actual time=159.39..1098.30 rows=72548 loops=1) Hash Cond: ("outer".part_id = "inner".part_id) -> Seq Scan on iwhs w (cost=0.00..2121.53 rows=72553 width=22) (actual time=0.01..259.48 rows=72553 loops=1) -> Hash (cost=1230.28..1230.28 rows=35528 width=14) (actual time=159.11..159.11 rows=0 loops=1) -> Seq Scan on inv i (cost=0.00..1230.28 rows=35528 width=14) (actual time=0.03..87.74 rows=35528 loops=1) Total runtime: 1609.91 msec (9 rows) From pgsql-performance-owner@postgresql.org Mon Dec 9 16:31:10 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 588A24765EE for ; Mon, 9 Dec 2002 16:31:06 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 19CE7476409 for ; Mon, 9 Dec 2002 16:26:34 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB9LQWpd019750; Mon, 9 Dec 2002 16:26:33 -0500 (EST) To: Joe Conway Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Speeding up aggregates In-reply-to: <3DF39F8B.4050801@joeconway.com> References: <12845.1039207565@sss.pgh.pa.us> <3DF39F8B.4050801@joeconway.com> Comments: In-reply-to Joe Conway message dated "Sun, 08 Dec 2002 11:37:47 -0800" Date: Mon, 09 Dec 2002 16:26:32 -0500 Message-ID: <19749.1039469192@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/93 X-Sequence-Number: 509 Joe Conway writes: > Just to follow up on my last post, I did indeed find that bumping up sort_mem > caused a switch back to HashAggregate, and a big improvement: > parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv > i, iwhs w where i.part_id = w.part_id group by i.part_id having sum(w.qty_oh) > 0; > QUERY PLAN > ---------------------------------------------------------------------------------------------------------------------------- > HashAggregate (cost=5254.46..5432.10 rows=35528 width=36) (actual > time=1286.89..1399.36 rows=4189 loops=1) > Filter: (sum(qty_oh) > 0::double precision) > -> Hash Join (cost=1319.10..4710.31 rows=72553 width=36) (actual > time=163.36..947.54 rows=72548 loops=1) How many rows out if you drop the HAVING clause? The planner's choice of which to use is dependent on its estimate of the required hashtable size, which is proportional to its guess about how many distinct groups there will be. The above output doesn't tell us that however, only how many groups passed the HAVING clause. I'm curious about the quality of this estimate, since the code to try to generate not-completely-bogus group count estimates is all new ... regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 9 16:51:54 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1B8E04763B7 for ; Mon, 9 Dec 2002 16:51:52 -0500 (EST) Received: from l2.socialecology.com (unknown [4.42.179.131]) by postgresql.org (Postfix) with ESMTP id 3E3AD476058 for ; Mon, 9 Dec 2002 16:42:13 -0500 (EST) Received: from 4.42.179.151 (broccoli.socialecology.com [4.42.179.151]) by l2.socialecology.com (Postfix) with SMTP id 264C028E944 for ; Mon, 9 Dec 2002 13:42:08 -0800 (PST) X-Mailer: UserLand Frontier 8.0.5 (Macintosh OS) (mailServer v1.1..142) Mime-Version: 1.0 Message-Id: <88699896.1172681174@[4.42.179.151]> X-authenticated-sender: erics In-reply-to: <200212091153.03762.josh@agliodbs.com> Date: Mon, 09 Dec 2002 13:42:02 -0800 To: pgsql-performance@postgresql.org From: eric soroos Subject: Re: questions about disk configurations Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/94 X-Sequence-Number: 510 > > Er, no, it's not. In fact, for a 3-disk config, I reccommend: > > Disk 1: OS, swap, system logs > Disk 2: Data + Indexes > Disk 3: Transaction Log What is the accepted way of splitting the data from pg_xlog? I've been testing some configurations for low budget performance, and I haven't been able to make this help vs. one disk. (under osx, ymmv) I rsync'd the pg_xlog directory to another disk, then set up a symlink pointing from the data/pg_xlog to /other/disk/pg_xlog. I then got tps numbers that were 2/3 of the single ide drive speed. The only explanation I can come up with is that something is seeking to the symlink, then doing the actual write on the other drive. I'm going to try this under linux using mount points, but I need to shuffle hardware first. any ideas? eric From pgsql-performance-owner@postgresql.org Mon Dec 9 16:59:18 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 72395476454 for ; Mon, 9 Dec 2002 16:59:16 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id B822A476576 for ; Mon, 9 Dec 2002 16:49:57 -0500 (EST) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 3.5.9) with ESMTP-TLS id 1474303; Mon, 09 Dec 2002 14:29:06 -0800 Message-ID: <3DF50FA5.3090000@joeconway.com> Date: Mon, 09 Dec 2002 13:48:21 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Speeding up aggregates References: <12845.1039207565@sss.pgh.pa.us> <3DF39F8B.4050801@joeconway.com> <19749.1039469192@sss.pgh.pa.us> In-Reply-To: <19749.1039469192@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/95 X-Sequence-Number: 511 Tom Lane wrote: > Joe Conway writes: > >>Just to follow up on my last post, I did indeed find that bumping up sort_mem >>caused a switch back to HashAggregate, and a big improvement: > > >>parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv >>i, iwhs w where i.part_id = w.part_id group by i.part_id having sum(w.qty_oh) > 0; >> QUERY PLAN >>---------------------------------------------------------------------------------------------------------------------------- >> HashAggregate (cost=5254.46..5432.10 rows=35528 width=36) (actual >>time=1286.89..1399.36 rows=4189 loops=1) >> Filter: (sum(qty_oh) > 0::double precision) >> -> Hash Join (cost=1319.10..4710.31 rows=72553 width=36) (actual >>time=163.36..947.54 rows=72548 loops=1) > > > How many rows out if you drop the HAVING clause? parts=# set sort_mem to 8000; SET parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv i, iwhs w where i.part_id = w.part_id group by i.part_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=5617.22..5706.04 rows=35528 width=36) (actual time=1525.93..1627.41 rows=34575 loops=1) -> Hash Join (cost=1319.10..5254.45 rows=72553 width=36) (actual time=156.86..1248.73 rows=72548 loops=1) Hash Cond: ("outer".part_id = "inner".part_id) -> Seq Scan on iwhs w (cost=0.00..2121.53 rows=72553 width=22) (actual time=0.01..274.00 rows=72553 loops=1) -> Hash (cost=1230.28..1230.28 rows=35528 width=14) (actual time=156.65..156.65 rows=0 loops=1) -> Seq Scan on inv i (cost=0.00..1230.28 rows=35528 width=14) (actual time=0.03..86.86 rows=35528 loops=1) Total runtime: 1680.86 msec (7 rows) > The planner's choice of which to use is dependent on its estimate of the > required hashtable size, which is proportional to its guess about how > many distinct groups there will be. The above output doesn't tell us > that however, only how many groups passed the HAVING clause. I'm > curious about the quality of this estimate, since the code to try to > generate not-completely-bogus group count estimates is all new ... If I'm reading it correctly, it looks like the estimate in this case is pretty good. Joe From pgsql-performance-owner@postgresql.org Mon Dec 9 17:11:25 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4FF2347610D for ; Mon, 9 Dec 2002 17:11:23 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id EA249475A1E for ; Mon, 9 Dec 2002 17:06:54 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gB9M6opd020089; Mon, 9 Dec 2002 17:06:50 -0500 (EST) To: Joe Conway Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Speeding up aggregates In-reply-to: <3DF50FA5.3090000@joeconway.com> References: <12845.1039207565@sss.pgh.pa.us> <3DF39F8B.4050801@joeconway.com> <19749.1039469192@sss.pgh.pa.us> <3DF50FA5.3090000@joeconway.com> Comments: In-reply-to Joe Conway message dated "Mon, 09 Dec 2002 13:48:21 -0800" Date: Mon, 09 Dec 2002 17:06:50 -0500 Message-ID: <20088.1039471610@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/96 X-Sequence-Number: 512 Joe Conway writes: >> How many rows out if you drop the HAVING clause? > parts=# set sort_mem to 8000; > SET > parts=# explain analyze select i.part_id, sum(w.qty_oh) as total_oh from inv > i, iwhs w where i.part_id = w.part_id group by i.part_id; > QUERY PLAN > ---------------------------------------------------------------------------------------------------------------------------- > HashAggregate (cost=5617.22..5706.04 rows=35528 width=36) (actual > time=1525.93..1627.41 rows=34575 loops=1) > -> Hash Join (cost=1319.10..5254.45 rows=72553 width=36) (actual > time=156.86..1248.73 rows=72548 loops=1) >> The planner's choice of which to use is dependent on its estimate of the >> required hashtable size, which is proportional to its guess about how >> many distinct groups there will be. The above output doesn't tell us >> that however, only how many groups passed the HAVING clause. I'm >> curious about the quality of this estimate, since the code to try to >> generate not-completely-bogus group count estimates is all new ... > If I'm reading it correctly, it looks like the estimate in this case is pretty > good. Better than I had any right to expect ;-). Thanks. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 9 17:15:28 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B48BC476452 for ; Mon, 9 Dec 2002 17:15:26 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id E5BC54764ED for ; Mon, 9 Dec 2002 17:10:59 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2273841; Mon, 09 Dec 2002 14:11:03 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: eric soroos , pgsql-performance@postgresql.org Subject: Re: questions about disk configurations Date: Mon, 9 Dec 2002 14:14:30 -0800 X-Mailer: KMail [version 1.4] References: <88699896.1172681174@[4.42.179.151]> In-Reply-To: <88699896.1172681174@[4.42.179.151]> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212091414.30418.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/97 X-Sequence-Number: 513 Eric, > I'm going to try this under linux using mount points, but I need to shuff= le=20 hardware first.=20 This is the only way I've done it. I'm not sure what the Mac problem is. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Dec 9 17:36:43 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B7CB847666D for ; Mon, 9 Dec 2002 17:36:41 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id 26D404762F9 for ; Mon, 9 Dec 2002 17:27:30 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gB9MQ6vp005553; Mon, 9 Dec 2002 15:26:07 -0700 (MST) Date: Mon, 9 Dec 2002 15:22:11 -0700 (MST) From: "scott.marlowe" To: eric soroos Cc: Subject: Re: questions about disk configurations In-Reply-To: <88699896.1172681174@[4.42.179.151]> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/98 X-Sequence-Number: 514 On Mon, 9 Dec 2002, eric soroos wrote: > > > > Er, no, it's not. In fact, for a 3-disk config, I reccommend: > > > > Disk 1: OS, swap, system logs > > Disk 2: Data + Indexes > > Disk 3: Transaction Log > > What is the accepted way of splitting the data from pg_xlog? You really can't split it so to speak. It all needs to be in one place. Or do you mean splitting the load? Maybe putting it onto a RAID0 partition, but that's chancy. > I've been testing some configurations for low budget performance, and I > haven't been able to make this help vs. one disk. (under osx, ymmv) I haven't found anything that helps much either, except for fast drives. You can, however, turn on the noatime mounting option under Linux (BSD has something similar) and it should help speed things up on any file system. You can also try turning on the async option, but I'm not sure this is a problem or not for data integrity on a transaction log file system. Comments? > I rsync'd the pg_xlog directory to another disk, then set up a symlink > pointing from the data/pg_xlog to /other/disk/pg_xlog. > > I then got tps numbers that were 2/3 of the single ide drive speed. The > only explanation I can come up with is that something is seeking to the > symlink, then doing the actual write on the other drive. rsync isn't still running is it? you can just use the cp command while the database is shut down to move the pg_xlog dir. like so: pg_ctl stop mkdir /mnt/bigdog/pg_xlog chown postgres.postgres /mnt/bigdog/pg_xlog chmod 700 /mnt/bigdog/pg_xlog cd $PGDATA cp -Rfp pg_xlog/* /mnt/bigdog/pg_xlog/ mv pg_xlog pg_xlog.old (I always keep stuff till I'm sure I really don't need it.) ln -s /mnt/bigdog/pg_xlog pg_xlog pg_ctl start Don't forget, noatime in the mount options, makes a big difference. From pgsql-performance-owner@postgresql.org Mon Dec 9 17:59:37 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2A73D475E2B for ; Mon, 9 Dec 2002 17:59:36 -0500 (EST) Received: from l2.socialecology.com (unknown [4.42.179.131]) by postgresql.org (Postfix) with ESMTP id 00A1347661B for ; Mon, 9 Dec 2002 17:44:35 -0500 (EST) Received: from 4.42.179.151 (broccoli.socialecology.com [4.42.179.151]) by l2.socialecology.com (Postfix) with SMTP id 47CFE29068B; Mon, 9 Dec 2002 14:44:36 -0800 (PST) X-Mailer: UserLand Frontier 8.0.5 (Macintosh OS) (mailServer v1.1..142) Mime-Version: 1.0 Message-Id: <88924842.1172677425@[4.42.179.151]> X-authenticated-sender: erics In-reply-to: Date: Mon, 09 Dec 2002 14:44:31 -0800 To: scott.marlowe , eric soroos Cc: pgsql-performance@postgresql.org From: eric soroos Subject: Re: questions about disk configurations Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/99 X-Sequence-Number: 515 > > I've been testing some configurations for low budget performance, and I > > haven't been able to make this help vs. one disk. (under osx, ymmv) > > I haven't found anything that helps much either, except for fast drives. > > You can, however, turn on the noatime mounting option under Linux (BSD has > something similar) and it should help speed things up on any file system. I don't think that's an option for osx/hfs mounts, at least mount doesn't list it. (not that mount really works on 10.1.x, but whatever) > You can also try turning on the async option, but I'm not sure this is a > problem or not for data integrity on a transaction log file system. > Comments? from man mount: async All I/O to the file system should be done asynchronously. This is a dangerous flag to set, and should not be used unless you are prepared to recreate the file system should your system crash. I'd guess that this is about the same as fsync = off, except that it's your os lying to you instead of your database. > > > I rsync'd the pg_xlog directory to another disk, then set up a symlink > > pointing from the data/pg_xlog to /other/disk/pg_xlog. > > > > I then got tps numbers that were 2/3 of the single ide drive speed. The > > only explanation I can come up with is that something is seeking to the > > symlink, then doing the actual write on the other drive. > > rsync isn't still running is it? you can just use the cp command while > the database is shut down to move the pg_xlog dir. like so: rsync == copy, it's just that I remember the command line switches for it. > pg_ctl stop > mkdir /mnt/bigdog/pg_xlog > chown postgres.postgres /mnt/bigdog/pg_xlog > chmod 700 /mnt/bigdog/pg_xlog > cd $PGDATA > cp -Rfp pg_xlog/* /mnt/bigdog/pg_xlog/ > mv pg_xlog pg_xlog.old (I always keep stuff till I'm sure I really don't > need it.) > ln -s /mnt/bigdog/pg_xlog pg_xlog > pg_ctl start > This is about what I did, except that /mnt/bigdog/pg_xlog == /Volumes/scsi1. Where you can do something different is mount bigdog at data/pg_xlog, instead of using the symlinks. Given the interesting state of filesystem tools under osx, I can't really do that. (at least under 10.1.5, looks like the laptop running 10.2 has a little more info. not that the laptop has room for a 3.5" 10k rpm scsi drive & pci scsi card for testing...) eric From pgsql-performance-owner@postgresql.org Mon Dec 9 18:06:44 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 52ECC475FD9 for ; Mon, 9 Dec 2002 18:06:41 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id 35114476058 for ; Mon, 9 Dec 2002 18:06:18 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gB9N4Rvp029771; Mon, 9 Dec 2002 16:04:28 -0700 (MST) Date: Mon, 9 Dec 2002 16:00:32 -0700 (MST) From: "scott.marlowe" To: Josh Berkus Cc: , Subject: Re: questions about disk configurations In-Reply-To: <200212091153.03762.josh@agliodbs.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/100 X-Sequence-Number: 516 On Mon, 9 Dec 2002, Josh Berkus wrote: > > Depesz, > > > i have a question about best harddisk configuration for postgresql > > performance. > > of course i know that: > > - scsi is better than ide > > - 2 disks are better than 1 > > - 3 disks are better than 2 > > > > i know that with 3 disks one should move xlog to one drive, index files > > to second and tables to third. > > that's clear. > > Er, no, it's not. In fact, for a 3-disk config, I reccommend: > > Disk 1: OS, swap, system logs > Disk 2: Data + Indexes > Disk 3: Transaction Log Actually, first I'd try one big RAID 5 and see how it runs. THEN I'd spend time mucking around with different configs if that wasn't fast enough. If you need x performance and get 10x with a RAID 5 then move on to more interesting problems. > > but: > > will making software raid on this discs provide performance increase or > > decrease? > > Hardware RAID can improve *read* performance, particilarly RAIDs 1, 01, and > 10. For writing, the best you can do is having it not inhibit performance. > The general testament is that *software* RAID does not improve things at all; > actually, the best that can be said for Linux Software RAID 1 is that it does > not harm performance much. Not in my experience. I'd estimate my test box with dual 18 Gig UW scsis runs about 1.5 to 1.8 times faster with the two drives in a RAID1 as if a single one is used. Bonnie confirms this. single drive can read about 25 Megs a second, a pair in a RAID1 reads at about 48 Megs a second. But as you pointed out in your reply, it's more important to look at how he's gonna drive the database. If it has to input hundreds of short queries a second, that's a whole different problem than a data warehouse with 500 people throwing 8 way joins at the data all day. From pgsql-performance-owner@postgresql.org Mon Dec 9 18:28:12 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 87CC647662D for ; Mon, 9 Dec 2002 18:28:11 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 776D84763B8 for ; Mon, 9 Dec 2002 18:23:05 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2274028; Mon, 09 Dec 2002 15:23:09 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "scott.marlowe" Subject: Re: questions about disk configurations Date: Mon, 9 Dec 2002 15:26:36 -0800 X-Mailer: KMail [version 1.4] Cc: , References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212091526.36232.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/101 X-Sequence-Number: 517 Scott, > Actually, first I'd try one big RAID 5 and see how it runs. THEN I'd=20 > spend time mucking around with different configs if that wasn't fast=20 > enough. If you need x performance and get 10x with a RAID 5 then move on= =20 > to more interesting problems. Depends on how much time you have to spend re-installing. IMHO, RAID 5 is= =20 slower that straight disks for Postgres, especially with large numbers of= =20 writes. This may not be true for $1000 RAID controllers, but I have yet to= =20 use one. I have a box with a low-end RAID 5 controller, and it drives like a single = IDE=20 drive on large UPDATE queries. Slower, somethimes. > Not in my experience. I'd estimate my test box with dual 18 Gig UW scsis= =20 > runs about 1.5 to 1.8 times faster with the two drives in a RAID1 as if= =20 > a single one is used. Bonnie confirms this. single drive can read about= =20 > 25 Megs a second, a pair in a RAID1 reads at about 48 Megs a second. This is Linux software RAID? > But as you pointed out in your reply, it's more important to look at how= =20 > he's gonna drive the database. If it has to input hundreds of short=20 > queries a second, that's a whole different problem than a data warehouse= =20 > with 500 people throwing 8 way joins at the data all day. Definitely. --=20 -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco From pgsql-performance-owner@postgresql.org Mon Dec 9 19:19:47 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3BDF1476515 for ; Mon, 9 Dec 2002 19:19:45 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id 2002C47673E for ; Mon, 9 Dec 2002 19:11:09 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gBA0AGvp004250; Mon, 9 Dec 2002 17:10:16 -0700 (MST) Date: Mon, 9 Dec 2002 17:06:20 -0700 (MST) From: "scott.marlowe" To: Josh Berkus Cc: , Subject: Re: questions about disk configurations In-Reply-To: <200212091526.36232.josh@agliodbs.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/103 X-Sequence-Number: 519 On Mon, 9 Dec 2002, Josh Berkus wrote: > > Scott, > > > Actually, first I'd try one big RAID 5 and see how it runs. THEN I'd > > spend time mucking around with different configs if that wasn't fast > > enough. If you need x performance and get 10x with a RAID 5 then move on > > to more interesting problems. > > Depends on how much time you have to spend re-installing. IMHO, RAID 5 is > slower that straight disks for Postgres, especially with large numbers of > writes. This may not be true for $1000 RAID controllers, but I have yet to > use one. Even the fastest RAID 5 boxes aren't superfast, but a RAID5 of 15k drives with a lot of drive in it does OK, since it can 1: spread small writes around on many different drives (i.e. if you have 12 drives, and a lot of small writes, a lot of them will be on different drives.) as well as spreading out random reads, while providing good large reads, i.e. sequential scans. The key to good RAID 5 is to throw as many drives as you possibly can at a problem, preferably across several SCSI interfaces. Or FC-AL. > I have a box with a low-end RAID 5 controller, and it drives like a single IDE > drive on large UPDATE queries. Slower, somethimes. Many low end RAID 5 controllers are pretty slow. The adaptec AIC133 series (I think that's the right number) are total dogs. The older AMI Mega raids were fast for their day, but any decent 350 MHz machine with a dual channed SymBIOS card will outrun it at RAID 5. > > Not in my experience. I'd estimate my test box with dual 18 Gig UW scsis > > runs about 1.5 to 1.8 times faster with the two drives in a RAID1 as if > > a single one is used. Bonnie confirms this. single drive can read about > > 25 Megs a second, a pair in a RAID1 reads at about 48 Megs a second. > > This is Linux software RAID? Yep. The kernel level drivers are quite fast in my experience, but they don't seem to give any improvement when layered (i.e. 1+0 or 0+1) over whatever is the slowest of the two layers. I.e. setting up a RAID5 of RAID0s results in almost the exact same performance as if you'd just setup the same number of drives under RAID 5 as you had mirror sets in RAID0. Since this is the case, you get better performance just going to RAID 5 with twice the disks and twice (-1n) the space. From pgsql-performance-owner@postgresql.org Mon Dec 9 19:13:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 04E8D4762E9 for ; Mon, 9 Dec 2002 19:13:39 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id C7A25476489 for ; Mon, 9 Dec 2002 19:08:02 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBA083pd020996; Mon, 9 Dec 2002 19:08:04 -0500 (EST) To: josh@agliodbs.com Cc: eric soroos , pgsql-performance@postgresql.org Subject: Re: questions about disk configurations In-reply-to: <200212091414.30418.josh@agliodbs.com> References: <88699896.1172681174@[4.42.179.151]> <200212091414.30418.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Mon, 09 Dec 2002 14:14:30 -0800" Date: Mon, 09 Dec 2002 19:08:03 -0500 Message-ID: <20995.1039478883@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/102 X-Sequence-Number: 518 Josh Berkus writes: >> I'm going to try this under linux using mount points, but I need to shuffle > hardware first. > This is the only way I've done it. I'm not sure what the Mac problem is. It sounds like OS X fails to optimize repeated lookups of the same symlink. I haven't tried to do any performance measurement of this myself, but if true a gripe to Apple would be in order. Most of the designs I've seen for clean tablespace handling will depend on symlinks much more than we do today, so a performance penalty for symlinks will *really* hurt further down the road. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 10 11:55:29 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0D78E4764D8 for ; Tue, 10 Dec 2002 11:55:27 -0500 (EST) Received: from web80305.mail.yahoo.com (web80305.mail.yahoo.com [66.218.79.21]) by postgresql.org (Postfix) with SMTP id 49F46476485 for ; Tue, 10 Dec 2002 11:55:26 -0500 (EST) Message-ID: <20021210165531.67062.qmail@web80305.mail.yahoo.com> Received: from [203.87.150.116] by web80305.mail.yahoo.com via HTTP; Tue, 10 Dec 2002 08:55:31 PST Date: Tue, 10 Dec 2002 08:55:31 -0800 (PST) From: Ludwig Lim Subject: Performance of multi-column index on INSERT To: PostgreSQL Mailing List MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/104 X-Sequence-Number: 520 Hi: Is the performance overhead of creating a multi-column index greater than creating an individual index for each column? (i.e. Is the INSERT slower for a table with a three column index than a similar table with three single column indices?). I was wondering this because according to PostgreSQL Manual in the section on multi-columned indexes "Multicolumn indexes should be used sparingly. Most of the time, an index on a single column is sufficient and saves space and time". Thank you very much, ludwig __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com From pgsql-performance-owner@postgresql.org Tue Dec 10 15:50:24 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 67121476448 for ; Tue, 10 Dec 2002 15:50:23 -0500 (EST) Received: from rh72.home.ee (adsl1030.estpak.ee [213.168.29.11]) by postgresql.org (Postfix) with ESMTP id 6E7D3476371 for ; Tue, 10 Dec 2002 15:50:22 -0500 (EST) Received: from rh72.home.ee (localhost.localdomain [127.0.0.1]) by rh72.home.ee (8.12.5/8.12.5) with ESMTP id gBAKoN3c002086; Wed, 11 Dec 2002 01:50:23 +0500 Received: (from hannu@localhost) by rh72.home.ee (8.12.5/8.12.5/Submit) id gBAKoMZS002084; Wed, 11 Dec 2002 01:50:22 +0500 X-Authentication-Warning: rh72.home.ee: hannu set sender to hannu@tm.ee using -f Subject: Re: Performance of multi-column index on INSERT From: Hannu Krosing To: Ludwig Lim Cc: PostgreSQL Mailing List In-Reply-To: <20021210165531.67062.qmail@web80305.mail.yahoo.com> References: <20021210165531.67062.qmail@web80305.mail.yahoo.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039553422.1945.10.camel@rh72.home.ee> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 11 Dec 2002 01:50:22 +0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/105 X-Sequence-Number: 521 Ludwig Lim kirjutas T, 10.12.2002 kell 21:55: > Hi: > > Is the performance overhead of creating a > multi-column index greater than creating an individual > index for each column? (i.e. Is the INSERT slower for > a table with a three column index than a similar table > with three single column indices?). > > I was wondering this because according to > PostgreSQL Manual in the section on multi-columned > indexes "Multicolumn indexes should be used sparingly. > Most of the time, an index on a single column is > sufficient and saves space and time". You should create only as much indexes as you really need. A multi-column index can not usually replace multiple single column indexes and vice versa. For example, while an index on a,b,c can be used for search on both a and b it will not be used for search on b and c and will be used like index on a for search on a and c. While a multi-column index is slower than a single-column one, it is definitely faster than multiple single column indexes - one 3-column index should always be faster than 3 single-column indexes. Also, currently even with multiple single-column indexes on a,b and c the search on a and c will use only one index, either on a or c. > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Hannu Krosing From pgsql-performance-owner@postgresql.org Tue Dec 10 16:17:00 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 68863476921 for ; Tue, 10 Dec 2002 16:16:59 -0500 (EST) Received: from spike.esolution.pl (spike.esolution.pl [217.11.134.154]) by postgresql.org (Postfix) with ESMTP id E91634769DA for ; Tue, 10 Dec 2002 16:16:37 -0500 (EST) Received: from [80.50.72.15] (helo=depesz.pl ident=exim) by spike.esolution.pl with esmtp (Exim 4.10) id 18Lrk1-0006Pi-00 for pgsql-performance@postgresql.org; Tue, 10 Dec 2002 22:16:33 +0100 Received: from depesz by depesz.pl with local (Exim 3.36 #1) id 18LrjX-0005q7-00 for pgsql-performance@postgresql.org; Tue, 10 Dec 2002 22:16:03 +0100 Date: Tue, 10 Dec 2002 22:16:03 +0100 From: Hubert depesz Lubaczewski To: pgsql-performance@postgresql.org Subject: Re: questions about disk configurations Message-ID: <20021210211603.GA22257@depesz.pl> Reply-To: depesz@depesz.pl References: <20021209113231.GA1113@depesz.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline In-Reply-To: <20021209113231.GA1113@depesz.pl> User-Agent: Mutt/1.4i 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?= X-Operating-System: Linux 2.4.18 i686 Pentium_III_(Coppermine) X-Spam-Score: -2.9 (--) X-Scanner: exiscan for exim4 (http://duncanthrax.net/exiscan/) *18Lrk1-0006Pi-00*D8dz6WEgjiw* X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/106 X-Sequence-Number: 522 --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable i'm replying to my own letter to gather all replies in one mail. i got some replies. some of them are useful. some aren't really. i'm not really sure how the usage can modify "what is best for some part of database files". can you explain me how comes that for some uses it's best (performance-wise) to keep xlog's on straight disc, and tables on raid5 with lots' of disks, and for some other uses it's better to keep xlog on raid0 and tables on raid 10? anyway: what i understood is that usually the best (performance-wise), would be to put: xlog - separate - unraid'ed disk, or raid0 tables - any raid, but not raid 1 indices - any raid, but not raid 1 thanks for all replies. depesz --=20 hubert depesz lubaczewski http://www.depesz.pl/ ------------------------------------------------------------------------ M=F3j Bo=BFe, spraw abym milcza=B3, dop=F3ki si=EA nie upewni=EA, =BFe na= prawd=EA mam co=B6 do powiedzenia. (c) 1998 depesz --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE99lmTKBwKA0prOAkRAtIOAJ98YH1xgmVRaSMI6l/SurCjUGxXSwCfRjEj DxkNuu7oBFr7XinRz+XPxFY= =uf1p -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn-- From pgsql-performance-owner@postgresql.org Tue Dec 10 18:13:37 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 83D83476592 for ; Tue, 10 Dec 2002 18:13:35 -0500 (EST) Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) by postgresql.org (Postfix) with ESMTP id DBD15476196 for ; Tue, 10 Dec 2002 18:13:34 -0500 (EST) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao02.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021210231337.HOFM2203.lakemtao02.cox.net@[192.168.1.1]> for ; Tue, 10 Dec 2002 18:13:37 -0500 Subject: Re: questions about disk configurations From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <20021210211603.GA22257@depesz.pl> References: <20021209113231.GA1113@depesz.pl> <20021210211603.GA22257@depesz.pl> Content-Type: text/plain Organization: Message-Id: <1039562015.27243.304.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 10 Dec 2002 17:13:35 -0600 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/107 X-Sequence-Number: 523 On Tue, 2002-12-10 at 15:16, Hubert depesz Lubaczewski wrote: [snip] > anyway: what i understood is that usually the best (performance-wise), > would be to put: > xlog - separate - unraid'ed disk, or raid0 Unless your data is *easily* recreatable, NEVER RAID0!! > tables - any raid, but not raid 1 > indices - any raid, but not raid 1 Why not RAID1 (mirroring)? It speeds up both reads and writes. Things are also dependent on the RAID controller, since they all have different strengths and weaknesses. -- +---------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "My advice to you is to get married: If you find a good wife, | | you will be happy; if not, you will become a philosopher." | | Socrates | +---------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Wed Dec 11 00:20:28 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5D0D9476B96 for ; Wed, 11 Dec 2002 00:20:25 -0500 (EST) Received: from mail1.acecape.com (mail1.acecape.com [66.114.74.12]) by postgresql.org (Postfix) with ESMTP id 4703E4761E2 for ; Wed, 11 Dec 2002 00:19:39 -0500 (EST) Received: from PASCAL.kencast.com (p67-47.acedsl.com [66.114.67.47]) by mail1.acecape.com (8.12.2/8.12.2) with ESMTP id gBB5JitB025501 for ; Wed, 11 Dec 2002 00:19:44 -0500 Message-Id: <5.1.1.6.0.20021210234537.00bae260@mail.futuris.net> X-Sender: wweng@mail.futuris.net (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.1.1 Date: Wed, 11 Dec 2002 00:20:57 -0500 To: PgSQL Performance ML From: Wei Weng Subject: Which of the solution is better? In-Reply-To: <1039562015.27243.304.camel@haggis> References: <20021210211603.GA22257@depesz.pl> <20021209113231.GA1113@depesz.pl> <20021210211603.GA22257@depesz.pl> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/108 X-Sequence-Number: 524 I have two tables A and B where A is a huge table with thousands of rows, B is a small table with only a couple of entries. I want to do something like SELECT A.ID A.Name FROM A JOIN B ON (A.ID = B.ID) And on the other hand I can have something like this SELECT A.ID A.Name FROM A WHERE A.ID IN (B_Id_List) B_Id_List is a string concatenation of B.ID. (ie, 1,2,3,4,5 ...) Which one is faster, more efficient? And if you could, which one is faster/more efficient under MS SQL Server 7? I am trying to develop a cross platform query, that is why I need to concern with performance under different databases. Thanks a lot! Wei From pgsql-performance-owner@postgresql.org Wed Dec 11 00:46:04 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 01434475CED for ; Wed, 11 Dec 2002 00:46:03 -0500 (EST) Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) by postgresql.org (Postfix) with ESMTP id 6AE1E4758DC for ; Wed, 11 Dec 2002 00:46:02 -0500 (EST) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao04.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021211054607.ZLN1248.lakemtao04.cox.net@[192.168.1.1]> for ; Wed, 11 Dec 2002 00:46:07 -0500 Subject: Re: Which of the solution is better? From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <5.1.1.6.0.20021210234537.00bae260@mail.futuris.net> References: <20021210211603.GA22257@depesz.pl> <20021209113231.GA1113@depesz.pl> <20021210211603.GA22257@depesz.pl> <5.1.1.6.0.20021210234537.00bae260@mail.futuris.net> Content-Type: text/plain Organization: Message-Id: <1039585564.1265.38.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 10 Dec 2002 23:46:04 -0600 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/109 X-Sequence-Number: 525 On Tue, 2002-12-10 at 23:20, Wei Weng wrote: > I have two tables A and B where A is a huge table with thousands of rows, B > is a small table with only a couple of entries. > > I want to do something like > > SELECT > A.ID > A.Name > FROM > A JOIN B ON (A.ID = B.ID) How is this query any different from: SELECT A.ID, A.Name FROM A, B WHERE A.ID = B.ID > And on the other hand I can have something like this > > SELECT > A.ID > A.Name > FROM > A > WHERE > A.ID IN (B_Id_List) > > B_Id_List is a string concatenation of B.ID. (ie, 1,2,3,4,5 ...) > > Which one is faster, more efficient? > > And if you could, which one is faster/more efficient under MS SQL Server 7? > I am trying to develop a cross platform query, that is why I need to > concern with performance under different databases. -- +---------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "My advice to you is to get married: If you find a good wife, | | you will be happy; if not, you will become a philosopher." | | Socrates | +---------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Wed Dec 11 10:48:25 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3BB0A4761E9 for ; Wed, 11 Dec 2002 10:48:24 -0500 (EST) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id 997C9476117 for ; Wed, 11 Dec 2002 10:48:23 -0500 (EST) Received: from andrew by mail.libertyrms.com with local (Exim 3.22 #3 (Debian)) id 18M964-0001av-00 for ; Wed, 11 Dec 2002 10:48:28 -0500 Date: Wed, 11 Dec 2002 10:48:28 -0500 From: Andrew Sullivan To: PgSQL Performance ML Subject: Re: Which of the solution is better? Message-ID: <20021211104828.F31768@mail.libertyrms.com> Mail-Followup-To: Andrew Sullivan , PgSQL Performance ML References: <20021210211603.GA22257@depesz.pl> <20021209113231.GA1113@depesz.pl> <20021210211603.GA22257@depesz.pl> <5.1.1.6.0.20021210234537.00bae260@mail.futuris.net> <1039585564.1265.38.camel@haggis> <1039623980.17037.3.camel@Monet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <1039623980.17037.3.camel@Monet>; from wweng@kencast.com on Wed, Dec 11, 2002 at 11:26:20AM -0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/111 X-Sequence-Number: 527 On Wed, Dec 11, 2002 at 11:26:20AM -0500, Wei Weng wrote: > I don't think there is any. It is just another way to write an outer > join. That's not exactly true. Doing A JOIN B ON (A.ID=B.ID) constrains the planner. See the section on explicit join order in the PostgreSQL manual. The IN locution, by the way, is almost always bad in Postgres. Avoid it. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Wed Dec 11 10:28:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B4F9B47690C for ; Wed, 11 Dec 2002 10:28:38 -0500 (EST) Received: from mta5.snet.net (mta5.snet.net [204.60.203.77]) by postgresql.org (Postfix) with ESMTP id 10E46476AEF for ; Wed, 11 Dec 2002 10:26:27 -0500 (EST) Received: from pop.snet.net (pop.snet.net [204.60.203.72]) by mta5.snet.net (8.12.3/8.12.3/SNET-mx-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id gBBFN1lh007129 for ; Wed, 11 Dec 2002 10:23:07 -0500 (EST) X-Originating-IP: [64.252.95.167] X-SBCIS-MTA: [pop.snet.net] Received: from [192.168.1.83] (167.95.252.64.snet.net [64.252.95.167]) by pop.snet.net (8.12.3/8.12.3/SNET-pop-1.2/D-1.1.1.1/O-1.1.1.1) with ESMTP id gBBFQHoq021756 for ; Wed, 11 Dec 2002 10:26:18 -0500 (EST) Subject: Re: Which of the solution is better? From: Wei Weng To: PgSQL Performance ML In-Reply-To: <1039585564.1265.38.camel@haggis> References: <20021210211603.GA22257@depesz.pl> <20021209113231.GA1113@depesz.pl> <20021210211603.GA22257@depesz.pl> <5.1.1.6.0.20021210234537.00bae260@mail.futuris.net> <1039585564.1265.38.camel@haggis> Content-Type: text/plain Organization: Message-Id: <1039623980.17037.3.camel@Monet> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 11 Dec 2002 11:26:20 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/110 X-Sequence-Number: 526 I don't think there is any. It is just another way to write an outer join. On Wed, 2002-12-11 at 00:46, Ron Johnson wrote: > On Tue, 2002-12-10 at 23:20, Wei Weng wrote: > > I have two tables A and B where A is a huge table with thousands of rows, B > > is a small table with only a couple of entries. > > > > I want to do something like > > > > SELECT > > A.ID > > A.Name > > FROM > > A JOIN B ON (A.ID = B.ID) > > How is this query any different from: > SELECT > A.ID, > A.Name > FROM > A, > B > WHERE > A.ID = B.ID > > > And on the other hand I can have something like this > > > > SELECT > > A.ID > > A.Name > > FROM > > A > > WHERE > > A.ID IN (B_Id_List) > > > > B_Id_List is a string concatenation of B.ID. (ie, 1,2,3,4,5 ...) > > > > Which one is faster, more efficient? > > > > And if you could, which one is faster/more efficient under MS SQL Server 7? > > I am trying to develop a cross platform query, that is why I need to > > concern with performance under different databases. -- Wei Weng Network Software Engineer KenCast Inc. From pgsql-general-owner@postgresql.org Wed Dec 11 12:50:20 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 37521476295 for ; Wed, 11 Dec 2002 12:50:18 -0500 (EST) Received: from smtp5.jaring.my (smtp5.jaring.my [61.6.32.55]) by postgresql.org (Postfix) with ESMTP id 01BB547618C for ; Wed, 11 Dec 2002 12:50:17 -0500 (EST) Received: from pc.localhost. (j153.crc25.jaring.my [61.6.98.167]) by smtp5.jaring.my (8.12.6/8.12.6) with ESMTP id gBBHoJKd077125 for ; Thu, 12 Dec 2002 01:50:20 +0800 (MYT) (envelope-from lyeoh@pop.jaring.my) Message-Id: <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> X-Sender: lyeoh@mbox.jaring.my X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 12 Dec 2002 02:07:09 +0800 To: pgsql-general@postgresql.org From: Lincoln Yeoh Subject: Docs: GIST Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/570 X-Sequence-Number: 34485 I'm a bit confused. In 7.3 is it possible to use GIST without using any of the stuff in contrib/? If it is, how can it be done and in which cases should it be done? The pgsql docs about indexes keep talking about GIST here and there, but I can't seem to use them on anything. And there's no gist in the "ops" and access method listing. Having the docs say Postgresql provides GIST as one of the four access methods, GIST supports multicolumn indexes, GIST etc, is just confusing if the docs pertaining to indexes don't also say that in a default postgresql installation you cannot create an index using GIST (if you can actually create a GIST index "out of box", how??). Another thing: is Eugene Selkov's 1998 message on GIST indexes in the 7.3 docs (see GIST Indexes) still valid? There's mention of Postgresql 6.3 and postgres95 there too. BTW, 7.3 is GREAT! Multiple col/row returns, prepare queries, schemas etc. Also set enable_seq_scan=off can get rolled back to whatever it was before now right? Cool, coz I have to force index use for a particular select. Thanks to the postgresql dev team and everyone involved! Cheerio, Link. From pgsql-performance-owner@postgresql.org Wed Dec 11 13:12:10 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5DAF5475BA1 for ; Wed, 11 Dec 2002 13:12:09 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id BBE66475461 for ; Wed, 11 Dec 2002 13:12:08 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2276930 for ; Wed, 11 Dec 2002 10:12:21 -0800 From: "Josh Berkus" Subject: Capping CPU usage? To: pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Wed, 11 Dec 2002 10:12:21 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/112 X-Sequence-Number: 528 Folks: I had a new question from a client: is it possible to "cap" CPU usage for PostgreSQL running on Linux? They don't care if the procedure degrades Postgres performance, but they can't afford to have Postgres take up more than 30% of processor for more than 400 milliseconds (they are running some real-time operations). I can't imagine that postmaster could do this, but I thought it there might be some kind of Linux Kernel CPU quota option I haven't heard of. �Can anybody point me in the right direction? -Josh Berkus From pgsql-performance-owner@postgresql.org Wed Dec 11 13:25:59 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 48032476606 for ; Wed, 11 Dec 2002 13:25:58 -0500 (EST) Received: from jester.senspire.com (unknown [216.208.117.7]) by postgresql.org (Postfix) with ESMTP id A195C476B8C for ; Wed, 11 Dec 2002 13:25:10 -0500 (EST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by jester.senspire.com (8.12.6/8.12.6) with ESMTP id gBBIOlNs017881; Wed, 11 Dec 2002 13:24:52 -0500 (EST) (envelope-from rbt@rbt.ca) Subject: Re: Capping CPU usage? From: Rod Taylor To: Josh Berkus Cc: Pgsql Performance In-Reply-To: References: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-S/TwCGtYsfeK0pboE8GV" Organization: Message-Id: <1039631086.17316.194.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 11 Dec 2002 13:24:47 -0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/114 X-Sequence-Number: 530 --=-S/TwCGtYsfeK0pboE8GV Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2002-12-11 at 13:12, Josh Berkus wrote: > Folks: >=20=20 > I had a new question from a client: is it possible to "cap" CPU usage > for PostgreSQL running on Linux? They don't care if the procedure > degrades Postgres performance, but they can't afford to have Postgres > take up more than 30% of processor for more than 400 milliseconds > (they > are running some real-time operations). >=20=20 > I can't imagine that postmaster could do this, but I thought it there > might be some kind of Linux Kernel CPU quota option I haven't heard > of. > Can anybody point me in the right direction? Don't know about Linux, but BSD cannot do that. CPU limits are hard -- once you hit it it'll dump the process. Anyway, would it be sufficient to simply reduce the priority of the process? --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-S/TwCGtYsfeK0pboE8GV Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQA994Lt6DETLow6vwwRAjCNAJ0XUgddPe0aDHQ3kEGd2xZM+v7ChACeJ6R5 JOalZ5ujdYTOEKaApPJX1j0= =HWEx -----END PGP SIGNATURE----- --=-S/TwCGtYsfeK0pboE8GV-- From pgsql-performance-owner@postgresql.org Wed Dec 11 13:24:07 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 72DA7476A6A for ; Wed, 11 Dec 2002 13:24:06 -0500 (EST) Received: from smtp.inphact.com (smtp.inphact.com [67.105.52.11]) by postgresql.org (Postfix) with ESMTP id 1EF0247618C for ; Wed, 11 Dec 2002 13:23:51 -0500 (EST) Received: from cafes.net (unknown [192.168.109.38]) by smtp.inphact.com (Postfix) with ESMTP id 90017134002; Wed, 11 Dec 2002 12:10:29 -0600 (CST) Date: Wed, 11 Dec 2002 12:27:45 -0600 Subject: Re: Capping CPU usage? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Mime-Version: 1.0 (Apple Message framework v548) Cc: pgsql-performance@postgresql.org To: "Josh Berkus" From: Cory 'G' Watson In-Reply-To: Message-Id: <3DFF224C-0D36-11D7-8019-0003939CCA58@cafes.net> Content-Transfer-Encoding: quoted-printable X-Mailer: Apple Mail (2.548) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/113 X-Sequence-Number: 529 On Wednesday, December 11, 2002, at 12:12 PM, Josh Berkus wrote: > I can't imagine that postmaster could do this, but I thought it there > might be some kind of Linux Kernel CPU quota option I haven't heard > of. > =A0Can anybody point me in the right direction? > You can always use nice(1) to lower it's priority. This would allow=20 other processes to get the CPU more often, effectively limiting it in=20 the face of more demanding processes. ulimit has a CPU time option, but it's probably not what you want. I=20 don't believe there is a kernel option for such a thing. I don't=20 recall seeing this type of accounting anywhere, but there are likely=20 some patches. Cory 'G' Watson From pgsql-performance-owner@postgresql.org Wed Dec 11 13:44:44 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F1D2B476287 for ; Wed, 11 Dec 2002 13:44:42 -0500 (EST) Received: from l2.socialecology.com (unknown [4.42.179.131]) by postgresql.org (Postfix) with ESMTP id 74D23476243 for ; Wed, 11 Dec 2002 13:44:42 -0500 (EST) Received: from 4.42.179.151 (broccoli.socialecology.com [4.42.179.151]) by l2.socialecology.com (Postfix) with SMTP id 935E62A1D50 for ; Wed, 11 Dec 2002 10:44:41 -0800 (PST) X-Mailer: UserLand Frontier 9.1b1 (Macintosh OS) (mailServer v1.1..142) Mime-Version: 1.0 Message-Id: <98429170.1172519017@[4.42.179.151]> X-authenticated-sender: erics In-reply-to: <1039631086.17316.194.camel@jester> Date: Wed, 11 Dec 2002 10:44:39 -0800 To: Pgsql Performance From: eric soroos Subject: Re: Capping CPU usage? Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/115 X-Sequence-Number: 531 > > I can't imagine that postmaster could do this, but I thought it there > > might be some kind of Linux Kernel CPU quota option I haven't heard > > of. > > Can anybody point me in the right direction? I was reading an interview last night (found from /.) on the O(1) scheduler. One thing that was mentioned was batch tasks which get only cpu that's not being used for other things, in blocks of 3 seconds. It has some harder enforcement of nice levels (i.e. batch @ 10 can completely prevent a batch @ 15 from running untill it completes, but is completely interruptable by ordinary processes). Since all the parameters are tweakable, many while running, this may be a place to look. eric From pgsql-performance-owner@postgresql.org Wed Dec 11 16:49:06 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 812FD47694E for ; Wed, 11 Dec 2002 16:49:05 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id D329447694C for ; Wed, 11 Dec 2002 16:49:04 -0500 (EST) Received: from [216.135.165.74] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2277363 for ; Wed, 11 Dec 2002 13:49:20 -0800 From: "Josh Berkus" Subject: Good/Bad RAID and SCSI controllers? To: pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Wed, 11 Dec 2002 13:49:20 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/116 X-Sequence-Number: 532 Folks, I am hoping to start a thread where users post their experiences with various RAID and SCSI controllers running Postgres. When completed, I'll post it somewhere on Techdocs with a big disclaimer. I'll start it off: MYLEX AcceleRAID 170: Not supported under Linux 2.4 kernels. Performance under RAID 5 with 3 Maxtor UW SCSI disks good on read operations (slightly better than a single SCSI disk) but on large write operations poor, similar to low-end IDE disks in having disk-acccess bottlenecks. Suspected in our installation of locking up on very large simultaneous read/write operations, such as data tranformations on tables over 1 million records. (cause of lockup not firmly determined yet). (Josh Berkus 11/2002) -Josh Berkus From pgsql-performance-owner@postgresql.org Wed Dec 11 16:53:24 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3F4E8475F5E for ; Wed, 11 Dec 2002 16:53:23 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 8DFEC475A9E for ; Wed, 11 Dec 2002 16:53:22 -0500 (EST) Received: from [216.135.165.74] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2277358 for ; Wed, 11 Dec 2002 13:53:38 -0800 From: "Josh Berkus" Subject: Re: Which of the solution is better? To: pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Wed, 11 Dec 2002 13:53:38 -0800 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/117 X-Sequence-Number: 533 Wei, > I have two tables A and B where A is a huge table with thousands of > rows, B is a small table with only a couple of entries. > > I want to do something like > > SELECT > A.ID > A.Name > FROM > A JOIN B ON (A.ID = B.ID) You might consider: SELECT A.ID A.Name FROM A WHERE EXISTS (SELECT ID FROM B WHERE B.ID = A.ID) This lets the parser know that you are not interested in retrieving entire records from B, just those rows from A which correspond to B. Run that, and compare the EXPLAIN ANALYZE plan against one which lets the that parser have free reign: SELECT A.ID, A.Name FROM A, B WHERE A.ID = B.ID Chances are, the parser will do a better job on the query than you can do by making stuff explicit. Give it a try. -Josh Berkus From pgsql-performance-owner@postgresql.org Wed Dec 11 17:06:08 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 737CE475FB7 for ; Wed, 11 Dec 2002 17:06:06 -0500 (EST) Received: from new-smtp2.ihug.com.au (new-smtp2.ihug.com.au [203.109.250.28]) by postgresql.org (Postfix) with ESMTP id C70C9475F5E for ; Wed, 11 Dec 2002 17:06:05 -0500 (EST) Received: from p463-tnt2.mel.ihug.com.au (postgresql.org) [203.173.165.209] by new-smtp2.ihug.com.au with esmtp (Exim 3.22 #1 (Debian)) id 18MEzR-0001Gd-00; Thu, 12 Dec 2002 09:06:02 +1100 Message-ID: <3DF7B6C8.9010008@postgresql.org> Date: Thu, 12 Dec 2002 09:06:00 +1100 From: Justin Clift User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-au, en-gb, en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Good/Bad RAID and SCSI controllers? References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/118 X-Sequence-Number: 534 Josh Berkus wrote: > Folks, > > I am hoping to start a thread where users post their experiences with > various RAID and SCSI controllers running Postgres. When completed, > I'll post it somewhere on Techdocs with a big disclaimer. I'll start it > off: Sounds like a really good idea. There's already the beginnings of a page on Techdocs for this too. ;-) Here's two thoughts that might be helpful, although they're not RAID. Advansys UW SCSI controller: Brain damaged. Won't let standard Seagate Cheetah 10k RPM drives operating at all without having SCSI Disconnection turned off, and speed is forced to a maximum throughput of 6MB/s. 100% not recommended. Adaptec 29160 Ultra160 controller, BIOS version 3.10.0: Seems nice. Everything works well, most stuff is automatically configured, supported by just about everything. Haven't done throughput benchmarks though. Regards and best wishes, Justin Clift > MYLEX AcceleRAID 170: Not supported under Linux 2.4 kernels. > Performance under RAID 5 with 3 Maxtor UW SCSI disks good on read > operations (slightly better than a single SCSI disk) but on large write > operations poor, similar to low-end IDE disks in having disk-acccess > bottlenecks. Suspected in our installation of locking up on very large > simultaneous read/write operations, such as data tranformations on > tables over 1 million records. (cause of lockup not firmly determined > yet). (Josh Berkus 11/2002) > > -Josh Berkus -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi From pgsql-performance-owner@postgresql.org Wed Dec 11 17:26:18 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D99954765F1; Wed, 11 Dec 2002 17:26:15 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id D3D6C476442; Wed, 11 Dec 2002 17:26:13 -0500 (EST) Received: from [216.135.165.74] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2277433; Wed, 11 Dec 2002 14:26:29 -0800 From: "Josh Berkus" Subject: Re: Good/Bad RAID and SCSI controllers? To: Justin Clift Cc: pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Wed, 11 Dec 2002 14:26:29 -0800 Message-ID: In-Reply-To: <3DF7B6C8.9010008@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/119 X-Sequence-Number: 535 Justin, > Sounds like a really good idea. There's already the beginnings of a > page on Techdocs for this too. ;-) Where? I don't see it. -Josh From pgsql-performance-owner@postgresql.org Wed Dec 11 17:40:01 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AFAB94762AA; Wed, 11 Dec 2002 17:39:59 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id 7559A475FB7; Wed, 11 Dec 2002 17:39:56 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gBBMccnd017531; Wed, 11 Dec 2002 15:38:38 -0700 (MST) Date: Wed, 11 Dec 2002 15:34:27 -0700 (MST) From: "scott.marlowe" To: Justin Clift Cc: Josh Berkus , Subject: Re: Good/Bad RAID and SCSI controllers? In-Reply-To: <3DF7B6C8.9010008@postgresql.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/120 X-Sequence-Number: 536 On Thu, 12 Dec 2002, Justin Clift wrote: > Josh Berkus wrote: > > Folks, > > > > I am hoping to start a thread where users post their experiences with > > various RAID and SCSI controllers running Postgres. When completed, > > I'll post it somewhere on Techdocs with a big disclaimer. I'll start it > > off: > > Sounds like a really good idea. There's already the beginnings of a page on Techdocs for this too. ;-) > > Here's two thoughts that might be helpful, although they're not RAID. > > Advansys UW SCSI controller: Brain damaged. Won't let standard Seagate Cheetah 10k RPM drives operating at all without > having SCSI Disconnection turned off, and speed is forced to a maximum throughput of 6MB/s. 100% not recommended. > > Adaptec 29160 Ultra160 controller, BIOS version 3.10.0: Seems nice. Everything works well, most stuff is automatically > configured, supported by just about everything. Haven't done throughput benchmarks though. I'll throw a vote in behind the SymBIOS / LSI logic cards. They are quite stable and reliable, and generally faster than most other cards. I've got an UW symbios card at home I'll have to truck into work to play with so I can compare it to my Adaptecs here. I picked it up on Ebay (the symbios card) for $30, and it had a network interface on it too, but the guy didn't know what kind it was. Turned out to be gig ethernet interface with the yellowfin chipset. not a bad deal, when you think about it. poor thing gets to run my scanner, a tape drive, and an old Plextor 12 Plex CDROM drive. I'd like to hook up something with the gigabit nic someday while it's still considered somewhat fast. :-) For insight into the SCSI cards that Linux supports and what the maintainers think, I highly recommend a tour of the driver source code files. It's amazing how often the words "brain damaged" and "piece of crap" show up there. From pgsql-performance-owner@postgresql.org Wed Dec 11 17:50:41 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 348B34762C7 for ; Wed, 11 Dec 2002 17:50:40 -0500 (EST) Received: from new-smtp2.ihug.com.au (new-smtp2.ihug.com.au [203.109.250.28]) by postgresql.org (Postfix) with ESMTP id 92C904762AA for ; Wed, 11 Dec 2002 17:50:39 -0500 (EST) Received: from p463-tnt2.mel.ihug.com.au (postgresql.org) [203.173.165.209] by new-smtp2.ihug.com.au with esmtp (Exim 3.22 #1 (Debian)) id 18MFge-0003Vi-00; Thu, 12 Dec 2002 09:50:41 +1100 Message-ID: <3DF7C13F.1020809@postgresql.org> Date: Thu, 12 Dec 2002 09:50:39 +1100 From: Justin Clift User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-au, en-gb, en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Good/Bad RAID and SCSI controllers? References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/121 X-Sequence-Number: 537 Josh Berkus wrote: > Justin, > > >>Sounds like a really good idea. There's already the beginnings of a >>page on Techdocs for this too. ;-) > > > Where? I don't see it. Was thinking about this: http://techdocs.postgresql.org/guides/DiskTuningGuide :-) Regards and best wishes, Justin Clift > -Josh > -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi From pgsql-general-owner@postgresql.org Thu Dec 12 00:41:41 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A3A00475E8C for ; Thu, 12 Dec 2002 00:41:40 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id E44EE475AE6 for ; Thu, 12 Dec 2002 00:41:39 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBC5fXpd003456; Thu, 12 Dec 2002 00:41:34 -0500 (EST) To: Lincoln Yeoh Cc: pgsql-general@postgresql.org Subject: Re: Docs: GIST In-reply-to: <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> References: <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> Comments: In-reply-to Lincoln Yeoh message dated "Thu, 12 Dec 2002 02:07:09 +0800" Date: Thu, 12 Dec 2002 00:41:33 -0500 Message-ID: <3455.1039671693@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/603 X-Sequence-Number: 34518 Lincoln Yeoh writes: > I'm a bit confused. > In 7.3 is it possible to use GIST without using any of the stuff in > contrib/? No, because there are no GIST opclasses in the standard installation. They are only in contrib. Yes, that's a bit silly. As GIST improves out of the "academic toy" category into the "production tool" category, I expect we will migrate GIST opclasses into the standard installation. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 12 00:52:15 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 132FD475DC0 for ; Thu, 12 Dec 2002 00:52:14 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 78CAB475AE6 for ; Thu, 12 Dec 2002 00:52:13 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBC5qBpd003548; Thu, 12 Dec 2002 00:52:11 -0500 (EST) To: Rod Taylor Cc: Josh Berkus , Pgsql Performance Subject: Re: Capping CPU usage? In-reply-to: <1039631086.17316.194.camel@jester> References: <1039631086.17316.194.camel@jester> Comments: In-reply-to Rod Taylor message dated "11 Dec 2002 13:24:47 -0500" Date: Thu, 12 Dec 2002 00:52:10 -0500 Message-ID: <3547.1039672330@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/122 X-Sequence-Number: 538 Rod Taylor writes: >> I had a new question from a client: is it possible to "cap" CPU usage >> for PostgreSQL running on Linux? > Anyway, would it be sufficient to simply reduce the priority of the > process? If the issue is to prevent Postgres *as a whole* from hogging CPU usage, I would think that nice-ing the postmaster at launch would work beautifully. Requests like "I want Postgres to use no more than 30% of CPU" make no sense to me: if the CPU is otherwise idle, why should you insist on reserving 70% of it for the idle loop? But what we commonly see is "I want to cap the resource usage of this particular query", and that is a whole lot harder. You cannot win by nice-ing one single backend, because of priority-inversion concerns. (The queries you would like to be high-priority might be blocked waiting for locks held by low-priority backends.) regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 12 02:12:32 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1A6E6476A00 for ; Thu, 12 Dec 2002 02:12:31 -0500 (EST) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 81C67476941 for ; Thu, 12 Dec 2002 02:12:28 -0500 (EST) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id gBC7CRm12312 for ; Thu, 12 Dec 2002 12:42:27 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id gBC7CR012307 for ; Thu, 12 Dec 2002 12:42:27 +0530 From: "Shridhar Daithankar" To: Date: Thu, 12 Dec 2002 12:43:02 +0530 MIME-Version: 1.0 Subject: Re: Good/Bad RAID and SCSI controllers? Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DF88456.4666.8C76734@localhost> References: <3DF7B6C8.9010008@postgresql.org> In-reply-to: X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/123 X-Sequence-Number: 539 On 11 Dec 2002 at 15:34, scott.marlowe wrote: > On Thu, 12 Dec 2002, Justin Clift wrote: > > Advansys UW SCSI controller: Brain damaged. Won't let standard Seagate Cheetah 10k RPM drives operating at all without > > having SCSI Disconnection turned off, and speed is forced to a maximum throughput of 6MB/s. 100% not recommended. > > > > Adaptec 29160 Ultra160 controller, BIOS version 3.10.0: Seems nice. Everything works well, most stuff is automatically > > configured, supported by just about everything. Haven't done throughput benchmarks though. > > I'll throw a vote in behind the SymBIOS / LSI logic cards. They are quite > stable and reliable, and generally faster than most other cards. I've got > an UW symbios card at home I'll have to truck into work to play with so I > can compare it to my Adaptecs here. > > I picked it up on Ebay (the symbios card) for $30, and it had a network > interface on it too, but the guy didn't know what kind it was. Turned out > to be gig ethernet interface with the yellowfin chipset. not a bad deal, > when you think about it. poor thing gets to run my scanner, a tape drive, > and an old Plextor 12 Plex CDROM drive. I'd like to hook up something > with the gigabit nic someday while it's still considered somewhat fast. > :-) Right now page on techdocs is pretty thin on such details. I suggest these authors to put this information(barring humour etc. Just experiences) on that document. Secondly I see my name there as contributor but I do not recall any contribution. Anyway since I would like to have my name there, I will put some info there as well. Bye Shridhar -- Rules for driving in New York: (1) Anything done while honking your horn is legal. (2) You may park anywhere if you turn your four-way flashers on. (3) A red light means the next six cars may go through the intersection. From pgsql-performance-owner@postgresql.org Thu Dec 12 02:35:32 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A3C1E476138 for ; Thu, 12 Dec 2002 02:35:30 -0500 (EST) Received: from web80307.mail.yahoo.com (web80307.mail.yahoo.com [66.218.79.23]) by postgresql.org (Postfix) with SMTP id 0F441475DC0 for ; Thu, 12 Dec 2002 02:35:30 -0500 (EST) Message-ID: <20021212073529.50065.qmail@web80307.mail.yahoo.com> Received: from [203.87.150.116] by web80307.mail.yahoo.com via HTTP; Wed, 11 Dec 2002 23:35:29 PST Date: Wed, 11 Dec 2002 23:35:29 -0800 (PST) From: Ludwig Lim Subject: Time to commit a change To: PostgreSQL Mailing list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/124 X-Sequence-Number: 540 Hi: How long does it take to commit a change to change to the database? I'm currently developing a application where response time should be fast. Today I notice the following in my application log: [12/10/2002 16:49:52] SQL statement created [12/10/2002 16:49:58] Updating OK. The SQL statement is a just a stored procedure that insert a single row to a table. 6 seconds is quite a long time to execute an insert statement even if the table has referential integrity constrants and some triggers (the database is small, no tables having more than 100 rows). I tried to recreate the scenario by doing the following at a psql prompt: begin; explain analyze select f_credit_insert('0810030358689',3,121002,402,1096,1654,62550/100 ,'ADXLXDDN',0); -- call the stored procedure rollback; The following is the result of the explain analyze: pilot=# explain analyze pilot-# select f_credit_insert('0810030358689',3,121002,402,1096,1654,62550/ ,'ADXLXDDN',0); NOTICE: QUERY PLAN: Result (cost=0.00..0.01 rows=1 width=0) (actual time=195.95..195.95 rows=1 s=1) Total runtime: 195.97 msec NOTICE: UPDATING fsphdr from f_ti_fspdetl NOTICE: Current points = 625 NOTICE: INSERTING into sc_add_points from f_ti_fspdetl NOTICE: date = 20021210 at f_ti_sc_add_points NOTICE: time = 1654 at f_ti_sc_add_points NOTICE: transtime = 1654 at f_auto_redeem NOTICE: transdate = 20021210 at f_auto_redeem NOTICE: balance = 1250 NOTICE: points needed to redeem = 5000 NOTICE: Lack the points to merit an auto-redemption in f_auto_redeem Since the database is not yet in "full production" mode. I put NOTOICEs to help me debug. I can only think of the following reasons why it took 5 seconds to execute the sql statements in a C++ application using libpq while it took 195.67 ms. : a) NOTICEs are also written to /var/log/messages so it can take some time. Does size of the /var/log/messages affect the time to execute stored procedures having NOTICE statements? b) Connection time overhead. c) RAID 5. There not much concurrent connection at that time (5 users at most concurrently connected during that time) One of the factor that I can't tell is the time it takes to commit that particular transaction. Are there ways to approximate the time to commit the changes given the time it take execute that particular sql statement (I'm assuming that there is only 1 SQL statement in that particular transaction). Anybody has a idea why it took that long to commit? My setup is a Pentium 4 with RAID 5. My version of postgresql is 7.2.2 Thank you very much, ludwig. __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com From pgsql-performance-owner@postgresql.org Thu Dec 12 03:07:06 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3BEB14762B6 for ; Thu, 12 Dec 2002 03:07:05 -0500 (EST) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 44FEB476061 for ; Thu, 12 Dec 2002 03:07:03 -0500 (EST) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id gBC870j16161 for ; Thu, 12 Dec 2002 13:37:00 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id gBC870016156 for ; Thu, 12 Dec 2002 13:37:00 +0530 From: "Shridhar Daithankar" To: PostgreSQL Mailing list Date: Thu, 12 Dec 2002 13:37:34 +0530 MIME-Version: 1.0 Subject: Re: Time to commit a change Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DF8911E.6439.8F9553F@localhost> In-reply-to: <20021212073529.50065.qmail@web80307.mail.yahoo.com> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/125 X-Sequence-Number: 541 On 11 Dec 2002 at 23:35, Ludwig Lim wrote: > How long does it take to commit a change to change > to the database? Shoudln't be long actually.. > [12/10/2002 16:49:52] SQL statement created > [12/10/2002 16:49:58] Updating OK. > > The SQL statement is a just a stored procedure that > insert a single row to a table. 6 seconds is quite a > long time to execute an insert statement even if the > table has referential integrity constrants and some > triggers (the database is small, no tables having more > than 100 rows). I tried to recreate the scenario by > doing the following at a psql prompt: I don't believe it would take so long. Last time I benchmarked postgresql on mandrake 8.2, I was able to insert/update/delete in 210-240ms on average. I was benhmarking a server application on a lowly P-III-450 with 256MB RAM and IDE disk. I put 30 clients on that and still excecution time was 240ms. But since there were 20 clients I was getting 240/30=8ms on an average thorughput. All the inserts/updates/deletes were in single transaction as well and tables were small 100-1000 rows. > a) NOTICEs are also written to /var/log/messages so > it can take some time. Does size of the > /var/log/messages affect the time to execute stored > procedures having NOTICE statements? > b) Connection time overhead. > c) RAID 5. I don't think any of these matters. What explain throws out is an estimate and it might be wrong as well. > One of the factor that I can't tell is the time it > takes to commit that particular transaction. Are there > ways to approximate the time to commit the changes > given the time it take execute that particular sql > statement (I'm assuming that there is only 1 SQL > statement in that particular transaction). Yes. Try something like this in C/C++ gettimeofday begin transact gettimeofday commit gettimeofday. I am certain it will be in range of 200-250ms. Couldn't get it below that on a network despite of pooled connections.. I am not sure second gettimeofday will be of any help but first and third will definitely give you an idea. > Anybody has a idea why it took that long to commit? > My setup is a Pentium 4 with RAID 5. My version of > postgresql is 7.2.2 I would put that to 200ms if client and server on same machine. Let us know what it turns out.. HTH Bye Shridhar -- Jim Nasium's Law: In a large locker room with hundreds of lockers, the few people using the facility at any one time will all have lockers next to each other so that everybody is cramped. From pgsql-performance-owner@postgresql.org Thu Dec 12 12:15:41 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 816D6476063 for ; Thu, 12 Dec 2002 12:15:39 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 68940475EB9 for ; Thu, 12 Dec 2002 12:15:38 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id C9220D609; Thu, 12 Dec 2002 09:15:43 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id AAA535C02; Thu, 12 Dec 2002 09:15:43 -0800 (PST) Date: Thu, 12 Dec 2002 09:15:43 -0800 (PST) From: Stephan Szabo To: Ludwig Lim Cc: PostgreSQL Mailing list Subject: Re: Time to commit a change In-Reply-To: <20021212073529.50065.qmail@web80307.mail.yahoo.com> Message-ID: <20021212091233.H8927-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/126 X-Sequence-Number: 542 On Wed, 11 Dec 2002, Ludwig Lim wrote: > > Hi: > > How long does it take to commit a change to change > to the database? > > I'm currently developing a application where > response time should be fast. Today I notice the > following in my application log: > > [12/10/2002 16:49:52] SQL statement created > [12/10/2002 16:49:58] Updating OK. > > The SQL statement is a just a stored procedure that > insert a single row to a table. 6 seconds is quite a > long time to execute an insert statement even if the > table has referential integrity constrants and some > triggers (the database is small, no tables having more > than 100 rows). I tried to recreate the scenario by > doing the following at a psql prompt: Was this run while anything else was hitting the database or just by itself? I'd wonder if there were any lock contentions (for example on foreign keys) or anything like that which might have had some effect. From pgsql-performance-owner@postgresql.org Thu Dec 12 12:44:50 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D5B54475EF0 for ; Thu, 12 Dec 2002 12:44:48 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id A51CA4760A7; Thu, 12 Dec 2002 12:43:07 -0500 (EST) Received: by davinci.ethosmedia.com (CommuniGate Pro PIPE 4.0.2) with PIPE id 2278801; Thu, 12 Dec 2002 09:43:32 -0800 X-Spam-Status: Scanner Called Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2278796; Thu, 12 Dec 2002 09:43:25 -0800 From: "Josh Berkus" Subject: Re: Capping CPU usage? To: Tom Lane , Rod Taylor Cc: Josh Berkus , Pgsql Performance X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Thu, 12 Dec 2002 09:43:25 -0800 Message-ID: In-Reply-To: <3547.1039672330@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Spam-Status: No, hits=-4.1 required=6.0 tests=IN_REP_TO, SUBJ_ENDS_IN_Q_MARK, AWL version=2.20 X-Spam-Level: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/127 X-Sequence-Number: 543 Tom, > If the issue is to prevent Postgres *as a whole* from hogging CPU > usage, > I would think that nice-ing the postmaster at launch would work > beautifully. Requests like "I want Postgres to use no more than 30% > of CPU" make no sense to me: if the CPU is otherwise idle, why should > you insist on reserving 70% of it for the idle loop? That's what I asked the person who asked me. Apparently, they want to do real-time operations without forking out for a real-time OS. My response was "you can nice the postmaster, and simplify your queries, but that's about it". Thank you, everybody, for confirming this. -Josh Berkus From pgsql-performance-owner@postgresql.org Thu Dec 12 12:54:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8347E476879 for ; Thu, 12 Dec 2002 12:54:36 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 3E409476E29 for ; Thu, 12 Dec 2002 12:48:44 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2278813; Thu, 12 Dec 2002 09:49:08 -0800 From: "Josh Berkus" Subject: Re: Time to commit a change To: Ludwig Lim , PostgreSQL Mailing list X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Thu, 12 Dec 2002 09:49:08 -0800 Message-ID: In-Reply-To: <20021212073529.50065.qmail@web80307.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/128 X-Sequence-Number: 544 Ludwig, > Anybody has a idea why it took that long to commit? > My setup is a Pentium 4 with RAID 5. My version of > postgresql is 7.2.2 Disk contention is also a very possible issue. I'd suggest trying the same test when you are certain that no other disk activity is happening. I've seen appalling wait times for random writes on some RAID5 controllers. Also, how about publishing the text of the function? What controller are you using? How many dirves, of what type? -Josh Berkus From pgsql-performance-owner@postgresql.org Thu Dec 12 13:04:56 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8B3914767ED for ; Thu, 12 Dec 2002 13:04:54 -0500 (EST) Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) by postgresql.org (Postfix) with ESMTP id 367AE4764C5 for ; Thu, 12 Dec 2002 12:57:53 -0500 (EST) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao04.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021212175759.MKAM22825.lakemtao04.cox.net@[192.168.1.1]> for ; Thu, 12 Dec 2002 12:57:59 -0500 Subject: Re: Capping CPU usage? From: Ron Johnson To: PgSQL Performance ML In-Reply-To: References: Content-Type: text/plain Organization: Message-Id: <1039715877.1261.101.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 12 Dec 2002 11:57:57 -0600 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/129 X-Sequence-Number: 545 On Thu, 2002-12-12 at 11:43, Josh Berkus wrote: > Tom, > > > If the issue is to prevent Postgres *as a whole* from hogging CPU > > usage, > > I would think that nice-ing the postmaster at launch would work > > beautifully. Requests like "I want Postgres to use no more than 30% > > of CPU" make no sense to me: if the CPU is otherwise idle, why should > > you insist on reserving 70% of it for the idle loop? > > That's what I asked the person who asked me. Apparently, they > want to do real-time operations without forking out for a real-time OS. > My response was "you can nice the postmaster, and simplify your > queries, but that's about it". Maybe, even with processes niced down low, the current Linux scheduler "drop down" a currently schueduled/executing process. Maybe that would change with the low-latency patches, or with the O(1) scheduler in kernel 2.6. -- +---------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "My advice to you is to get married: If you find a good wife, | | you will be happy; if not, you will become a philosopher." | | Socrates | +---------------------------------------------------------------+ From pgsql-general-owner@postgresql.org Thu Dec 12 15:46:11 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3B8E5476677 for ; Thu, 12 Dec 2002 15:46:09 -0500 (EST) Received: from smtp4.jaring.my (smtp4.jaring.my [61.6.32.54]) by postgresql.org (Postfix) with ESMTP id 425C1476307 for ; Thu, 12 Dec 2002 15:46:07 -0500 (EST) Received: from pc.localhost. (j198.crc25.jaring.my [61.6.98.212]) by smtp4.jaring.my (8.11.4/8.11.4) with ESMTP id gBCKjp814151; Fri, 13 Dec 2002 04:46:00 +0800 (MYT) Message-Id: <5.1.0.14.1.20021213043655.027360b0@mbox.jaring.my> X-Sender: lyeoh@mbox.jaring.my X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 13 Dec 2002 05:02:28 +0800 To: Tom Lane From: Lincoln Yeoh Subject: Re: Docs: GIST Cc: pgsql-general@postgresql.org In-Reply-To: <3455.1039671693@sss.pgh.pa.us> References: <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/656 X-Sequence-Number: 34571 I did figure it out eventually but it'll be clearer to mention that in the docs - e.g. the only way to use GIST is to use the stuff in contrib. Coz I had a bit of wishful thinking - thought that maybe some bits of GIST might have at least become useable by default in 7.3 e.g. the simpler stuff (the docs didn't quite contradict that). Definitely not asking for it to be rushed in tho. Software is more reliable when the developers know what they are doing, and they get to release stuff when they think it's ready, not when others say it is. Cheerio, Link. At 12:41 AM 12/12/02 -0500, Tom Lane wrote: >Lincoln Yeoh writes: > > I'm a bit confused. > > In 7.3 is it possible to use GIST without using any of the stuff in > > contrib/? > >No, because there are no GIST opclasses in the standard installation. >They are only in contrib. From pgsql-general-owner@postgresql.org Thu Dec 12 16:31:41 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E6E86476D17; Thu, 12 Dec 2002 16:31:38 -0500 (EST) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id ECF7B475E24; Thu, 12 Dec 2002 16:31:37 -0500 (EST) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id QAA10221; Thu, 12 Dec 2002 16:31:38 -0500 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma010219; Thu, 12 Dec 02 16:31:10 -0500 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id QAA05029; Thu, 12 Dec 2002 16:29:39 -0500 Message-ID: <3DF90042.E5290B7F@nsd.ca> Date: Thu, 12 Dec 2002 16:31:46 -0500 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-general@postgresql.org Cc: pgsql-performance@postgresql.org Subject: CLUSTER command References: <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> <5.1.0.14.1.20021213043655.027360b0@mbox.jaring.my> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/659 X-Sequence-Number: 34574 Hi all, I just read about the cluster command and was a little (very) disapointed. Clustered tables do not remain clustered after inserts. Clustered tables are usefull when the table is very large and there are few different keys. Because the table file is already extended (2G limit) using different files extension (.N) how complicated (modifying the code) would it be to have the table files split according to the cluster key? This would: Greatly improve performance when the cluster key in included in search criteria. Allow for a much larger table before a file has to be split (.N). Simplify the management of symblinks (that's something else we need to look at). The index file for that field would no longer be required. Of course, there should be only one cluster key per table. The length the "key" should be short and the number of unique key should be low as well. SO... ? JLL From pgsql-general-owner@postgresql.org Thu Dec 12 16:41:14 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6B3AF476DC6; Thu, 12 Dec 2002 16:41:13 -0500 (EST) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id 273ED476D57; Thu, 12 Dec 2002 16:40:08 -0500 (EST) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id QAA10276; Thu, 12 Dec 2002 16:40:09 -0500 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma010272; Thu, 12 Dec 02 16:39:48 -0500 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id QAA05053; Thu, 12 Dec 2002 16:38:18 -0500 Message-ID: <3DF90248.9BAF931C@nsd.ca> Date: Thu, 12 Dec 2002 16:40:24 -0500 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-general@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [PERFORM] CLUSTER command References: <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> <5.1.0.14.1.20021213043655.027360b0@mbox.jaring.my> <3DF90042.E5290B7F@nsd.ca> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/661 X-Sequence-Number: 34576 Oh, and something else, I think the syntax should be: Cluster on Maybe inheritance can be use here. The problem is creating the new "table" when a new key is detected. I know, I can use rules, but the optimiser is not aware of the clustering. Enough from me for now. What do you think? JLL Jean-Luc Lachance wrote: > > Hi all, > > I just read about the cluster command and was a little (very) > disapointed. > Clustered tables do not remain clustered after inserts. > Clustered tables are usefull when the table is very large and there are > few different keys. > > Because the table file is already extended (2G limit) using different > files extension (.N) > how complicated (modifying the code) would it be to have the table files > split according to the cluster key? > > This would: > > Greatly improve performance when the cluster key in included in search > criteria. > Allow for a much larger table before a file has to be split (.N). > Simplify the management of symblinks (that's something else we need to > look at). > The index file for that field would no longer be required. > > Of course, there should be only one cluster key per table. > The length the "key" should be short and the number of unique key should > be low as well. > > SO... ? > > JLL > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From pgsql-general-owner@postgresql.org Thu Dec 12 17:08:58 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1DD20476EB0; Thu, 12 Dec 2002 17:08:55 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id E91D7476F50; Thu, 12 Dec 2002 17:03:55 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 5FD05D60A; Thu, 12 Dec 2002 14:03:56 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 4D6F15C02; Thu, 12 Dec 2002 14:03:56 -0800 (PST) Date: Thu, 12 Dec 2002 14:03:56 -0800 (PST) From: Stephan Szabo To: Jean-Luc Lachance Cc: , Subject: Re: CLUSTER command In-Reply-To: <3DF90042.E5290B7F@nsd.ca> Message-ID: <20021212135913.Q11714-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/669 X-Sequence-Number: 34584 On Thu, 12 Dec 2002, Jean-Luc Lachance wrote: > Hi all, > > I just read about the cluster command and was a little (very) > disapointed. > Clustered tables do not remain clustered after inserts. > Clustered tables are usefull when the table is very large and there are > few different keys. > > > Because the table file is already extended (2G limit) using different > files extension (.N) > how complicated (modifying the code) would it be to have the table files > split according to the cluster key? I'd vote against changing the existing CLUSTER since the existing CLUSTER while not great does handle many different key values fairly well as well and this solution wouldn't. Many different key values are still useful to cluster if you're doing searches over ranges since it lowers the number of heap file reads necessary. If done this should probably be separate from the existing cluster or at least both versions should be possible. From pgsql-general-owner@postgresql.org Thu Dec 12 17:20:35 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 160FC476E79; Thu, 12 Dec 2002 17:20:35 -0500 (EST) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id EF728476F48; Thu, 12 Dec 2002 17:15:14 -0500 (EST) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id RAA10695; Thu, 12 Dec 2002 17:15:09 -0500 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma010693; Thu, 12 Dec 02 17:15:01 -0500 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id RAA05215; Thu, 12 Dec 2002 17:13:30 -0500 Message-ID: <3DF90A89.61040846@nsd.ca> Date: Thu, 12 Dec 2002 17:15:37 -0500 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: Stephan Szabo Cc: pgsql-general@postgresql.org, pgsql-performance@postgresql.org Subject: Re: CLUSTER command References: <20021212135913.Q11714-100000@megazone23.bigpanda.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/671 X-Sequence-Number: 34586 The current cluster command is equivalant to: create b as select * from a order by i; So you would not be loosing anything. Stephan Szabo wrote: > > On Thu, 12 Dec 2002, Jean-Luc Lachance wrote: > > > Hi all, > > > > I just read about the cluster command and was a little (very) > > disapointed. > > Clustered tables do not remain clustered after inserts. > > Clustered tables are usefull when the table is very large and there are > > few different keys. > > > > > > Because the table file is already extended (2G limit) using different > > files extension (.N) > > how complicated (modifying the code) would it be to have the table files > > split according to the cluster key? > > I'd vote against changing the existing CLUSTER since the existing CLUSTER > while not great does handle many different key values fairly well as well > and this solution wouldn't. Many different key values are still > useful to cluster if you're doing searches over ranges since it lowers the > number of heap file reads necessary. If done this should probably be > separate from the existing cluster or at least both versions should be > possible. From pgsql-performance-owner@postgresql.org Thu Dec 12 17:24:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 89FDC476E3E for ; Thu, 12 Dec 2002 17:24:39 -0500 (EST) Received: from phaedrusdeinus.org (dsl092-130-239.chi1.dsl.speakeasy.net [66.92.130.239]) by postgresql.org (Postfix) with SMTP id 20C01476EF4 for ; Thu, 12 Dec 2002 17:22:12 -0500 (EST) Received: (qmail 8464 invoked by uid 1001); 12 Dec 2002 22:26:41 -0000 Date: Thu, 12 Dec 2002 16:26:41 -0600 From: johnnnnnn To: Stephan Szabo Cc: pgsql-performance@postgresql.org, pgsql-general@postgresql.org Subject: Re: [GENERAL] CLUSTER command Message-ID: <20021212222641.GA8278@performics.com> References: <3DF90042.E5290B7F@nsd.ca> <20021212135913.Q11714-100000@megazone23.bigpanda.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021212135913.Q11714-100000@megazone23.bigpanda.com> User-Agent: Mutt/1.5.1i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/134 X-Sequence-Number: 550 On Thu, Dec 12, 2002 at 02:03:56PM -0800, Stephan Szabo wrote: > I'd vote against changing the existing CLUSTER since the existing > CLUSTER while not great does handle many different key values fairly > well as well and this solution wouldn't. I would agree. What's being proposed sounds much more like table partitioning than clustering. That's not to say that the existing CLUSTER couldn't be improved, at the very least to the point where it allows inserts to respect the clustered structure. That's a post for another thread, though. -johnnnnnnnnnnn From pgsql-general-owner@postgresql.org Thu Dec 12 17:27:28 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6388C476F14; Thu, 12 Dec 2002 17:27:27 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 9A1254758F1; Thu, 12 Dec 2002 17:27:00 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 505EAD618; Thu, 12 Dec 2002 14:27:02 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 4610D5C02; Thu, 12 Dec 2002 14:27:02 -0800 (PST) Date: Thu, 12 Dec 2002 14:27:02 -0800 (PST) From: Stephan Szabo To: Jean-Luc Lachance Cc: , Subject: Re: CLUSTER command In-Reply-To: <3DF90A89.61040846@nsd.ca> Message-ID: <20021212142547.J12742-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/672 X-Sequence-Number: 34587 On Thu, 12 Dec 2002, Jean-Luc Lachance wrote: > The current cluster command is equivalant to: > > create b as select * from a order by i; > > So you would not be loosing anything. Except for the fact that the CLUSTER is intended (although I don't know if it does yet) to retain things like constraints and other indexes which the above doesn't. From pgsql-general-owner@postgresql.org Thu Dec 12 17:39:31 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6C2DA476E9F; Thu, 12 Dec 2002 17:39:30 -0500 (EST) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id 79895476E9C; Thu, 12 Dec 2002 17:39:28 -0500 (EST) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id RAA11018; Thu, 12 Dec 2002 17:39:10 -0500 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma011016; Thu, 12 Dec 02 17:39:07 -0500 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id RAA05326; Thu, 12 Dec 2002 17:37:37 -0500 Message-ID: <3DF91030.A372DF7C@nsd.ca> Date: Thu, 12 Dec 2002 17:39:44 -0500 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: johnnnnnn Cc: Stephan Szabo , pgsql-performance@postgresql.org, pgsql-general@postgresql.org Subject: Re: [PERFORM] CLUSTER command References: <3DF90042.E5290B7F@nsd.ca> <20021212135913.Q11714-100000@megazone23.bigpanda.com> <20021212222641.GA8278@performics.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/674 X-Sequence-Number: 34589 OK fine, Let's create a new command: PARTITION
ON I did not want to start a fight. You can keep the CLUSTER command as it is. I still think clustering/partitioning would be a great idea. This is what I want to talk about. Look at the original post for the reasons. JLL johnnnnnn wrote: > > On Thu, Dec 12, 2002 at 02:03:56PM -0800, Stephan Szabo wrote: > > I'd vote against changing the existing CLUSTER since the existing > > CLUSTER while not great does handle many different key values fairly > > well as well and this solution wouldn't. > > I would agree. What's being proposed sounds much more like table > partitioning than clustering. > > That's not to say that the existing CLUSTER couldn't be improved, at > the very least to the point where it allows inserts to respect the > clustered structure. That's a post for another thread, though. > > -johnnnnnnnnnnn > > ---------------------------(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-general-owner@postgresql.org Thu Dec 12 17:33:10 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6D938476E65; Thu, 12 Dec 2002 17:33:09 -0500 (EST) Received: from smtp9.jaring.my (smtp9.jaring.my [61.6.32.59]) by postgresql.org (Postfix) with ESMTP id B27F4476D17; Thu, 12 Dec 2002 17:33:06 -0500 (EST) Received: from pc.localhost. (j230.crc30.jaring.my [61.6.109.244]) by smtp9.jaring.my (8.12.6/8.12.6) with ESMTP id gBCMX0M1087923; Fri, 13 Dec 2002 06:33:01 +0800 (MYT) (envelope-from lyeoh@pop.jaring.my) Message-Id: <5.1.0.14.1.20021213063727.0278b270@mbox.jaring.my> X-Sender: lyeoh@mbox.jaring.my X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 13 Dec 2002 06:49:12 +0800 To: Jean-Luc Lachance , pgsql-general@postgresql.org From: Lincoln Yeoh Subject: Re: CLUSTER command Cc: pgsql-performance@postgresql.org In-Reply-To: <3DF90042.E5290B7F@nsd.ca> References: <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> <5.1.0.14.1.20021212010621.0273d040@mbox.jaring.my> <5.1.0.14.1.20021213043655.027360b0@mbox.jaring.my> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/673 X-Sequence-Number: 34588 Splitting table files by indexed value may not help if the operating system doesn't manage to keep the tables unfragmented on disk. I suppose the O/S should know how to do it though. Cheerio, Link. At 04:31 PM 12/12/02 -0500, Jean-Luc Lachance wrote: >Hi all, > >I just read about the cluster command and was a little (very) >disapointed. >Clustered tables do not remain clustered after inserts. >Clustered tables are usefull when the table is very large and there are >few different keys. > > >Because the table file is already extended (2G limit) using different >files extension (.N) >how complicated (modifying the code) would it be to have the table files >split according to the cluster key? From pgsql-general-owner@postgresql.org Thu Dec 12 17:52:33 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 558A5476E3E for ; Thu, 12 Dec 2002 17:52:32 -0500 (EST) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.85]) by postgresql.org (Postfix) with ESMTP id 38996476F73 for ; Thu, 12 Dec 2002 17:51:45 -0500 (EST) Received: from asmtp02.mac.com (asmtp02-qfe3 [10.13.10.66]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id gBCMplZT018066 for ; Thu, 12 Dec 2002 14:51:47 -0800 (PST) Received: from mac.com ([165.121.130.207]) by asmtp02.mac.com (Netscape Messaging Server 4.15) with ESMTP id H713I900.S49 for ; Thu, 12 Dec 2002 14:51:45 -0800 Date: Thu, 12 Dec 2002 17:50:55 -0500 Subject: PerformPortalClose warning in 7.3 Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v548) From: Michael Engelhart To: pgsql-general@postgresql.org Content-Transfer-Encoding: 7bit In-Reply-To: <3DF91030.A372DF7C@nsd.ca> Message-Id: <2C6CDB6A-0E24-11D7-8E88-000393A48A3C@mac.com> X-Mailer: Apple Mail (2.548) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/677 X-Sequence-Number: 34592 Hi - I've been running PostgreSQL 7.3 on Mac OS X 10.2 since it was released and it's been running fine. I'm using pyPgSQL 2.3 for client side programming which also was working great until tonight. Now whenever I do any query of any type, I get warnings like this: WARNING: PerformPortalClose: portal "pgsql_00179f10" not found It "appears" that everything is still working the way it was but it's a bit discomforting to have these show up on my screen while running my applications. Anyone that can explain this? Here's a tiny bit of Python sample code that I used to make sure it wasn't my other code causing the problems from pyPgSQL import PgSQL dbname = "template1" conn = PgSQL.connect(database=dbname) cursor = conn.cursor() sql = "SELECT now()"; cursor.execute(sql) res = cursor.fetchall() for i in res: print i cursor.close() conn.commit() strangely if I remove the last 2 lines (cursor.close() and conn.commit()) I don't get the errors. Also I don't notice that I don't have this problem with psql command line either. Is this the Python API causing this? Thanks for any help Mike From pgsql-performance-owner@postgresql.org Thu Dec 12 17:55:54 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CFBCD476F33 for ; Thu, 12 Dec 2002 17:55:52 -0500 (EST) Received: from phaedrusdeinus.org (dsl092-130-239.chi1.dsl.speakeasy.net [66.92.130.239]) by postgresql.org (Postfix) with SMTP id 9F3DB476F43 for ; Thu, 12 Dec 2002 17:55:31 -0500 (EST) Received: (qmail 8571 invoked by uid 1001); 12 Dec 2002 23:00:02 -0000 Date: Thu, 12 Dec 2002 17:00:02 -0600 From: johnnnnnn To: pgsql-performance@postgresql.org, pgsql-general@postgresql.org Subject: Re: [GENERAL] CLUSTER command Message-ID: <20021212230002.GC8278@performics.com> References: <3DF90042.E5290B7F@nsd.ca> <20021212135913.Q11714-100000@megazone23.bigpanda.com> <20021212222641.GA8278@performics.com> <3DF91030.A372DF7C@nsd.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3DF91030.A372DF7C@nsd.ca> User-Agent: Mutt/1.5.1i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/138 X-Sequence-Number: 554 On Thu, Dec 12, 2002 at 05:39:44PM -0500, Jean-Luc Lachance wrote: > Let's create a new command: > > PARTITION
ON > Because the table file is already extended (2G limit) using > different files extension (.N) > how complicated (modifying the code) would it be to have the table > files split according to the cluster key? I think the code changes would be complicated. Just at a 30-second consideration, this would need to touch: - all sql (selects, inserts, updates, deletes) - vacuuming - indexing - statistics gathering - existing clustering That's not to say it's not worthwhile to look into, but it's big. All of that aside, a view over unions is possible now: create table u1 (...); create table u2 (...); create table u3 (...); create view uv as (select "A" as partition_key, ... from u1 union all select "B" as partition_key, ... from u2 union all select "C" as partition_key, ... from u3); That keeps the tables in different files on-disk while still allowing you to query against all of them. You need to index them separately and logic is necessary when changing data. Hope that helps. -johnnnnnnnnnn From pgsql-general-owner@postgresql.org Thu Dec 12 19:03:46 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3F46D475ED1; Thu, 12 Dec 2002 19:03:45 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id ADCA2475C8B; Thu, 12 Dec 2002 19:03:44 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 2F9A1D600; Thu, 12 Dec 2002 16:03:47 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 254E45C02; Thu, 12 Dec 2002 16:03:47 -0800 (PST) Date: Thu, 12 Dec 2002 16:03:47 -0800 (PST) From: Stephan Szabo To: johnnnnnn Cc: , Subject: Re: [PERFORM] CLUSTER command In-Reply-To: <20021212230002.GC8278@performics.com> Message-ID: <20021212154146.T13718-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/681 X-Sequence-Number: 34596 On Thu, 12 Dec 2002, johnnnnnn wrote: > On Thu, Dec 12, 2002 at 05:39:44PM -0500, Jean-Luc Lachance wrote: > > Let's create a new command: > > > > PARTITION
ON > > > Because the table file is already extended (2G limit) using > > different files extension (.N) > > how complicated (modifying the code) would it be to have the table > > files split according to the cluster key? > > I think the code changes would be complicated. Just at a 30-second > consideration, this would need to touch: > - all sql (selects, inserts, updates, deletes) > - vacuuming > - indexing > - statistics gathering > - existing clustering I think his idea was to treat it similarly to the way that the system treats tables >2G with .N files. The only thing is that I believe the code that deals with that wouldn't be particularly easy to change to do it though, but I've only taken a cursory look at what I think is the place that does that(storage/smgr/md.c). Some sort of good partitioning system would be nice though. > create table u1 (...); > create table u2 (...); > create table u3 (...); > > create view uv as (select "A" as partition_key, ... from u1 > union all > select "B" as partition_key, ... from u2 > union all > select "C" as partition_key, ... from u3); > > That keeps the tables in different files on-disk while still allowing > you to query against all of them. You need to index them separately > and logic is necessary when changing data. Unfortunately, I think that the optimizer isn't going to do what you'd hope here and scan only the appropriate table if you were to say partition_key='A' and foo='bar'. I'd love to be shown that I'm wrong, but the best I could see hoping for would be that if partition_key was part of u1-u3 and there was an index on partition_key,foo that it could use that and do minimal work on the other tables. In addition, doing something like the above is a nightmare if you don't know beforehand what the partitions should be (for example if you know there aren't alot of distinct values, but you don't know what they are) or for that matter even with 10-15 partitions, writing the rules and such would probably be really error prone. From pgsql-general-owner@postgresql.org Thu Dec 12 19:47:24 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D1B87475DB3; Thu, 12 Dec 2002 19:47:22 -0500 (EST) Received: from alvh.no-ip.org (CM-lcon6-148-43.cm.vtr.net [200.83.148.43]) by postgresql.org (Postfix) with ESMTP id 24081475C8B; Thu, 12 Dec 2002 19:47:22 -0500 (EST) Received: by alvh.no-ip.org (Postfix, from userid 500) id 4D37A80241; Thu, 12 Dec 2002 21:47:19 -0300 (CLST) Date: Thu, 12 Dec 2002 21:47:19 -0300 From: Alvaro Herrera To: Stephan Szabo Cc: johnnnnnn , pgsql-performance@postgresql.org, pgsql-general@postgresql.org Subject: Re: [PERFORM] CLUSTER command Message-ID: <20021213004719.GA19217@dcc.uchile.cl> References: <20021212230002.GC8278@performics.com> <20021212154146.T13718-100000@megazone23.bigpanda.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20021212154146.T13718-100000@megazone23.bigpanda.com> User-Agent: Mutt/1.4i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/682 X-Sequence-Number: 34597 On Thu, Dec 12, 2002 at 04:03:47PM -0800, Stephan Szabo wrote: > On Thu, 12 Dec 2002, johnnnnnn wrote: > > > I think the code changes would be complicated. Just at a 30-second > > consideration, this would need to touch: > > - all sql (selects, inserts, updates, deletes) > > - vacuuming > > - indexing > > - statistics gathering > > - existing clustering > > I think his idea was to treat it similarly to the way that the > system treats tables >2G with .N files. The only thing is that > I believe the code that deals with that wouldn't be particularly > easy to change to do it though, but I've only taken a cursory look at > what I think is the place that does that(storage/smgr/md.c). Some sort of > good partitioning system would be nice though. I don't think this is doable without a huge amount of work. The storage manager doesn't know anything about what is in a page, let alone a tuple. And it shouldn't, IMHO. Upper levels don't know how are pages organized in disk; they don't know about .1 segments and so on, and they shouldn't. I think this kind of partition doesn't buy too much. I would really like to have some kind of auto-clustering, but it should be implemented in some upper level; e.g., by leaving some empty space in pages for future tuples, and arranging the whole heap again when it runs out of free space somewhere. Note that this is very far from the storage manager. -- Alvaro Herrera () "La realidad se compone de muchos sue�os, todos ellos diferentes, pero en cierto aspecto, parecidos..." (Yo, hablando de sue�os er�ticos) From pgsql-general-owner@postgresql.org Thu Dec 12 20:06:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DBE77475ED1; Thu, 12 Dec 2002 20:06:38 -0500 (EST) Received: from clearmetrix.com (unknown [209.92.142.67]) by postgresql.org (Postfix) with ESMTP id 1961C475DB3; Thu, 12 Dec 2002 20:06:38 -0500 (EST) Received: from clearmetrix.com (chw.muvpn.clearmetrix.com [172.16.1.3]) by clearmetrix.com (8.11.6/linuxconf) with ESMTP id gBD16cx24508; Thu, 12 Dec 2002 20:06:38 -0500 Message-ID: <3DF9329B.1020908@clearmetrix.com> Date: Thu, 12 Dec 2002 20:06:35 -0500 From: "Charles H. Woloszynski" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alvaro Herrera Cc: pgsql-performance@postgresql.org, pgsql-general@postgresql.org Subject: Re: [PERFORM] CLUSTER command References: <20021212230002.GC8278@performics.com> <20021212154146.T13718-100000@megazone23.bigpanda.com> <20021213004719.GA19217@dcc.uchile.cl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/683 X-Sequence-Number: 34598 I think Oracle does something like this with its clustering. You set a %fill and Oracle uses this when doing inserts into a segment and when to add a new one. There is also some control over the grouping of data within a page. I don't have an Oracle manual present, but I think the clustering works on a specific index. I agree that adding auto-clustering would be a very good thing and that we can learn about functionality by studying what other applications have already done and if/how those strategies were successful. Charlie Alvaro Herrera wrote: >On Thu, Dec 12, 2002 at 04:03:47PM -0800, Stephan Szabo wrote: > > >>On Thu, 12 Dec 2002, johnnnnnn wrote: >> >> >> >>>I think the code changes would be complicated. Just at a 30-second >>>consideration, this would need to touch: >>>- all sql (selects, inserts, updates, deletes) >>>- vacuuming >>>- indexing >>>- statistics gathering >>>- existing clustering >>> >>> >>I think his idea was to treat it similarly to the way that the >>system treats tables >2G with .N files. The only thing is that >>I believe the code that deals with that wouldn't be particularly >>easy to change to do it though, but I've only taken a cursory look at >>what I think is the place that does that(storage/smgr/md.c). Some sort of >>good partitioning system would be nice though. >> >> > >I don't think this is doable without a huge amount of work. The storage >manager doesn't know anything about what is in a page, let alone a >tuple. And it shouldn't, IMHO. Upper levels don't know how are pages >organized in disk; they don't know about .1 segments and so on, and they >shouldn't. > >I think this kind of partition doesn't buy too much. I would really >like to have some kind of auto-clustering, but it should be implemented >in some upper level; e.g., by leaving some empty space in pages for >future tuples, and arranging the whole heap again when it runs out of >free space somewhere. Note that this is very far from the storage >manager. > > > -- Charles H. Woloszynski ClearMetrix, Inc. 115 Research Drive Bethlehem, PA 18015 tel: 610-419-2210 x400 fax: 240-371-3256 web: www.clearmetrix.com From pgsql-general-owner@postgresql.org Thu Dec 12 21:11:48 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 84829475EA9; Thu, 12 Dec 2002 21:11:47 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 02806475E14; Thu, 12 Dec 2002 21:11:47 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 68C47D618; Thu, 12 Dec 2002 18:11:50 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 5E6935C02; Thu, 12 Dec 2002 18:11:50 -0800 (PST) Date: Thu, 12 Dec 2002 18:11:50 -0800 (PST) From: Stephan Szabo To: Alvaro Herrera Cc: johnnnnnn , , Subject: Re: [PERFORM] CLUSTER command In-Reply-To: <20021213004719.GA19217@dcc.uchile.cl> Message-ID: <20021212175208.B15052-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/686 X-Sequence-Number: 34601 On Thu, 12 Dec 2002, Alvaro Herrera wrote: > On Thu, Dec 12, 2002 at 04:03:47PM -0800, Stephan Szabo wrote: > > On Thu, 12 Dec 2002, johnnnnnn wrote: > > > > > I think the code changes would be complicated. Just at a 30-second > > > consideration, this would need to touch: > > > - all sql (selects, inserts, updates, deletes) > > > - vacuuming > > > - indexing > > > - statistics gathering > > > - existing clustering > > > > I think his idea was to treat it similarly to the way that the > > system treats tables >2G with .N files. The only thing is that > > I believe the code that deals with that wouldn't be particularly > > easy to change to do it though, but I've only taken a cursory look at > > what I think is the place that does that(storage/smgr/md.c). Some sort of > > good partitioning system would be nice though. > > I don't think this is doable without a huge amount of work. The storage > manager doesn't know anything about what is in a page, let alone a > tuple. And it shouldn't, IMHO. Upper levels don't know how are pages > organized in disk; they don't know about .1 segments and so on, and they > shouldn't. Which is part of why I said it wouldn't be easy to change to do that, there's no good way to communicate that information. Like I said, I didn't look deeply, but I had to look though, because you can never tell with bits of old university code to do mostly what you want that haven't been exercised in years floating around. > I think this kind of partition doesn't buy too much. I would really > like to have some kind of auto-clustering, but it should be implemented > in some upper level; e.g., by leaving some empty space in pages for > future tuples, and arranging the whole heap again when it runs out of > free space somewhere. Note that this is very far from the storage > manager. Auto clustering would be nice. I think Jean-Luc's suggested partitioning mechanism has certain usage patterns that it's a win for and most others that it's not. Since the usage pattern I can think of (very large table with a small number of breakdowns where your conditions are primarily on those breakdowns) aren't even remotely in the domain of things I've worked with, I can't say whether it'd end up really being a win to avoid the index reads for the table. From pgsql-performance-owner@postgresql.org Thu Dec 12 22:18:04 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 916C6475C8B for ; Thu, 12 Dec 2002 22:18:03 -0500 (EST) Received: from phaedrusdeinus.org (dsl092-130-239.chi1.dsl.speakeasy.net [66.92.130.239]) by postgresql.org (Postfix) with SMTP id BB589475B85 for ; Thu, 12 Dec 2002 22:18:02 -0500 (EST) Received: (qmail 9028 invoked by uid 1001); 13 Dec 2002 03:22:38 -0000 Date: Thu, 12 Dec 2002 21:22:38 -0600 From: johnnnnnn To: pgsql-performance@postgresql.org Subject: automated index suggestor -- request for comment Message-ID: <20021213032238.GC8912@performics.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.1i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/143 X-Sequence-Number: 559 The manual is pretty sparse on advice regarding indices. Plenty of good feature documentation, but not much about when and where an index is appropriate (except a suggestion that multi-column indices should be avoided). Of course, the ultimate arbiter of which indices are used is the planner/optimizer. If i could somehow convince the optimizer to consider indices that don't yet exist, it could tell me which would give the greatest benefit should i add them. So, i'm writing for two reasons. First, i want to gauge interest in this tool. Is this something that people would find useful? Second, i am looking to solicit some advice. Is this project even feasible? If so, where would be the best place to start? My assumption has been that i would need to hack into the current code for determining index paths, and spoof it somehow, but is that possible without actually creating the indices? Any and all feedback welcome. -johnnnnnnnnnn From pgsql-performance-owner@postgresql.org Fri Dec 13 05:11:48 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 363DE475C8B for ; Fri, 13 Dec 2002 05:11:47 -0500 (EST) Received: from localhost.localdomain (sein.itera.ee [194.126.109.126]) by postgresql.org (Postfix) with ESMTP id 2D6BD475925 for ; Fri, 13 Dec 2002 05:11:46 -0500 (EST) Received: (from hannu@localhost) by localhost.localdomain (8.11.6/8.11.6) id gBDC5aG20639; Fri, 13 Dec 2002 12:05:36 GMT X-Authentication-Warning: localhost.localdomain: hannu set sender to hannu@tm.ee using -f Subject: Re: automated index suggestor -- request for comment From: Hannu Krosing To: johnnnnnn Cc: pgsql-performance@postgresql.org In-Reply-To: <20021213032238.GC8912@performics.com> References: <20021213032238.GC8912@performics.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039781136.19813.16.camel@huli> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 13 Dec 2002 12:05:36 +0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/144 X-Sequence-Number: 560 On Fri, 2002-12-13 at 03:22, johnnnnnn wrote: > The manual is pretty sparse on advice regarding indices. Plenty of > good feature documentation, but not much about when and where an index > is appropriate (except a suggestion that multi-column indices should > be avoided). > > Of course, the ultimate arbiter of which indices are used is the > planner/optimizer. If i could somehow convince the optimizer to > consider indices that don't yet exist, it could tell me which would > give the greatest benefit should i add them. the generated index names should be self-explaining or else we would have to change EXPLAIN output code as well, just to tell what the actual index definition was. That could become the EXPLAIN SPECULATE command ? > So, i'm writing for two reasons. First, i want to gauge interest in > this tool. Is this something that people would find useful? Sure it would be helpful. > Second, i am looking to solicit some advice. Is this project even > feasible? As tom recently wrote on this list, no statistics is _gathered_ base on existence of indexes, so pretending that they are there should be limited just to planner changes plus a way to tell the planner to do it. > If so, where would be the best place to start? My assumption > has been that i would need to hack into the current code for > determining index paths, and spoof it somehow, but is that possible > without actually creating the indices? Either with or without real indexes, it's all just code ;) In worst case you could generate the entries in pg_class table without building the actual index and then drop or rollback when the explain is ready. Of course you could just determine all possibly useful indexes and generate then anyhow an then drop them if they were not used ;) -- Hannu Krosing From pgsql-performance-owner@postgresql.org Fri Dec 13 08:27:18 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 65276475C8B for ; Fri, 13 Dec 2002 08:27:17 -0500 (EST) Received: from themode.com (themode.com [161.58.169.198]) by postgresql.org (Postfix) with ESMTP id 892F4475956 for ; Fri, 13 Dec 2002 08:27:16 -0500 (EST) Received: from localhost (mode@localhost) by themode.com (8.11.6) id gBDDRJG84362; Fri, 13 Dec 2002 08:27:19 -0500 (EST) Date: Fri, 13 Dec 2002 08:27:19 -0500 (EST) From: brew@theMode.com X-X-Sender: mode@themode.com To: pgsql-performance@postgresql.org Subject: Capping CPU usage? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/145 X-Sequence-Number: 561 Josh..... > I had a new question from a client: is it possible to "cap" CPU usage > for PostgreSQL running on Linux? I remember reading a few months ago about a virtual freebsd OS that divides the memory and cpu up between different users. Although this is not Linux proper (or improper) it is one way of doing it. I searched for a few minutes and was unable to find the url, it was something like virtualFreeBSD.org. I've been running on a virtual FreeBSD server for years from iserver, now verio. Each user has their own apache conf, sendmail, etc. and they claim to divide up memory and cpu usage. I am not sure if virtualFreeBSD is the same or different product and whether it would be useful for you, but it's something to consider. brew From pgsql-performance-owner@postgresql.org Fri Dec 13 09:50:37 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C160D475956 for ; Fri, 13 Dec 2002 09:50:33 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 98015476EA2 for ; Fri, 13 Dec 2002 09:49:50 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBDEnrpd009275; Fri, 13 Dec 2002 09:49:53 -0500 (EST) To: Hannu Krosing Cc: johnnnnnn , pgsql-performance@postgresql.org Subject: Re: automated index suggestor -- request for comment In-reply-to: <1039781136.19813.16.camel@huli> References: <20021213032238.GC8912@performics.com> <1039781136.19813.16.camel@huli> Comments: In-reply-to Hannu Krosing message dated "13 Dec 2002 12:05:36 +0000" Date: Fri, 13 Dec 2002 09:49:53 -0500 Message-ID: <9274.1039790993@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/146 X-Sequence-Number: 562 Hannu Krosing writes: > That could become the EXPLAIN SPECULATE command ? [ snicker... ] Seriously, it wouldn't be hard to inject a slew of phony index definitions into the planner to see what it comes up with. You just have to cons up an IndexOptInfo record, the planner will be none the wiser. The tricky part is deciding which indexes are even worth expending planner cycles on. ("Make 'em all" doesn't seem very practical when you consider multi-column or functional indexes.) Also, I don't see any reasonable way to automatically suggest partial indexes; certainly not on the basis of individual queries. The big boys approach this sort of problem with "workload analysis" tools, which start from a whole collection of sample queries not just one. I don't think EXPLAIN applied to individual queries can hope to produce similarly useful results. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 13 10:17:01 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 336E2476E83 for ; Fri, 13 Dec 2002 10:17:01 -0500 (EST) Received: from phaedrusdeinus.org (dsl092-130-239.chi1.dsl.speakeasy.net [66.92.130.239]) by postgresql.org (Postfix) with SMTP id F0EAF476D6E for ; Fri, 13 Dec 2002 10:16:11 -0500 (EST) Received: (qmail 10508 invoked by uid 1001); 13 Dec 2002 15:20:54 -0000 Date: Fri, 13 Dec 2002 09:20:54 -0600 From: johnnnnnn To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: automated index suggestor -- request for comment Message-ID: <20021213152054.GD8278@performics.com> References: <20021213032238.GC8912@performics.com> <1039781136.19813.16.camel@huli> <9274.1039790993@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9274.1039790993@sss.pgh.pa.us> User-Agent: Mutt/1.5.1i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/148 X-Sequence-Number: 564 On Fri, Dec 13, 2002 at 09:49:53AM -0500, Tom Lane wrote: > Hannu Krosing writes: > > That could become the EXPLAIN SPECULATE command ? > > [ snicker... ] Seriously, it wouldn't be hard to inject a slew of > phony index definitions into the planner to see what it comes up > with. You just have to cons up an IndexOptInfo record, the planner > will be none the wiser. That's good news. The easier it is, the more likely i am to actually get it working and available to people. > The tricky part is deciding which indexes are even worth expending > planner cycles on. ("Make 'em all" doesn't seem very practical when > you consider multi-column or functional indexes.) Agreed. But for a first development iteration, "Make 'em all" could certainly include the combinatorial explosion of all single- and multi-column indices. It might be slow as a dog, but it would exist. > The big boys approach this sort of problem with "workload analysis" > tools, which start from a whole collection of sample queries not > just one. I don't think EXPLAIN applied to individual queries can > hope to produce similarly useful results. Again, agreed. My intent was to start with something simple which could only deal with one query at a time, and then build a more robust tool from that point. That said, i wasn't planning on grafting onto the EXPLAIN syntax, but rather creating a new SUGGEST command, which could take a query or eventually a workload file. The other option was to decouple it from pg proper and have an independent application to live in contrib/ or gborg. -johnnnnnnnnnnn From pgsql-performance-owner@postgresql.org Fri Dec 13 10:34:12 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2B659476FE9 for ; Fri, 13 Dec 2002 10:34:11 -0500 (EST) Received: from phaedrusdeinus.org (dsl092-130-239.chi1.dsl.speakeasy.net [66.92.130.239]) by postgresql.org (Postfix) with SMTP id 13883476E5D for ; Fri, 13 Dec 2002 10:32:36 -0500 (EST) Received: (qmail 10542 invoked by uid 1001); 13 Dec 2002 15:37:19 -0000 Date: Fri, 13 Dec 2002 09:37:19 -0600 From: johnnnnnn To: Hannu Krosing Cc: pgsql-performance@postgresql.org Subject: Re: automated index suggestor -- request for comment Message-ID: <20021213153719.GE8278@performics.com> References: <20021213032238.GC8912@performics.com> <1039781136.19813.16.camel@huli> <20021213095637.4a2b9db4.gry@ll.mit.edu> <1039798832.19813.28.camel@huli> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1039798832.19813.28.camel@huli> User-Agent: Mutt/1.5.1i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/149 X-Sequence-Number: 565 On Fri, Dec 13, 2002 at 05:00:32PM +0000, Hannu Krosing wrote: > On Fri, 2002-12-13 at 14:56, george young wrote: > > > Of course you could just determine all possibly useful indexes > > > and generate then anyhow an then drop them if they were not used > > > ;) > > > > Why not! At least for selects, this seems like the ideal. For > > insert and update, you have to deal with updating the superfluous > > indexes -- does the planner include index updating in its work > > estimates? Well, i had a few reasons i didn't want to *actually* create the indices: 1- Disk space. If it's evaluating all indices, including multi-column indices, that ends up being a significant space drain. 2- Time. Creating indices can take a while for big tables (again, moreso for multi-column indices). 3- Usability on running systems. If i can eliminate actual index creation, it won't tie up disk access on systems that are already dealing with high load. > At least I think we don't optimize the plan for different index > access patterns for updating indexes. I don't think that's the case either, which makes it more difficult to estimate negative cost of index creation. Not sure how i'll deal with that except by (for now) ignoring it. -johnnnnnnnnnnn From pgsql-general-owner@postgresql.org Fri Dec 13 11:42:49 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A5A3947703A; Fri, 13 Dec 2002 11:42:48 -0500 (EST) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id F342B476FFB; Fri, 13 Dec 2002 11:42:22 -0500 (EST) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id LAA15816; Fri, 13 Dec 2002 11:42:08 -0500 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma015812; Fri, 13 Dec 02 11:41:41 -0500 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id LAA08179; Fri, 13 Dec 2002 11:40:09 -0500 Message-ID: <3DFA0DF1.DE3B5462@nsd.ca> Date: Fri, 13 Dec 2002 11:42:25 -0500 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: Stephan Szabo Cc: johnnnnnn , pgsql-performance@postgresql.org, pgsql-general@postgresql.org Subject: Re: [PERFORM] CLUSTER command References: <20021212154146.T13718-100000@megazone23.bigpanda.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/703 X-Sequence-Number: 34618 Stephan, Someone commented earlier about the separation/abstraction of the storage manager. I agree that it should not be done at the storage level. Maybe a better idea, would be to create a new pg_partition table that would have the functionality of an index on the key field and also be used to point to a file/table ID. That would be alot more work to code on thet planner though. If a newly inherited table could also inherite the constraints and indecies of its parent maybe things would be easier. JLL Stephan Szabo wrote: > > On Thu, 12 Dec 2002, johnnnnnn wrote: > > > On Thu, Dec 12, 2002 at 05:39:44PM -0500, Jean-Luc Lachance wrote: > > > Let's create a new command: > > > > > > PARTITION
ON > > > > > Because the table file is already extended (2G limit) using > > > different files extension (.N) > > > how complicated (modifying the code) would it be to have the table > > > files split according to the cluster key? > > > > > I think the code changes would be complicated. Just at a 30-second > > consideration, this would need to touch: > > - all sql (selects, inserts, updates, deletes) > > - vacuuming > > - indexing > > - statistics gathering > > - existing clustering > > I think his idea was to treat it similarly to the way that the > system treats tables >2G with .N files. The only thing is that > I believe the code that deals with that wouldn't be particularly > easy to change to do it though, but I've only taken a cursory look at > what I think is the place that does that(storage/smgr/md.c). Some sort of > good partitioning system would be nice though. > > > create table u1 (...); > > create table u2 (...); > > create table u3 (...); > > > > create view uv as (select "A" as partition_key, ... from u1 > > union all > > select "B" as partition_key, ... from u2 > > union all > > select "C" as partition_key, ... from u3); > > > > That keeps the tables in different files on-disk while still allowing > > you to query against all of them. You need to index them separately > > and logic is necessary when changing data. > > Unfortunately, I think that the optimizer isn't going to do what you'd > hope here and scan only the appropriate table if you were to say > partition_key='A' and foo='bar'. I'd love to be shown that I'm wrong, but > the best I could see hoping for would be that if partition_key was part of > u1-u3 and there was an index on partition_key,foo that it could use that > and do minimal work on the other tables. > > In addition, doing something like the above is a nightmare if you don't > know beforehand what the partitions should be (for example if you know > there aren't alot of distinct values, but you don't know what they are) or > for that matter even with 10-15 partitions, writing the rules and such > would probably be really error prone. > > ---------------------------(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 Dec 13 10:07:18 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4A768476FC2 for ; Fri, 13 Dec 2002 10:07:17 -0500 (EST) Received: from localhost.localdomain (sein.itera.ee [194.126.109.126]) by postgresql.org (Postfix) with ESMTP id 60282476F23 for ; Fri, 13 Dec 2002 10:06:42 -0500 (EST) Received: (from hannu@localhost) by localhost.localdomain (8.11.6/8.11.6) id gBDH0Xi21297; Fri, 13 Dec 2002 17:00:33 GMT X-Authentication-Warning: localhost.localdomain: hannu set sender to hannu@tm.ee using -f Subject: Re: automated index suggestor -- request for comment From: Hannu Krosing To: gry@ll.mit.edu Cc: "pgsql-performance@postgresql.org" In-Reply-To: <20021213095637.4a2b9db4.gry@ll.mit.edu> References: <20021213032238.GC8912@performics.com> <1039781136.19813.16.camel@huli> <20021213095637.4a2b9db4.gry@ll.mit.edu> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039798832.19813.28.camel@huli> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 13 Dec 2002 17:00:32 +0000 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/147 X-Sequence-Number: 563 I cc'b back to list, hope this is ok? On Fri, 2002-12-13 at 14:56, george young wrote: > On 13 Dec 2002 12:05:36 +0000 > Hannu Krosing wrote: > > > On Fri, 2002-12-13 at 03:22, johnnnnnn wrote: > > > > In worst case you could generate the entries in pg_class table without > > building the actual index and then drop or rollback when the explain is > > ready. > > > --> Of course you could just determine all possibly useful indexes and <-- > --> generate then anyhow an then drop them if they were not used ;) <-- > > Why not! At least for selects, this seems like the ideal. For insert > and update, you have to deal with updating the superfluous indexes -- > does the planner include index updating in its work estimates? Probably not - the work should be almost the same (modulo cached status of index pages) for any plan. At least I think we don't optimize the plan for different index access patterns for updating indexes. > > For queries > that use functions in the where clause, you'd have to parse enough to know > to include indexes on the functions (I know-- the last time I said "all I > have to do is parse ..." I was really sorry later...). -- Hannu Krosing From pgsql-performance-owner@postgresql.org Fri Dec 13 13:19:08 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D5547476FB2 for ; Fri, 13 Dec 2002 13:19:06 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 723C347708D for ; Fri, 13 Dec 2002 13:18:15 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2280254; Fri, 13 Dec 2002 10:18:40 -0800 From: "Josh Berkus" Subject: Re: Capping CPU usage? To: brew@theMode.com, pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Fri, 13 Dec 2002 10:18:40 -0800 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/151 X-Sequence-Number: 567 Brew, > I've been running on a virtual FreeBSD server for years from iserver, > now > verio. Each user has their own apache conf, sendmail, etc. and they > claim > to divide up memory and cpu usage. I am not sure if virtualFreeBSD > is the > same or different product and whether it would be useful for you, but > it's > something to consider. Interesting idea. Sadly for this client, they are trying to cap CPU usage because they are short on system resources, so virtualization is not an option. However, it would be a possiblilty to keep in mind for other projects. -Josh From pgsql-performance-owner@postgresql.org Fri Dec 13 14:53:04 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5F2464770B3 for ; Fri, 13 Dec 2002 14:53:02 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id CBFAC477122 for ; Fri, 13 Dec 2002 14:52:04 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2280431 for pgsql-performance@postgresql.org; Fri, 13 Dec 2002 11:52:31 -0800 Content-Type: text/plain; charset="us-ascii" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Odd Sort/Limit/Max Problem Date: Fri, 13 Dec 2002 11:55:51 -0800 X-Mailer: KMail [version 1.4] MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212131155.51985.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/152 X-Sequence-Number: 568 Folks,=20 Consider this performance quandry brought to me by Elein, which I can replc= ate=20 in 7.2.3 and in 7.4 devel: case_clients is a medium-large table with about 110,000 rows. The field=20 date_resolved is a timestamp field which is indexed and allows nulls (in=20 fact, is null for 40% of entries). First, as expected, a regular aggregate is slow: jwnet=3D> explain analyze select max(date_resolved) from case_clients; NOTICE: QUERY PLAN: Aggregate (cost=3D3076.10..3076.10 rows=3D1 width=3D4) (actual time=3D484.= 24..484.24=20 rows=3D1 loops=3D1) -> Seq Scan on case_clients (cost=3D0.00..2804.48 rows=3D108648 width= =3D4)=20 (actual time=3D0.08..379.81 rows=3D108648 loops=3D1) Total runtime: 484.44 msec So we use the workaround standard for PostgreSQL: jwnet=3D> explain analyze select date_resolved from case_clients order by= =20 date_resolved desc limit 1; NOTICE: QUERY PLAN: Limit (cost=3D0.00..1.50 rows=3D1 width=3D4) (actual time=3D0.22..0.23 row= s=3D1=20 loops=3D1) -> Index Scan Backward using idx_caseclients_resolved on case_clients=20= =20 (cost=3D0.00..163420.59 rows=3D108648 width=3D4) (actual time=3D0.21..0.22 = rows=3D2=20 loops=3D1) Total runtime: 0.33 msec ... which is fast, but returns NULL, since nulls sort to the bottom! So we= =20 add IS NOT NULL: jwnet=3D> explain analyze select date_resolved from case_clients where=20 date_resolved is not null order by date_resolved desc limit 1; NOTICE: QUERY PLAN: Limit (cost=3D0.00..4.06 rows=3D1 width=3D4) (actual time=3D219.63..219.64= rows=3D1=20 loops=3D1) -> Index Scan Backward using idx_caseclients_resolved on case_clients=20= =20 (cost=3D0.00..163420.59 rows=3D40272 width=3D4) (actual time=3D219.62..219.= 62 rows=3D2=20 loops=3D1) Total runtime: 219.76 msec Aieee! Almost as slow as the aggregate! Now, none of those times is huge on this test database, but on a larger=20 database (> 1million rows) the performance problem is much worse. For some= =20 reason, the backward index scan seems to have to transverse all of the NULL= s=20 before selecting a value. I find this peculiar, as I was under the=20 impression that NULLs were not indexed. What's going on here? --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Dec 13 15:10:55 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2CEA44770AA for ; Fri, 13 Dec 2002 15:10:55 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 4740A477113 for ; Fri, 13 Dec 2002 15:10:23 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 25AAAD619; Fri, 13 Dec 2002 12:10:20 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 1B5D75C02; Fri, 13 Dec 2002 12:10:20 -0800 (PST) Date: Fri, 13 Dec 2002 12:10:20 -0800 (PST) From: Stephan Szabo To: Josh Berkus Cc: Subject: Re: Odd Sort/Limit/Max Problem In-Reply-To: <200212131155.51985.josh@agliodbs.com> Message-ID: <20021213120738.D25935-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/153 X-Sequence-Number: 569 On Fri, 13 Dec 2002, Josh Berkus wrote: > First, as expected, a regular aggregate is slow: > So we use the workaround standard for PostgreSQL: > > ... which is fast, but returns NULL, since nulls sort to the bottom! So we > add IS NOT NULL: > > jwnet=> explain analyze select date_resolved from case_clients where > date_resolved is not null order by date_resolved desc limit 1; > NOTICE: QUERY PLAN: > > Limit (cost=0.00..4.06 rows=1 width=4) (actual time=219.63..219.64 rows=1 > loops=1) > -> Index Scan Backward using idx_caseclients_resolved on case_clients > (cost=0.00..163420.59 rows=40272 width=4) (actual time=219.62..219.62 rows=2 > loops=1) > Total runtime: 219.76 msec > > Aieee! Almost as slow as the aggregate! I'd suggest trying a partial index on date_resolved where date_resolve is not null. In my simple tests on about 200,000 rows of ints where 50% are null that sort of index cut the runtime on my machine from 407.66 msec to 0.15 msec. From pgsql-performance-owner@postgresql.org Fri Dec 13 15:24:26 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 23E0047704E for ; Fri, 13 Dec 2002 15:24:25 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 5815F477045 for ; Fri, 13 Dec 2002 15:24:24 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBDKONpd023243; Fri, 13 Dec 2002 15:24:23 -0500 (EST) To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org Subject: Re: Odd Sort/Limit/Max Problem In-reply-to: <200212131155.51985.josh@agliodbs.com> References: <200212131155.51985.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Fri, 13 Dec 2002 11:55:51 -0800" Date: Fri, 13 Dec 2002 15:24:23 -0500 Message-ID: <23242.1039811063@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/154 X-Sequence-Number: 570 Josh Berkus writes: > Now, none of those times is huge on this test database, but on a larger > database (> 1million rows) the performance problem is much worse. For some > reason, the backward index scan seems to have to transverse all of the NULLs > before selecting a value. Correct. You lose, if there are a lot of nulls. Unfortunately, the "IS NOT NULL" clause isn't considered an indexable operator and so the indexscan has no idea that it shouldn't return the null rows. If it could just traverse past them in the index, this example wouldn't be so bad, but it goes out and fetches the heap rows before discarding 'em :-( > I find this peculiar, as I was under the > impression that NULLs were not indexed. Not correct. btrees index NULLs, as they must do in order to have correct behavior for multicolumn indexes. I think it would work to instead do something like select date_resolved from case_clients where date_resolved < 'infinity' order by date_resolved desc limit 1; since then the indexscan will get a qualifier condition that will allow it to discard the nulls. In fact, I think this will even prevent having to traverse past the nulls in the index --- the original form starts the indexscan at the index end, but this should do a btree descent search to exactly the place you want. Note that the where-clause has to match the scan direction (> or >= for ASC, < or <= for DESC) so that it looks like a "start here" condition to btree. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 13 17:22:25 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5B951475EE4 for ; Fri, 13 Dec 2002 17:22:25 -0500 (EST) Received: from rh72.home.ee (adsl1030.estpak.ee [213.168.29.11]) by postgresql.org (Postfix) with ESMTP id 6A6E5475B47 for ; Fri, 13 Dec 2002 17:22:24 -0500 (EST) Received: from rh72.home.ee (localhost.localdomain [127.0.0.1]) by rh72.home.ee (8.12.5/8.12.5) with ESMTP id gBDMMD2N002427; Sat, 14 Dec 2002 03:22:13 +0500 Received: (from hannu@localhost) by rh72.home.ee (8.12.5/8.12.5/Submit) id gBDMM9A4002425; Sat, 14 Dec 2002 03:22:09 +0500 X-Authentication-Warning: rh72.home.ee: hannu set sender to hannu@tm.ee using -f Subject: Re: Odd Sort/Limit/Max Problem From: Hannu Krosing To: Tom Lane Cc: josh@agliodbs.com, pgsql-performance@postgresql.org In-Reply-To: <23242.1039811063@sss.pgh.pa.us> References: <200212131155.51985.josh@agliodbs.com> <23242.1039811063@sss.pgh.pa.us> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039818128.2391.7.camel@rh72.home.ee> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 14 Dec 2002 03:22:08 +0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/155 X-Sequence-Number: 571 Tom Lane kirjutas L, 14.12.2002 kell 01:24: > Josh Berkus writes: > > Now, none of those times is huge on this test database, but on a larger > > database (> 1million rows) the performance problem is much worse. For some > > reason, the backward index scan seems to have to transverse all of the NULLs > > before selecting a value. > > Correct. You lose, if there are a lot of nulls. Unfortunately, the > "IS NOT NULL" clause isn't considered an indexable operator and so the > indexscan has no idea that it shouldn't return the null rows. If it > could just traverse past them in the index, this example wouldn't be so > bad, but it goes out and fetches the heap rows before discarding 'em :-( > > > I find this peculiar, as I was under the > > impression that NULLs were not indexed. > > Not correct. btrees index NULLs, as they must do in order to have > correct behavior for multicolumn indexes. I've heard this befoe, but this is something I've never understood - why do you have to index _single_ null's in order to behave correctly for multi-column index. Is it that postgres thinks that tuple of several nulls is the same as null ? Is it just that nulls need to have an ordering and that this fact has somehow leaked down to actually being stored in the index ? I don't have anything against nulls being indexed - in a table where nulls have about the same frequency as other values it may actually be useful (if indexes were used to find IS NULL tuples) -- Hannu Krosing From pgsql-hackers-owner@postgresql.org Fri Dec 13 19:00:45 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0269C475921; Fri, 13 Dec 2002 19:00:44 -0500 (EST) Received: from office.nextbus.com (ns.nextbus.com [64.164.28.194]) by postgresql.org (Postfix) with ESMTP id 714F84758E1; Fri, 13 Dec 2002 19:00:43 -0500 (EST) Received: from visor.corp.nextbus.com (visor.corp.nextbus.com [192.168.1.109]) by office.nextbus.com (Postfix) with ESMTP id 6A09B4F883; Fri, 13 Dec 2002 16:00:44 -0800 (PST) Received: from localhost (laurette@localhost) by visor.corp.nextbus.com (8.11.2/8.8.7) with ESMTP id gBE00jd19867; Fri, 13 Dec 2002 16:00:45 -0800 X-Authentication-Warning: visor.corp.nextbus.com: laurette owned process doing -bs Date: Fri, 13 Dec 2002 16:00:45 -0800 (PST) From: Laurette Cisneros X-X-Sender: laurette@visor.corp.nextbus.com To: Josh Berkus Cc: sszabo@megazone23.bigpanda.com, , Subject: Re: Fwd: Re: [PERFORM] Odd Sort/Limit/Max Problem In-Reply-To: <200212131445.37863.josh@agliodbs.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/759 X-Sequence-Number: 33214 Thank you for a good workaround. Even BETTER would be to fix the aggregates so workarounds wouldn't have to be found. Thanks again, L. On Fri, 13 Dec 2002, Josh Berkus wrote: > > > ---------- Forwarded Message ---------- > > Subject: Re: [PERFORM] Odd Sort/Limit/Max Problem > Date: Fri, 13 Dec 2002 12:10:20 -0800 (PST) > From: Stephan Szabo > To: Josh Berkus > Cc: > > On Fri, 13 Dec 2002, Josh Berkus wrote: > > > First, as expected, a regular aggregate is slow: > > > So we use the workaround standard for PostgreSQL: > > > > ... which is fast, but returns NULL, since nulls sort to the bottom! So we > > add IS NOT NULL: > > > > jwnet=> explain analyze select date_resolved from case_clients where > > date_resolved is not null order by date_resolved desc limit 1; > > NOTICE: QUERY PLAN: > > > > Limit (cost=0.00..4.06 rows=1 width=4) (actual time=219.63..219.64 rows=1 > > loops=1) > > -> Index Scan Backward using idx_caseclients_resolved on case_clients > > (cost=0.00..163420.59 rows=40272 width=4) (actual time=219.62..219.62 rows=2 > > loops=1) > > Total runtime: 219.76 msec > > > > Aieee! Almost as slow as the aggregate! > > I'd suggest trying a partial index on date_resolved where date_resolve is > not null. In my simple tests on about 200,000 rows of ints where 50% are > null that sort of index cut the runtime on my machine from 407.66 msec to > 0.15 msec. > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > > ------------------------------------------------------- > > -- Laurette Cisneros The Database Group (510) 420-3137 NextBus Information Systems, Inc. www.nextbus.com ---------------------------------- There's more to life than just SQL. From pgsql-performance-owner@postgresql.org Fri Dec 13 19:03:58 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1F0B9475F81 for ; Fri, 13 Dec 2002 19:03:58 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id A85514758E1 for ; Fri, 13 Dec 2002 19:03:56 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBE03tpd006353; Fri, 13 Dec 2002 19:03:55 -0500 (EST) To: Hannu Krosing Cc: josh@agliodbs.com, pgsql-performance@postgresql.org Subject: Re: Odd Sort/Limit/Max Problem In-reply-to: <1039818128.2391.7.camel@rh72.home.ee> References: <200212131155.51985.josh@agliodbs.com> <23242.1039811063@sss.pgh.pa.us> <1039818128.2391.7.camel@rh72.home.ee> Comments: In-reply-to Hannu Krosing message dated "14 Dec 2002 03:22:08 +0500" Date: Fri, 13 Dec 2002 19:03:55 -0500 Message-ID: <6352.1039824235@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/157 X-Sequence-Number: 573 Hannu Krosing writes: > Tom Lane kirjutas L, 14.12.2002 kell 01:24: >> Not correct. btrees index NULLs, as they must do in order to have >> correct behavior for multicolumn indexes. > I've heard this befoe, but this is something I've never understood - why > do you have to index _single_ null's in order to behave correctly for > multi-column index. Well, you don't absolutely *have to* index individual nulls, but you do have to support nulls in index entries. The example that motivates this is create table foo (f1 int, f2 int); create index fooi on foo(f1,f2); ... fill table ... select * from foo where f1 = 42; The planner is entitled to implement this as an indexscan using fooi's first column (and ignoring its lower-order column(s)). Now if fooi does not index rows in which f2 is null, you lose, because it may omit rows with f1 = 42 that should have been found by the indexscan. So it *has to* be able to store index entries like (42, NULL). For btree's purposes, the easiest implementation is to say that NULL is an ordinary index entry with a definable sort position (which we chose to define as "after all non-NULL values"). There's no particular value in having a special case for all-NULL index entries, so we don't. GiST is not able to handle all-NULL index entries, so it uses the rule "index all rows in which the first index column is not NULL". This still meets the planner's constraint because we never do an indexscan that uses only lower-order index columns. hash and rtree don't support NULL index entries, but they don't support multicolumn indexes either, so the constraint doesn't apply. > I don't have anything against nulls being indexed - in a table where > nulls have about the same frequency as other values it may actually be > useful (if indexes were used to find IS NULL tuples) At least for btree, it would be nice to someday allow IS NULL as an indexable operator. I haven't thought very hard about how to do that; shoehorning it into the operator class structure looks like it'd be a horrid mess, so it'd probably require some creative klugery :-( > Is it just that nulls need to have an ordering and that this fact has > somehow leaked down to actually being stored in the index ? No, more the other way around: btree assigns an ordering to NULLs because it must do so in order to know where to put them in the index. This is an artifact of btree that happens to "leak upward" ... regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 13 21:15:59 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 46DC3475EE4 for ; Fri, 13 Dec 2002 21:15:58 -0500 (EST) Received: from o2.hostbaby.com (o2.hostbaby.com [208.187.29.121]) by postgresql.org (Postfix) with SMTP id 7A3F2475E82 for ; Fri, 13 Dec 2002 21:15:57 -0500 (EST) Received: (qmail 23241 invoked from network); 14 Dec 2002 02:16:06 -0000 Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 14 Dec 2002 02:16:06 -0000 Received: from 216.80.95.13 (Hostbaby Webmail authenticated user typea@l-i-e.com) by www.l-i-e.com with HTTP; Fri, 13 Dec 2002 18:16:06 -0800 (PST) Message-ID: <49719.216.80.95.13.1039832166.squirrel@www.l-i-e.com> Date: Fri, 13 Dec 2002 18:16:06 -0800 (PST) Subject: ~* + LIMIT => infinite time? From: To: In-Reply-To: <1038346393.1958.34.camel@rh72.home.ee> References: <61777.12.249.229.112.1038341633.squirrel@www.l-i-e.com> <1038346393.1958.34.camel@rh72.home.ee> X-Priority: 3 Importance: Normal X-Mailer: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/158 X-Sequence-Number: 574 I looked for a "known bugs" sort of database to search before bugging you guys, but failed to find it... But I am at least asking before I submit a new bug report :-) In version 7.1.3 on a Linux box: A particularly long, nasty query works "just fine" (returning seemingly correct results in about 15 seconds) until I tack on "LIMIT 1" Adding LIMIT 1, however, seems to make the query take an infinite amount of time. Well, more than 5 minutes, anyway, and I'm not that patient when I know it worked okay without it the LIMIT, if you know what I mean. Here is the query: SELECT DISTINCT *, 0 + 10 * (lower(title) like '%albert einstein%') ::int + 10 * (lower(author_flattened) like '%albert einstein%') ::int + 30 * (lower(subject_flattened) like '%albert einstein%') ::int + 9 * (substring(lower(title), 1, 20) like '%albert%') ::int + 25 * (substring(lower(text), 1, 20) LIKE '%albert%') ::int + (8 * (lower(title) LIKE '%albert%' AND lower(title) LIKE '%einstein%' AND ((title ~* 'albert.{0,20}einstein') OR (title ~* 'einstein.{0,20}albert'))) ::int) + (1 * ( (lower(title) LIKE '%albert%') )::int) + (1 * ( (lower(author_flattened) LIKE '%albert%') )::int) + (1 * ( (lower(subject_flattened) LIKE '%albert%') )::int) + 9 * (substring(lower(title), 1, 20) like '%einstein%') ::int + 25 * (substring(lower(text), 1, 20) LIKE '%einstein%') ::int + (8 * (lower(title) LIKE '%einstein%' AND lower(title) LIKE '%albert%' AND ((title ~* 'einstein.{0,20}albert') OR (title ~* 'albert.{0,20}einstein'))) ::int) + (1 * ( (lower(title) LIKE '%einstein%') )::int) + (1 * ( (lower(author_flattened) LIKE '%einstein%') )::int) + (1 * ( (lower(subject_flattened) LIKE '%einstein%') )::int) AS points FROM article WHERE FALSE OR (lower(title) LIKE '%albert%') OR (lower(author_flattened) LIKE '%albert%') OR (lower(subject_flattened) LIKE '%albert%') OR (lower(title) LIKE '%einstein%') OR (lower(author_flattened) LIKE '%einstein%') OR (lower(subject_flattened) LIKE '%einstein%') ORDER BY points desc, volume, number, article.article LIMIT 1 , 1; explain with or without the LIMIT part is about what you'd expect. Limit (cost=1596.50..1596.50 rows=1 width=216) -> Unique (cost=1596.45..1596.50 rows=1 width=216) -> Sort (cost=1596.45..1596.45 rows=1 width=216) -> Seq Scan on article (cost=0.00..1596.44 rows=1 width=216) Obviously the "Limit" line is gone from the explain output when there is no LIMIT, but the other lines are all the same. Is this a known bug, is there a fix or work-around? If not, should I report it, or will the first answer be "Upgrade." ? The table in question has 17,000 reords, and the various fields mentioned here are all rather short -- Just author names, subject lines, and titles of text articles. [The articles themselves are super long, but are not involved in this query.] I can take out the ~* parts, and life is good again, so almost for sure that's a critical component in the failure. ps auxwwww | grep postgrs seems to report an "idle" postgres process for each failed query -- attempting to ^C the query and/or killing the idle process (I know, "Don't") is unfruitful. kill -9 does nuke the idle processes, IIRC, but I'm not 100% sure... I restarted the server soon after that, since (A) PHP command-line (aka "CGI") was refusing to start, complaining about "mm" not being loadable, and there was not much free RAM and the web-server was not particularly happy about that state of affairs... The schema is probably not particularly interesting -- Pretty much every field involved is a 'text' field, but here you go: Table "article" Attribute | Type | Modifier -------------------+---------+---------------------------------------------- id | integer | not null default nextval('article_ID'::text) volume | text | number | text | article | text | date | text | cover_date | text | title | text | author | text | author_last | text | author_first | text | subject | text | pages | text | artwork | text | text | text | type | integer | type_hardcoded | text | type_detailed | integer | abstract | text | subject_flattened | text | author_flattened | text | Indices: article_id_index, article_oid_index, article_type_index Just FYI, the _flattened fields are de-normalizing (or is it re-normalizing?) some relation tables so that we're not making a zillion tuples here, and it's just a simple (we though) short and sweet text search. PS Thanks for all your help on the full text index! I'm still evaluating some options, but a home-brew concordance is showing the most promise. I'll post source/details if it works out. From pgsql-performance-owner@postgresql.org Fri Dec 13 21:19:42 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0086D475E82 for ; Fri, 13 Dec 2002 21:19:41 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 650754758E1 for ; Fri, 13 Dec 2002 21:19:40 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2281061; Fri, 13 Dec 2002 18:20:11 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: , Subject: Re: ~* + LIMIT => infinite time? Date: Fri, 13 Dec 2002 18:23:32 -0800 X-Mailer: KMail [version 1.4] References: <1038346393.1958.34.camel@rh72.home.ee> <49719.216.80.95.13.1039832166.squirrel@www.l-i-e.com> In-Reply-To: <49719.216.80.95.13.1039832166.squirrel@www.l-i-e.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212131823.32326.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/159 X-Sequence-Number: 575 typea, > I looked for a "known bugs" sort of database to search before bugging you > guys, but failed to find it... But I am at least asking before I submit a > new bug report :-) >=20 > In version 7.1.3 on a Linux box: You'll get a snarky response, and then be told to upgrade, if you try to=20 submit a bug in 7.1.3.=20=20 --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Dec 13 23:48:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D0F0A475D64 for ; Fri, 13 Dec 2002 23:48:36 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 218E94758E1 for ; Fri, 13 Dec 2002 23:48:36 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBE4mcpd019878; Fri, 13 Dec 2002 23:48:38 -0500 (EST) To: josh@agliodbs.com Cc: typea@l-i-e.com, pgsql-performance@postgresql.org Subject: Re: ~* + LIMIT => infinite time? In-reply-to: <200212131823.32326.josh@agliodbs.com> References: <1038346393.1958.34.camel@rh72.home.ee> <49719.216.80.95.13.1039832166.squirrel@www.l-i-e.com> <200212131823.32326.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Fri, 13 Dec 2002 18:23:32 -0800" Date: Fri, 13 Dec 2002 23:48:38 -0500 Message-ID: <19877.1039841318@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/160 X-Sequence-Number: 576 Josh Berkus writes: > You'll get a snarky response, and then be told to upgrade, if you try to > submit a bug in 7.1.3. 7.1 is a tad long in the tooth, but still I'm curious about this. I don't see how can possibly take longer than + . regards, tom lane From pgsql-performance-owner@postgresql.org Sat Dec 14 14:47:27 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5B9D2476386 for ; Sat, 14 Dec 2002 14:47:26 -0500 (EST) Received: from lakemtao03.cox.net (lakemtao03.cox.net [68.1.17.242]) by postgresql.org (Postfix) with ESMTP id C9E70475AD7 for ; Sat, 14 Dec 2002 14:46:17 -0500 (EST) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao03.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021214194618.FBNH26808.lakemtao03.cox.net@[192.168.1.1]> for ; Sat, 14 Dec 2002 14:46:18 -0500 Subject: Re: automated index suggestor -- request for comment From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <20021213032238.GC8912@performics.com> References: <20021213032238.GC8912@performics.com> Content-Type: text/plain Organization: Message-Id: <1039895176.16976.26.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 14 Dec 2002 13:46:16 -0600 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/161 X-Sequence-Number: 577 On Thu, 2002-12-12 at 21:22, johnnnnnn wrote: > The manual is pretty sparse on advice regarding indices. Plenty of > good feature documentation, but not much about when and where an index > is appropriate (except a suggestion that multi-column indices should > be avoided). > > Of course, the ultimate arbiter of which indices are used is the > planner/optimizer. If i could somehow convince the optimizer to > consider indices that don't yet exist, it could tell me which would > give the greatest benefit should i add them. > > So, i'm writing for two reasons. First, i want to gauge interest in > this tool. Is this something that people would find useful? > > Second, i am looking to solicit some advice. Is this project even > feasible? If so, where would be the best place to start? My assumption > has been that i would need to hack into the current code for > determining index paths, and spoof it somehow, but is that possible > without actually creating the indices? Isn't this what a DBA (or, heck, even a modestly bright developer) does during transactional analysis? You know what the INSERTs and statements-that-have-WHERE-clauses are, and, hopefully, approximately how often per day (or week) each should execute. Then, *you* make the decision about which single-key and multi-key indexes should be created, based upon a) the cardinality of each table b) the frequency each query (includes UPDATE & DELETE) is run c) how often INSERT statements occur Thus, for example, an OLTP database will have a significantly different mix of indexes than, say, a "reporting" database... -- +---------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "My advice to you is to get married: If you find a good wife, | | you will be happy; if not, you will become a philosopher." | | Socrates | +---------------------------------------------------------------+ From pgsql-interfaces-owner@postgresql.org Sat Dec 14 17:58:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 302E14758BD for ; Sat, 14 Dec 2002 17:58:37 -0500 (EST) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id E819C474E5C for ; Sat, 14 Dec 2002 17:58:35 -0500 (EST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id gBEMwUH26494; Sat, 14 Dec 2002 17:58:30 -0500 (EST) From: Bruce Momjian Message-Id: <200212142258.gBEMwUH26494@candle.pha.pa.us> Subject: Re: [GENERAL] PerformPortalClose warning in 7.3 In-Reply-To: <2C6CDB6A-0E24-11D7-8E88-000393A48A3C@mac.com> To: Michael Engelhart Date: Sat, 14 Dec 2002 17:58:30 -0500 (EST) Cc: PostgreSQL-interfaces X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/42 X-Sequence-Number: 3455 I tried to reproduce the problem here but it seems my python is too old. I am CC'ing this to the interfaces list in case someone there knows or can test it. --------------------------------------------------------------------------- Michael Engelhart wrote: > Hi - > I've been running PostgreSQL 7.3 on Mac OS X 10.2 since it was released > and it's been running fine. I'm using pyPgSQL 2.3 for client side > programming which also was working great until tonight. Now whenever > I do any query of any type, I get warnings like this: > > WARNING: PerformPortalClose: portal "pgsql_00179f10" not found > > It "appears" that everything is still working the way it was but it's a > bit discomforting to have these show up on my screen while running my > applications. > > Anyone that can explain this? > > Here's a tiny bit of Python sample code that I used to make sure it > wasn't my other code causing the problems > > from pyPgSQL import PgSQL > > dbname = "template1" > conn = PgSQL.connect(database=dbname) > cursor = conn.cursor() > sql = "SELECT now()"; > cursor.execute(sql) > res = cursor.fetchall() > for i in res: > print i > cursor.close() > conn.commit() > > strangely if I remove the last 2 lines (cursor.close() and > conn.commit()) I don't get the errors. > > Also I don't notice that I don't have this problem with psql command > line either. Is this the Python API causing this? > > Thanks for any help > > Mike > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > -- 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 Sat Dec 14 19:42:27 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 451724758E6 for ; Sat, 14 Dec 2002 19:42:25 -0500 (EST) Received: from o2.hostbaby.com (o2.hostbaby.com [208.187.29.121]) by postgresql.org (Postfix) with SMTP id C8A6D47628F for ; Sat, 14 Dec 2002 19:41:52 -0500 (EST) Received: (qmail 73236 invoked from network); 15 Dec 2002 00:41:54 -0000 Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 15 Dec 2002 00:41:54 -0000 Received: from 12.249.229.112 (Hostbaby Webmail authenticated user typea@l-i-e.com) by www.l-i-e.com with HTTP; Sat, 14 Dec 2002 16:41:54 -0800 (PST) Message-ID: <63165.12.249.229.112.1039912914.squirrel@www.l-i-e.com> Date: Sat, 14 Dec 2002 16:41:54 -0800 (PST) Subject: Re: ~* + LIMIT => infinite time? From: To: In-Reply-To: <19877.1039841318@sss.pgh.pa.us> References: <1038346393.1958.34.camel@rh72.home.ee> <49719.216.80.95.13.1039832166.squirrel@www.l-i-e.com> <200212131823.32326.josh@agliodbs.com> <19877.1039841318@sss.pgh.pa.us> X-Priority: 3 Importance: Normal Cc: X-Mailer: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/162 X-Sequence-Number: 578 > Josh Berkus writes: >> You'll get a snarky response, and then be told to upgrade, if you try >> to submit a bug in 7.1.3. > > 7.1 is a tad long in the tooth, but still I'm curious about this. I > don't see how can possibly take longer than + node on top>. Hey Tom. I think we met very briefly at the International PHP Conference in Frankfurt in 2001... Anyway. It's actually the other way around. takes like 4 seconds. + takes literally FOREVER and leaves a postgres process hanging 'round that I have to kill -9 to get rid of. I'd understand the LIMIT clause taking a bit longer, or being faster for startup (if there were no ORDER BY, which there is) but I never even considered it would hang the whole thing. Actually, PostgreSQL has been so reliable over the years, the idea that I'd run across a bug was just foreign to me... So I've been trying to tune performance on this query for weeks now, not realizing that the speed wasn't the issue at all. I could almost rip out the LIMIT completely if the application logic let me, and if the performance were a bit better. It occurred to me last night that the actual data *MIGHT* be involved -- It's some OCR text, and there are a few scattered non-ASCII characters involved... So *MAYBE* the actual text getting scanned could also be important. It seems unlikely, since the non-LIMIT query returns all the data just fine, but just in case... Here's a schema and a full dump for anybody that wants to dig in: http://bulletinarchive.org/pg_dump/ I could provide PHP source as well, or the query posted in this thread can serve as the test case. At the moment, I've altered the application to not use LIMIT when I have ~* in the query, and it "works" -- only the paging of results is broken, and the whole page takes twice as long to load as it should in those cases, since it's doing the same query twice and snarfing all the monster data and then throwing away the majority of rows in both cases. I need the first row to get the highest score, and the rows for paging in the real application... Anyway, my point is that the queries seem fine without the LIMIT clause, and "hang" with both "~*" and LIMIT, and I've even gone so far as to incorporate that into the application logic for now, just to have a page that loads at all instead of one that hangs. Meanwhile, I guess I should flail at it and try 7.3 in the hopes the bug disappeared. I was hoping to know for sure that it was a fixed bug in that upgrade path. Boss actually said we should go ahead and upgrade just on principle anyway. It's nice to have a smart boss. :-) From pgsql-performance-owner@postgresql.org Sun Dec 15 15:21:53 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 19244475C22 for ; Sun, 15 Dec 2002 15:21:52 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 57463475B99 for ; Sun, 15 Dec 2002 15:21:51 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2282278; Sun, 15 Dec 2002 12:22:25 -0800 From: "Josh Berkus" Subject: Re: ~* + LIMIT => infinite time? To: , Cc: X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Sun, 15 Dec 2002 12:22:25 -0800 Message-ID: In-Reply-To: <63165.12.249.229.112.1039912914.squirrel@www.l-i-e.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/163 X-Sequence-Number: 579 Typea, > At the moment, I've altered the application to not use LIMIT when I > have > ~* in the query, and it "works" -- only the paging of results is > broken, Would your application allow you to use " ILIKE '%%'" in the query instead of "~*" ? If so, does the query still hang with ILIKE ... LIMIT? -Josh From pgsql-performance-owner@postgresql.org Sun Dec 15 19:04:07 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 10B6E475EF7 for ; Sun, 15 Dec 2002 19:04:06 -0500 (EST) Received: from rh72.home.ee (adsl1030.estpak.ee [213.168.29.11]) by postgresql.org (Postfix) with ESMTP id 16E56475D87 for ; Sun, 15 Dec 2002 19:04:05 -0500 (EST) Received: from rh72.home.ee (localhost.localdomain [127.0.0.1]) by rh72.home.ee (8.12.5/8.12.5) with ESMTP id gBG044ph014158; Mon, 16 Dec 2002 05:04:04 +0500 Received: (from hannu@localhost) by rh72.home.ee (8.12.5/8.12.5/Submit) id gBG03tmd014156; Mon, 16 Dec 2002 05:03:55 +0500 X-Authentication-Warning: rh72.home.ee: hannu set sender to hannu@tm.ee using -f Subject: Re: ~* + LIMIT => infinite time? From: Hannu Krosing To: typea@l-i-e.com Cc: tgl@sss.pgh.pa.us, pgsql-performance@postgresql.org In-Reply-To: <63165.12.249.229.112.1039912914.squirrel@www.l-i-e.com> References: <1038346393.1958.34.camel@rh72.home.ee> <49719.216.80.95.13.1039832166.squirrel@www.l-i-e.com> <200212131823.32326.josh@agliodbs.com> <19877.1039841318@sss.pgh.pa.us> <63165.12.249.229.112.1039912914.squirrel@www.l-i-e.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1039997033.12952.6.camel@rh72.home.ee> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.1 Date: 16 Dec 2002 05:03:54 +0500 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/164 X-Sequence-Number: 580 typea@l-i-e.com kirjutas P, 15.12.2002 kell 05:41: > It occurred to me last night that the actual data *MIGHT* be involved -- > It's some OCR text, and there are a few scattered non-ASCII characters > involved... So *MAYBE* the actual text getting scanned could also be > important. > > It seems unlikely, since the non-LIMIT query returns all the data just > fine, but just in case... Have you tried using DECLARE CURSOR...; FETCH 1; CLOSE CURSOR; instead of LIMIT ? > Here's a schema and a full dump for anybody that wants to dig in: > http://bulletinarchive.org/pg_dump/ gzipping the data could make sense - data.sql goes from 200M to 60M ;) > I could provide PHP source as well, or the query posted in this thread can > serve as the test case. > > At the moment, I've altered the application to not use LIMIT when I have > ~* in the query, and it "works" -- only the paging of results is broken, > and the whole page takes twice as long to load as it should in those > cases, since it's doing the same query twice and snarfing all the monster > data and then throwing away the majority of rows in both cases. I need > the first row to get the highest score, and the rows for paging in the > real application... > > Anyway, my point is that the queries seem fine without the LIMIT clause, > and "hang" with both "~*" and LIMIT, and I've even gone so far as to > incorporate that into the application logic for now, just to have a page > that loads at all instead of one that hangs. > > Meanwhile, I guess I should flail at it and try 7.3 in the hopes the bug > disappeared. I tested (part of) it on 7.3 , had to manually change ::int to case-when-then-else-end as there is no cast from bool to int in7.3 This ran fine: SELECT DISTINCT *, 0 + case when (title ilike '%albert einstein%') then 10 else 0 end + case when ( title iLIKE '%einstein%' AND title iLIKE '%albert%' AND ( (title ~* 'einstein.{0,20}albert') OR (title ~* 'albert.{0,20}einstein'))) then 8 else 0 end as points FROM article WHERE FALSE OR (title iLIKE '%albert%') OR (author_flattened iLIKE '%albert%') OR (subject_flattened iLIKE '%albert%') OR (title iLIKE '%einstein%') OR (author_flattened iLIKE '%einstein%') OR (subject_flattened iLIKE '%einstein%') ORDER BY points desc, volume, number, article.article LIMIT 1 OFFSET 1; I also changed "lower(field) like '%albert%'" to "field ilike '%albert%'" and got about 20% speed boost - EXPLAIN ANALYZE reported 0.189 insead of 0.263 sec as actual time. > I was hoping to know for sure that it was a fixed bug in > that upgrade path. > > Boss actually said we should go ahead and upgrade just on principle > anyway. It's nice to have a smart boss. :-) > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) -- Hannu Krosing From pgsql-performance-owner@postgresql.org Mon Dec 16 03:21:08 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6EFB7475ADD for ; Mon, 16 Dec 2002 03:21:07 -0500 (EST) Received: from o2.hostbaby.com (o2.hostbaby.com [208.187.29.121]) by postgresql.org (Postfix) with SMTP id AAF884759BD for ; Mon, 16 Dec 2002 03:21:06 -0500 (EST) Received: (qmail 24743 invoked from network); 16 Dec 2002 08:21:14 -0000 Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 16 Dec 2002 08:21:14 -0000 Received: from 12.249.229.112 (Hostbaby Webmail authenticated user typea@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 16 Dec 2002 00:21:14 -0800 (PST) Message-ID: <61988.12.249.229.112.1040026874.squirrel@www.l-i-e.com> Date: Mon, 16 Dec 2002 00:21:14 -0800 (PST) Subject: Re: ~* + LIMIT => infinite time? From: To: In-Reply-To: <1039997033.12952.6.camel@rh72.home.ee> References: <1038346393.1958.34.camel@rh72.home.ee> <49719.216.80.95.13.1039832166.squirrel@www.l-i-e.com> <200212131823.32326.josh@agliodbs.com> <19877.1039841318@sss.pgh.pa.us> <63165.12.249.229.112.1039912914.squirrel@www.l-i-e.com> <1039997033.12952.6.camel@rh72.home.ee> X-Priority: 3 Importance: Normal Cc: , , X-Mailer: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/165 X-Sequence-Number: 581 > Have you tried using DECLARE CURSOR...; FETCH 1; CLOSE CURSOR; instead > of LIMIT ? I think I did, in the monitory, and it worked fine. > I tested (part of) it on 7.3 , had to manually change ::int to > case-when-then-else-end as there is no cast from bool to int in7.3 An upgrade to 7.3 has, in fact, gotten rid of that bug... Though now I'm forced to use localhost for connecting, since: A) Upon boot, I'm told I can't use password or crypt, but B) When trying to connect, I can't use md5 C) the passwords get turned into md5 whether I like it or not What's up with all that? I also don't understand why the incredibly useful function I had to auto-typecast from bool to int won't work using ::int syntax, but will if I use int4(...) syntax. Grrr. And breaking the LIMIT x, y thing was annoying. Oh well. I can move forward with some changes in the way we do things. Now that the query runs, I can start in on the optimization again :-) THANKS ALL!!! Oh, and the lower(field) LIKE is MySQL compatible, but I don't think MySQL has an ILIKE... We're abandoning the MySQL support now anyway, since we NEED performance way more than we need MySQL compatibility. Thanks again! From pgsql-performance-owner@postgresql.org Mon Dec 16 05:20:21 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CAE9A475BC3 for ; Mon, 16 Dec 2002 05:20:19 -0500 (EST) Received: from o2.hostbaby.com (o2.hostbaby.com [208.187.29.121]) by postgresql.org (Postfix) with SMTP id ECB034759BD for ; Mon, 16 Dec 2002 05:20:18 -0500 (EST) Received: (qmail 58018 invoked from network); 16 Dec 2002 10:20:27 -0000 Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 16 Dec 2002 10:20:27 -0000 Received: from 12.249.229.112 (Hostbaby Webmail authenticated user typea@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 16 Dec 2002 02:20:27 -0800 (PST) Message-ID: <64288.12.249.229.112.1040034027.squirrel@www.l-i-e.com> Date: Mon, 16 Dec 2002 02:20:27 -0800 (PST) Subject: Re: ~* + LIMIT => infinite time? From: To: In-Reply-To: <61988.12.249.229.112.1040026874.squirrel@www.l-i-e.com> References: <1038346393.1958.34.camel@rh72.home.ee> <49719.216.80.95.13.1039832166.squirrel@www.l-i-e.com> <200212131823.32326.josh@agliodbs.com> <19877.1039841318@sss.pgh.pa.us> <63165.12.249.229.112.1039912914.squirrel@www.l-i-e.com> <1039997033.12952.6.camel@rh72.home.ee> <61988.12.249.229.112.1040026874.squirrel@www.l-i-e.com> X-Priority: 3 Importance: Normal X-Mailer: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/166 X-Sequence-Number: 582 >> I tested (part of) it on 7.3 , had to manually change ::int to >> case-when-then-else-end as there is no cast from bool to int in7.3 > > An upgrade to 7.3 has, in fact, gotten rid of that bug... Damn. I spoke to soon. It *SEEMS* like it's back again. Very, very strange. If explain claims the "cost" will be ~1000, and then a query takes SO long to return I give up and hit ^C, that's just not right, right? I mean, that "cost" near 1000 may not be in seconds or anything, but 1000 is pretty low, isn't it? I give up for now. Need sleep. From pgsql-performance-owner@postgresql.org Mon Dec 16 13:29:02 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 197EC476607 for ; Mon, 16 Dec 2002 13:29:02 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 9EFAE47634E for ; Mon, 16 Dec 2002 13:25:41 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2283495; Mon, 16 Dec 2002 10:26:24 -0800 From: "Josh Berkus" Subject: Re: ~* + LIMIT => infinite time? To: , Cc: , , X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Mon, 16 Dec 2002 10:26:24 -0800 Message-ID: In-Reply-To: <61988.12.249.229.112.1040026874.squirrel@www.l-i-e.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/167 X-Sequence-Number: 583 Typea, > Oh, and the lower(field) LIKE is MySQL compatible, but I don't think > MySQL > has an ILIKE... We're abandoning the MySQL support now anyway, since > we > NEED performance way more than we need MySQL compatibility. ILIKE is SQL-spec. There's reasons to use any: ILIKE is slightly faster on un-anchored text searches ("name ILIKE '%john%'") lower(column) can be indexed for anchored text searches ("lower(name) LIKE 'john%'") "~*" cannot be indexed, but will accept regexp operators for sophisticated text searches ("name ~* 'jo[han]n?'") -Josh Berkus From pgsql-performance-owner@postgresql.org Mon Dec 16 13:35:42 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 790784762D1 for ; Mon, 16 Dec 2002 13:35:40 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 7C9CF476584 for ; Mon, 16 Dec 2002 13:35:00 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBGIYnpd022969; Mon, 16 Dec 2002 13:34:49 -0500 (EST) To: "Josh Berkus" Cc: typea@l-i-e.com, hannu@tm.ee, pgsql-performance@postgresql.org Subject: Re: ~* + LIMIT => infinite time? In-reply-to: References: Comments: In-reply-to "Josh Berkus" message dated "Mon, 16 Dec 2002 10:26:24 -0800" Date: Mon, 16 Dec 2002 13:34:49 -0500 Message-ID: <22968.1040063689@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/168 X-Sequence-Number: 584 "Josh Berkus" writes: > ILIKE is SQL-spec. It is? I don't see it in there ... regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 16 13:55:27 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A60994764B4 for ; Mon, 16 Dec 2002 13:55:25 -0500 (EST) Received: from mailhost1.mistral.co.uk (mailhost1.mistral.co.uk [195.184.229.180]) by postgresql.org (Postfix) with ESMTP id C3E734764A6 for ; Mon, 16 Dec 2002 13:55:23 -0500 (EST) Received: from test.xorch.net.netcomuk.co.uk (adsl-217-154-8-180.mistral.co.uk [217.154.8.180]) by mailhost1.mistral.co.uk (Postfix) with ESMTP id 02B2F78332 for ; Mon, 16 Dec 2002 18:55:22 +0000 (GMT) From: Jeff Davis MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15870.8609.145600.122190@test.xorch.net> Date: Mon, 16 Dec 2002 13:55:29 -0500 To: pgsql-performance@postgresql.org Subject: Problem with GEQO when using views and nested selects X-Mailer: VM 7.07 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/169 X-Sequence-Number: 585 I have been trying tune joins against a view we use a lot for which the optimizer generates very poor query plans when it uses the GEQO. The long involved version (and more readable version) of the problem is here: http://xarg.net/writing/misc/GEQO I have tried doing a variety of explicit joins but generally end up with something a lot poorer than the result from the exhaustive search. I am hoping someone has some advice on how to tackle this (my inclination is to turn of GEQO since we use this and similiarly complex views quite a lot and with a poor plan these queries are very slow, I would trade predictably slow query planning against unpredictably slow queries I guess). Anyway, Here is the view: create view cc_users as SELECT o.*, pa.*, pe.*, u.*, mr.member_state, mr.rel_id FROM acs_objects o, parties pa, persons pe, users u, group_member_map m, membership_rels mr WHERE o.object_id = pa.party_id and pa.party_id = pe.person_id and pe.person_id = u.user_id and u.user_id = m.member_id and m.group_id = acs__magic_object_id('registered_users') and m.rel_id = mr.rel_id and m.container_id = m.group_id; and here are the two query plans: oatest=# set geqo_threshold to 11; explain analyze select * from cc_users u, forums_messages m where u.user_id = m.user_id and m.message_id = 55001; SET VARIABLE NOTICE: QUERY PLAN: Nested Loop (cost=15202.01..19099.49 rows=1 width=1483) (actual time=6012.96..6054.26 rows=1 loops=1) -> Index Scan using forums_messages_pk on forums_messages m (cost=0.00..3.38 rows=1 width=983) (actual time=0.06..0.08 rows=1 loops=1) -> Materialize (cost=18571.15..18571.15 rows=41997 width=500) (actual time=5996.36..6009.62 rows=42002 loops=1) -> Hash Join (cost=15202.01..18571.15 rows=41997 width=500) (actual time=4558.36..5920.36 rows=42002 loops=1) -> Merge Join (cost=0.00..3089.82 rows=42002 width=354) (actual time=0.13..651.67 rows=42002 loops=1) -> Index Scan using parties_pk on parties pa (cost=0.00..992.58 rows=42018 width=146) (actual time=0.05..122.78 rows=42018 loops=1) -> Index Scan using users_pk on users u (cost=0.00..1362.17 rows=42002 width=208) (actual time=0.03..223.07 rows=42002 loops=1) -> Hash (cost=15097.01..15097.01 rows=41997 width=146) (actual time=4558.05..4558.05 rows=0 loops=1) -> Hash Join (cost=4639.30..15097.01 rows=41997 width=146) (actual time=1512.75..4445.08 rows=42002 loops=1) -> Seq Scan on acs_objects o (cost=0.00..8342.17 rows=318117 width=90) (actual time=0.03..1567.37 rows=318117 loops=1) -> Hash (cost=4534.30..4534.30 rows=41997 width=56) (actual time=1511.87..1511.87 rows=0 loops=1) -> Hash Join (cost=2951.31..4534.30 rows=41997 width=56) (actual time=857.33..1291.41 rows=42002 loops=1) -> Seq Scan on persons pe (cost=0.00..848.02 rows=42002 width=32) (actual time=0.01..73.65 rows=42002 loops=1) -> Hash (cost=2846.30..2846.30 rows=42004 width=24) (actual time=856.92..856.92 rows=0 loops=1) -> Hash Join (cost=1318.18..2846.30 rows=42004 width=24) (actual time=584.26..806.18 rows=42002 loops=1) -> Seq Scan on membership_rels mr (cost=0.00..688.04 rows=42004 width=16) (actual time=0.01..60.95 rows=42004 loops=1) -> Hash (cost=1213.16..1213.16 rows=42009 width=8) (actual time=583.69..583.69 rows=0 loops=1) -> Seq Scan on group_element_index (cost=0.00..1213.16 rows=42009 width=8) (actual time=0.05..430.06 rows=42002 loops=1) Total runtime: 6064.47 msec ------------------------------------------------------------ oatest=# set geqo_threshold to 15; explain analyze select * from cc_users u, forums_messages m where u.user_id = m.user_id and m.message_id = 55001; SET VARIABLE NOTICE: QUERY PLAN: Nested Loop (cost=0.00..21.65 rows=1 width=1483) (actual time=0.42..0.44 rows=1 loops=1) -> Nested Loop (cost=0.00..18.62 rows=1 width=1451) (actual time=0.36..0.37 rows=1 loops=1) -> Nested Loop (cost=0.00..15.59 rows=1 width=1435) (actual time=0.30..0.32 rows=1 loops=1) -> Nested Loop (cost=0.00..12.54 rows=1 width=1289) (actual time=0.22..0.23 rows=1 loops=1) -> Nested Loop (cost=0.00..9.44 rows=1 width=1199) (actual time=0.17..0.18 rows=1 loops=1) -> Nested Loop (cost=0.00..6.41 rows=1 width=991) (actual time=0.12..0.13 rows=1 loops=1) -> Index Scan using forums_messages_pk on forums_messages m (cost=0.00..3.38 rows=1 width=983) (actual time=0.06..0.06 rows=1 loops=1) -> Index Scan using group_elem_idx_element_idx on group_element_index (cost=0.00..3.02 rows=1 width=8) (actual time=0.05..0.05 rows=1 loops=1) -> Index Scan using users_pk on users u (cost=0.00..3.02 rows=1 width=208) (actual time=0.03..0.03 rows=1 loops=1) -> Index Scan using acs_objects_pk on acs_objects o (cost=0.00..3.08 rows=1 width=90) (actual time=0.03..0.03 rows=1 loops=1) -> Index Scan using parties_pk on parties pa (cost=0.00..3.04 rows=1 width=146) (actual time=0.05..0.05 rows=1 loops=1) -> Index Scan using membership_rel_rel_id_pk on membership_rels mr (cost=0.00..3.01 rows=1 width=16) (actual time=0.02..0.02 rows=1 loops=1) -> Index Scan using persons_pk on persons pe (cost=0.00..3.01 rows=1 width=32) (actual time=0.03..0.03 rows=1 loops=1) Total runtime: 1.01 msec From pgsql-performance-owner@postgresql.org Mon Dec 16 14:30:33 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id ADC1A476450 for ; Mon, 16 Dec 2002 14:30:29 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 0BE1347634E for ; Mon, 16 Dec 2002 14:30:28 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBGJUGpd023508; Mon, 16 Dec 2002 14:30:16 -0500 (EST) To: Jeff Davis Cc: pgsql-performance@postgresql.org Subject: Re: Problem with GEQO when using views and nested selects In-reply-to: <15870.8609.145600.122190@test.xorch.net> References: <15870.8609.145600.122190@test.xorch.net> Comments: In-reply-to Jeff Davis message dated "Mon, 16 Dec 2002 13:55:29 -0500" Date: Mon, 16 Dec 2002 14:30:16 -0500 Message-ID: <23507.1040067016@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/170 X-Sequence-Number: 586 Jeff Davis writes: > I have been trying tune joins against a view we use a lot for which > the optimizer generates very poor query plans when it uses the GEQO. > The long involved version (and more readable version) of the problem > is here: http://xarg.net/writing/misc/GEQO This is not actually using GEQO. The reason you are seeing an effect from raising geqo_threshold is that geqo_threshold determines whether or not the view will be flattened into the upper query. For this particular query situation, flattening the view is essential (since you don't want the thing to compute the whole view). The relevant source code tidbit is /* * Yes, so do we want to merge it into parent? Always do * so if child has just one element (since that doesn't * make the parent's list any longer). Otherwise we have * to be careful about the increase in planning time * caused by combining the two join search spaces into * one. Our heuristic is to merge if the merge will * produce a join list no longer than GEQO_RELS/2. * (Perhaps need an additional user parameter?) */ AFAICS, your only good solution is to make geqo_threshold at least 14, since you want a 7-way join after flattening. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 16 16:52:20 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B734C476711 for ; Mon, 16 Dec 2002 16:52:18 -0500 (EST) Received: from mailhost1.mistral.co.uk (mailhost1.mistral.co.uk [195.184.229.180]) by postgresql.org (Postfix) with ESMTP id 3DF7F4766AB for ; Mon, 16 Dec 2002 16:47:08 -0500 (EST) Received: from test.xorch.net.netcomuk.co.uk (adsl-217-154-8-180.mistral.co.uk [217.154.8.180]) by mailhost1.mistral.co.uk (Postfix) with ESMTP id 3C94178DBE; Mon, 16 Dec 2002 21:47:09 +0000 (GMT) From: Jeff Davis MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15870.18917.306678.855332@test.xorch.net> Date: Mon, 16 Dec 2002 16:47:17 -0500 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Problem with GEQO when using views and nested selects In-Reply-To: <23507.1040067016@sss.pgh.pa.us> References: <15870.8609.145600.122190@test.xorch.net> <23507.1040067016@sss.pgh.pa.us> X-Mailer: VM 7.07 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/171 X-Sequence-Number: 587 Tom> Jeff Davis writes: >> I have been trying tune joins against a view we use a lot for which >> the optimizer generates very poor query plans when it uses the GEQO. >> The long involved version (and more readable version) of the problem >> is here: http://xarg.net/writing/misc/GEQO Tom> This is not actually using GEQO. The reason you are seeing an effect Tom> from raising geqo_threshold is that geqo_threshold determines whether Tom> or not the view will be flattened into the upper query. For this Tom> particular query situation, flattening the view is essential (since you Tom> don't want the thing to compute the whole view). The relevant source Tom> code tidbit is Tom> /* Tom> * Yes, so do we want to merge it into parent? Always do Tom> * so if child has just one element (since that doesn't Tom> * make the parent's list any longer). Otherwise we have Tom> * to be careful about the increase in planning time Tom> * caused by combining the two join search spaces into Tom> * one. Our heuristic is to merge if the merge will Tom> * produce a join list no longer than GEQO_RELS/2. Tom> * (Perhaps need an additional user parameter?) Tom> */ Tom> AFAICS, your only good solution is to make geqo_threshold at least 14, Tom> since you want a 7-way join after flattening. Thanks very much. I have to admit it was all very mysterious to me and the only knobs I had seemed to indicate that the GEQO was the issue. I think having another user parameter as mentioned in the comment is a good idea (although I see it's been discussed before), that or maybe some better guidance on the actual interpretation of GEQO_THRESHOLD (the comment is hugely more illuminating than the documentation on this point). Now that I understand what is going on, I know in our case this crops up a fair bit and no one had really figured ever figured out what was causing views to work ok some of the time and then fall over in other queries. From pgsql-performance-owner@postgresql.org Mon Dec 16 23:03:02 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1337B4761BD for ; Mon, 16 Dec 2002 23:03:01 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 710174761A3 for ; Mon, 16 Dec 2002 23:03:00 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2284485 for ; Mon, 16 Dec 2002 20:03:51 -0800 From: "Josh Berkus" Subject: Profiling To: pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Mon, 16 Dec 2002 20:03:51 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/172 X-Sequence-Number: 588 Folks, I had a request from one of the SF-PUG members that I found interesting. She suggested that we post the specs of some of the PostgreSQL servers that we administrate, their statistics, and some comments on how they perform. I'll start it off with an example: Small Cheap Workgroup Server AMD Athalon 700mhz 256mb SDRAM Dual 20gb 7200rpm IDE Drives (1 IBM, 1 Quantum) with OS, Apache, XLog on 1st drive, Postgres Database, Swap on 2nd drive Running SuSE Linux 7.3 Apache 1.3.x PHP 4.0.x PostgreSQL 7.1.3 3-8 concurrent users on intranet application with large transactions but low transaction frequency (est. 20-300 reads and 5-80 writes per hour) on small database (< 20,000 records combined in main tables) Performance assessment: Adequate, reasonably fast on selects except aggregates, commits taking 5-20 seconds during medium activity. Same system with a Celeron 500 previously demonstrated horrible performance (often > 45 seconds on selects) on complex queries, such as one view with custom aggregates. -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco From pgsql-performance-owner@postgresql.org Mon Dec 16 23:12:03 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C6952475ED4 for ; Mon, 16 Dec 2002 23:12:01 -0500 (EST) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 23B6F475D1C; Mon, 16 Dec 2002 23:12:01 -0500 (EST) Received: by davinci.ethosmedia.com (CommuniGate Pro PIPE 4.0.2) with PIPE id 2284498; Mon, 16 Dec 2002 20:12:52 -0800 X-Spam-Status: Scanner Called Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2284500; Mon, 16 Dec 2002 20:12:47 -0800 From: "Josh Berkus" Subject: Re: Profiling To: "Josh Berkus" , pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Mon, 16 Dec 2002 20:12:47 -0800 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Spam-Status: No, hits=-4.1 required=6.0 tests=IN_REP_TO,AWL version=2.20 X-Spam-Level: X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/173 X-Sequence-Number: 589 Folks, > I had a request from one of the SF-PUG members that I found > interesting. She suggested that we post the specs of some of the > PostgreSQL servers that we administrate, their statistics, and some > comments on how they perform. I'll start it off with an example: > > Small Cheap Workgroup Server > AMD Athalon 700mhz > 256mb SDRAM > Dual 20gb 7200rpm IDE Drives (1 IBM, 1 Quantum) > with OS, Apache, XLog on 1st drive, > Postgres Database, Swap on 2nd drive > Running SuSE Linux 7.3 > Apache 1.3.x > PHP 4.0.x > PostgreSQL 7.1.3 > 3-8 concurrent users on intranet application > with large transactions but low transaction frequency > (est. 20-300 reads and 5-80 writes per hour) > on small database (< 20,000 records combined in main tables) > > Performance assessment: Adequate, reasonably fast > on selects except aggregates, commits taking 5-20 seconds > during medium activity. Same system with a Celeron 500 > previously demonstrated horrible performance (often > 45 seconds > on selects) on complex queries, such as one view with > custom aggregates. Oh, and I forgot: shared_buffers 4096 sort_mem 2048 wal_files 8 wal_sync_method = fdatasync -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco From pgsql-performance-owner@postgresql.org Mon Dec 16 23:30:56 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F1463475D1C for ; Mon, 16 Dec 2002 23:30:54 -0500 (EST) Received: from smtp3.ihug.com.au (smtp3.ihug.com.au [203.109.250.76]) by postgresql.org (Postfix) with ESMTP id 23EAB475CBC for ; Mon, 16 Dec 2002 23:30:54 -0500 (EST) Received: from p108-tnt1.mel.ihug.com.au (postgresql.org) [203.173.160.108] by smtp3.ihug.com.au with esmtp (Exim 3.22 #1 (Debian)) id 18O9Nh-0003HS-00; Tue, 17 Dec 2002 15:30:57 +1100 Message-ID: <3DFEA87F.9040304@postgresql.org> Date: Tue, 17 Dec 2002 15:30:55 +1100 From: Justin Clift User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-au, en-gb, en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Profiling References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/174 X-Sequence-Number: 590 Josh Berkus wrote: > Folks, > > >>I had a request from one of the SF-PUG members that I found >>interesting. She suggested that we post the specs of some of the >>PostgreSQL servers that we administrate, their statistics, and some >>comments on how they perform. I'll start it off with an example: >> >>Small Cheap Workgroup Server >>AMD Athalon 700mhz >>256mb SDRAM >>Dual 20gb 7200rpm IDE Drives (1 IBM, 1 Quantum) >> with OS, Apache, XLog on 1st drive, >> Postgres Database, Swap on 2nd drive >>Running SuSE Linux 7.3 >> Apache 1.3.x >> PHP 4.0.x >> PostgreSQL 7.1.3 >>3-8 concurrent users on intranet application >>with large transactions but low transaction frequency >>(est. 20-300 reads and 5-80 writes per hour) >>on small database (< 20,000 records combined in main tables) >> >>Performance assessment: Adequate, reasonably fast >>on selects except aggregates, commits taking 5-20 seconds >>during medium activity. Same system with a Celeron 500 >>previously demonstrated horrible performance (often > 45 seconds >>on selects) on complex queries, such as one view with >>custom aggregates. > > > Oh, and I forgot: > > shared_buffers 4096 > sort_mem 2048 > wal_files 8 > wal_sync_method = fdatasync Hi Josh, Want to CVS checkout the latest OSDB source code (http://www.sf.net/projects/osdb), generate say a 100MB database and do a multiuser test of 20 or so users on it? :-) Regards and best wishes, Justin Clift > -Josh > > ______AGLIO DATABASE SOLUTIONS___________________________ > Josh Berkus > Complete information technology josh@agliodbs.com > and data management solutions (415) 565-7293 > for law firms, small businesses fax 621-2533 > and non-profit organizations. San Francisco > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi From pgsql-performance-owner@postgresql.org Tue Dec 17 01:56:48 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B3F73475D4B for ; Tue, 17 Dec 2002 01:56:46 -0500 (EST) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 91535475D1C for ; Tue, 17 Dec 2002 01:56:42 -0500 (EST) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id gBH6uf313575 for ; Tue, 17 Dec 2002 12:26:41 +0530 Received: from daithan.itnranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id gBH6uf013570 for ; Tue, 17 Dec 2002 12:26:41 +0530 Content-Type: text/plain; charset="iso-8859-1" From: Shridhar Daithankar To: pgsql-performance@postgresql.org Subject: Re: Profiling Date: Tue, 17 Dec 2002 12:27:07 +0530 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Message-Id: <200212171227.07258.shridhar_daithankar@persistent.co.in> Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by www.pspl.co.in id gBH6uf013570 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/175 X-Sequence-Number: 591 On Tuesday 17 December 2002 09:33 am, you wrote: > Folks, > > I had a request from one of the SF-PUG members that I found > interesting. She suggested that we post the specs of some of the > PostgreSQL servers that we administrate, their statistics, and some > comments on how they perform. I'll start it off with an example: OK my take. P-II-450MHz/256MB/20GB IDE. Mandrake8.2, postgresql 7.2.x PGBench, with 10M records/10,000 transactions/10 users. Throughput 25tps. Rest of the things were default. I am not too sure of details as this was more than 4 months back and that machine is windows now. Same machine/Another benchmark Banking application simulation. Shared buffers 14000 Number of records: 100 in one table, continously updated+log table continously inserted Throughput 200tps. HTH Shridhar From pgsql-performance-owner@postgresql.org Tue Dec 17 08:25:54 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 20EAD475AE4 for ; Tue, 17 Dec 2002 08:25:52 -0500 (EST) Received: from smtp.inphact.com (smtp.inphact.com [67.105.52.11]) by postgresql.org (Postfix) with ESMTP id 52040475AAC for ; Tue, 17 Dec 2002 08:25:50 -0500 (EST) Received: from cafes.net (unknown [192.168.109.38]) by smtp.inphact.com (Postfix) with ESMTP id 763E5134002 for ; Tue, 17 Dec 2002 07:12:15 -0600 (CST) Date: Tue, 17 Dec 2002 07:29:48 -0600 Subject: Re: Profiling Content-Type: multipart/mixed; boundary=Apple-Mail-6--452436910 Mime-Version: 1.0 (Apple Message framework v548) From: Cory 'G' Watson To: pgsql-performance@postgresql.org In-Reply-To: <200212171227.07258.shridhar_daithankar@persistent.co.in> Message-Id: <9D71C94A-11C3-11D7-8929-0003939CCA58@cafes.net> X-Mailer: Apple Mail (2.548) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/176 X-Sequence-Number: 592 --Apple-Mail-6--452436910 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On Tuesday, December 17, 2002, at 12:57 AM, Shridhar Daithankar wrote: > On Tuesday 17 December 2002 09:33 am, you wrote: >> Folks, >> >> I had a request from one of the SF-PUG members that I found >> interesting. She suggested that we post the specs of some of the >> PostgreSQL servers that we administrate, their statistics, and some >> comments on how they perform. I'll start it off with an example: > My take: Dual PIII-1.12Ghz, 3Gb, 5 x 36 RAID 5'ed with a spare, RedHat 7.2, Pg 7.3 pgbench, default settings, 252tps inc. connex, 409tps excluding connex Day to day, runs a monitoring/historical analysis tool of my design with gathers metrics from around 30 hosts (they report every 10 minutes, by their clock). Has 3,689,652 rows as of right now in the 'metrics' table, which is indexed by timestamp. My 'main' query is in the form of: SELECT timestamp, data FROM metrics WHERE resgroupid=? and hostid=? AND timestamp BETWEEN ? AND ? ORDER BY timestamp Index is on timestamp. This query generally takes about half a second for 24 hours worth of data. I just ran a 240 hour query on a test database with about 20,000 rows and the result too 2998ms. Things slowed to a crawl about 2 weeks ago, so I upgraded to 7.3 and saw a huge improvement. I believe part of this might have been due to the recreation of the database, similar to a CLUSTER. My performance is not degrading from a time perspective, but CPU usage is steadily degrading. User time is steadily increasing over the last 240 hours, from 5% to 15%. Attached is output of my monitoring program (well, the new improved Java version) showing the CPU performance over the last 240 hours. shared_buffers = 98304 sort_mem = 1600 fsync = false Everything else is default, recommendations welcome. ;) --Apple-Mail-6--452436910 Content-Disposition: inline; filename=cpu.png Content-Transfer-Encoding: base64 Content-Type: image/png; x-unix-mode=0644; name="cpu.png" iVBORw0KGgoAAAANSUhEUgAABBMAAAILCAIAAAA18UPGAABwTklEQVR42uy9 DXRUVZrvHWLlarc6ijpGEJAvbeW2grYaVDQZ8SMMjkkn8qHihTHo4nrhYmNY MRNsbJzmY1DEJUgTBEOTGARCiimVFjokeaGbdzWX8UXpoX31ruDIXU1f1vsy 6+XeYa3ba93z7sNT7Np1zqnPVFXq47fXs/baOTl16tQvdU6e/3meZ++i3x78 LYZhGIZhGIZhWHQrAgGGYRiGYRiGYSgHDMMwDMMwDMNQDhiGYRiGYRiGoRww DMMwDMMwDEM5YBiGYRiGYRiGcsAwDMMwDMMwDOWAYRiGYRiGYRjKAcMwDMMw DMMwDOWAYRiGxfz3cLGBAsMwDEM5YBiGpd4O9R5qWNxQ/lD597//fZ/Pd+ml l44dO3b6tOlb3t/i8MilqR3GjB4zZ/acnq6e6C57TD8+6Rd6vjaeLYgWDMMw lAOGYRiWjHV2dI68aaQpDEpKSpR+MP3goght6pSpmVEOD056cMSIEd+77HvZ oBziPBkMwzAM5YBhGJY/1nugd/iw4eLyjr9j/Pp31x/qPSS/WvfOuvsm3ud2 i9UOi19ZrIMPmVEOcfrlmXHfEQkYhmEoBwzDsIKzBfMXiBM87rZxB3sOxukr K/GgoxMZUA7uWEd/Yg6R4ifmu//ivV88MvkRyd26+qqra6prPvv0s0RPRpl6 1czpMwcPHqyOo3o11sdxv6ru+bprr7lWIZ30wKRPA5/y5cQwDEM5YBiGZZHd dedd4rmuXrU6Tv8+4A88MfUJ+fFHd/0oL5WD+7cV5RWJnkzXvq4xo8c4dh41 apTa7n4j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BIDgBIDn/NJdp5QjvKtJk52gxbMty0+qjb pqk2E9XTS6mnoT+WfkV/0G4mqvbjezfJwUTP5dKU2VT7NNne3t5eWVnp5PIt 3/8Ok4OJ5kvd3Nw4nU5le3Z2tlKpBINBw3fBkn0mOQAkBwAkh+eKx+PaL2+4 XK5qtZrNZiORiLIyMjJyd3d3fHzs9XqbBovJycnT09NSqeR2u5seSiQSmUzG 9J2j6rc4wuGwshIKhfL5vBxL/da+fkV/UMPhaXh4WK7oHyYHEz1fWlra3NyU DXnh/Py8+tparSaX08nlW77/HSYHE81XbulRvxokL19cXEyn04bvgiX7THIA SA4A+iA5SEIw9OeP+pSLiwuPx6POCjMzMzJFBYPBQqGgrORyOfmxUqnob2aQ 50Sj0aOjI32ouL6+ljPZ2NhQv8D91jtHZZ8+n082lJWzs7NYLCYno94nql/R H9RwopIT1t/S3ZPkcHJi3O/fv/96momey0skp9ntdjlz9YZd2UMgEFC+dv/q 5Vu+/8VG0fDX/VfjVzfNV/5o4Pf71ZuY6/X66Ojow8OD4btgyT6THACSA4A+ SA4f9f8XaboymUxTFNGvfLr64D23dv9NNF9Cxfr6el/1meQAkBwAkBwMSrll 8wOWw+GQc/P7/eon7vqVT1oftuf90H8TzV9eXi6Xy33VZ5IDQHIAQHKgKIoi OQAgOQB9nBwoiqJ6W/zTCpAcAAAAAIDkAAAAAOAt/gO7wyTxouBoqgAAAABJ RU5ErkJggg== --Apple-Mail-6--452436910 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Cory 'G' Watson --Apple-Mail-6--452436910-- From pgsql-performance-owner@postgresql.org Tue Dec 17 08:26:29 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7D122475AAC for ; Tue, 17 Dec 2002 08:26:25 -0500 (EST) Received: from smtp.inphact.com (smtp.inphact.com [67.105.52.11]) by postgresql.org (Postfix) with ESMTP id D20F54766E3 for ; Tue, 17 Dec 2002 08:26:13 -0500 (EST) Received: from cafes.net (unknown [192.168.109.38]) by smtp.inphact.com (Postfix) with ESMTP id ECE93134002 for ; Tue, 17 Dec 2002 07:12:39 -0600 (CST) Date: Tue, 17 Dec 2002 07:30:13 -0600 Subject: Re: Profiling Content-Type: multipart/mixed; boundary=Apple-Mail-8--452412343 Mime-Version: 1.0 (Apple Message framework v548) From: Cory 'G' Watson To: pgsql-performance@postgresql.org In-Reply-To: <200212171227.07258.shridhar_daithankar@persistent.co.in> Message-Id: X-Mailer: Apple Mail (2.548) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/177 X-Sequence-Number: 593 --Apple-Mail-8--452412343 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On Tuesday, December 17, 2002, at 12:57 AM, Shridhar Daithankar wrote: > On Tuesday 17 December 2002 09:33 am, you wrote: >> Folks, >> >> I had a request from one of the SF-PUG members that I found >> interesting. She suggested that we post the specs of some of the >> PostgreSQL servers that we administrate, their statistics, and some >> comments on how they perform. I'll start it off with an example: > My take: Dual PIII-1.12Ghz, 3Gb, 5 x 36 RAID 5'ed with a spare, RedHat 7.2, Pg 7.3 pgbench, default settings, 252tps inc. connex, 409tps excluding connex Day to day, runs a monitoring/historical analysis tool of my design with gathers metrics from around 30 hosts (they report every 10 minutes, by their clock). Has 3,689,652 rows as of right now in the 'metrics' table, which is indexed by timestamp. My 'main' query is in the form of: SELECT timestamp, data FROM metrics WHERE resgroupid=? and hostid=? AND timestamp BETWEEN ? AND ? ORDER BY timestamp Index is on timestamp. This query generally takes about half a second for 24 hours worth of data. I just ran a 240 hour query on a test database with about 20,000 rows and the result too 2998ms. Things slowed to a crawl about 2 weeks ago, so I upgraded to 7.3 and saw a huge improvement. I believe part of this might have been due to the recreation of the database, similar to a CLUSTER. My performance is not degrading from a time perspective, but CPU usage is steadily degrading. User time is steadily increasing over the last 240 hours, from 5% to 15%. Attached is output of my monitoring program (well, the new improved Java version) showing the CPU performance over the last 240 hours. shared_buffers = 98304 sort_mem = 1600 fsync = false Everything else is default, recommendations welcome. ;) --Apple-Mail-8--452412343 Content-Disposition: inline; filename=cpu.png Content-Transfer-Encoding: base64 Content-Type: image/png; x-unix-mode=0644; name="cpu.png" iVBORw0KGgoAAAANSUhEUgAABBMAAAILCAIAAAA18UPGAABwTklEQVR42uy9 DXRUVZrvHWLlarc6ijpGEJAvbeW2grYaVDQZ8SMMjkkn8qHihTHo4nrhYmNY MRNsbJzmY1DEJUgTBEOTGARCiimVFjokeaGbdzWX8UXpoX31ruDIXU1f1vsy 6+XeYa3ba93z7sNT7Np1zqnPVFXq47fXs/baOTl16tQvdU6e/3meZ++i3x78 LYZhGIZhGIZhWHQrAgGGYRiGYRiGYSgHDMMwDMMwDMNQDhiGYRiGYRiGoRww DMMwDMMwDEM5YBiGYRiGYRiGcsAwDMMwDMMwDOWAYRiGYRiGYRjKAcMwDMMw DMMwDOWAYRiGxfz3cLGBAsMwDEM5YBiGpd4O9R5qWNxQ/lD597//fZ/Pd+ml l44dO3b6tOlb3t/i8MilqR3GjB4zZ/acnq6e6C57TD8+6Rd6vjaeLYgWDMMw lAOGYRiWjHV2dI68aaQpDEpKSpR+MP3goght6pSpmVEOD056cMSIEd+77HvZ oBziPBkMwzAM5YBhGJY/1nugd/iw4eLyjr9j/Pp31x/qPSS/WvfOuvsm3ud2 i9UOi19ZrIMPmVEOcfrlmXHfEQkYhmEoBwzDsIKzBfMXiBM87rZxB3sOxukr K/GgoxMZUA7uWEd/Yg6R4ifmu//ivV88MvkRyd26+qqra6prPvv0s0RPRpl6 1czpMwcPHqyOo3o11sdxv6ru+bprr7lWIZ30wKRPA5/y5cQwDEM5YBiGZZHd dedd4rmuXrU6Tv8+4A88MfUJ+fFHd/0oL5WD+7cV5RWJnkzXvq4xo8c4dh41 apTa7n4jjVTaY48+xpcTwzAM5YBhGJZFdumll4qr2nugNx7/3mxXXnnlL1t+ OYDZSv2vc9BpV9Nqp5nblePetq1NUrYc0ZX4T+b5Oc/Llqonqw71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EGgABBrEHILm8/kibaHOITUNINAA CDQAAg2AQAMg0Mh15bB61eq77rzL3LJy+coJ4ycQc0DpQgMg0AAINAACDYBA A+UQmoN11KhRW97forf4fL5xt41r29bGeg4pbACBBkCgARBoAAQaAIFGDisH 1pBG6UIDINAACDQAAg2AQAPlMJDKgdQ6gEADINAACDQAAg2AQAPlgMwFCDQA Ag2AQAMg0AAINFAOqVAOpNYBBBoAgQZAoAEQaAAEGigHZC5AoAEQaAAEGgCB BkCggXKgziEdDSDQAAg0AAINgEADINBAOSBzAQINgEADINAACDQAAg2UA3UO KWgAgQZAoAEQaAAEGgCBBsoBmQsQaAAEGgCBBkCgARBooByoc0hJAwg0AAIN gEADINAACDRQDshcgEADINAACDQAAg2AQAPlQJ1DChpAoAEQaAAEGgCBBkCg gXJA5gIEGgCBBkCgARBoAAQaKAfqHFLSAAINgEADINAACDQAAo3cVQ5FRUXF xcXj7xi//t31sqWzo7Pqyaqa6pqAP0DMAaULDYBAAyDQAAg0AAINlEPIdu/c PXjwYBkr2dDU2NTY0FhbU0udQwobQKABEGgABBoAgQZAoJHzymHtW2sryitk XFpa2nugV5kaEHNA6UIDINAACDQAAg2AQAPlELTi4uIxo8fs/Xiv/Ojz+fSg 50Lz+/0tLS2qt+VaX193d7fqY47lzxP//nk/VkoXDqHx0qVw4HqJNFY04MD1 wr2U64V7KdcL99I4x5mOOSx7fdl9E+9zKwdiDihdaAAEGgCBBkCgARBoEHMI M60ThtwwpKerp2tfVz+zlUitAwg0AAINgEADINAACDTyTTmsXrX6rjvvknFt TW1TY1PD4oZ+VkgjcwECDYBAAyDQAAg0AAKN/FEORRfaqFGjtry/RbYE/IGa 6pr+z8rKFMIAgQZAoAEQaAAEGgCBRv4oB9aQRulCAyDQAAg0AAINgEAD5TCQ yoHUOoBAAyDQAAg0AAINgEAD5YDMBQg0AAINgEADINAACDRQDqlQDqTWAQQa AIEGQKABEGgABBooB2QuQKABEGgABBoAgQZAoIFyoM4hDQ0g0AAINAACDYBA A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J5kvd3Nw4nU5le3Z2tlKpBINBw3fBkn0mOQAkBwAkh+eKx+PaL2+4 XK5qtZrNZiORiLIyMjJyd3d3fHzs9XqbBovJycnT09NSqeR2u5seSiQSmUzG 9J2j6rc4wuGwshIKhfL5vBxL/da+fkV/UMPhaXh4WK7oHyYHEz1fWlra3NyU DXnh/Py8+tparSaX08nlW77/HSYHE81XbulRvxokL19cXEyn04bvgiX7THIA SA4A+iA5SEIw9OeP+pSLiwuPx6POCjMzMzJFBYPBQqGgrORyOfmxUqnob2aQ 50Sj0aOjI32ouL6+ljPZ2NhQv8D91jtHZZ8+n082lJWzs7NYLCYno94nql/R H9RwopIT1t/S3ZPkcHJi3O/fv/96momey0skp9ntdjlz9YZd2UMgEFC+dv/q 5Vu+/8VG0fDX/VfjVzfNV/5o4Pf71ZuY6/X66Ojow8OD4btgyT6THACSA4A+ SA4f9f8XaboymUxTFNGvfLr64D23dv9NNF9Cxfr6el/1meQAkBwAkBwMSrll 8wOWw+GQc/P7/eon7vqVT1oftuf90H8TzV9eXi6Xy33VZ5IDQHIAQHKgKIoi OQAgOQB9nBwoiqJ6W/zTCpAcAAAAAIDkAAAAAOAt/gO7wyTxouBoqgAAAABJ RU5ErkJggg== --Apple-Mail-8--452412343 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Cory 'G' Watson --Apple-Mail-8--452412343-- From pgsql-performance-owner@postgresql.org Tue Dec 17 08:36:29 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EBCA14768AB for ; Tue, 17 Dec 2002 08:36:26 -0500 (EST) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id DBDEA476866 for ; Tue, 17 Dec 2002 08:35:16 -0500 (EST) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id gBHDZGK09636 for ; Tue, 17 Dec 2002 19:05:16 +0530 Received: from daithan.itnranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id gBHDZG009631 for ; Tue, 17 Dec 2002 19:05:16 +0530 Content-Type: text/plain; charset="iso-8859-1" From: Shridhar Daithankar To: pgsql-performance@postgresql.org Subject: Re: Profiling Date: Tue, 17 Dec 2002 19:05:41 +0530 User-Agent: KMail/1.4.3 References: <9D71C94A-11C3-11D7-8929-0003939CCA58@cafes.net> In-Reply-To: <9D71C94A-11C3-11D7-8929-0003939CCA58@cafes.net> MIME-Version: 1.0 Message-Id: <200212171905.41759.shridhar_daithankar@persistent.co.in> Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by www.pspl.co.in id gBHDZG009631 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/178 X-Sequence-Number: 594 On Tuesday 17 December 2002 06:59 pm, you wrote: > shared_buffers = 98304 > sort_mem = 1600 > fsync = false > > Everything else is default, recommendations welcome. ;) What is the vacuum frequency? Shridhar From pgsql-performance-owner@postgresql.org Tue Dec 17 08:39:31 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D5DDC475AE4 for ; Tue, 17 Dec 2002 08:39:29 -0500 (EST) Received: from smtp.inphact.com (smtp.inphact.com [67.105.52.11]) by postgresql.org (Postfix) with ESMTP id 5D1FE475AAC for ; Tue, 17 Dec 2002 08:39:29 -0500 (EST) Received: from cafes.net (unknown [192.168.109.38]) by smtp.inphact.com (Postfix) with ESMTP id E0C57134002; Tue, 17 Dec 2002 07:25:55 -0600 (CST) Date: Tue, 17 Dec 2002 07:43:28 -0600 Subject: Re: Profiling Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v548) Cc: pgsql-performance@postgresql.org To: Shridhar Daithankar From: Cory 'G' Watson In-Reply-To: <200212171905.41759.shridhar_daithankar@persistent.co.in> Message-Id: <861F40A0-11C5-11D7-8929-0003939CCA58@cafes.net> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.548) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/179 X-Sequence-Number: 595 On Tuesday, December 17, 2002, at 07:35 AM, Shridhar Daithankar wrote: > On Tuesday 17 December 2002 06:59 pm, you wrote: >> shared_buffers = 98304 >> sort_mem = 1600 >> fsync = false >> >> Everything else is default, recommendations welcome. ;) > > What is the vacuum frequency? Every morning. This db is almost exclusively INSERT and SELECT. Well, I take that back, a single table gets UPDATEs rather frequently. Otherwise, INSERT only. Cory 'G' Watson From pgsql-performance-owner@postgresql.org Tue Dec 17 08:49:08 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 57E0F475DD0 for ; Tue, 17 Dec 2002 08:49:07 -0500 (EST) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 40FFF475AE4 for ; Tue, 17 Dec 2002 08:49:05 -0500 (EST) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id gBHDn8q10992 for ; Tue, 17 Dec 2002 19:19:08 +0530 Received: from daithan.itnranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id gBHDn7010987 for ; Tue, 17 Dec 2002 19:19:07 +0530 Content-Type: text/plain; charset="iso-8859-1" From: Shridhar Daithankar To: pgsql-performance@postgresql.org Subject: Re: Profiling Date: Tue, 17 Dec 2002 19:19:33 +0530 User-Agent: KMail/1.4.3 References: <861F40A0-11C5-11D7-8929-0003939CCA58@cafes.net> In-Reply-To: <861F40A0-11C5-11D7-8929-0003939CCA58@cafes.net> MIME-Version: 1.0 Message-Id: <200212171919.33174.shridhar_daithankar@persistent.co.in> Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by www.pspl.co.in id gBHDn7010987 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/180 X-Sequence-Number: 596 On Tuesday 17 December 2002 07:13 pm, you wrote: > On Tuesday, December 17, 2002, at 07:35 AM, Shridhar Daithankar wrote: > > What is the vacuum frequency? > > Every morning. This db is almost exclusively INSERT and SELECT. Well, > I take that back, a single table gets UPDATEs rather frequently. > Otherwise, INSERT only. i recommend a vacuum analyze per 1000/2000 records for the table that gets updated. It should boost the performance like anything.. Shridhar From pgsql-performance-owner@postgresql.org Tue Dec 17 09:17:19 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0075947629D for ; Tue, 17 Dec 2002 09:17:19 -0500 (EST) Received: from smtp.inphact.com (smtp.inphact.com [67.105.52.11]) by postgresql.org (Postfix) with ESMTP id 1DB84476243 for ; Tue, 17 Dec 2002 09:16:21 -0500 (EST) Received: from cafes.net (unknown [192.168.109.38]) by smtp.inphact.com (Postfix) with ESMTP id E00E0134002; Tue, 17 Dec 2002 08:02:47 -0600 (CST) Date: Tue, 17 Dec 2002 08:20:21 -0600 Subject: Re: Profiling Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v548) Cc: pgsql-performance@postgresql.org To: Shridhar Daithankar From: Cory 'G' Watson In-Reply-To: <200212171919.33174.shridhar_daithankar@persistent.co.in> Message-Id: Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.548) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/181 X-Sequence-Number: 597 On Tuesday, December 17, 2002, at 07:49 AM, Shridhar Daithankar wrote: > On Tuesday 17 December 2002 07:13 pm, you wrote: >> On Tuesday, December 17, 2002, at 07:35 AM, Shridhar Daithankar wrote: >>> What is the vacuum frequency? >> >> Every morning. This db is almost exclusively INSERT and SELECT. >> Well, >> I take that back, a single table gets UPDATEs rather frequently. >> Otherwise, INSERT only. > > i recommend a vacuum analyze per 1000/2000 records for the table that > gets > updated. It should boost the performance like anything.. By my math, I'll need to vacuum once every hour or so. Cron, here I come. vacuumdb --table cached_metrics loggerithim I assume I do not need a --analyze, since that table has no indexes. Should I vacuum the entire DB? Any other settings I should look at? Note that I'm not necessarily having any problems at present, but one can always tune. This DB is used with a web app (mod_perl/DBI) at the moment, but is moving to a Java Swing client, which will give me much more data about performance. Cory 'G' Watson From pgsql-performance-owner@postgresql.org Tue Dec 17 09:29:16 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 01F2D476855 for ; Tue, 17 Dec 2002 09:29:16 -0500 (EST) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by postgresql.org (Postfix) with ESMTP id 4F46047684A for ; Tue, 17 Dec 2002 09:29:14 -0500 (EST) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id gBHETHe14332 for ; Tue, 17 Dec 2002 19:59:17 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id gBHETH014327 for ; Tue, 17 Dec 2002 19:59:17 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Tue, 17 Dec 2002 19:59:42 +0530 MIME-Version: 1.0 Subject: Re: Profiling Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3DFF822E.3862.23CE04@localhost> References: <200212171919.33174.shridhar_daithankar@persistent.co.in> In-reply-to: X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/182 X-Sequence-Number: 598 On 17 Dec 2002 at 8:20, Cory 'G' Watson wrote: > By my math, I'll need to vacuum once every hour or so. Cron, here I > come. > > vacuumdb --table cached_metrics loggerithim http://gborg.postgresql.org/project/pgavd/projdisplay.php Yeah, yeah.. I wrote that..and use CVS as usual. No release as yet.. > I assume I do not need a --analyze, since that table has no indexes. > Should I vacuum the entire DB? You need analyse to keep vacuum non-locking I assume. And there is no need to vacuum entire DB. HTH Bye Shridhar -- paycheck: The weekly $5.27 that remains after deductions for federal withholding, state withholding, city withholding, FICA, medical/dental, long- term disability, unemployment insurance, Christmas Club, and payroll savings plan contributions. From pgsql-performance-owner@postgresql.org Tue Dec 17 09:49:26 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E2F3C475AE6 for ; Tue, 17 Dec 2002 09:49:24 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 450ED475AAC for ; Tue, 17 Dec 2002 09:49:24 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBHEnHpd006742; Tue, 17 Dec 2002 09:49:17 -0500 (EST) To: "Cory 'G' Watson" Cc: Shridhar Daithankar , pgsql-performance@postgresql.org Subject: Re: Profiling In-reply-to: References: Comments: In-reply-to "Cory 'G' Watson" message dated "Tue, 17 Dec 2002 08:20:21 -0600" Date: Tue, 17 Dec 2002 09:49:16 -0500 Message-ID: <6741.1040136556@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/183 X-Sequence-Number: 599 "Cory 'G' Watson" writes: > I assume I do not need a --analyze, since that table has no indexes. Whether you need analyze or not has nothing to do with whether there are indexes. You probably don't need it once an hour, but maybe once a day would be good. > Should I vacuum the entire DB? Overkill; just get the heavily-updated table(s). A DB-wide vacuum must be done occasionally, but again once-a-day would be plenty. > Any other settings I should look at? Free space map (fsm) settings must be adequate to keep track of the free space in your tables. However, all of this relates only to keeping performance good on the table with lots of updates. If you are seeing progressive degradation on a table that only gets INSERTs, then there's something else going on. AFAIR you didn't show us an EXPLAIN ANALYZE for the principal query? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Dec 17 11:23:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1EA1D47626B for ; Tue, 17 Dec 2002 11:23:37 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id 33528476247 for ; Tue, 17 Dec 2002 11:23:36 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gBHGMuI4008911 for ; Tue, 17 Dec 2002 09:22:56 -0700 (MST) Date: Tue, 17 Dec 2002 09:18:02 -0700 (MST) From: "scott.marlowe" To: Subject: Re: Profiling In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/184 X-Sequence-Number: 600 OK, my turn. We have two main servers that are identical, one is the online server, the other is the hot spare. Their specs: Dual PIII-750 1.5 Gig ram and dual 18 Gig 10krpm UW SCSI drives. OS on one drive, postgresql on the other. Interesting postgresql.conf entries: max_connections = 128 shared_buffers = 32768 max_fsm_relations = 10000 sort_mem = 2048 vacuum_mem = 8192 cpu_tuple_cost = 0.01 cpu_index_tuple_cost = 0.0001 cpu_operator_cost = 0.05 pgbench -c 4 -t 200 delivers about 240 tps. Performance is outstanding. This machine runs apache, OpenLDAP, Real Server 1, as well as Postgresql. All non-database data is stored on a NAS, so the local drives are only used for swap and postgresql. Average load is about 40 to 200 reads per minute, with only a handful of writes per minute (1 to 5 max). Most data is loaded from nightly runs out of the mainframe and a few other systems for things like company phonebook and ldap. My test servers: Server A: Dual PPro 200 with 256 Meg RAM and 6x4Gig 10kRPM UW SCSI drives (3 quantum, 3 seagate) and 2x80Gig 7200 RPM IDE drives. Data is generally stored on the pair of 80 gig drives, because the 4 gig scsis just aren't big enough. The 80 gig ides are setup as two 40 gig mirrors (i.e. they're split in half) with the other half used to store backups and such. shared_buffers = 5000 pgbench -c 4 -t 200 yields about 80 tps. Performance is actually quite good, and this is a box we bought in 1997. Server B: (My workstation) Celeron 1.1GHz, with 512 MEg RAM and a 40 gig IDE @7200 RPM, and a 17 Gig IDE @5400 RPM. shared_buffers = 4096 pgbench -c 4 -t 200 yields about 75 tps. Yes, my dual PPro 200 outruns this box. But then again, my workstation has KDE up and running with Mozilla, xmms mp3 player going, and a couple other programs running as well. All of these boxes are / were heavily tested before deployment, and we have never had a problem with postgresql on any of them. From pgsql-performance-owner@postgresql.org Thu Dec 19 05:09:33 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B0666476D7B for ; Thu, 19 Dec 2002 05:09:32 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 55F9847629D for ; Thu, 19 Dec 2002 05:09:19 -0500 (EST) Received: from klaster.net (ph56.krakow.cvx.ppp.tpnet.pl [217.99.208.56]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 218932B854 for ; Thu, 19 Dec 2002 10:52:50 +0100 (CET) Message-ID: <3E019B71.5050901@klaster.net> Date: Thu, 19 Dec 2002 11:12:01 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: PgSQL Performance ML Subject: EXISTS vs IN vs OUTER JOINS Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/185 X-Sequence-Number: 601 Hi Few days ago I read, that EXISTS is better than IN, but only if there are many records (how many?). I was wondering which one is better and when. Did anyone try to compare these queries doing the same work: - select * from some_table t where t.id [not] in (select id from filter); - select * from some_table t where [not] exists (select * from filter where id=t.id); - select * from some_table t left join filter f using (id) where f.id is [not] null; Regards, Tomasz Myrta From pgsql-performance-owner@postgresql.org Thu Dec 19 12:16:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A415B476FBE for ; Thu, 19 Dec 2002 12:16:33 -0500 (EST) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id 262DD476FEB for ; Thu, 19 Dec 2002 12:15:38 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2291801; Thu, 19 Dec 2002 09:15:36 -0800 From: "Josh Berkus" Subject: Re: EXISTS vs IN vs OUTER JOINS To: Tomasz Myrta , PgSQL Performance ML X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Thu, 19 Dec 2002 09:15:36 -0800 Message-ID: In-Reply-To: <3E019B71.5050901@klaster.net> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/186 X-Sequence-Number: 602 Tomasz, > Few days ago I read, that EXISTS is better than IN, but only if there > are many records (how many?). I was wondering which one is better and > when. Did anyone try to compare these queries doing the same work: > > - select * from some_table t > where t.id [not] in (select id from filter); > -select * from some_table t > where [not] exists (select * from filter where id=t.id); The rule I use is: if I expect the sub-select to return more than 12 records 20% or more of the time, use EXISTS. The speed gain for IN on small lists is not as dramatic as the speed loss for EXISTS on large lists. More importantly, the difference between NOT IN and NOT EXISTS can be as much as 20:1 on large sub-selects, as opposed to IN and EXISTS, where I have rarely seen a difference of more than 3:1. As I understand it, this is because NOT EXISTS can use optimized join algorithms to locate matching rows, whereas NOT IN must compare each row against every possible matching value in the subselect. It also makes a difference whether or not the referenced field(s) in the subselect is indexed. EXISTS will often use an index to compare the values in the master query to the sub-query. As far as I know, IN can use an index to retrieve the subquery values, but not to sort or compare them after they have been retreived into memory. > -select * from some_table t > left join filter f using (id) > where f.id is [not] null; This will not get you the same result as the above. It will get you all rows from t+f where a record is present in f and has (or does not have) a NULL value for f.id. While this type of query works in MS Access, it will not work in SQL92/99-commpliant databases. Incidentally, the dramatic differences between IN and EXISTS are not only a "PostgreSQL Thing". The same rules apply to MS SQL Server and SQL Anywhere, for the same reasons. -Josh Berkus From pgsql-performance-owner@postgresql.org Thu Dec 19 12:47:46 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 096464770CD for ; Thu, 19 Dec 2002 12:47:44 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id E177A476FC4 for ; Thu, 19 Dec 2002 12:44:03 -0500 (EST) Received: by serwer.skawsoft.com.pl (Postfix, from userid 1000) id CDC2F2B85D; Thu, 19 Dec 2002 18:27:33 +0100 (CET) Date: Thu, 19 Dec 2002 18:27:33 +0100 To: Josh Berkus Cc: Tomasz Myrta , PgSQL Performance ML Subject: Re: EXISTS vs IN vs OUTER JOINS Message-ID: <20021219172733.GA1001@serwer> References: <3E019B71.5050901@klaster.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i From: jasiek@klaster.net X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/187 X-Sequence-Number: 603 On Thu, Dec 19, 2002 at 09:15:36AM -0800, Josh Berkus wrote: > > -select * from some_table t > > left join filter f using (id) > > where f.id is [not] null; > > This will not get you the same result as the above. It will get you > all rows from t+f where a record is present in f and has (or does not > have) a NULL value for f.id. While this type of query works in MS > Access, it will not work in SQL92/99-commpliant databases. filter_table does not contain null fields. It has only two states: it has row or it hasn't row coresponding to row in some_table. And now, which one is better? Tomasz Myrta From pgsql-performance-owner@postgresql.org Thu Dec 19 12:48:28 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CF5DC4770C8 for ; Thu, 19 Dec 2002 12:48:27 -0500 (EST) Received: from joeconway.com (unknown [63.210.180.150]) by postgresql.org (Postfix) with ESMTP id C29BA4762C1 for ; Thu, 19 Dec 2002 12:44:56 -0500 (EST) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.2) with ESMTP-TLS id 1489143; Thu, 19 Dec 2002 10:24:30 -0800 Message-ID: <3E02053C.7070305@joeconway.com> Date: Thu, 19 Dec 2002 09:43:24 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2) Gecko/20021126 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: Tomasz Myrta , PgSQL Performance ML Subject: Re: EXISTS vs IN vs OUTER JOINS References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/188 X-Sequence-Number: 604 Josh Berkus wrote: > where I have rarely seen a difference of more than 3:1. As I > understand it, this is because NOT EXISTS can use optimized join > algorithms to locate matching rows, whereas NOT IN must compare each > row against every possible matching value in the subselect. > > It also makes a difference whether or not the referenced field(s) in > the subselect is indexed. EXISTS will often use an index to compare > the values in the master query to the sub-query. As far as I know, IN > can use an index to retrieve the subquery values, but not to sort or > compare them after they have been retreived into memory. I wonder if "[NOT] IN (subselect)" could be improved with a hash table in similar fashion to the hash aggregate solution Tom recently implemented? Joe From pgsql-performance-owner@postgresql.org Thu Dec 19 13:58:40 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 74A41475DB3 for ; Thu, 19 Dec 2002 13:58:39 -0500 (EST) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id 60D11475C2B for ; Thu, 19 Dec 2002 13:58:38 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2291948; Thu, 19 Dec 2002 10:58:30 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: jasiek@klaster.net Subject: Re: EXISTS vs IN vs OUTER JOINS Date: Thu, 19 Dec 2002 11:02:39 -0800 X-Mailer: KMail [version 1.4] Cc: Tomasz Myrta , PgSQL Performance ML References: <3E019B71.5050901@klaster.net> <20021219172733.GA1001@serwer> In-Reply-To: <20021219172733.GA1001@serwer> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212191102.39785.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/190 X-Sequence-Number: 606 Tomasz, > > This will not get you the same result as the above. It will get you > > all rows from t+f where a record is present in f and has (or does not > > have) a NULL value for f.id. While this type of query works in MS > > Access, it will not work in SQL92/99-commpliant databases. >=20 > filter_table does not contain null fields. It has only two states: it > has row > or it hasn't row coresponding to row in some_table. >=20 > And now, which one is better? You're not listening. I said that LEFT JOIN won't work. At all. Please re-read the paragraph above, which explains why. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Dec 19 14:08:09 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C232E4770A3 for ; Thu, 19 Dec 2002 14:08:08 -0500 (EST) Received: from email04.aon.at (WARSL402PIP5.highway.telekom.at [195.3.96.79]) by postgresql.org (Postfix) with SMTP id E55BB47705E for ; Thu, 19 Dec 2002 14:07:37 -0500 (EST) Received: (qmail 335746 invoked from network); 19 Dec 2002 19:07:37 -0000 Received: from m150p028.dipool.highway.telekom.at (HELO cantor) ([62.46.8.188]) (envelope-sender ) by qmail5rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 19 Dec 2002 19:07:37 -0000 From: Manfred Koizar To: gry@ll.mit.edu Cc: pgsql-performance@postgresql.org Subject: Re: 4G row table? Date: Thu, 19 Dec 2002 20:07:53 +0100 Message-ID: References: <20021219141058.11d4b693.gry@ll.mit.edu> In-Reply-To: <20021219141058.11d4b693.gry@ll.mit.edu> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/191 X-Sequence-Number: 607 On Thu, 19 Dec 2002 14:10:58 -0500, george young wrote: >with 4 billion(4e9) rows. I would guess to make wafer, die_row, etc. be of >type "char", probably testtype a char too with a separate testtype lookup table. >Even so, this will be a huge table. Don't know if you can store 0-127 in a "char" column ... Anyway, it doesn't matter, if it does not cause the tuple size to cross a 4 byte boundary, because the tuple size will be rounded up to a multiple of 4. >Questions: How much overhead will there be in the table in addition to the >9 bytes of data I see? There is a page header (ca. 20 bytes) per page (8K by default). Then you have a tuple header and 4 bytes ItemIdData per tuple. PG 7.2: Without NULLs a tuple header is 32 bytes, add 4 bytes for each tuple containing at least one NULL column. PG 7.3: 24 bytes tuple header (with and without NULLs, because you have only 8 columns). >How big will the primary index on the first seven columns be? Don't know offhand. No time now to dig it out. Will answer tomorrow, if nobody else jumps in ... Servus Manfred From pgsql-performance-owner@postgresql.org Thu Dec 19 13:16:47 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C65A2476CA2 for ; Thu, 19 Dec 2002 13:16:45 -0500 (EST) Received: from ll.mit.edu (LLMAIL.LL.MIT.EDU [129.55.12.40]) by postgresql.org (Postfix) with ESMTP id C315D476FE2 for ; Thu, 19 Dec 2002 13:11:30 -0500 (EST) Received: (from smtp@localhost) by ll.mit.edu (8.11.3/8.8.8) id gBJIBTZ22588 for ; Thu, 19 Dec 2002 13:11:29 -0500 (EST) Received: from sty.llan.ll.mit.edu( ), claiming to be "sty.llan" via SMTP by llpost, id smtpdAAAfTaWgJ; Thu Dec 19 13:10:56 2002 Date: Thu, 19 Dec 2002 14:10:58 -0500 From: george young To: pgsql-performance@postgresql.org Subject: 4G row table? Message-Id: <20021219141058.11d4b693.gry@ll.mit.edu> Reply-To: gry@ll.mit.edu Organization: MIT Lincoln Laboratory X-Mailer: Sylpheed version 0.8.5 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/189 X-Sequence-Number: 605 [linux, 700MHz athlon, 512MB RAM, 700GB 10kRPM SCSI HW RAID, postgresql 7.2] We're setting up a DB of IC test data, which is very simple and regular, but large. One project (we get three or four per year) has ~4 giga bits, each specified by a few small integer values, e.g.: Name Type Values ---------------------- wafer int 1-50 die_row int 2-7 die_col int 2-7 testtype string (~10 different short strings) vdd int 0-25 bit_col int 0-127 bit_row int 0-511 value bit 0 or 1 with 4 billion(4e9) rows. I would guess to make wafer, die_row, etc. be of type "char", probably testtype a char too with a separate testtype lookup table. Even so, this will be a huge table. Questions: How much overhead will there be in the table in addition to the 9 bytes of data I see? How big will the primary index on the first seven columns be? Will this schema work at all? Of course, we could pack 128 bits into an 8 byte "text" field (or should we use bit(128)?), but lose some ease of use, especially for naive (but important) users. Comments, suggestions? -- George -- I cannot think why the whole bed of the ocean is not one solid mass of oysters, so prolific they seem. Ah, I am wandering! Strange how the brain controls the brain! -- Sherlock Holmes in "The Dying Detective" From pgsql-performance-owner@postgresql.org Thu Dec 19 14:11:19 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F3ACE47590C for ; Thu, 19 Dec 2002 14:11:18 -0500 (EST) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id 44913475C45 for ; Thu, 19 Dec 2002 14:11:18 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2291962; Thu, 19 Dec 2002 11:11:11 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: gry@ll.mit.edu, pgsql-performance@postgresql.org Subject: Re: 4G row table? Date: Thu, 19 Dec 2002 11:15:20 -0800 X-Mailer: KMail [version 1.4] References: <20021219141058.11d4b693.gry@ll.mit.edu> In-Reply-To: <20021219141058.11d4b693.gry@ll.mit.edu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212191115.20391.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/192 X-Sequence-Number: 608 George, > [linux, 700MHz athlon, 512MB RAM, 700GB 10kRPM SCSI HW RAID, postgresql 7= .2] What kind of RAID? How many drives? Will you be updating the data=20 frequently, or mostly just running reports on it? With 4G rows, you will have *heavy* disk access, so the configuration and= =20 quality of your disk array is a big concern. You also might think about= =20 upping th ememory if you can. > We're setting up a DB of IC test data, which is very simple and regular, = but=20 large. > One project (we get three or four per year) has ~4 giga bits, each specif= ied=20 by > a few small integer values, e.g.: > Name Type Values > ---------------------- > wafer int 1-50 > die_row int 2-7 > die_col int 2-7 > testtype string (~10 different short strings) > vdd int 0-25 > bit_col int 0-127 > bit_row int 0-511 > value bit 0 or 1 >=20 > with 4 billion(4e9) rows. I would guess to make wafer, die_row, etc. be = of > type "char", probably testtype a char too with a separate testtype lookup= =20 table. > Even so, this will be a huge table.=20=20 1. Use INT2 and not INT for the INT values above. If you can hire a=20 PostgreSQL hacker, have them design a new data type for you, an unsigned IN= T1=20 which will cut your storage space even further. 2. Do not use CHAR for wafer & die-row. CHAR requries min 3bytes storage;= =20 INT2 is only 2 bytes. 3. If you can use a lookup table for testtype, make it another INT2 and cre= ate=20 a numeric key for the lookup table. > Questions: How much overhead will there be in the table in addition to the > 9 bytes of data I see?=20=20 There's more than 9 bytes in the above. Count again. > How big will the primary index on the first seven columns > be? Will this schema work at all?=20 As large as the 7 columns themselves, plus a little more. I suggest creat= ing=20 a surrogate key as an int8 sequence to refer to most rows.=20=20 > Of course, we could pack 128 bits into an 8 byte "text" field (or should = we=20 use bit(128)?), > but lose some ease of use, especially for naive (but important) users. This is also unlikely to be more efficient due to the translation<->convers= ion=20 process requried to access the data when you query. > Comments, suggestions? Unless you have a *really* good RAID array, expect slow performance on this= =20 hardware platform. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Dec 19 14:28:28 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 29428476CD4 for ; Thu, 19 Dec 2002 14:28:26 -0500 (EST) Received: from clearmetrix.com (unknown [209.92.142.67]) by postgresql.org (Postfix) with ESMTP id 078EA476067 for ; Thu, 19 Dec 2002 14:28:23 -0500 (EST) Received: from clearmetrix.com (chw.muvpn.clearmetrix.com [172.16.1.3]) by clearmetrix.com (8.11.6/linuxconf) with ESMTP id gBJJRi721356; Thu, 19 Dec 2002 14:27:44 -0500 Message-ID: <3E021D9D.1040608@clearmetrix.com> Date: Thu, 19 Dec 2002 14:27:25 -0500 From: "Charles H. Woloszynski" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: josh@agliodbs.com Cc: gry@ll.mit.edu, pgsql-performance@postgresql.org Subject: Re: 4G row table? References: <20021219141058.11d4b693.gry@ll.mit.edu> <200212191115.20391.josh@agliodbs.com> In-Reply-To: <200212191115.20391.josh@agliodbs.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/193 X-Sequence-Number: 609 Josh: Why do you say to expect slow performance on this hardware? Is there something specific about the configuration that worries you? Or, just lots of data in the database, so the data will be on disk and not in the cache (system or postgresql)? What do you classify as *slow*? Obviously, he is dependent on the I/O channel given the size of the tables. So, good indexing will be required to help on the queries. No comments on the commit rate for this data (I am guessing that it is slow, given the description of the database), so that may or may not be an issue. Depending on the type of queries, perhaps clustering will help, along with some good partitioning indexes. I just don't see the slow in the hardware. Of course, if he is targeting lots of concurrent queries, better add some additional processors, or better yet, use ERSERVER and replicate the data to a farm of machines. [To avoid the I/O bottleneck of lots of concurrent queries against these large tables]. I guess there are a lot of assumptions on the data's use to decide if the hardware is adequate or not :-) Charlie Josh Berkus wrote: >George, > > >>[linux, 700MHz athlon, 512MB RAM, 700GB 10kRPM SCSI HW RAID, postgresql 7.2] >> >> > >What kind of RAID? How many drives? Will you be updating the data >frequently, or mostly just running reports on it? > > >Unless you have a *really* good RAID array, expect slow performance on this >hardware platform. > > > -- Charles H. Woloszynski ClearMetrix, Inc. 115 Research Drive Bethlehem, PA 18015 tel: 610-419-2210 x400 fax: 240-371-3256 web: www.clearmetrix.com From pgsql-performance-owner@postgresql.org Thu Dec 19 14:45:07 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C7E4E475E7B for ; Thu, 19 Dec 2002 14:45:05 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 22533475DB3 for ; Thu, 19 Dec 2002 14:45:03 -0500 (EST) Received: by serwer.skawsoft.com.pl (Postfix, from userid 1000) id 64D882B85D; Thu, 19 Dec 2002 20:28:30 +0100 (CET) Date: Thu, 19 Dec 2002 20:28:30 +0100 To: Josh Berkus Cc: jasiek@klaster.net, PgSQL Performance ML Subject: Re: EXISTS vs IN vs OUTER JOINS Message-ID: <20021219192830.GA8336@serwer> References: <3E019B71.5050901@klaster.net> <20021219172733.GA1001@serwer> <200212191102.39785.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200212191102.39785.josh@agliodbs.com> User-Agent: Mutt/1.3.28i From: jasiek@klaster.net X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/195 X-Sequence-Number: 611 On Thu, Dec 19, 2002 at 11:02:39AM -0800, Josh Berkus wrote: > > Tomasz, > You're not listening. I said that LEFT JOIN won't work. At all. > > Please re-read the paragraph above, which explains why. I read your mail once again, but I still don't understand what are you talking about. I'll write example - maybe it will help us to understand each other. I have three tables: users, things and access_list create table users( user_id integer primary key, username varchar ); insert into users(1,'Tomasz'); create table things( thing_id int4 primary key, thingname varchar ); insert into things(1,'thing1'); insert into things(2,'thing2'); insert into things(3,'thing3'); insert into things(4,'thing4'); insert into things(5,'thing5'); create table access_list( user_id int4 not null references users, thing_id int4 not null references things ); insert into access_list(1,1); insert into access_list(1,4); SELECT u.username,t.thingname,al.thing_id from users u cross join things t left join access_list al on (s.user_id=al.user_id and t.thing_id=al.thing_id) Result: username thingname thing_id Tomasz thing1 1 Tomasz thing2 Tomasz thing3 Tomasz thing4 4 Tomasz thing5 5 Now if we add "where al.user_id is null" we get: Tomasz thing2 Tomasz thing3 Or if we add "where al.user_id is not null" we get: (the same result we have when using inner join) Tomasz thing1 1 Tomasz thing4 4 Tomasz thing5 5 I know this method will fail if we have not unique pairs in table access_list, but in other case it looks ok. Tomasz Myrta From pgsql-performance-owner@postgresql.org Thu Dec 19 14:36:39 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0DF5D475F26 for ; Thu, 19 Dec 2002 14:36:38 -0500 (EST) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by postgresql.org (Postfix) with ESMTP id 6C674475E7B for ; Thu, 19 Dec 2002 14:36:37 -0500 (EST) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20021219193638.WOP4411.lakemtao01.cox.net@[192.168.1.1]> for ; Thu, 19 Dec 2002 14:36:38 -0500 Subject: Re: 4G row table? From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <20021219141058.11d4b693.gry@ll.mit.edu> References: <20021219141058.11d4b693.gry@ll.mit.edu> Content-Type: text/plain Organization: Message-Id: <1040326596.28772.186.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 19 Dec 2002 13:36:36 -0600 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/194 X-Sequence-Number: 610 On Thu, 2002-12-19 at 13:10, george young wrote: > [linux, 700MHz athlon, 512MB RAM, 700GB 10kRPM SCSI HW RAID, postgresql 7.2] > We're setting up a DB of IC test data, which is very simple and regular, but large. > One project (we get three or four per year) has ~4 giga bits, each specified by > a few small integer values, e.g.: > Name Type Values > ---------------------- > wafer int 1-50 > die_row int 2-7 > die_col int 2-7 > testtype string (~10 different short strings) > vdd int 0-25 > bit_col int 0-127 > bit_row int 0-511 > value bit 0 or 1 > > with 4 billion(4e9) rows. I would guess to make wafer, die_row, etc. be of > type "char", probably testtype a char too with a separate testtype lookup table. > Even so, this will be a huge table. How many records per day will be inserted? Will they ever be updated? Do you have to have *ALL* 4 billion records in the same table at the same time? As Josh Berkus mentioned, wafer thru bit_col can be converted to INT2, if you make testtype use a lookup table; thus, each tuple could be shrunk to 20 bytes, plus 24 bytes per tuple (in v7.3) that would make the table a minimum of 189 billion bytes, not including index!!! Rethink your solution... One possibility would to have a set of tables, with names like: TEST_DATA_200301 TEST_DATA_200302 TEST_DATA_200303 TEST_DATA_200304 TEST_DATA_200305 TEST_DATA_200306 TEST_DATA_200307 TEST_DATA_ Then, each month do "CREATE VIEW TEST_DATA AS TEST_DATA_yyyymm" for the current month. > Questions: How much overhead will there be in the table in addition to the > 9 bytes of data I see? How big will the primary index on the first seven columns > be? Will this schema work at all? > > Of course, we could pack 128 bits into an 8 byte "text" field (or should we use bit(128)?), > but lose some ease of use, especially for naive (but important) users. > > Comments, suggestions? > > -- George > -- +---------------------------------------------------------------+ | Ron Johnson, Jr. mailto:ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | "My advice to you is to get married: If you find a good wife, | | you will be happy; if not, you will become a philosopher." | | Socrates | +---------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Dec 19 17:47:09 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BED48475D00 for ; Thu, 19 Dec 2002 17:47:07 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 1A5C6475CBC for ; Thu, 19 Dec 2002 17:47:07 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBJMkKpd006982; Thu, 19 Dec 2002 17:46:20 -0500 (EST) To: Joe Conway Cc: Josh Berkus , Tomasz Myrta , PgSQL Performance ML Subject: Re: EXISTS vs IN vs OUTER JOINS In-reply-to: <3E02053C.7070305@joeconway.com> References: <3E02053C.7070305@joeconway.com> Comments: In-reply-to Joe Conway message dated "Thu, 19 Dec 2002 09:43:24 -0800" Date: Thu, 19 Dec 2002 17:46:20 -0500 Message-ID: <6981.1040337980@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/196 X-Sequence-Number: 612 Joe Conway writes: > I wonder if "[NOT] IN (subselect)" could be improved with a hash table in > similar fashion to the hash aggregate solution Tom recently implemented? It's being worked on ;-) http://archives.postgresql.org/pgsql-hackers/2002-11/msg01055.php Assuming I get this done, the conventional wisdom that "EXISTS outperforms IN" will be stood on its head --- unless we add planner code to try to reverse-engineer an IN from an EXISTS, which is something I'm not really eager to expend code and cycles on. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 19 17:53:22 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CCAD3475F00 for ; Thu, 19 Dec 2002 17:53:20 -0500 (EST) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id 006DD475D00 for ; Thu, 19 Dec 2002 17:53:01 -0500 (EST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id gBJMqON27748; Thu, 19 Dec 2002 17:52:24 -0500 (EST) From: Bruce Momjian Message-Id: <200212192252.gBJMqON27748@candle.pha.pa.us> Subject: Re: EXISTS vs IN vs OUTER JOINS In-Reply-To: <6981.1040337980@sss.pgh.pa.us> To: Tom Lane Date: Thu, 19 Dec 2002 17:52:24 -0500 (EST) Cc: Joe Conway , Josh Berkus , Tomasz Myrta , PgSQL Performance ML X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/197 X-Sequence-Number: 613 Tom Lane wrote: > Joe Conway writes: > > I wonder if "[NOT] IN (subselect)" could be improved with a hash table in > > similar fashion to the hash aggregate solution Tom recently implemented? > > It's being worked on ;-) > > http://archives.postgresql.org/pgsql-hackers/2002-11/msg01055.php > > Assuming I get this done, the conventional wisdom that "EXISTS > outperforms IN" will be stood on its head --- unless we add planner code > to try to reverse-engineer an IN from an EXISTS, which is something I'm > not really eager to expend code and cycles on. I am looking forward to removing _that_ FAQ item. :-) -- 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 Thu Dec 19 18:20:38 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 14879476082 for ; Thu, 19 Dec 2002 18:20:34 -0500 (EST) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id C1A9B4769EF for ; Thu, 19 Dec 2002 18:19:19 -0500 (EST) Received: from [216.135.165.74] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2292427; Thu, 19 Dec 2002 15:19:21 -0800 From: "Josh Berkus" Subject: Re: EXISTS vs IN vs OUTER JOINS To: jasiek@klaster.net, Josh Berkus Cc: jasiek@klaster.net, PgSQL Performance ML X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Thu, 19 Dec 2002 15:19:21 -0800 Message-ID: In-Reply-To: <20021219192830.GA8336@serwer> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/198 X-Sequence-Number: 614 Tomasz, > I read your mail once again, but I still don't understand what are > you > talking about. > I'll write example - maybe it will help us to understand each other. Hmmm ... you're right. Sorry for being dense. It shouldn't work, but it does. Tom, Bruce: If I run the query: SELECT t1.* FROM table1 t1 LEFT JOIN table2 t2 ON t1.xid = t2.xid WHERE t2.label IS NULL I will get rows in t1 for which there is no row in t2. This does not seem SQL-spec to me; shouldn't I get only rows from t1 where a row exists in t2 and t2.label IS NULL? -Josh From pgsql-performance-owner@postgresql.org Thu Dec 19 19:03:31 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 53890475F5F for ; Thu, 19 Dec 2002 19:03:29 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id C90CD4768AA for ; Thu, 19 Dec 2002 19:02:14 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBK02Dpd010091; Thu, 19 Dec 2002 19:02:14 -0500 (EST) To: "Josh Berkus" Cc: jasiek@klaster.net, PgSQL Performance ML Subject: Re: EXISTS vs IN vs OUTER JOINS In-reply-to: References: Comments: In-reply-to "Josh Berkus" message dated "Thu, 19 Dec 2002 15:19:21 -0800" Date: Thu, 19 Dec 2002 19:02:13 -0500 Message-ID: <10090.1040342533@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/199 X-Sequence-Number: 615 "Josh Berkus" writes: > If I run the query: > SELECT t1.* > FROM table1 t1 > LEFT JOIN table2 t2 ON t1.xid = t2.xid > WHERE t2.label IS NULL > I will get rows in t1 for which there is no row in t2. This does not > seem SQL-spec to me; shouldn't I get only rows from t1 where a row > exists in t2 and t2.label IS NULL? No; that would be the behavior of an inner join, but you did a left join. The above will give you t1 rows for which there is no match in t2 (plus rows for which there is a match containing null in t2.label). regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 20 03:54:16 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 46EB64758C9 for ; Fri, 20 Dec 2002 03:54:15 -0500 (EST) Received: from email04.aon.at (WARSL402PIP5.highway.telekom.at [195.3.96.79]) by postgresql.org (Postfix) with SMTP id 6B8AD4758BD for ; Fri, 20 Dec 2002 03:54:14 -0500 (EST) Received: (qmail 298194 invoked from network); 20 Dec 2002 08:54:14 -0000 Received: from m169p025.dipool.highway.telekom.at (HELO cantor) ([62.46.11.25]) (envelope-sender ) by qmail5rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 20 Dec 2002 08:54:14 -0000 From: Manfred Koizar To: "Josh Berkus" Cc: jasiek@klaster.net, PgSQL Performance ML Subject: Re: EXISTS vs IN vs OUTER JOINS Date: Fri, 20 Dec 2002 09:53:56 +0100 Message-ID: <53m50vohh8v0asvmb425e9lplphvb1m6b1@4ax.com> References: <20021219192830.GA8336@serwer> In-Reply-To: X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/200 X-Sequence-Number: 616 On Thu, 19 Dec 2002 15:19:21 -0800, "Josh Berkus" wrote: >SELECT t1.* >FROM table1 t1 > LEFT JOIN table2 t2 ON t1.xid = t2.xid >WHERE t2.label IS NULL Josh, also note that Tomasz did something like SELECT t1.* FROM table1 t1 LEFT JOIN table2 t2 ON t1.xid = t2.xid WHERE t2.xid IS NULL ^^^ This special trick guarantees that you get exactly the rows from t1 not having a matching row in t2, because a NULL xid in t2 would not satisfy the condition t1.xid = t2.xid. Servus Manfred From pgsql-performance-owner@postgresql.org Fri Dec 20 05:28:20 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 855914767E6 for ; Fri, 20 Dec 2002 05:28:18 -0500 (EST) Received: from email05.aon.at (WARSL401PIP2.highway.telekom.at [195.3.96.74]) by postgresql.org (Postfix) with SMTP id B415D47600E for ; Fri, 20 Dec 2002 05:28:05 -0500 (EST) Received: (qmail 391048 invoked from network); 20 Dec 2002 10:27:36 -0000 Received: from m169p025.dipool.highway.telekom.at (HELO cantor) ([62.46.11.25]) (envelope-sender ) by qmail7rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 20 Dec 2002 10:27:36 -0000 From: Manfred Koizar To: gry@ll.mit.edu Cc: pgsql-performance@postgresql.org Subject: Re: 4G row table? Date: Fri, 20 Dec 2002 11:27:18 +0100 Message-ID: References: <20021219141058.11d4b693.gry@ll.mit.edu> In-Reply-To: <20021219141058.11d4b693.gry@ll.mit.edu> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/201 X-Sequence-Number: 617 On Thu, 19 Dec 2002 14:10:58 -0500, george young wrote: >with 4 billion(4e9) rows. >How big will the primary index on the first seven columns be? If you manage to pack the key into 8 bytes (by using a custom 1 byte integer datatype) and if there are no NULLs: 75 GB with a 100% fill factor, 114 GB with a 66% fill factor, realistically something in between. Note that frequent updates can cause index growth. >Will this schema work at all? You have a somewhat unusual identifier : payload ratio (8B : 1b). It depends on the planned use, but I'm not sure if *any* database is the right solution. You have "only" 30670848000 (30G) possible different key combinations, more than 1/8 of them (4G) are actually used. A 7-dimensional array of double-bits (1 bit to indicate a valid value and 1 bit payload) would require not more than 8 GB. If you plan to use a database because you have to answer ad-hoc queries, you will almost certainly need additonal indices. Servus Manfred From pgsql-performance-owner@postgresql.org Fri Dec 20 12:01:26 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 32BEB475B33 for ; Fri, 20 Dec 2002 12:01:24 -0500 (EST) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id 89229475AEC for ; Fri, 20 Dec 2002 12:01:23 -0500 (EST) Received: from [63.195.55.98] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 4.0.2) with HTTP id 2293056; Fri, 20 Dec 2002 09:01:28 -0800 From: "Josh Berkus" Subject: Re: 4G row table? To: "Charles H. Woloszynski" , josh@agliodbs.com Cc: gry@ll.mit.edu, pgsql-performance@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.4.0.2 Date: Fri, 20 Dec 2002 09:01:28 -0800 Message-ID: In-Reply-To: <3E021D9D.1040608@clearmetrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/202 X-Sequence-Number: 618 Charlie, > Why do you say to expect slow performance on this hardware? Is > there something specific about the configuration that worries you? > Or, just lots of data in the database, so the data will be on disk > and not in the cache (system or postgresql)? > What do you classify as *slow*? Obviously, he is dependent on the > I/O channel given the size of the tables. So, good indexing will be > required to help on the queries. No comments on the commit rate for > this data (I am guessing that it is slow, given the description of > the database), so that may or may not be an issue. > Depending on the type of queries, perhaps clustering will help, along > with some good partitioning indexes. > I just don't see the slow in the hardware. Of course, if he is > targeting lots of concurrent queries, better add some additional > processors, or better yet, use ERSERVER and replicate the data to a > farm of machines. [To avoid the I/O bottleneck of lots of concurrent > queries against these large tables]. > > I guess there are a lot of assumptions on the data's use to decide if > the hardware is adequate or not :-) Well, slow is relative. It may be fast enough for him. Me, I'd be screaming in frustration. Take, for example, an index scan on the primary key. Assuming that he can get the primary key down to 12 bytes per node using custom data types, that's still: 12bytes * 4,000,000,000 rows = 48 GB for the index As you can see, it's utterly impossible for him to load even the primary key index into his 512 MB of RAM (of which no more than 200mb can go to Postgres anyway without risking conflicts over RAM). A Sort-and-Limit on the primary key, for example, would require swapping the index from RAM to swap space as much as 480 times! (though probably more like 100 times on average) With a slow RAID array and the hardware he described to us, this would mean, most likely, that a simple sort-and-limit on primary key query could take hours to execute. Even with really fast disk access, we're talking tens of minutes at least. -Josh Berkus From pgsql-performance-owner@postgresql.org Fri Dec 20 17:58:18 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1C376476D8D for ; Fri, 20 Dec 2002 17:58:17 -0500 (EST) Received: from allresearch.com (allresearch.com [209.73.229.162]) by postgresql.org (Postfix) with ESMTP id 0314947709C for ; Fri, 20 Dec 2002 17:57:26 -0500 (EST) Received: from allresearch.com (office.allresearch.com [209.73.255.249]) by allresearch.com (Postfix) with ESMTP id 03F5B34B53 for ; Fri, 20 Dec 2002 17:57:28 -0500 (EST) Date: Fri, 20 Dec 2002 17:57:28 -0500 Mime-Version: 1.0 (Apple Message framework v548) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: Speed Question From: Noah Silverman To: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit Message-Id: <69932226-146E-11D7-8943-000393AA8F3C@allresearch.com> X-Mailer: Apple Mail (2.548) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/203 X-Sequence-Number: 619 Hello, We are considering switching our systems over from MySQL to Postgresql. Speed is one of our major concerns, so before switching we've decided to perform some speed tests. From what I understand, Postgresql is NOT as fast as Mysql, but should be close enough. We've installed the software and have run some basic insert, index and query tests that seem ridiculously slow. I can't help thinking that we are doing something wrong, or don't have things configured for optimal performance. We've performed these same tests on Mysql and then run dramatically faster. Here's the initial performance test results and issues... Table configuration: speedtest( prop1 integer, prop2 integer, prop3 integer, prop4 integer); indexes on each of the four individual property fields Each record consists of four random integers, uniformly distributed, between 0 and 1000. The integers are computed in the perl script used to populate the table, not using an SQL random() function. Hardware configuration: P3-500, 384MB ram, *unloaded* system. Software configuration: Linux 2.4.20, reiserfs, standard slackware install. Issue #1: Speed of inserts is relatively slow. 100000 inserts is taking roughly 10 minutes. This isn't EVIL, but mysql appears to be about ten times faster here. Is there something we could do to the indexes differently? Disable transactions? Is there a more "raw" insert, which may not set off triggers? Issue #2: It doesn't appear as though multiple indexes are being used. ie: select count(*) from speedtest where (prop1 between 100 and 200) and( prop2 between 100 and 200) and (prop3 between 100 and 200) and (prop4 between 100 and 200) formulates a query plan that only uses one index. The following is pasted from the 'explain select' --- Aggregate (cost=17.16..17.16 rows=1 width=0) -> Index Scan using p4 on speedtest (cost=0.00..17.16 rows=1 width=0) Index Cond: ((prop4 >= 100) AND (prop4 <= 200)) Filter: ((prop1 >= 100) AND (prop1 <= 200) AND (prop2 >= 100) AND (prop2 <= 200) AND (prop3 >= 100) AND (prop3 <= 200)) (4 rows) It appears as though the index on prop4 is being used to determine a subset of records to fetch -- subsequently filtering them with the other conditions. Unfortunately, since the index condition matches 10% of the table (due to the random uniform integers from 0-1000), this results in a large number of record fetches and examinations the db engine must make. This query takes at least a second to execute, whereas we would like to be able to drop this into the sub-0.1 second range, and preferably into the millisecond range. While this would run faster on the production machines than on my workstation, it is still a fundamental flaw that multiple indexes aren't being combined to restrict the record set to fetch. OTOH, if we could do index combining, we could fetch 10% of 10% of 10% of the initial 10% of records... Resulting in a microscopic number of items to retrieve and examine. Can anybody give me some ideas as to what I am doing wrong??? Thanks, -Noah From pgsql-performance-owner@postgresql.org Fri Dec 20 18:24:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C27E34762A4 for ; Fri, 20 Dec 2002 18:24:34 -0500 (EST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id 7B2C9476212 for ; Fri, 20 Dec 2002 18:24:33 -0500 (EST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.6/8.12.6) with ESMTP id gBKNNgnX024317; Fri, 20 Dec 2002 16:23:42 -0700 (MST) Date: Fri, 20 Dec 2002 16:23:59 -0700 (MST) From: "scott.marlowe" To: Noah Silverman Cc: Subject: Re: Speed Question In-Reply-To: <69932226-146E-11D7-8943-000393AA8F3C@allresearch.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailBodyFilter: Message body has not been filtered X-MailScanner: Found to be clean X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/204 X-Sequence-Number: 620 On Fri, 20 Dec 2002, Noah Silverman wrote: > Issue #1: Speed of inserts is relatively slow. 100000 inserts is > taking > roughly 10 minutes. This isn't EVIL, but mysql appears to be about > ten times faster here. Is there something we could do to the indexes > differently? Disable transactions? Is there a more "raw" insert, which > may not set off triggers? Are you doing these in a transaction? If not, then try adding a begin;end; pair around your inserts. i.e. begin; insert 100000 rows end; that should help. Reading the rest of your message, it appears there are two issues here. One is you might get some help from a multi-column index. Further, have you run analyze on your database? Have you read the administrative docs yet? There's lots more good stuff in there too. These are the basics. The other issue is the assumption that indexes are ALWAYS faster, which they aren't. If the query planner thinks it's gonna grab some significant portion of a table, it will just grab the whole thing instead of using an index, which makes a certain amount of sense. To reduce the likelihood of the planner picking a sequential scan, change random_page_cost from the default 4 to something lower. A 1 means that the cost of grabbing a page randomly is the same as grabbing it sequentially, which shouldn't be possible, but is, if the data is all in memory. Next, use EXPLAIN ANALYZE to get an output of both what the query planner THOUGHT it was going to do, and what the query actually did, in terms of time to execute. Let us know how it all turns out. From pgsql-performance-owner@postgresql.org Fri Dec 20 18:50:27 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0803C475C98 for ; Fri, 20 Dec 2002 18:50:26 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 50AE7475C22 for ; Fri, 20 Dec 2002 18:50:25 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBKNoPpd025959; Fri, 20 Dec 2002 18:50:25 -0500 (EST) To: "scott.marlowe" Cc: Noah Silverman , pgsql-performance@postgresql.org Subject: Re: Speed Question In-reply-to: References: Comments: In-reply-to "scott.marlowe" message dated "Fri, 20 Dec 2002 16:23:59 -0700" Date: Fri, 20 Dec 2002 18:50:25 -0500 Message-ID: <25958.1040428225@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/205 X-Sequence-Number: 621 "scott.marlowe" writes: > On Fri, 20 Dec 2002, Noah Silverman wrote: >> Issue #1: Speed of inserts is relatively slow. 100000 inserts is > Are you doing these in a transaction? If not, then try adding a > begin;end; pair around your inserts. i.e. > begin; > insert 100000 rows > end; Or use a COPY command instead of retail inserts. See also the tips at http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/populate.html > One is you might get some help from a multi-column index. Yes, I'd recommend a multi-column index when no single column is particularly selective. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Dec 20 18:58:02 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AE35C475C98 for ; Fri, 20 Dec 2002 18:58:00 -0500 (EST) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id DDFE6475C22 for ; Fri, 20 Dec 2002 18:57:59 -0500 (EST) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2293611; Fri, 20 Dec 2002 15:58:02 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Noah Silverman , pgsql-performance@postgresql.org Subject: Re: Speed Question Date: Fri, 20 Dec 2002 15:59:23 -0800 X-Mailer: KMail [version 1.4] References: <69932226-146E-11D7-8943-000393AA8F3C@allresearch.com> In-Reply-To: <69932226-146E-11D7-8943-000393AA8F3C@allresearch.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212201559.23341.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/206 X-Sequence-Number: 622 Noah, > Speed is one of our major concerns, so before switching we've decided=20 > to perform some speed tests. > From what I understand, Postgresql is NOT as fast as Mysql, This is a PR myth spread by MySQL AB. The truth is: 1) PostgreSQL, unconfigured and not optimized, is indeed slower than MySQL= =20 out-of-the-box. MySQL is meant to be idiot-proof; PostgreSQL is not,=20 intentionally. 2) Nobody has yet come up with a database benchmark that both MySQL AB and = the=20 PostgreSQL team are willing to accept; depending on whose benchmark you use= ,=20 either could be faster -- and neither benchmark may approximate your setup. > We've installed the software and have run some basic insert, index and=20 > query tests that > seem ridiculously slow. I can't help thinking that we are doing=20 > something wrong, or > don't have things configured for optimal performance. Almost undoubtedly. Have you modified the postgresql.conf file at all?=20= =20 Where are your database files located on disk? How are you construting you= r=20 queries? > We've performed these same tests on Mysql and then run dramatically=20 > faster. Without transations? Sure. Turn off transaction logging, and PostgreSQL= =20 runs faster, too. >=20 > Here's the initial performance test results and issues... >=20 > Table configuration: > speedtest( prop1 integer, prop2 integer, prop3 integer, prop4 integer); > indexes on each of the four individual property fields >=20 > Each record consists of four random integers, uniformly distributed, > between 0 and 1000. The integers are computed in the perl script > used to populate the table, not using an SQL random() function. >=20 > Hardware configuration: P3-500, 384MB ram, *unloaded* system. > Software configuration: Linux 2.4.20, reiserfs, standard slackware=20 > install. You haven't mentioned your PostgreSQL memory settings, by which I assume th= at=20 you haven't configured them. This is very important. > Issue #1: Speed of inserts is relatively slow. 100000 inserts is=20 > taking > roughly 10 minutes. This isn't EVIL, but mysql appears to be about > ten times faster here. Is there something we could do to the indexes > differently? Disable transactions? Is there a more "raw" insert, which > may not set off triggers? Bundle them in a single transaction. Move pg_xlog to a seperate drive from= =20 the database. > Issue #2: It doesn't appear as though multiple indexes are being used. > ie: select count(*) from speedtest where (prop1 between 100 and 200) > and( prop2 between 100 and 200) and (prop3 between 100 and 200) > and (prop4 between 100 and 200) formulates a query plan that only > uses one index. The following is pasted from the 'explain select' --- That's correct; Postgres will only use a single index on this query. If yo= u=20 want to reference all columns, create a multi-column index. Note that,=20 however, Postgres is likely to reject the index as it is just as large as t= he=20 table. In this way, your test is insufficiently like real data. Good luck. Why not use the Open Database Benchmark for testing, instead of= =20 inventing your own? http://www.sf.net/projects/osdb --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Dec 20 19:10:48 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B8D3A476188 for ; Fri, 20 Dec 2002 19:10:47 -0500 (EST) Received: from allresearch.com (allresearch.com [209.73.229.162]) by postgresql.org (Postfix) with ESMTP id CB36E476164 for ; Fri, 20 Dec 2002 19:10:46 -0500 (EST) Received: from allresearch.com (office.allresearch.com [209.73.255.249]) by allresearch.com (Postfix) with ESMTP id 590EB36480 for ; Fri, 20 Dec 2002 19:10:49 -0500 (EST) Date: Fri, 20 Dec 2002 19:10:49 -0500 Mime-Version: 1.0 (Apple Message framework v548) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: Re: Speed Question From: Noah Silverman To: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit Message-Id: X-Mailer: Apple Mail (2.548) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/207 X-Sequence-Number: 623 First: THANK YOU everyone for all your suggestions. I've discovered the "copy from" command and it helps a lot. Right now, we just ran a test on 1MM rows with 4 columns and it is very fast with a 4 column index. Works well. Now we are creating more of a real world example: 10MM rows with 32 columns of integers. I'm loading up the data now, and will create a multi-column index(on all 32) after the data is loaded. From everyone's responses I understand that we really need to tune the system to get optimal performance. I would love to do this, but don't really know where to start. Below are our system stats if anyone wants to suggest some settings: 2x AMD 2100MP CPU 2 GB RAM Data - 350GB on a raid5 card Note: We will probably NEVER use transactions, so turning off that feature would be fine if it would help, and we knew how. Our data is probably only going to take up 20% MAXIMUM of our RAID. Subsequently, we have no problem trading a little extra space for better performance. BTW - is there any kind of "describe table" and/or "show index" function if pgsql. I've gotten very used to them in Mysql, but they don't work here. There must be some way. I've RTFM, but can't find anything. help. THANKS AGAIN, -Noah From pgsql-performance-owner@postgresql.org Fri Dec 20 20:01:15 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D16AC475CB4 for ; Fri, 20 Dec 2002 20:01:14 -0500 (EST) Received: from cypress.adhesivemedia.com (cypress.adhesivemedia.com [207.202.159.72]) by postgresql.org (Postfix) with ESMTP id 18952475C22 for ; Fri, 20 Dec 2002 20:01:14 -0500 (EST) Received: from cypress.adhesivemedia.com (localhost [127.0.0.1]) by cypress.adhesivemedia.com (8.12.3/8.12.3) with ESMTP id gBL11DFk003932; Fri, 20 Dec 2002 17:01:13 -0800 (PST) (envelope-from philip@adhesivemedia.com) Received: from localhost (philip@localhost) by cypress.adhesivemedia.com (8.12.3/8.12.3/Submit) with ESMTP id gBL11DHX003929; Fri, 20 Dec 2002 17:01:13 -0800 (PST) X-Authentication-Warning: cypress.adhesivemedia.com: philip owned process doing -bs Date: Fri, 20 Dec 2002 17:01:13 -0800 (PST) From: Philip Hallstrom To: Noah Silverman Cc: pgsql-performance@postgresql.org Subject: Re: Speed Question In-Reply-To: Message-ID: <20021220170025.N3706-100000@cypress.adhesivemedia.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/208 X-Sequence-Number: 624 > BTW - is there any kind of "describe table" and/or "show index" > function if pgsql. I've gotten very used to them in Mysql, but they > don't work here. There must be some way. I've RTFM, but can't find > anything. help. In psql use "\d tablename". do a "\?" for a quick overview and "man psql" for lots of stuff. -philip From pgsql-performance-owner@postgresql.org Sat Dec 21 07:21:46 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F34E5475AFF for ; Sat, 21 Dec 2002 07:21:44 -0500 (EST) Received: from email06.aon.at (WARSL401PIP3.highway.telekom.at [195.3.96.75]) by postgresql.org (Postfix) with SMTP id 0ECE34753A1 for ; Sat, 21 Dec 2002 07:21:44 -0500 (EST) Received: (qmail 198134 invoked from network); 21 Dec 2002 12:21:46 -0000 Received: from m169p031.dipool.highway.telekom.at (HELO cantor) ([62.46.11.31]) (envelope-sender ) by qmail6rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 21 Dec 2002 12:21:46 -0000 From: Manfred Koizar To: Noah Silverman Cc: pgsql-performance@postgresql.org Subject: Re: Speed Question Date: Sat, 21 Dec 2002 13:21:31 +0100 Message-ID: <04k80vsfcspvni82kmqkj8qodrh3qbmthq@4ax.com> References: In-Reply-To: X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/209 X-Sequence-Number: 625 On Fri, 20 Dec 2002 19:10:49 -0500, Noah Silverman wrote: >Now we are creating more of a real world example: 10MM rows with 32 >columns of integers. I'm loading up the data now, and will create a >multi-column index(on all 32) after the data is loaded. If a table with a 32 column key and no dependent attributes is a real world example, I'd like to see your use case ;-) An index on c1, c2, ..., cn will only help, if your search criteria contain (strict) conditions on the leading index columns, e.g. WHERE c1 = ... AND c2 = ... AND c3 BETWEEN ... AND ... It won't help for WHERE c22 = ... > From everyone's responses I understand that we really need to tune [...] >2x AMD 2100MP CPU >2 GB RAM >Data - 350GB on a raid5 card It all depends on your application, but looking at SHARED_BUFFERS, EFFECTIVE_CACHE_SIZE, SORT_MEM, MAX_FSM_RELATIONS, and MAX_FSM_PAGES might be a good start. Later you might want to use CPU_*_COST, RANDOM_PAGE_COST, and various WAL settings to fine tune your system. >Note: We will probably NEVER use transactions, Oh yes, you will. You have no other choice. If you don't enclose (several) statements between BEGIN and COMMIT, every statement is automatically wrapped into its own transaction. It helps performance and consistency, if *you* control transactions. Servus Manfred From pgsql-performance-owner@postgresql.org Sat Dec 21 13:45:31 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 42654474E44 for ; Sat, 21 Dec 2002 13:45:30 -0500 (EST) Received: from allresearch.com (allresearch.com [209.73.229.162]) by postgresql.org (Postfix) with ESMTP id AEC10474E53 for ; Sat, 21 Dec 2002 13:45:29 -0500 (EST) Received: from allresearch.com (office.allresearch.com [209.73.255.249]) by allresearch.com (Postfix) with ESMTP id 9B55E36577; Sat, 21 Dec 2002 13:45:29 -0500 (EST) Date: Sat, 21 Dec 2002 13:46:05 -0500 Subject: Re: Speed Question Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v551) Cc: pgsql-performance@postgresql.org To: Manfred Koizar From: Noah Silverman In-Reply-To: <04k80vsfcspvni82kmqkj8qodrh3qbmthq@4ax.com> Message-Id: <76295AB6-1514-11D7-B570-003065BAA92A@allresearch.com> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.551) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/210 X-Sequence-Number: 626 Thanks for the help. We've been using MySQL for the last 4 years, so PgSQL is a whole new world for me. Lots to learn Actually the "real world" test we are performing is an exact duplication of our intended use. Without divulging too many company secrets, we create a 32 key profile of an object. We then have to be able to search the database to find "similar" objects. In reality, we will probably have 20MM to 30MM rows in our table. I need to very quickly find the matching records on a "test" object. If you're really curious as to more details, let me know (I don't want to bore the group with our specifics) Since this machine is solely a database server, I want to utilize a ton of RAM to help things along. Probably at lease 1.5 Gigs worth. I guess my next step is to try and figure out what all the various memory settings are and where to set them. Thanks, -N On Saturday, December 21, 2002, at 07:21 AM, Manfred Koizar wrote: > On Fri, 20 Dec 2002 19:10:49 -0500, Noah Silverman > wrote: >> Now we are creating more of a real world example: 10MM rows with 32 >> columns of integers. I'm loading up the data now, and will create a >> multi-column index(on all 32) after the data is loaded. > > If a table with a 32 column key and no dependent attributes is a real > world example, I'd like to see your use case ;-) > > An index on c1, c2, ..., cn will only help, if your search criteria > contain (strict) conditions on the leading index columns, e.g. > WHERE c1 = ... AND c2 = ... AND c3 BETWEEN ... AND ... > > It won't help for > WHERE c22 = ... > >> From everyone's responses I understand that we really need to tune >> [...] >> 2x AMD 2100MP CPU >> 2 GB RAM >> Data - 350GB on a raid5 card > > It all depends on your application, but looking at SHARED_BUFFERS, > EFFECTIVE_CACHE_SIZE, SORT_MEM, MAX_FSM_RELATIONS, and MAX_FSM_PAGES > might be a good start. Later you might want to use CPU_*_COST, > RANDOM_PAGE_COST, and various WAL settings to fine tune your system. > >> Note: We will probably NEVER use transactions, > > Oh yes, you will. You have no other choice. If you don't enclose > (several) statements between BEGIN and COMMIT, every statement is > automatically wrapped into its own transaction. > > It helps performance and consistency, if *you* control transactions. > > Servus > Manfred > > From pgsql-performance-owner@postgresql.org Sat Dec 21 15:04:32 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B602C475DDB for ; Sat, 21 Dec 2002 15:04:30 -0500 (EST) Received: from email05.aon.at (WARSL401PIP2.highway.telekom.at [195.3.96.74]) by postgresql.org (Postfix) with SMTP id 5BCA9476176 for ; Sat, 21 Dec 2002 15:02:53 -0500 (EST) Received: (qmail 427602 invoked from network); 21 Dec 2002 20:02:53 -0000 Received: from m150p026.dipool.highway.telekom.at (HELO cantor) ([62.46.8.186]) (envelope-sender ) by qmail7rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 21 Dec 2002 20:02:53 -0000 From: Manfred Koizar To: Noah Silverman Cc: pgsql-performance@postgresql.org Subject: Re: Speed Question Date: Sat, 21 Dec 2002 21:02:39 +0100 Message-ID: References: <04k80vsfcspvni82kmqkj8qodrh3qbmthq@4ax.com> <76295AB6-1514-11D7-B570-003065BAA92A@allresearch.com> In-Reply-To: <76295AB6-1514-11D7-B570-003065BAA92A@allresearch.com> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/211 X-Sequence-Number: 627 On Sat, 21 Dec 2002 13:46:05 -0500, Noah Silverman wrote: >Without divulging too many company >secrets, we create a 32 key profile of an object. We then have to be >able to search the database to find "similar" objects. ... where "similar" means that the value of each attribute lies within a small range around the value of the corresponding attribute of the reference object? I fear a multicolumn b-tree index is not the optimal solution to this problem, unless you have some extremely selective attributes you can put at the start of the index. But then again I doubt that it makes sense to include even the last attribute (or the last few attributes) into the index. >In reality, we >will probably have 20MM to 30MM rows in our table. I need to very >quickly find the matching records on a "test" object. This seems to be a nice case for utilizing bitmaps for index scans. Thus you would scan several single column indices and combine the bitmaps before accessing the heap tuples. This has been discussed on -hackers and I believe it is a todo item. I don't know, whether GiST or R-Tree could help. Is anybody listening who knows? >If you're really curious as to more details, let me know (I don't want >to bore the group with our specifics) The group is patient :-) Servus Manfred From pgsql-performance-owner@postgresql.org Sat Dec 21 15:17:18 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 63E034759BD for ; Sat, 21 Dec 2002 15:17:17 -0500 (EST) Received: from allresearch.com (allresearch.com [209.73.229.162]) by postgresql.org (Postfix) with ESMTP id D3BA84759AF for ; Sat, 21 Dec 2002 15:17:16 -0500 (EST) Received: from allresearch.com (office.allresearch.com [209.73.255.249]) by allresearch.com (Postfix) with ESMTP id 8A6B536710; Sat, 21 Dec 2002 15:17:17 -0500 (EST) Date: Sat, 21 Dec 2002 15:17:53 -0500 Subject: Re: Speed Question Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v551) Cc: pgsql-performance@postgresql.org To: Manfred Koizar From: Noah Silverman In-Reply-To: Message-Id: <491F60CE-1521-11D7-B570-003065BAA92A@allresearch.com> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.551) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/212 X-Sequence-Number: 628 You are correct. "similar" means within a small range. Below is a sample query: select count(*) from speedtest where (p1 between 209 and 309) and (p2 between 241 and 341) and (p3 between 172 and 272) and (p4 between 150 and 250) and (p5 between 242 and 342) and (p6 between 222 and 322) and (p7 between 158 and 258) and (p8 between 249 and 349) and (p9 between 162 and 262) and (p10 between 189 and 289) and (p11 between 201 and 301) and (p12 between 167 and 267) and (p13 between 167 and 267) and (p14 between 229 and 329) and (p15 between 235 and 335) and (p16 between 190 and 290) and (p17 between 240 and 340) and (p18 between 156 and 256) and (p19 between 150 and 250) and (p20 between 171 and 271) and (p21 between 241 and 341) and (p22 between 244 and 344) and (p23 between 219 and 319) and (p24 between 198 and 298) and (p25 between 196 and 296) and (p26 between 243 and 343) and (p27 between 160 and 260) and (p28 betw een 151 and 251) and (p29 between 226 and 326) and (p30 between 168 and 268) and (p31 between 153 and 253) and (p32 between 218 and 318) Currently, on an un-tuned installation, this query takes about 1 second. Much too slow for our needs. We need to be able to execute about 30-50 per second. I'm not a database expert. There is probably a better way to do this, but I have no idea how. The general use of this table is as an index for document storage. When we come across a new document, we have to know if we already have something close to it. Exact checksums don't work because two documents with only a few different words are still "the same" for our intended use. We calculate 32 separate checksums on parts of each document. By storing all 32, we have a good representation of each document. A new document can then very quickly be checked against the table to see if we already have something close to it. If anybody has any better ideas, I would love to hear it... -N On Saturday, December 21, 2002, at 03:02 PM, Manfred Koizar wrote: > On Sat, 21 Dec 2002 13:46:05 -0500, Noah Silverman > wrote: >> Without divulging too many company >> secrets, we create a 32 key profile of an object. We then have to be >> able to search the database to find "similar" objects. > > ... where "similar" means that the value of each attribute lies within > a small range around the value of the corresponding attribute of the > reference object? > > I fear a multicolumn b-tree index is not the optimal solution to this > problem, unless you have some extremely selective attributes you can > put at the start of the index. But then again I doubt that it makes > sense to include even the last attribute (or the last few attributes) > into the index. > >> In reality, we >> will probably have 20MM to 30MM rows in our table. I need to very >> quickly find the matching records on a "test" object. > > This seems to be a nice case for utilizing bitmaps for index scans. > Thus you would scan several single column indices and combine the > bitmaps before accessing the heap tuples. This has been discussed on > -hackers and I believe it is a todo item. > > I don't know, whether GiST or R-Tree could help. Is anybody listening > who knows? > >> If you're really curious as to more details, let me know (I don't want >> to bore the group with our specifics) > > The group is patient :-) > > Servus > Manfred > > From pgsql-performance-owner@postgresql.org Sat Dec 21 15:28:34 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D2B15475D99 for ; Sat, 21 Dec 2002 15:28:31 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id D32E3475D64 for ; Sat, 21 Dec 2002 15:28:30 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBLKSMd0001961; Sat, 21 Dec 2002 15:28:22 -0500 (EST) To: Manfred Koizar Cc: Noah Silverman , pgsql-performance@postgresql.org Subject: Re: Speed Question In-reply-to: References: <04k80vsfcspvni82kmqkj8qodrh3qbmthq@4ax.com> <76295AB6-1514-11D7-B570-003065BAA92A@allresearch.com> Comments: In-reply-to Manfred Koizar message dated "Sat, 21 Dec 2002 21:02:39 +0100" Date: Sat, 21 Dec 2002 15:28:22 -0500 Message-ID: <1960.1040502502@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/213 X-Sequence-Number: 629 Manfred Koizar writes: > ... where "similar" means that the value of each attribute lies within > a small range around the value of the corresponding attribute of the > reference object? > I don't know, whether GiST or R-Tree could help. If the problem is multidimensional range search then GIST might be just the ticket. I am not sure if you'd need to do any coding though. It looks like contrib/btree_gist provides the necessary operator class, but only for int4 and timestamp datatypes. I think that our r-tree code is restricted to two-dimensional indexing, so it wouldn't help. regards, tom lane From pgsql-general-owner@postgresql.org Sun Dec 22 20:19:23 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CC4F64758DC for ; Sun, 22 Dec 2002 20:19:20 -0500 (EST) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by postgresql.org (Postfix) with ESMTP id 0CABE474E5C for ; Sun, 22 Dec 2002 20:19:20 -0500 (EST) Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18QHF2-0001L8-00 for ; Mon, 23 Dec 2002 02:18:48 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-general@postgresql.org Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18QHF1-0001Kz-00 for ; Mon, 23 Dec 2002 02:18:47 +0100 Path: not-for-mail From: Gerhard Haering Subject: Re: PerformPortalClose warning in 7.3 Date: Mon, 23 Dec 2002 01:18:46 +0000 (UTC) Organization: People's Front of Judea Lines: 88 Message-ID: References: <3DF91030.A372DF7C@nsd.ca> <2C6CDB6A-0E24-11D7-8E88-000393A48A3C@mac.com> X-Complaints-To: usenet@main.gmane.org User-Agent: slrn/0.9.7.4 (FreeBSD) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/1062 X-Sequence-Number: 34977 Michael Engelhart wrote in gmane.comp.db.postgresql.general: > Hi - > I've been running PostgreSQL 7.3 on Mac OS X 10.2 since it was released > and it's been running fine. I'm using pyPgSQL 2.3 for client side > programming which also was working great until tonight. Now whenever > I do any query of any type, I get warnings like this: > > WARNING: PerformPortalClose: portal "pgsql_00179f10" not found > > It "appears" that everything is still working the way it was but it's a > bit discomforting to have these show up on my screen while running my > applications. > > Anyone that can explain this? > > Here's a tiny bit of Python sample code that I used to make sure it > wasn't my other code causing the problems > > from pyPgSQL import PgSQL > > dbname = "template1" > conn = PgSQL.connect(database=dbname) > cursor = conn.cursor() > sql = "SELECT now()"; > cursor.execute(sql) > res = cursor.fetchall() > for i in res: > print i > cursor.close() > conn.commit() Actually, pyPgSQL is using PostgreSQL portals behind your back. This is a feature! To show this, we use the undocumented, but very handy toggleShowQuery flag. The effect is that we can see what SQL pyPgSQL sends to the backend using libpq (the lines staring with QUERY: below): #v+ gerhard@gargamel:~$ python Python 2.2.2 (#1, Nov 30 2002, 23:19:58) [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4 Type "help", "copyright", "credits" or "license" for more information. >>> from pyPgSQL import PgSQL >>> con = PgSQL.connect() >>> con.conn.toggleShowQuery 'On' >>> cursor = con.cursor() QUERY: BEGIN WORK >>> cursor.execute("select * from test") QUERY: DECLARE "PgSQL_0811F1EC" CURSOR FOR select * from test QUERY: FETCH 1 FROM "PgSQL_0811F1EC" QUERY: SELECT typname, -1 , typelem FROM pg_type WHERE oid = 23 QUERY: SELECT typname, -1 , typelem FROM pg_type WHERE oid = 1043 >>> result = cursor.fetchmany(5) QUERY: FETCH 4 FROM "PgSQL_0811F1EC" >>> result [[None, 'A'], [None, 'B'], [None, 'C'], [None, 'F'], [None, 'F']] >>> con.commit() QUERY: CLOSE PgSQL_0811F1EC QUERY: COMMIT WORK >>> #v- This gives me a warning like this: #v+ WARNING: PerformPortalClose: portal "pgsql_0811f1ec" not found #v- As far as I can see, the SQL pyPgSQL emits is perfectly ok. But I'd be glad to hear a clarification. > strangely if I remove the last 2 lines (cursor.close() and > conn.commit()) I don't get the errors. > > Also I don't notice that I don't have this problem with psql command > line either. Is this the Python API causing this? If you use the same SQL statements using portals in psql, you get the same warning (obviously). I just tried. Gerhard (pyPgSQL developer) -- Favourite database: http://www.postgresql.org/ Favourite programming language: http://www.python.org/ Combine the two: http://pypgsql.sf.net/ Embedded database for Python: http://pysqlite.sf.net/ From pgsql-general-owner@postgresql.org Sun Dec 22 21:36:32 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D93D8475AE4 for ; Sun, 22 Dec 2002 21:36:30 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 1EF1F4758FE for ; Sun, 22 Dec 2002 21:36:30 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBN2aRd0028407; Sun, 22 Dec 2002 21:36:27 -0500 (EST) To: Gerhard Haering Cc: pgsql-general@postgresql.org Subject: Re: PerformPortalClose warning in 7.3 In-reply-to: References: <3DF91030.A372DF7C@nsd.ca> <2C6CDB6A-0E24-11D7-8E88-000393A48A3C@mac.com> Comments: In-reply-to Gerhard Haering message dated "Mon, 23 Dec 2002 01:18:46 +0000" Date: Sun, 22 Dec 2002 21:36:27 -0500 Message-ID: <28406.1040610987@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/1064 X-Sequence-Number: 34979 Gerhard Haering writes: > To show this, we use the undocumented, but very handy toggleShowQuery > flag. The effect is that we can see what SQL pyPgSQL sends to the > backend using libpq (the lines staring with QUERY: below): > QUERY: DECLARE "PgSQL_0811F1EC" CURSOR FOR select * from test > ... > QUERY: CLOSE PgSQL_0811F1EC This looks like a pyPgSQL bug to me. If it's going to use a mixed-case name for the cursor then it must either always double-quote the name or never do so. Failing to double-quote in the CLOSE command is wrong. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Dec 23 16:55:05 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D7A0D47603C for ; Mon, 23 Dec 2002 16:55:02 -0500 (EST) Received: from allresearch.com (allresearch.com [209.73.229.162]) by postgresql.org (Postfix) with ESMTP id 4DB5C475E52 for ; Mon, 23 Dec 2002 16:55:01 -0500 (EST) Received: from allresearch.com (office.allresearch.com [209.73.255.249]) by allresearch.com (Postfix) with ESMTP id F35F3371F5; Mon, 23 Dec 2002 16:55:01 -0500 (EST) Date: Mon, 23 Dec 2002 16:55:01 -0500 Subject: Re: Speed Question Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v548) Cc: Manfred Koizar , pgsql-performance@postgresql.org To: Tom Lane From: Noah Silverman In-Reply-To: <1960.1040502502@sss.pgh.pa.us> Message-Id: <2FB53415-16C1-11D7-A512-000393AA8F3C@allresearch.com> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.548) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/214 X-Sequence-Number: 630 Does anyone know how/where I can find the contrib/btree_gist stuff and how I use it, and are there docs for it. Thanks, -N On Saturday, December 21, 2002, at 03:28 PM, Tom Lane wrote: > Manfred Koizar writes: >> ... where "similar" means that the value of each attribute lies within >> a small range around the value of the corresponding attribute of the >> reference object? > >> I don't know, whether GiST or R-Tree could help. > > If the problem is multidimensional range search then GIST might be just > the ticket. I am not sure if you'd need to do any coding though. It > looks like contrib/btree_gist provides the necessary operator class, > but > only for int4 and timestamp datatypes. > > I think that our r-tree code is restricted to two-dimensional indexing, > so it wouldn't help. > > regards, tom lane > From pgsql-performance-owner@postgresql.org Tue Dec 24 15:05:20 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6F5F247647B for ; Tue, 24 Dec 2002 15:05:19 -0500 (EST) Received: from wolff.to (wolff.to [66.93.197.35]) by postgresql.org (Postfix) with SMTP id 8BCB847645A for ; Tue, 24 Dec 2002 15:05:16 -0500 (EST) Received: (qmail 15924 invoked by uid 500); 24 Dec 2002 20:16:38 -0000 Date: Tue, 24 Dec 2002 14:16:38 -0600 From: Bruno Wolff III To: pgsql-performance@postgresql.org Subject: View performance Message-ID: <20021224201638.GA15882@wolff.to> 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.3.25i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/215 X-Sequence-Number: 631 I was looking at some queries that appeared to be slower than I remembered them being under 7.2 (which may be a wrong perception) and noticed that a view wasn't being handled very efficiently. The view is security view that is used to hide some fields in some records when displaying information on the web. The primary key is left alone though. When this view is joined a plan is generated that applies the field suppression for each row of the underlying table even though only a few rows out of this view are going to be selected. It would see that first looking for rows that will be used and only applying the changes to rows that are going to be used would result in a significant speed up. The other thing that seemed odd is that the constant (select pord from priv where pname = 'web') subqueries weren't pulled out of the loop. I was able to get a 20% speed up by adding an index on gameid to crate and by disabling merge joins so that a has join was used instead. The merge join estimate was about 20% low and the hash join estimate was about 100% high resulting in the merge join getting picked. View: create view cname_web as select areaid, case when (select pord from priv where pname = 'web') >= (select pord from priv where pname = privacy) then lname else null end as lname, case when (select pord from priv where pname = 'web') >= (select pord from priv where pname = privacy) then fmname else null end as fmname, case when (select pord from priv where pname = 'web') >= (select pord from priv where pname = privacy) then aname else null end as aname, case when (select pord from priv where pname = 'web') >= (select pord from priv where pname = privacy) then gen else null end as gen, case when (select pord from priv where pname = 'web') >= (select pord from priv where pname = privacy) then genlab else null end as genlab, case when (select pord from priv where pname = 'web') >= (select pord from priv where pname = privacy) then touched else null end as touched from cname; Query: explain analyze select cname_web.areaid, lname, fmname, aname, coalesce(genlab, to_char(gen, 'FMRN')), rate, frq, opp, rmp, trn, to_char(crate.touched,'YYYY-MM-DD') from cname_web, crate where cname_web.areaid = crate.areaid and gameid = '776' and frq > 0 and crate.touched >= ((timestamp 'epoch' + '1040733601 second') + '2 year ago') order by rate desc, lower(lname), lower(coalesce((aname || ' ') || fmname, fmname, aname)), gen, genlab, cname_web.areaid; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=1308.35..1308.44 rows=39 width=203) (actual time=1152.67..1152.68 rows=25 loops=1) Sort Key: crate.rate, lower(cname_web.lname), lower(CASE WHEN (((cname_web.aname || ' '::text) || cname_web.fmname) IS NOT NULL) THEN ((cname_web.aname || ' '::text) || cname_web.fmname) WHEN (cname_web.fmname IS NOT NULL) THEN cname_web.fmname WHEN (cname_web.aname IS NOT NULL) THEN cname_web.aname ELSE NULL::text END), cname_web.gen, cname_web.genlab, cname_web.areaid -> Merge Join (cost=1270.71..1307.31 rows=39 width=203) (actual time=1120.23..1152.25 rows=25 loops=1) Merge Cond: ("outer".areaid = "inner".areaid) -> Sort (cost=681.95..699.97 rows=7208 width=63) (actual time=1079.55..1083.66 rows=7147 loops=1) Sort Key: cname_web.areaid -> Subquery Scan cname_web (cost=0.00..220.08 rows=7208 width=63) (actual time=0.40..843.48 rows=7208 loops=1) -> Seq Scan on cname (cost=0.00..220.08 rows=7208 width=63) (actual time=0.40..818.24 rows=7208 loops=1) InitPlan -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.04..0.05 rows=1 loops=1) Filter: (pname = 'web'::text) -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.02 rows=1 loops=1) Filter: (pname = 'web'::text) -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.02 rows=1 loops=1) Filter: (pname = 'web'::text) -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.02 rows=1 loops=1) Filter: (pname = 'web'::text) -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.02 rows=1 loops=1) Filter: (pname = 'web'::text) -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.02 rows=1 loops=1) Filter: (pname = 'web'::text) SubPlan -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.01 rows=1 loops=7208) Filter: (pname = $1) -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.01 rows=1 loops=7208) Filter: (pname = $1) -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.01 rows=1 loops=7208) Filter: (pname = $1) -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.01 rows=1 loops=7208) Filter: (pname = $1) -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.01 rows=1 loops=7208) Filter: (pname = $1) -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.01..0.01 rows=1 loops=7208) Filter: (pname = $1) -> Sort (cost=588.76..588.80 rows=16 width=39) (actual time=39.95..39.96 rows=25 loops=1) Sort Key: crate.areaid -> Seq Scan on crate (cost=0.00..588.45 rows=16 width=39) (actual time=3.14..39.58 rows=25 loops=1) Filter: ((gameid = '776'::text) AND (frq > 0) AND (touched >= '2000-12-24 12:40:01'::timestamp without time zone)) Total runtime: 1155.29 msec (39 rows) From pgsql-performance-owner@postgresql.org Tue Dec 24 15:55:18 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 153AC4758E1 for ; Tue, 24 Dec 2002 15:55:16 -0500 (EST) Received: from wolff.to (wolff.to [66.93.197.35]) by postgresql.org (Postfix) with SMTP id 3C92A475843 for ; Tue, 24 Dec 2002 15:55:15 -0500 (EST) Received: (qmail 16100 invoked by uid 500); 24 Dec 2002 21:06:37 -0000 Date: Tue, 24 Dec 2002 15:06:37 -0600 From: Bruno Wolff III To: pgsql-performance@postgresql.org Subject: Re: View performance Message-ID: <20021224210637.GA16085@wolff.to> Mail-Followup-To: pgsql-performance@postgresql.org References: <20021224201638.GA15882@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021224201638.GA15882@wolff.to> User-Agent: Mutt/1.3.25i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/216 X-Sequence-Number: 632 As a followup to this I rewrote the view as: create view cname_web as select a.areaid, b.lname, b.fmname, b.aname, b.gen, b.genlab, b.touched from cname a left join (select areaid, lname, fmname, aname, gen, genlab, touched, privacy from cname, priv where pname = privacy and pord <= (select pord from priv where pname = 'web') ) b using (areaid); And got the query down to about half the original time as shown here: QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sort (cost=970.71..970.74 rows=15 width=113) (actual time=550.82..550.83 rows=25 loops=1) Sort Key: crate.rate, lower(cname.lname), lower(CASE WHEN (((cname.aname || ' '::text) || cname.fmname) IS NOT NULL) THEN ((cname.aname || ' '::text) || cname.fmname) WHEN (cname.fmname IS NOT NULL) THEN cname.fmname WHEN (cname.aname IS NOT NULL) THEN cname.aname ELSE NULL::text END), cname.gen, cname.genlab, a.areaid InitPlan -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.02..0.03 rows=1 loops=1) Filter: (pname = 'web'::text) -> Merge Join (cost=484.88..970.41 rows=15 width=113) (actual time=361.92..550.53 rows=25 loops=1) Merge Cond: ("outer".areaid = "inner".areaid) -> Merge Join (cost=348.16..815.45 rows=7208 width=74) (actual time=358.29..520.50 rows=7147 loops=1) Merge Cond: ("outer".areaid = "inner".areaid) -> Index Scan using cname_pkey on cname a (cost=0.00..407.27 rows=7208 width=11) (actual time=0.03..26.59 rows=7147 loops=1) -> Sort (cost=348.16..354.17 rows=2403 width=63) (actual time=358.20..362.38 rows=7141 loops=1) Sort Key: cname.areaid -> Hash Join (cost=1.09..213.25 rows=2403 width=63) (actual time=0.35..94.32 rows=7202 loops=1) Hash Cond: ("outer".privacy = "inner".pname) -> Seq Scan on cname (cost=0.00..146.08 rows=7208 width=55) (actual time=0.01..33.41 rows=7208 loops=1) -> Hash (cost=1.09..1.09 rows=2 width=8) (actual time=0.07..0.07 rows=0 loops=1) -> Seq Scan on priv (cost=0.00..1.09 rows=2 width=8) (actual time=0.06..0.07 rows=2 loops=1) Filter: (pord <= $0) -> Sort (cost=136.72..136.76 rows=15 width=39) (actual time=0.95..0.96 rows=25 loops=1) Sort Key: crate.areaid -> Index Scan using crate_game on crate (cost=0.00..136.42 rows=15 width=39) (actual time=0.10..0.67 rows=25 loops=1) Index Cond: (gameid = '776'::text) Filter: ((frq > 0) AND (touched >= '2000-12-24 12:40:01'::timestamp without time zone)) Total runtime: 553.17 msec (24 rows) On Tue, Dec 24, 2002 at 14:16:38 -0600, Bruno Wolff III wrote: > > View: > create view cname_web as select > areaid, > case when (select pord from priv where pname = 'web') >= > (select pord from priv where pname = privacy) then > lname else null end as lname, > case when (select pord from priv where pname = 'web') >= > (select pord from priv where pname = privacy) then > fmname else null end as fmname, > case when (select pord from priv where pname = 'web') >= > (select pord from priv where pname = privacy) then > aname else null end as aname, > case when (select pord from priv where pname = 'web') >= > (select pord from priv where pname = privacy) then > gen else null end as gen, > case when (select pord from priv where pname = 'web') >= > (select pord from priv where pname = privacy) then > genlab else null end as genlab, > case when (select pord from priv where pname = 'web') >= > (select pord from priv where pname = privacy) then > touched else null end as touched > from cname; > > Query: > > explain analyze select cname_web.areaid, lname, fmname, aname, coalesce(genlab, to_char(gen, 'FMRN')), rate, frq, opp, rmp, trn, to_char(crate.touched,'YYYY-MM-DD') from cname_web, crate where cname_web.areaid = crate.areaid and gameid = '776' and frq > 0 and crate.touched >= ((timestamp 'epoch' + '1040733601 second') + '2 year ago') order by rate desc, lower(lname), lower(coalesce((aname || ' ') || fmname, fmname, aname)), gen, genlab, cname_web.areaid; From pgsql-performance-owner@postgresql.org Tue Dec 24 16:14:36 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id EDF944758E1 for ; Tue, 24 Dec 2002 16:14:34 -0500 (EST) Received: from wolff.to (wolff.to [66.93.197.35]) by postgresql.org (Postfix) with SMTP id 2C634475843 for ; Tue, 24 Dec 2002 16:14:34 -0500 (EST) Received: (qmail 16182 invoked by uid 500); 24 Dec 2002 21:25:56 -0000 Date: Tue, 24 Dec 2002 15:25:56 -0600 From: Bruno Wolff III To: pgsql-performance@postgresql.org Subject: Re: View performance Message-ID: <20021224212556.GA16170@wolff.to> Mail-Followup-To: pgsql-performance@postgresql.org References: <20021224201638.GA15882@wolff.to> <20021224210637.GA16085@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021224210637.GA16085@wolff.to> User-Agent: Mutt/1.3.25i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/217 X-Sequence-Number: 633 By disabling merge joins and using the updated view, I got the query down to about 25% of its original runtime. Note the query estimate is off by a factor of more than 10. QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sort (cost=3271.35..3271.39 rows=15 width=113) (actual time=232.25..232.27 rows=25 loops=1) Sort Key: crate.rate, lower(cname.lname), lower(CASE WHEN (((cname.aname || ' '::text) || cname.fmname) IS NOT NULL) THEN ((cname.aname || ' '::text) || cname.fmname) WHEN (cname.fmname IS NOT NULL) THEN cname.fmname WHEN (cname.aname IS NOT NULL) THEN cname.aname ELSE NULL::text END), cname.gen, cname.genlab, a.areaid InitPlan -> Seq Scan on priv (cost=0.00..1.09 rows=1 width=4) (actual time=0.02..0.03 rows=1 loops=1) Filter: (pname = 'web'::text) -> Hash Join (cost=355.71..3271.05 rows=15 width=113) (actual time=106.82..231.97 rows=25 loops=1) Hash Cond: ("outer".areaid = "inner".areaid) -> Hash Join (cost=219.25..431.41 rows=7208 width=74) (actual time=103.86..222.00 rows=7208 loops=1) Hash Cond: ("outer".areaid = "inner".areaid) -> Seq Scan on cname a (cost=0.00..146.08 rows=7208 width=11) (actual time=0.01..16.23 rows=7208 loops=1) -> Hash (cost=213.25..213.25 rows=2403 width=63) (actual time=103.70..103.70 rows=0 loops=1) -> Hash Join (cost=1.09..213.25 rows=2403 width=63) (actual time=0.35..88.82 rows=7202 loops=1) Hash Cond: ("outer".privacy = "inner".pname) -> Seq Scan on cname (cost=0.00..146.08 rows=7208 width=55) (actual time=0.01..29.73 rows=7208 loops=1) -> Hash (cost=1.09..1.09 rows=2 width=8) (actual time=0.07..0.07 rows=0 loops=1) -> Seq Scan on priv (cost=0.00..1.09 rows=2 width=8) (actual time=0.06..0.07 rows=2 loops=1) Filter: (pord <= $0) -> Hash (cost=136.42..136.42 rows=15 width=39) (actual time=0.72..0.72 rows=0 loops=1) -> Index Scan using crate_game on crate (cost=0.00..136.42 rows=15 width=39) (actual time=0.10..0.66 rows=25 loops=1) Index Cond: (gameid = '776'::text) Filter: ((frq > 0) AND (touched >= '2000-12-24 12:40:01'::timestamp without time zone)) Total runtime: 232.83 msec (22 rows) From pgsql-performance-owner@postgresql.org Thu Dec 26 14:42:42 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 98E1F475DC5 for ; Thu, 26 Dec 2002 14:42:40 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 0640E475D87 for ; Thu, 26 Dec 2002 14:42:40 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBQJgdd0002667; Thu, 26 Dec 2002 14:42:40 -0500 (EST) To: Bruno Wolff III Cc: pgsql-performance@postgresql.org Subject: Re: View performance In-reply-to: <20021224201638.GA15882@wolff.to> References: <20021224201638.GA15882@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Tue, 24 Dec 2002 14:16:38 -0600" Date: Thu, 26 Dec 2002 14:42:39 -0500 Message-ID: <2666.1040931759@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/218 X-Sequence-Number: 634 Bruno Wolff III writes: > I was looking at some queries that appeared to be slower than I remembered > them being under 7.2 (which may be a wrong perception) and noticed > that a view wasn't being handled very efficiently. The change in behavior from 7.2 is probably due to this patch: 2002-12-05 16:46 tgl * src/backend/optimizer/plan/planner.c (REL7_3_STABLE): Avoid pulling up sublinks from a subselect's targetlist. Works around problems that occur if sublink is referenced via a join alias variable. Perhaps this can be improved later, but a simple and safe fix is needed for 7.3.1. which means that views using subselects in their targetlists will not be flattened into the calling query in 7.3.1. This is not real desirable, but I see no other short-term fix. In the particular case, your view definition seemed mighty inefficient anyway (it must recompute the subselects for each column retrieved from the view) so I think your rewrite is a good change. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 26 14:50:16 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A3386475B47 for ; Thu, 26 Dec 2002 14:50:14 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id EFBE14753A1 for ; Thu, 26 Dec 2002 14:50:13 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBQJoEd0002714; Thu, 26 Dec 2002 14:50:14 -0500 (EST) To: Bruno Wolff III Cc: pgsql-performance@postgresql.org Subject: Re: View performance In-reply-to: <20021224212556.GA16170@wolff.to> References: <20021224201638.GA15882@wolff.to> <20021224210637.GA16085@wolff.to> <20021224212556.GA16170@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Tue, 24 Dec 2002 15:25:56 -0600" Date: Thu, 26 Dec 2002 14:50:14 -0500 Message-ID: <2713.1040932214@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/219 X-Sequence-Number: 635 Bruno Wolff III writes: > By disabling merge joins and using the updated view, I got the query down > to about 25% of its original runtime. > Note the query estimate is off by a factor of more than 10. This seems to indicate some estimation problems in cost_hashjoin; the estimated cost for the hashjoin is evidently a lot higher than it should be. Are you interested in digging into this; or could you send me a dump of the tables used in the view and query, so I could look into it? regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 26 15:25:31 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4E070475B47 for ; Thu, 26 Dec 2002 15:25:30 -0500 (EST) Received: from wolff.to (wolff.to [66.93.197.35]) by postgresql.org (Postfix) with SMTP id 94C724753A1 for ; Thu, 26 Dec 2002 15:25:29 -0500 (EST) Received: (qmail 23060 invoked by uid 500); 26 Dec 2002 20:36:56 -0000 Date: Thu, 26 Dec 2002 14:36:56 -0600 From: Bruno Wolff III To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: View performance Message-ID: <20021226203656.GB22984@wolff.to> Mail-Followup-To: Tom Lane , pgsql-performance@postgresql.org References: <20021224201638.GA15882@wolff.to> <2666.1040931759@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2666.1040931759@sss.pgh.pa.us> User-Agent: Mutt/1.3.25i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/220 X-Sequence-Number: 636 On Thu, Dec 26, 2002 at 14:42:39 -0500, Tom Lane wrote: > > which means that views using subselects in their targetlists will not be > flattened into the calling query in 7.3.1. This is not real desirable, > but I see no other short-term fix. Thanks for the explaination. > In the particular case, your view definition seemed mighty inefficient > anyway (it must recompute the subselects for each column retrieved from > the view) so I think your rewrite is a good change. I was naively expecting that the planner would notice the common subexpressions and only compute them once. From pgsql-performance-owner@postgresql.org Thu Dec 26 15:45:56 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 74979474E53 for ; Thu, 26 Dec 2002 15:45:55 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id D1979474E44 for ; Thu, 26 Dec 2002 15:45:54 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBQKjtd0004245; Thu, 26 Dec 2002 15:45:55 -0500 (EST) To: Bruno Wolff III Cc: pgsql-performance@postgresql.org Subject: Re: View performance In-reply-to: <20021226203656.GB22984@wolff.to> References: <20021224201638.GA15882@wolff.to> <2666.1040931759@sss.pgh.pa.us> <20021226203656.GB22984@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Thu, 26 Dec 2002 14:36:56 -0600" Date: Thu, 26 Dec 2002 15:45:55 -0500 Message-ID: <4244.1040935555@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/221 X-Sequence-Number: 637 Bruno Wolff III writes: > I was naively expecting that the planner would notice the common > subexpressions and only compute them once. There isn't currently any code for detection of common subexpressions of any kind. My gut feeling is that searching for common subexpressions would be a net waste of cycles in the vast majority of queries. It'd be fairly expensive (a naive implementation would be roughly O(N^2) in the number of expression nodes), with zero payback in very many cases. It might be worth doing for very constrained classes of subexpressions. For instance, I was just thinking about putting in some code to recognize duplicate aggregates (eg, "sum(foo)" appearing twice in the same query). nodeAgg.c could do this relatively cheaply, since it has to make a list of the aggregate expressions to be computed, anyway. I'm not sure about recognizing duplicated sub-SELECT expressions; it could possibly be done but some thought would have to be given to preserving semantics. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Dec 26 18:43:39 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 60C934753A1 for ; Thu, 26 Dec 2002 18:43:38 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 0C44C474E53 for ; Thu, 26 Dec 2002 18:43:37 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBQNhdd0020651; Thu, 26 Dec 2002 18:43:39 -0500 (EST) To: Bruno Wolff III Cc: pgsql-performance@postgresql.org Subject: Re: View performance In-reply-to: <20021226203212.GA22984@wolff.to> References: <20021224201638.GA15882@wolff.to> <20021224210637.GA16085@wolff.to> <20021224212556.GA16170@wolff.to> <2713.1040932214@sss.pgh.pa.us> <20021226203212.GA22984@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Thu, 26 Dec 2002 14:32:12 -0600" Date: Thu, 26 Dec 2002 18:43:39 -0500 Message-ID: <20650.1040946219@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/222 X-Sequence-Number: 638 I wrote: >> This seems to indicate some estimation problems in cost_hashjoin; the >> estimated cost for the hashjoin is evidently a lot higher than it should >> be. The answer is that estimate_hash_bucketsize() is producing a rather silly result in this situation, viz. a bucketsize "fraction" that's well above 1.0. I've applied the following band-aid patch to CVS tip, which perhaps you might like to use locally. But probably the long-range answer is to rethink what that routine is doing --- its adjustment for skewed data distributions is perhaps not such a great idea. regards, tom lane *** src/backend/optimizer/path/costsize.c.orig Fri Dec 13 19:17:55 2002 --- src/backend/optimizer/path/costsize.c Thu Dec 26 18:34:02 2002 *************** *** 1164,1169 **** --- 1164,1179 ---- if (avgfreq > 0.0 && mcvfreq > avgfreq) estfract *= mcvfreq / avgfreq; + /* + * Clamp bucketsize to sane range (the above adjustment could easily + * produce an out-of-range result). We set the lower bound a little + * above zero, since zero isn't a very sane result. + */ + if (estfract < 1.0e-6) + estfract = 1.0e-6; + else if (estfract > 1.0) + estfract = 1.0; + ReleaseSysCache(tuple); return (Selectivity) estfract; From pgsql-performance-owner@postgresql.org Fri Dec 27 02:01:32 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4E35D4758C9 for ; Fri, 27 Dec 2002 02:01:31 -0500 (EST) Received: from pineapple.ji.justsystem.co.jp (pineapple.ji.justsystem.co.jp [210.169.202.64]) by postgresql.org (Postfix) with ESMTP id 83216474E53 for ; Fri, 27 Dec 2002 02:01:30 -0500 (EST) Received: from vrs01.b1.justsystem.co.jp ([10.4.1.51]) by pineapple.ji.justsystem.co.jp with smtp (Exim 3.33 #1) id 18RoVD-0005tP-00 for pgsql-performance@postgresql.org; Fri, 27 Dec 2002 16:01:51 +0900 Received: from justsystem.co.jp ([10.4.1.38]) by vrs01.b1.justsystem.co.jp (NAVGW 2.5.1.19) with SMTP id M2002122716013412584 for ; Fri, 27 Dec 2002 16:01:34 +0900 Received: (qmail 8607 invoked from network); 27 Dec 2002 16:01:29 +0900 Received: from bat.b1.justsystem.co.jp (10.4.1.37) by owl.b1.justsystem.co.jp with SMTP; 27 Dec 2002 16:01:29 +0900 Received: from yutaka_inada by bat.b1.justsystem.co.jp (8.8.8/3.6W) id PAA05960; Fri, 27 Dec 2002 15:58:16 +0900 (JST) From: yutaka_inada@justsystem.co.jp MIME-Version: 1.0 Date: Fri, 27 Dec 2002 16:03:48 +0900 Subject: executing pgsql on Xeon-dual machine To: pgsql-performance@postgresql.org Message-ID: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: JsvMail 4.0 (Shuriken Pro2) X-Priority: 3 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/223 X-Sequence-Number: 639 Hello, I'm facing to a performance problem, when I run PostgreSQL 7. 2.1 + RedHat Linux 7.3 on a Xeon Dual CPU machine. Compared with a P4 2.4GHz machine, pgbench shows 1/10 on the Xeon machine (detail is describled below), while hdparm shows 2 times faster. Disabling HTT had no effects. PostgreSQL 7.2.3 is also slow on the machine. I'm grateful if any of you can give me an advice. thank you. data --------------- [Hardware Profile] DELL PowerEdge 2600 CPU Xeon 2GHz Dual Memory 2GB PC2100 ECC DDR266 SDRAM HDD 73GB 10,000rpm U320 SCSI DELL PowerEdge 600SC (for comparison) CPU Pentium 4 2.4GHz Single Memory 1GB 400MHz ECC DDR SDRAM HDD 80GB 7,200rpm EIDE [pgbench result] multiplicity | 1 | 128 --------------+-----+------ PE 600 |259.2|178.2 [tps] PE 2600 | 22.9| 34.8 [tps] - wal_sync_method(wal_method.sh) fsync - 200,000 data items --- Yutaka Inada [Justsystem Corporation] From pgsql-performance-owner@postgresql.org Fri Dec 27 13:36:05 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A5B0F476280 for ; Fri, 27 Dec 2002 13:36:04 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 3F50C4762A2 for ; Fri, 27 Dec 2002 13:36:03 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBRIZwd0025731; Fri, 27 Dec 2002 13:35:59 -0500 (EST) To: yutaka_inada@justsystem.co.jp Cc: pgsql-performance@postgresql.org Subject: Re: executing pgsql on Xeon-dual machine In-reply-to: References: Comments: In-reply-to yutaka_inada@justsystem.co.jp message dated "Fri, 27 Dec 2002 16:03:48 +0900" Date: Fri, 27 Dec 2002 13:35:58 -0500 Message-ID: <25730.1041014158@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/224 X-Sequence-Number: 640 yutaka_inada@justsystem.co.jp writes: > Compared with a P4 2.4GHz machine, pgbench shows 1/10 on the > Xeon machine (detail is describled below), while hdparm > shows 2 times faster. If you set fsync off, how do the pgbench results change? > [Hardware Profile] > DELL PowerEdge 2600 > CPU Xeon 2GHz Dual > Memory 2GB PC2100 ECC DDR266 SDRAM > HDD 73GB 10,000rpm U320 SCSI > DELL PowerEdge 600SC (for comparison) > CPU Pentium 4 2.4GHz Single > Memory 1GB 400MHz ECC DDR SDRAM > HDD 80GB 7,200rpm EIDE I'm suspicious that the IDE drive may be configured to lie about write completion. If it reports write complete when it's really only buffered the data in controller RAM, then you're effectively running with fsync off on the PE600. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Dec 29 17:09:11 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4691D475CE5 for ; Sun, 29 Dec 2002 17:09:10 -0500 (EST) Received: from cs.uoregon.edu (vitalstatistix.cs.uoregon.edu [128.223.4.19]) by postgresql.org (Postfix) with ESMTP id 832AC475925 for ; Sun, 29 Dec 2002 17:09:09 -0500 (EST) Received: from ix.cs.uoregon.edu (lili@ix.cs.uoregon.edu [128.223.4.21]) by cs.uoregon.edu (8.11.0/8.11.0) with ESMTP id gBTM9Aj21751 for ; Sun, 29 Dec 2002 14:09:10 -0800 (PST) Date: Sun, 29 Dec 2002 14:09:10 -0800 (PST) From: li li To: Subject: A question about inheritance Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/225 X-Sequence-Number: 641 Hi, As we can see all tuples of a child table when scanning parent table, I'm confused about if that means there are two copies that are stored on disk, one is for child table, and the other for parent table? If so, I have to reconsider the size of my database. Thanks. Li Li From pgsql-performance-owner@postgresql.org Mon Dec 30 20:42:50 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B3C22475FBE for ; Mon, 30 Dec 2002 20:42:48 -0500 (EST) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by postgresql.org (Postfix) with ESMTP id 126F447592C for ; Mon, 30 Dec 2002 20:42:48 -0500 (EST) Received: from lfix.demon.co.uk ([158.152.59.127] helo=linda.lfix.co.uk) by anchor-post-35.mail.demon.net with esmtp (Exim 3.36 #2) id 18TBQg-0006Hc-0Z; Tue, 31 Dec 2002 01:42:50 +0000 Received: from localhost ([127.0.0.1] ident=olly) by linda.lfix.co.uk with esmtp (Exim 3.36 #1 (Debian)) id 18TBQf-0004iS-00; Tue, 31 Dec 2002 01:42:49 +0000 Subject: Re: A question about inheritance From: Oliver Elphick To: li li Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Organization: LFIX Limited Message-Id: <1041298969.22899.27.camel@linda.lfix.co.uk> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.0 Date: 31 Dec 2002 01:42:49 +0000 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/226 X-Sequence-Number: 642 On Sun, 2002-12-29 at 22:09, li li wrote: > Hi, > As we can see all tuples of a child table when scanning parent table, > I'm confused about if that means there are two copies that are stored on > disk, one is for child table, and the other for parent table? If so, > I have to reconsider the size of my database. When you select from the parent table, all rows in its children are also selected unless you use the keyword ONLY. So SELECT * FROM parent; will show all rows of parent and children. But SELECT * FROM ONLY parent; will show just the rows in the parent table. -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Ye have heard that it hath been said, Thou shalt love thy neighbour, and hate thine enemy. But I say unto you, Love your enemies, bless them that curse you, do good to them that hate you, and pray for them which despitefully use you, and persecute you;" Matthew 5:43,44 From pgsql-performance-owner@postgresql.org Tue Dec 31 17:14:35 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BFF46475E1F for ; Tue, 31 Dec 2002 17:14:33 -0500 (EST) Received: from web14810.mail.yahoo.com (web14810.mail.yahoo.com [216.136.224.231]) by postgresql.org (Postfix) with SMTP id 284D6475CE5 for ; Tue, 31 Dec 2002 17:14:33 -0500 (EST) Message-ID: <20021231221435.26755.qmail@web14810.mail.yahoo.com> Received: from [204.155.157.33] by web14810.mail.yahoo.com via HTTP; Tue, 31 Dec 2002 14:14:34 PST Date: Tue, 31 Dec 2002 14:14:34 -0800 (PST) From: Michael Teter Subject: preliminary testing, two very slow situations... To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/227 X-Sequence-Number: 643 Howdy. I've used PostgreSQL in the past on a small project, and I thought it was great. Now I'm trying to evaluate it as a possible replacement for MS SQL Server. I have two issues: 1. I have a homegrown Java migration tool I wrote that seems to work reasonably well, but I'm hoping to understand how to improve its performance. 2. After migrating, I found pg_dump to be plenty quick, but psql < (to completely reload the database) to be very very slow during the COPY stage. Now for more detail. On problem 1., I have autocommit off, and I'm doing PreparedStatement.addBatch() and executeBatch(), and eventually, commit. I've been playing with the amount of rows I do before executeBatch(), and I seem to do best with 20,000 to 50,000 rows in a batch. Some background: this is RedHat8.0 with all the latest RedHat patches, 1GB RAMBUS RAM, 2GHz P4, 40GB 7200RPM HD. Watching gkrellm and top, I see a good bit of CPU use by postmaster duing the addBatch()es, but then when executeBatch() comes, CPU goes almost totally idle, and disk starts churning. Somehow it seems the disk isn't being utilized to the fullest, but I'm just guessing. I'm wondering if there's some postmaster tuning I might do to improve this. Then on problem 2., a pg_dump of the database takes about 3 minutes, and creates a file of 192MB in size. Then I create testdb and do psql -e testdb ; Tue, 31 Dec 2002 18:05:26 -0500 (EST) Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by postgresql.org (Postfix) with ESMTP id 5F8DD475CE5 for ; Tue, 31 Dec 2002 18:05:25 -0500 (EST) Received: from samurai.com (localhost [127.0.0.1]) by bob.samurai.com (Postfix) with SMTP id 559091DBA; Tue, 31 Dec 2002 18:05:27 -0500 (EST) Received: from cpe00d0096a6cd5.cpe.net.cable.rogers.com ([24.112.166.30]) (SquirrelMail authenticated user neilc) by mailbox.samurai.com with HTTP; Tue, 31 Dec 2002 18:05:27 -0500 (EST) Message-ID: <2973.24.112.166.30.1041375927.squirrel@mailbox.samurai.com> Date: Tue, 31 Dec 2002 18:05:27 -0500 (EST) Subject: Re: preliminary testing, two very slow situations... From: "Neil Conway" To: In-Reply-To: <20021231221435.26755.qmail@web14810.mail.yahoo.com> References: <20021231221435.26755.qmail@web14810.mail.yahoo.com> X-Priority: 3 Importance: Normal Cc: X-Mailer: SquirrelMail (version 1.2.9) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/228 X-Sequence-Number: 644 Michael Teter said: > I've used PostgreSQL in the past on a small project, > and I thought it was great. > > Now I'm trying to evaluate it as a possible > replacement for MS SQL Server. [ ... ] What version of PostgreSQL are you using? Have you made any changes to the default configuration parameters? If not, that's probably the first thing to look at. Several settings (e.g. shared_buffers) are set to very conservative values by default. You can also consider trading some reliability for better performance by disabling fsync. For more info on configuration, see: http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/runtime-config.html Another low-hanging fruit is kernel configuration. For example, what OS and kernel are you using? Have you enabled DMA? What filesystem are you using? Cheers, Neil