On Wed, Jan 12, 2005 at 04:43:13PM -0500, Tom Lane wrote:
> Jeff Davis <jdavis-pgsql@empires.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/