From: | "omid omoomi" <oomoomi(at)hotmail(dot)com> |
---|---|
To: | infrared(at)a-b(dot)hu |
Cc: | pgsql-general(at)postgreSQL(dot)org |
Subject: | Re: [GENERAL] when are indexes used? |
Date: | 1999-09-22 06:01:10 |
Message-ID: | 19990922130112.57191.qmail@hotmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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 <infrared(at)a-b(dot)hu>
>To: pgsql-general(at)postgreSQL(dot)org
>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
From | Date | Subject | |
---|---|---|---|
Next Message | Adriaan Joubert | 1999-09-22 06:20:50 | Re: [HACKERS] Re: [GENERAL] Update of bitmask type |
Previous Message | The Hermit Hacker | 1999-09-22 05:46:46 | Re: [HACKERS] Re: [GENERAL] Update of bitmask type |