Re: [PERFORM] Can Postgres use an INDEX over an OR?

2009-07-19 Thread Віталій Тимчишин
2009/7/20 Robert James > > Hi. I notice that when I do a WHERE x, Postgres uses an index, and when I > do WHERE y, it does so as well, but when I do WHERE x OR y, it doesn't. Why > is this so? It's not clever enough. And how can I shut this off? Use UNION/UNION ALL if possible in your case.

Re: [PERFORM] Fastest char datatype

2009-07-19 Thread Peter Eisentraut
On Monday 20 July 2009 04:46:53 Robert James wrote: > I'm storing a lot of words in a database. What's the fastest format for > finding them? I'm going to be doing a lot of WHERE w LIKE 'marsh%' and > WHERE w IN ('m', 'ma'). All characters are lowercase a-z, no punctuation, > no other alphabets.

Re: [PERFORM] Poor query performance

2009-07-19 Thread Scott Marlowe
On Thu, Jul 9, 2009 at 3:34 PM, Alex wrote: > Below is a query that takes 16 seconds on the first run.  I am having > generally poor performance for queries in uncached areas of the data > and often mediocre (500ms-2s+) performance generallly, although > sometimes it's very fast.  All the queries a

[PERFORM] Fastest char datatype

2009-07-19 Thread Robert James
I'm storing a lot of words in a database. What's the fastest format for finding them? I'm going to be doing a lot of WHERE w LIKE 'marsh%' and WHERE w IN ('m', 'ma'). All characters are lowercase a-z, no punctuation, no other alphabets. By default I'm using varchar in utf-8 encoding, but was won

[PERFORM] Can Postgres use an INDEX over an OR?

2009-07-19 Thread Robert James
Hi. I notice that when I do a WHERE x, Postgres uses an index, and when I do WHERE y, it does so as well, but when I do WHERE x OR y, it doesn't. Why is this so? And how can I shut this off? select * from dict where word in (select substr('moon', 0, generate_series(3,length('moon' -- this is m