Re: index on user defined type

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jeff Davis <jdavis-pgsql(at)empires(dot)org>, PgSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: index on user defined type
Date: 2005-01-12 22:48:56
Message-ID: 20050112224856.GB39244@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jan 12, 2005 at 04:43:13PM -0500, Tom Lane wrote:
> Jeff Davis <jdavis-pgsql(at)empires(dot)org> writes:
> >
> > => explain select * from test where t = '(2)';
> > QUERY PLAN
> > ---------------------------------------------------------------------
> > Seq Scan on test (cost=100000000.00..100000002.54 rows=1 width=32)
> > Filter: ((t).i = ('(2)'::type2).i)
> > (2 rows)
>
> The explain doesn't seem to quite match up with what you wrote in the
> command. How did those ".i" qualifiers get in there?

I started looking at this in 8.0.0rc5 and got the same thing:

EXPLAIN ANALYZE SELECT * FROM test WHERE t = '(2)';
QUERY PLAN
---------------------------------------------------------------------------------------------------------------
Seq Scan on test (cost=100000000.00..100000001.04 rows=1 width=32) (actual time=0.078..0.088 rows=1 loops=1)
Filter: ((t).i = ('(2)'::type2).i)
Total runtime: 0.203 ms
(3 rows)

If I add another column to the type I get this:

EXPLAIN ANALYZE SELECT * FROM test WHERE t = '(2,3)';
QUERY PLAN
---------------------------------------------------------------------------------------------------------------
Seq Scan on test (cost=100000000.00..100000001.05 rows=1 width=36) (actual time=0.093..0.107 rows=1 loops=1)
Filter: (((t).i = ('(2,3)'::type2).i) AND ((t).j = ('(2,3)'::type2).j))
Total runtime: 0.226 ms
(3 rows)

Table columns having a composite type are new in 8.0, right? Has
indexing a composite type been done before?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2005-01-12 22:56:59 Re: index on user defined type
Previous Message Josué Maldonado 2005-01-12 22:42:42 Re: Postgresql Text field / Visual FoxPro Memo and ODBC