Re: [Dbmail] SQL suggestion

2006-11-16 Thread Tom Allison
Paul J Stevens wrote: Tom Allison wrote: Does is make sense to add yet another index? Since postgres performs better with than without, is that in question? or to ensure that all the userid records are inserted as lowercase only? That only works if you make damn sure there aren't any reaso

Re: [Dbmail] SQL suggestion

2006-11-16 Thread Rick Morris
Paul J Stevens wrote: Tom Allison wrote: Does is make sense to add yet another index? Since postgres performs better with than without, is that in question? Verified with a couple production 2.0 installs, this does increase IMAP performance. I can't see a serious downside. Maybe

Re: [Dbmail] SQL suggestion

2006-11-16 Thread Paul J Stevens
Tom Allison wrote: > Does is make sense to add yet another index? Since postgres performs better with than without, is that in question? > or to ensure that all the userid records are inserted as lowercase only? That only works if you make damn sure there aren't any reasons for doing things mixe

Re: [Dbmail] SQL suggestion

2006-11-16 Thread Tom Allison
Does is make sense to add yet another index? or to ensure that all the userid records are inserted as lowercase only? I would think that the existing index can be made to work with a modification to the INSERT/UPDATE SQL and not have to go through the process of building out two nearly identical

Re: [Dbmail] SQL suggestion

2006-11-16 Thread Paul J Stevens
Tom Allison wrote: > >> In postgres, it's possible to create an index based on a function: >> >> CREATE INDEX lower_userid ON dbmail_users (lower(userid)); >> >> At that point the query would take about the same amount of time and >> userids can stay in different cases. > > > That is very cool a

Re: [Dbmail] SQL suggestion

2006-11-16 Thread Tom Allison
In postgres, it's possible to create an index based on a function: CREATE INDEX lower_userid ON dbmail_users (lower(userid)); At that point the query would take about the same amount of time and userids can stay in different cases. That is very cool and one more reason why I prefer postgres

Re: [Dbmail] SQL suggestion

2006-11-16 Thread UEMURA (fka. MAENAKA) Tetsuya
Posted on Thu, 16 Nov 2006 15:02:49 +1100 by author Daniel Kasak <[EMAIL PROTECTED]> > In MySQL the default seems to be to have case insensitive matches ( not > sure about other databases ), so in this case you wouldn't need the > 'lower' function. I have tested my dbmail installation ( on a test

Re: [Dbmail] SQL suggestion

2006-11-16 Thread Daniel Kasak
Jason Chu wrote: At that point the query would take about the same amount of time and userids can stay in different cases. In MySQL the default seems to be to have case insensitive matches ( not sure about other databases ), so in this case you wouldn't need the 'lower' function. I have test

Re: [Dbmail] SQL suggestion

2006-11-16 Thread Jason Chu
On Wed, 15 Nov 2006 21:47:49 -0500 Tom Allison <[EMAIL PROTECTED]> wrote: > Believe me, I'm not trying to be an expert here, so if I'm wrong I > could benefit from some explaining why... but... > instead of: > > SELECT user_idnr FROM dbmail_users WHERE lower(userid) = > lower('[EMAIL PROTECTED]'

[Dbmail] SQL suggestion

2006-11-16 Thread Tom Allison
Believe me, I'm not trying to be an expert here, so if I'm wrong I could benefit from some explaining why... but... instead of: SELECT user_idnr FROM dbmail_users WHERE lower(userid) = lower('[EMAIL PROTECTED]') Wouldn't it make more sense to create these entries with a INSERT INTO .. lower(