Re: [sqlite] Re: Re: Re: Re: Re: Re: How does SQLite choose the index?

2007-08-05 Thread John Stanton

RB Smissaert 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?

RBS

No, the relationship is set by the math.  An absolute measurement 
requires that you experiment to discover the constants, but in real 
world situations you are operating in a fixed environment and just want 
to optimize your performance by proportional measurements.  Whether you 
use log or ln merely introduces the famous 2.303 constant proportion.


Whether a full scan of an index is slower than a row scan does depend on 
the index structure.  If the index has brother pointers a full index 
scan can be as fast as a row scan, and if an ordered list is requesteded 
can be faster.  This is where you could experiment to discover more 
about the performance of the index.  I think that Sqlite's indices do 
not have the extra pointers, but have not looked carefully to find out 
for sure.


A binary tree type index like a B-tree maintains its keys in collating 
sequence order so a scan of the index gives you an ordered list without 
extra sorting.  Sqlite uses such an index to sort result sets rather 
than a traditional sort.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Re: Re: Re: Re: Re: Re: How does SQLite choose the index?

2007-08-04 Thread RB Smissaert
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?

RBS



-Original Message-
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: 04 August 2007 21:32
To: SQLite
Subject: [sqlite] Re: Re: Re: Re: Re: Re: How does SQLite choose the index?

RB Smissaert <[EMAIL PROTECTED]>
wrote:
> OK, will have a look at the wiki.
>
>> There's no "m" on the right hand side.
>> m equals N divided by logarithm of N.
>
> What is the base of that logarithm then?

Doesn't matter. All calulations shown are order of magnitude, only 
accurate modulo multiplication by some unknown constant. Choosing 
different base for the logarithm simply changes this constant.

Igor Tandetnik 



-
To unsubscribe, send email to [EMAIL PROTECTED]

-




-
To unsubscribe, send email to [EMAIL PROTECTED]
-