RE: [sqlite] An explanation?

2007-04-26 Thread B V, Phanisekhar
column as primary key and create index on Id, how does it affect the performance of the two queries? Regards, Phanisekahr From: Dennis Cote [mailto:[EMAIL PROTECTED] Sent: Thu 4/26/2007 7:52 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] An explanation

Re: [sqlite] An explanation?

2007-04-26 Thread Dennis Cote
B V, Phanisekhar wrote: Thanks for that Info. I have another question: Assume I have a table given below "CREATE TABLE IF NOT EXISTS Title(Id INTEGER PRIMARY KEY, TitleName String)" "CREATE UNIQUE INDEX IF NOT EXISTS TitleIdx ON TitleName" Now since Id is an integer and a primary key, this wil

RE: [sqlite] An explanation?

2007-04-26 Thread B V, Phanisekhar
l give even better performance? Regards, Phanisekhar -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 26, 2007 3:42 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] An explanation? "B V, Phanisekhar" <[EMAIL PROTECTED]> wrote

Re: [sqlite] An explanation?

2007-04-26 Thread drh
"B V, Phanisekhar" <[EMAIL PROTECTED]> wrote: > How does the index table looks? > > Assume the main table to be: > CREATE TABLE table1 (a INTEGER, b INTEGER) > Assume there is an index on column a: > CREATE INDEX index1 ON table1 (a); > > Now let's suppose the entries

RE: [sqlite] An explanation?

2007-04-26 Thread B V, Phanisekhar
ching record. Can you explain how this is? Doesn't it will do binary search on index table? Regards, Phani -Original Message- From: Dennis Cote [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 24, 2007 4:06 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] An explanation? Marco Bam

Re: [sqlite] An explanation?

2007-04-24 Thread Marco Bambini
Thanks a lot for the explanation Dennis, I really appreciate. --- Marco On Apr 24, 2007, at 12:35 AM, Dennis Cote wrote: Marco Bambini wrote: Database is uniformly distributed, I created it ad hoc just for my test (sqlite 3.3.12): Marco, Another way to think of this is that if your data

Re: [sqlite] An explanation?

2007-04-23 Thread Dennis Cote
Marco Bambini wrote: Database is uniformly distributed, I created it ad hoc just for my test (sqlite 3.3.12): Marco, Another way to think of this is that if your database contained random numbers in the range 1-100 for both a and b, then an index on either of those values would allow sqlite

Re: [sqlite] An explanation?

2007-04-23 Thread Dennis Cote
Marco Bambini wrote: I know that I can use the ANALYZE command or that I can index both columns. I was making some tests and I found that with one index the query is slower that without any index, so I just trying to understand the reason... I do not want to run it faster, I already know that

Re: [sqlite] An explanation?

2007-04-23 Thread Marco Bambini
I know that I can use the ANALYZE command or that I can index both columns. I was making some tests and I found that with one index the query is slower that without any index, so I just trying to understand the reason... I do not want to run it faster, I already know that it is possible.

Re: [sqlite] An explanation?

2007-04-23 Thread drh
Marco Bambini <[EMAIL PROTECTED]> wrote: > Yes, I know that it is faster ... I just wonder why with one index > the query is slower that without any index... Probably because most of the entries in your table match the term being indexed. In your case, this likely means that a large fraction of

Re: [sqlite] An explanation?

2007-04-23 Thread Dennis Cote
Marco Bambini wrote: As a performance test I created a db with 300,000 records, table is: CREATE TABLE table1 (a INTEGER, b INTEGER) a query like: SELECT * FROM table1 WHERE a=5 AND b=11; takes 0.281 secs. if I add two indexes: CREATE INDEX index1 ON table1(a); CREATE INDEX index2 ON table1(b)

Re: [sqlite] An explanation?

2007-04-23 Thread Marco Bambini
Yes, I know that it is faster ... I just wonder why with one index the query is slower that without any index... --- Marco Bambini On Apr 23, 2007, at 6:31 PM, P Kishor wrote: On 4/23/07, Marco Bambini <[EMAIL PROTECTED]> wrote: As a performance test I created a db with 300,000 records, tab

Re: [sqlite] An explanation?

2007-04-23 Thread P Kishor
On 4/23/07, Marco Bambini <[EMAIL PROTECTED]> wrote: As a performance test I created a db with 300,000 records, table is: CREATE TABLE table1 (a INTEGER, b INTEGER) a query like: SELECT * FROM table1 WHERE a=5 AND b=11; takes 0.281 secs. if I add two indexes: CREATE INDEX index1 ON table1(a);

[sqlite] An explanation?

2007-04-23 Thread Marco Bambini
As a performance test I created a db with 300,000 records, table is: CREATE TABLE table1 (a INTEGER, b INTEGER) a query like: SELECT * FROM table1 WHERE a=5 AND b=11; takes 0.281 secs. if I add two indexes: CREATE INDEX index1 ON table1(a); CREATE INDEX index2 ON table1(b); the same query is a