From: | Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> |
---|---|
To: | Ahti Legonkov <lego(at)127(dot)0(dot)0(dot)1> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Why doesn't it use indexes? |
Date: | 2002-07-03 07:54:34 |
Message-ID: | Pine.LNX.4.44.0207031052550.9583-100000@matrix.gatewaynet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, 2 Jul 2002, Ahti Legonkov wrote:
Check the actual time by explain analyze.
If sequential scan (your table is small e.g.) is faster
then there is no need for index use.
Also check the enable_indexscan variable.
> Hi,
>
> I have this query:
> select * from reo inner join usr on reo.owner_id=usr.user_id
>
> I also have created these indexes:
> CREATE INDEX "owner_id_reo_key" ON reo (owner_id);
> CREATE INDEX "user_id_user_key" ON usr (user_id);
>
> Explain tells me this:
> Merge Join (cost=1341.74..1481.12 rows=299697 width=461)
> -> Sort (cost=775.05..775.05 rows=6629 width=328)
> -> Seq Scan on apartment_reo reo (cost=0.00..354.29 rows=6629
> width=328)
> -> Sort (cost=566.69..566.69 rows=4521 width=133)
> -> Seq Scan on USER usr (cost=0.00..292.21 rows=4521 width=133)
>
> Why it does not use indexes I have created?
>
>
--
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
tel: +30-10-8981112
fax: +30-10-8981877
email: achill(at)matrix(dot)gatewaynet(dot)com
mantzios(at)softlab(dot)ece(dot)ntua(dot)gr
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Sjöstrand | 2002-07-03 08:28:14 | How do I access the current row from a trigger? |
Previous Message | Achilleus Mantzios | 2002-07-03 07:51:51 | Re: pg_restore cannot restore function |