pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Miroslav Šulc <miroslav.sulc@startnet.cz>
Cc: pgsql-performance@postgreSQL.org
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: [PERFORM] How to read query plan
Date: Mon, 14 Mar 2005 10:03:01 -0500
Message-ID: <13458.1110812581@sss.pgh.pa.us> (raw)
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>

=?windows-1250?Q?Miroslav_=8Aulc?= <miroslav.sulc@startnet.cz> 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



view thread (37+ messages)  latest in thread

Message-ID: <13458.1110812581@sss.pgh.pa.us>
Permalink:  ../13458.1110812581@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13458.1110812581@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, miroslav.sulc@startnet.cz, pgsql-hackers@postgreSQL.org
  Subject: Re: [PERFORM] How to read query plan
  In-Reply-To: <13458.1110812581@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox