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 02B795666B for ; Mon, 14 Mar 2005 15:21:47 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53360-05 for ; Mon, 14 Mar 2005 15:21:36 +0000 (GMT) Received: from sranda.klamovka.kosire.czf (unknown [82.113.63.66]) by svr1.postgresql.org (Postfix) with ESMTP id BF61D5665F for ; Mon, 14 Mar 2005 15:21:34 +0000 (GMT) Received: (qmail 20641 invoked from network); 14 Mar 2005 16:21:37 +0100 Received: from startnet.klamovka.kosire.czf (HELO ?192.168.11.101?) (10.15.6.17) by sranda.klamovka.kosire.czf with AES256-SHA encrypted SMTP; 14 Mar 2005 16:21:37 +0100 Message-ID: <4235AC01.600@startnet.cz> Date: Mon, 14 Mar 2005 16:21:37 +0100 From: =?windows-1250?Q?Miroslav_=8Aulc?= Organization: StartNet s.r.o. User-Agent: Mozilla Thunderbird 1.0 (X11/20041208) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgreSQL.org, pgsql-hackers@postgreSQL.org Subject: Re: [PERFORM] How to read query plan 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> <13458.1110812581@sss.pgh.pa.us> In-Reply-To: <13458.1110812581@sss.pgh.pa.us> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/mixed; boundary="------------020308040300050508020701" X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200503/728 X-Sequence-Number: 65530 This is a multi-part message in MIME format. --------------020308040300050508020701 Content-Type: text/plain; charset=windows-1250; format=flowed Content-Transfer-Encoding: 7bit Tom Lane wrote: >=?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 was aware of that :-( >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. > > The problem lies in migration from MySQL to PostgreSQL. In MySQL we (badly) choose enum for yes/no switches (there's nothing like boolean field type in MySQL as I know but we could use tinyint). It will be very time consuming to rewrite all such enums and check the code whether it works. >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. > > Unfortunatelly I don't see any other way than LEFT JOINing in this case. > regards, tom lane > > Miroslav --------------020308040300050508020701 Content-Type: text/x-vcard; charset=utf-8; name="miroslav.sulc.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="miroslav.sulc.vcf" begin:vcard fn;quoted-printable:Miroslav =C5=A0ulc n;quoted-printable:=C5=A0ulc;Miroslav org:StartNet s.r.o. adr;quoted-printable;quoted-printable:;;Vrchlick=C3=A9ho 161/5;Praha 5;;150 00;=C4=8Cesk=C3=A1 republika email;internet:miroslav.sulc@startnet.cz title:CEO tel;work:+420 257 225 602 tel;cell:+420 603 711 413 x-mozilla-html:TRUE url:http://www.startnet.cz version:2.1 end:vcard --------------020308040300050508020701--