hi,
I just wait afew days to see whether some one ( with more info about this 
issue in pg ) reply. but ... so here is my word :


>From: InfraRED <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: [GENERAL] when are indexes used?
>Date: Sun, 19 Sep 1999 17:29:57 +0200 (CEST)
>
>
>I noticed that indexes are not used sometimes when they could speed up
>queries:
>
>explain select * from auth where uid=30;
>         Index Scan using auth_uid_key on auth  (cost=2.05 rows=1 width=40)
>
>explain select * from auth where uid<30;
>         Seq Scan on auth  (cost=2.06 rows=11 width=40)
>

Testing on my machine it works fine. I mean this query uses the index file 
on my database.

>explain select * from auth order by uid;
>         Sort  (cost=2.06 rows=32 width=40)
>           ->  Seq Scan on auth  (cost=2.06 rows=32 width=40)
>
>are there any ways to speed up queries like these?
>the exact usage alg. of indexes is documented somewhere?
>when is this going to be fixed?

It seems that in pg one may only use row field name at the where clause part 
of the query. ie :
select * from auth where uid= 30 ;
but if you want to use the index file,don't use it like this :
select * from auth where uid= ( 28 + 2 ) ;
also you may not use any function on the clause. ie :
select * from auth where sqrt(uid)= 30 ;
So you have to make the where clause statement very simple with no 
complexity.
Though, due to my old knowledge about oracle, some databases supports these 
features a little stronger.
I will also be glad to hear about more docs about indexing on pg.
regards
omid.

>>************

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

************

Reply via email to