Thread: index or not
Hi list, I wonder if indexes are relevant or not on a small table? (250 rows, 10 columns, often retrieved in different order) JY -- If you have never been hated by your child, you have never been a parent. -- Bette Davis
Jean-Yves F. Barbier <12ukwn@gmail.com> wrote: > Hi list, > > I wonder if indexes are relevant or not on a small table? > (250 rows, 10 columns, often retrieved in different order) Don't ask us, ask EXPLAIN instead! ;-) Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
On Mon, 12 Dec 2011 19:15:32 +0100 Andreas Kretschmer <akretschmer@spamfence.net> wrote: > > I wonder if indexes are relevant or not on a small table? > > (250 rows, 10 columns, often retrieved in different order) > > Don't ask us, ask EXPLAIN instead! ;-) The PB is, it is in dev state and not filled; from what I read on the site about indexes, I would say "no" - so I ask here to see if somebody has a return of experience. -- Psychiatry is the care of the id by the odd.
Jean-Yves F. Barbier <12ukwn@gmail.com> wrote: > On Mon, 12 Dec 2011 19:15:32 +0100 > Andreas Kretschmer <akretschmer@spamfence.net> wrote: > > > > I wonder if indexes are relevant or not on a small table? > > > (250 rows, 10 columns, often retrieved in different order) > > > > Don't ask us, ask EXPLAIN instead! ;-) > > The PB is, it is in dev state and not filled; from what I read > on the site about indexes, I would say "no" - so I ask here to > see if somebody has a return of experience. As i said: use EXPLAIN. The answer of your question depends on a lot of details, i can't say if an seq-scan is cheaper or not. (for instance, if you have SSDs, a index-scan maybe is cheaper than an seq-scan ...) Create an Index, use explain, if it use a seq-scan you can drop the index. For such small tables it is hard to guess the plan... Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
On Mon, 12 Dec 2011 20:26:06 +0100 Andreas Kretschmer <akretschmer@spamfence.net> wrote: > > As i said: use EXPLAIN. The answer of your question depends on a lot of > details, i can't say if an seq-scan is cheaper or not. (for instance, if > you have SSDs, a index-scan maybe is cheaper than an seq-scan ...) > > Create an Index, use explain, if it use a seq-scan you can drop the index. > > For such small tables it is hard to guess the plan... Ok, I'll create indexes (no time to test right now), thanks. -- "Take that, you hostile sons-of-bitches!" -- James Coburn, in the finale of _The_President's_Analyst_