
> > There is one table, let's
> > say table1, with about 11.0000 rows. On doing a "select distinct var1
> > from table1" via ODBC-Driver, I had to wait about 15 sec for the result.

1. I assume following index exists: 
	create index table1_x0 on table1 (var1);

"select distinct" when executed through a btree index could benefit from
an optimization as follows:

for each "key" that is already in a sorted list output skip the heap tuple
lookup, since for a duplicate it is not necessary to know the tx status,
not sure if that is implementable though.

(PostreSQL needs to look up the tx status in the table for each key in index)

The performance difference is unfortunately to be expected, since Centura can
probably do the distinct by only looking at the index.

You could try to normalize your schema (pull those values out into an extra table) 
if you need such "distinct" queries to be fast.

Andreas

Thu, 26 Jul 2001 09:18:36 +0200
Zeugswetter Andreas SB  <ZeugswetterA@wien.spardat.at>
AW: Re: Slow Performance in PostgreSQL