Re: [sqlite] Indexes not being used after INNER JOINS?

2007-12-31 Thread Hugo Ferreira
@Scott: Id is a primary key. I believe PKs always have indexes. @Griggs: While the database engine is to be run on a full blown PC, I have three needs that have lead me to choose SQLite: a) It should be completely integrated/embedded within the application; no separate install. Just a single

Re: Re[2]: [sqlite] Fastest way to check if new row or update existing one?

2007-12-31 Thread Kees Nuyt
On Mon, 31 Dec 2007 13:54:50 +, "Hugo Ferreira" <[EMAIL PROTECTED]> wrote: >Hmmm... Would it be possible to make a trigger on a >table such that if any update fails, it does an insert? >If so, then one would only need to issue updates. I don't think that would be possible, an update

Re: [sqlite] Indexes not being used after INNER JOINS?

2007-12-31 Thread Scott Baker
Hugo Ferreira wrote: > Hi everyone, > > I seem to be having a problem here with LEFT JOINS between tables and > results of INNER JOINS. Take for example the following example (table > definition is in the end): > > TABLE COUNT esparqueologico: 750 > TABLE COUNT data: 3828 > TABLE COUNT

Re: [sqlite] Indexes not being used after INNER JOINS?

2007-12-31 Thread Trevor Talbot
On 12/31/07, Hugo Ferreira <[EMAIL PROTECTED]> wrote: > Yes, indeed, it is doing a sequential scan according to EXPLAIN. Still, the > slowness is unbelievable in such a small database. The whole db takes 11Mb, > and doing a LEFT JOIN between a few hundred and a few thousand of rows on a > "Core 2

Re: [sqlite] Indexes not being used after INNER JOINS?

2007-12-31 Thread Hugo Ferreira
Hey! Yes, indeed, it is doing a sequential scan according to EXPLAIN. Still, the slowness is unbelievable in such a small database. The whole db takes 11Mb, and doing a LEFT JOIN between a few hundred and a few thousand of rows on a "Core 2 Duo" taking 6 seconds is... I don't even know what it is

[sqlite] HAPPY NEW YEAR - and a question, of course: SegV on Update

2007-12-31 Thread Jonathan Hendler
Wishing all a joyous and prosperous 2008 - filled with happy coding and happy clients/customers/bosses/families. Cheers... Now a question. :) I have 3 different database handles running in the same thread. One of them is ":memory:". I send an update statement to one and the program crashes.

RE: [sqlite] Indexes not being used after INNER JOINS?

2007-12-31 Thread Griggs, Donald
Hello Hugo, If you preceed a SELECT with the string EXPLAIN QUERY PLAN sqlite will make it clear which, if any, indices it would use when running the select. Sqlite, unlike some of the "non-light" databases, uses a maxium of one index per table per select, I believe. You may want to look at

[sqlite] Indexes not being used after INNER JOINS?

2007-12-31 Thread Hugo Ferreira
Hi everyone, I seem to be having a problem here with LEFT JOINS between tables and results of INNER JOINS. Take for example the following example (table definition is in the end): TABLE COUNT esparqueologico: 750 TABLE COUNT data: 3828 TABLE COUNT reftemporal: 3972 This query would take 6.7s to

Re: [sqlite] Fastest way to check if new row or update existing one?

2007-12-31 Thread John Stanton
Did you try using INSERT OR REPLACE? Hugo Ferreira wrote: > Hmmm... Would it be possible to make a trigger on a table such that if any > update fails, it does an insert? > If so, then one would only need to issue updates. > > On Dec 26, 2007 11:35 AM, Kees Nuyt <[EMAIL PROTECTED]> wrote: > >>

Re: [sqlite] Best way of merging tables

2007-12-31 Thread Mag. Wilhelm Braun
Thanks a lot Kees Nuyt, greate help W.Braun Kees Nuyt wrote: On Mon, 31 Dec 2007 09:56:23 +0100, "Mag. Wilhelm Braun" <[EMAIL PROTECTED]> wrote: hi, I have following situation: database2006: table 'myname': Columns: "ID integer primary key, timestamp integer, x text, y text

Re: [sqlite] Best way of merging tables

2007-12-31 Thread Kees Nuyt
On Mon, 31 Dec 2007 09:56:23 +0100, "Mag. Wilhelm Braun" <[EMAIL PROTECTED]> wrote: >hi, > >I have following situation: > >database2006: table 'myname': Columns: "ID integer primary key, >timestamp integer, x text, y text >database2007: table 'myname': Columns: "ID integer primary key,

[sqlite] Best way of merging tables

2007-12-31 Thread Mag. Wilhelm Braun
hi, I have following situation: database2006: table 'myname': Columns: "ID integer primary key, timestamp integer, x text, y text database2007: table 'myname': Columns: "ID integer primary key, timestamp integer, x text, y text empty comvineddatabase: : table 'myname': Columns: "ID integer