Re: [sqlite] String Vs Integer Index

2010-02-10 Thread Ibrahim A
Am 10.02.2010 23:17, schrieb Simon Slavin: > But that's true only if you're running a SELECT which actually uses > that column and only that column to do the searching. Which is why I > asked that question earlier on in this thread. > Simon. > The implementation of sqlite uses a B+Tree for

Re: [sqlite] String Vs Integer Index

2010-02-10 Thread Jay A. Kreibich
On Wed, Feb 10, 2010 at 10:17:28PM +, Simon Slavin scratched on the wall: > > On 10 Feb 2010, at 7:51pm, Ibrahim A wrote: > > > An "INTEGER PRIMARY KEY" is at least twice as fast as another type of > > PRIMARY KEY, > > the reason is based on the implementation of the engine. An integer > >

Re: [sqlite] String Vs Integer Index

2010-02-10 Thread Simon Slavin
On 10 Feb 2010, at 7:51pm, Ibrahim A wrote: > An "INTEGER PRIMARY KEY" is at least twice as fast as another type of > PRIMARY KEY, > the reason is based on the implementation of the engine. An integer > primary key substitutes the rowid column of a table. But that's true only if you're

Re: [sqlite] String Vs Integer Index

2010-02-10 Thread Ibrahim A
Am 10.02.2010 18:19, schrieb Alberto Simões: > Supose a table with a key that is a string (say, words from 1 to 10 > characters) or a table with a key of integers. > > How different is the efficiency on fetching one record on these tables? > > If you look into the documentation for "create

Re: [sqlite] String Vs Integer Index

2010-02-10 Thread Virgilio Fornazin
Sure (com certeza!), because it depends on the hardware and software of your target platform. 2010/2/10 Alberto Simões > On Wed, Feb 10, 2010 at 5:42 PM, Virgilio Fornazin > wrote: > > I think you should be asking 'How fast is SQLite locating a

Re: [sqlite] String Vs Integer Index

2010-02-10 Thread Alberto Simões
On Wed, Feb 10, 2010 at 5:42 PM, Virgilio Fornazin wrote: > I think you should be asking 'How fast is SQLite locating a key in a integer > column index vs a string index'... > > Generally, integer keys are faster in key lookups than string keys, because > comparing a

Re: [sqlite] String Vs Integer Index

2010-02-10 Thread Virgilio Fornazin
I think you should be asking 'How fast is SQLite locating a key in a integer column index vs a string index'... Generally, integer keys are faster in key lookups than string keys, because comparing a integer value is a single CMP CPU instruction versus a more-complicated string comparison (that

Re: [sqlite] String Vs Integer Index

2010-02-10 Thread Simon Slavin
On 10 Feb 2010, at 5:19pm, Alberto Simões wrote: > I know I can benchmark myself this question, but I am sure somebody > did that already. > > Supose a table with a key that is a string (say, words from 1 to 10 > characters) or a table with a key of integers. > > How different is the

[sqlite] String Vs Integer Index

2010-02-10 Thread Alberto Simões
Howdy SQLite users, I know I can benchmark myself this question, but I am sure somebody did that already. Supose a table with a key that is a string (say, words from 1 to 10 characters) or a table with a key of integers. How different is the efficiency on fetching one record on these tables?