From: | Mark Volpe <volpe(dot)mark(at)epamail(dot)epa(dot)gov> |
---|---|
To: | Najm Hashmi <najm(at)mondo-live(dot)com> |
Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Index scan |
Date: | 2001-01-31 17:42:01 |
Message-ID: | 3A784E69.ECCAAB30@epamail.epa.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Since you are selecting all the rows of media, there is no reason to use the
index to do this as it would just slow things down.
Mark
Najm Hashmi wrote:
>
> Hi all,
> I am unable to understand why my inidcies are not used in the query.
> I have following indices:
> index on categories.root
> index on media.category
> unique index on categories.id
> Here is my query :
> mondo=# explain select m.id
> form media m, categories c
> where c.id=m.category and c.root like 'B%';
> NOTICE: QUERY PLAN:
>
> Hash Join (cost=22.55..116.80 rows=11 width=28)
> -> Seq Scan on media m (cost=0.00..60.40 rows=840 width=16)
> -> Hash (cost=22.50..22.50 rows=20 width=12)
> -> Index Scan using cat_id_root on categories c
> (cost=0.00..22.50 rows=20 width=12)
> EXPLAIN
>
> I simply dont understand why it uses seq scan on media.
> Thanks all for your help.
> -Najm
From | Date | Subject | |
---|---|---|---|
Next Message | Jie Liang | 2001-01-31 17:48:20 | Re: interval query. |
Previous Message | Albert REINER | 2001-01-31 17:25:12 | Re: Automated scripting... |