[EMAIL PROTECTED] wrote:
Greetings everyone! I've been using DBMail for quite some time now and
recently I've found myself interested in tweaking performance in
PostgreSQL. I've noticed that there's one particular query that keeps
popping up that is notoriously slow and I believe I've found a tweak to
increase the performance significantly. Here's what I've seen:
Good I think there is certainly some room for query optimization.
[ Snip of query optimizaion and explains ]
Question, what version of PostgreSQL are you using, I'm not sure, but I
think there has been some optimizations of the IN clause in recent
releases.
MESSAGE_STATUS_NEW = 0
MESSAGE_STATUS_SEEN = 1
MESSAGE_STATUS_DELETE = 2
MESSAGE_STATUS_PURGE = 3
MESSAGE_STATUS_UNUSED = 4
MESSAGE_STATUS_INSERT = 5
MESSAGE_STATUS_ERROR = 6
Can we always assume a range? That is can we always optimize where foo
IN (0,1,2,3) as where foo < 4? Or are there times where we want to know
where foo IN (0,2,4,6)?
Matt