when are indexes used?

From: InfraRED <infrared(at)a-b(dot)hu>
To: pgsql-general(at)postgresql(dot)org
Subject: when are indexes used?
Date: 1999-09-19 15:29:57
Message-ID: 37E500CA.3FF5DB37@a-b.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


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)

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?

finally some enhancement ideas:

persistent views: like select into, but the view gets updated every time
the table(s) it was created from change. (gives no further functionality
over views, but when used wisely, can speed up things)

pertable fsync behaviour

inmemory tables: table data should not be saved to disk (maybe except
for swapping), because contains rapidly changing data, which would
expire before restarting the backend

ps: sorry for my bad english

--
InfraRED of aurora-borealis/Veres Tibor
E-Mail: infrared(at)a-b(dot)hu

Browse pgsql-general by date

  From Date Subject
Next Message Martin Weinberg 1999-09-19 15:39:30 Memory exhausted in AllocSetAlloc()
Previous Message Naceur 1999-09-19 15:13:52 (no subject)

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1999-09-19 15:48:06 Re: [HACKERS] All things equal, we are still alot slower then MySQL?
Previous Message Thomas Lockhart 1999-09-19 15:24:22 INSERT/DEFAULT VALUES broken?