X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 64497563D9; Mon, 14 Mar 2005 15:03:10 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46277-07; Mon, 14 Mar 2005 15:02:59 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6F38752A57; Mon, 14 Mar 2005 15:02:58 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j2EF31lF013459; Mon, 14 Mar 2005 10:03:01 -0500 (EST) To: =?windows-1250?Q?Miroslav_=8Aulc?= Cc: pgsql-performance@postgreSQL.org, pgsql-hackers@postgreSQL.org Subject: Re: [PERFORM] How to read query plan In-reply-to: <42354EA7.4020907@startnet.cz> References: <42345D24.8070104@startnet.cz> <4234692E.3050802@arbash-meinel.com> <42347407.2000202@startnet.cz> <423478B1.7080106@arbash-meinel.com> <18381.1110741354@sss.pgh.pa.us> <423497FE.6040908@startnet.cz> <19293.1110743673@sss.pgh.pa.us> <42349C96.60401@startnet.cz> <3174.1110745587@sss.pgh.pa.us> <4234AF56.1040509@startnet.cz> <6715.1110758921@sss.pgh.pa.us> <42354EA7.4020907@startnet.cz> Comments: In-reply-to =?windows-1250?Q?Miroslav_=8Aulc?= message dated "Mon, 14 Mar 2005 09:43:19 +0100" Date: Mon, 14 Mar 2005 10:03:01 -0500 Message-ID: <13458.1110812581@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/444 X-Sequence-Number: 65246 =?windows-1250?Q?Miroslav_=8Aulc?= writes: > As there are a lot of varchar(1) in the AdDevicesSites table, wouldn't > be helpful to change them to char(1)? Would it solve the variable-width > problem at least for some fields and speed the query up? No, because char(1) isn't physically fixed-width (consider multibyte encodings). There's really no advantage to char(N) in Postgres. I don't know what you're doing with those fields, but if they are effectively booleans or small codes you might be able to convert them to bool or int fields. There is also the "char" datatype (not to be confused with char(1)) which can hold single ASCII characters, but is nonstandard and a bit impoverished as to functionality. However, I doubt this is worth pursuing. One of the things I tested yesterday was a quick hack to organize the storage of intermediate join tuples with fixed-width fields first and non-fixed ones later. It really didn't help much at all :-(. I think the trouble with your example is that in the existing code, the really fast path applies only when the tuple contains no nulls --- and since you're doing all that left joining, there's frequently at least one null lurking. regards, tom lane