Ok, I guessed something like that were the case, but what I didn't get was the purpose of the logN, without knowing the base for that. So why not simply something like: if (N / m) > 2 then most likely index will be helpful.
It sure is tricky to add these indexes as getting it wrong will seriously affect performance. Trouble in this particular case is that I am dealing with lots of different queries set by the user. I think an application that would produce all the needed indexes based on the table and all the possible queries would be helpful. Anybody done such an app? I think though that I am getting close now to having it all covered and thanks again for all the assistance. RBS -----Original Message----- From: Igor Tandetnik [mailto:[EMAIL PROTECTED] Sent: 04 August 2007 23:45 To: SQLite Subject: [sqlite] Re: Re: Re: Re: Re: Re: Re: How does SQLite choose the index? RB Smissaert <[EMAIL PROTECTED]> wrote: > But then if the base of the logarithm doesn't matter then > how is this equation going to help you? > > m==N/logN > > So, basically it comes down to some experimenting? Well, it tells you that if m is much smaller than N (say, by two orders of magnitude or more), it's a pretty safe bet that index will be useful. If m is close to N (say, within an order of magnitude), it is a pretty safe bet the index will be unhelpful. In the middle lies an area where it's more or less a wash. Most real world problems tend to fall into the two well-defined areas. If you find your particular problem to fall into the gray area, then yes, you might want to experiment. But in this case, even if you find that an index helps, it is unlikely to help by much, so any advantage may be outweighed by additional space requirements and slowdown on inserts and updates. Igor Tandetnik ---------------------------------------------------------------------------- - To unsubscribe, send email to [EMAIL PROTECTED] ---------------------------------------------------------------------------- - ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------