Query not using index for user defined type

From: Rodrigo Barboza <rodrigombufrj(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Query not using index for user defined type
Date: 2013-04-15 20:08:04
Message-ID: CANs8QJYRwKssekopcJ73ybs9gzOPrv_JEv7nCT8-1VyuMex48A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi guys.
I created a type 'mytype' (an unsigned int) and created an operator class
for index.
Then I created a table with a column of my type and isnerted 1000 entries.
But no matter how many entries I have in the table, it never uses the
index. It always does a seq scan.

Here is the explain analyze with 1000 entries:

explain analyze select * from mytable where a > 120::mytype and a <
530::mytype;

---------------------------------------------------------------------------------------------------
Seq Scan on mytable (cost=0.00..19.02 rows=400 width=4) (actual
time=0.023..0.229 rows=409 loops=1)
Filter: ((a > '120'::mytype) AND (a < '530'::mytpe))
Total runtime: 0.297 ms

Does anybody know why?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-04-15 20:18:27 Re: [PATCH] pg_regress and non-default unix socket path
Previous Message Robert Haas 2013-04-15 19:52:21 Re: COPY and Volatile default expressions