On Tue, Oct 10, 2006 at 08:41:56AM -0400, [EMAIL PROTECTED] wrote: > Sorry for the delayed response. I've been away for a few days. > > I'm using PostgreSQL 8.0.8. It is using the indexes because it > automatically typecasts the char to an int. However, an IN or OR clause > causes it to scan the index twice and then merge the results. This is > significantly slower than a single index scan. > > I've been testing the query I sent last week and performance on > SquirrelMail appears to be faster as well as some IMAP filtering Perl > scripts that I wrote. Unfortunately if the flags do not remain in their > current order there is no guarantee that we can get away with the less > than operator instead of IN/OR. I'll keep digging and see if I can find a > more efficient way.
You might want to post to one of the PostgreSQL lists about it. I'm guessing the community won't be terribly interested in giving the planner enough brains to know that IN(1,2) on an int column could be converted to BETWEEN 1 AND 2, but you never know... -- Jim C. Nasby, Database Architect [EMAIL PROTECTED] Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?"
