It really depends on the number of rows. If the number of
rows in the tables are small or the number of rows returned is
a reasonable percentage, the index scan is currently more expensive.
What does (for example) select count(*) from classes; give?
On Thu, 31 May 2001, Koen Antonissen wrote:
> actually the serials are declared int4 (integer),
> I tried to use your work around anyway, but it didn't work...:
>
> dsc_competition=# \d classes
> Table "classes"
> Attribute | Type | Modifier
>
> ------------+---------+-------------------------------------------------
> -
> id | integer | not null default nextval('classes_id_seq'::text)
> name | text | not null
> definition | text |
> active | boolean | default 't'::bool
> Indices: classes_pkey,
> index_classes_name,
> unq_classes_name
>
> dsc_competition=# explain select * from classes where id = int8(4);
> NOTICE: QUERY PLAN:
>
> Seq Scan on classes (cost=0.00..1.07 rows=1 width=29)
>
> EXPLAIN
> dsc_competition=# explain select * from classes where id = int4(4);
> NOTICE: QUERY PLAN:
>
> Seq Scan on classes (cost=0.00..1.07 rows=1 width=29)
>
> EXPLAIN
> dsc_competition=# explain select * from classes where id = int2(4);
> NOTICE: QUERY PLAN:
>
> Seq Scan on classes (cost=0.00..1.07 rows=1 width=29)
>
> EXPLAIN
>
>
>
> Thing I descovered after i posted to the group was that after creating
> the scheme again, the indexes are used! after vacuum (analyze) the use
> of indexes was gone again on certain tables...
>
> Any other suggestions?