Re: [sqlite] one liner for insert or update ?

2009-09-12 Thread Doug
Wouldn't "INSERT OR REPLACE" do that for you? (which by the way, has to be one of the coolest features in SQLite of all!) http://www.sqlite.org/lang_insert.html Doug > -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of

Re: [sqlite] Any way to speed up this SQL?

2009-09-12 Thread RB Smissaert
Thanks, that works and is a lot faster. I got this down to under 0.5 sec now. I took '¬' for the upper limit character and that should always be fine. RBS -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik Sent:

[sqlite] one liner for insert or update ?

2009-09-12 Thread yogibabu
my dream is to be able do it like that: query("INSERT UPDATE table SET value1='somedata', value2=somedata, id=$getid ") ?> when $getid contains data (a number of course) then an update is performed, otherwise if it is null then database engine ignores `id` valule without any notification and

Re: [sqlite] Any way to speed up this SQL?

2009-09-12 Thread Ken
On additional thing. One of the indices will not be required. Since one table will be the driving table and will require a full scan. The other table should have the index. I would make that the smaller of the tables. Secondly if at all possible try not to make composit fields. A compoisit

Re: [sqlite] Any way to speed up this SQL?

2009-09-12 Thread Igor Tandetnik
RB Smissaert wrote: > Have 2 tables with both one text field called term and need to run a > SQL like this, to count the records in table1 where the start of term > in table1 equals a term in table2: > > select > count(a.rowid) > from table1 a inner join table2 b on > (lower(b.term) =

Re: [sqlite] Any way to speed up this SQL?

2009-09-12 Thread RB Smissaert
Thanks for the tip and will have a look at that. I have in the meantime made this a lot faster by making the data in both tables upper case and making the small table smaller by taking out invalid records. I can then run a simpler join with glob, although I noticed it still doesn't use the index.

Re: [sqlite] Any way to speed up this SQL?

2009-09-12 Thread marbex
I had a similar issue. I wanted to find strings that started as another string in the same table and field. My solution was to create a temp table that consisted of the id, the string and the first word of the string which I then indexed. The table had 30 000 records and the total processing time

[sqlite] Any way to speed up this SQL?

2009-09-12 Thread RB Smissaert
Have 2 tables with both one text field called term and need to run a SQL like this, to count the records in table1 where the start of term in table1 equals a term in table2: select count(a.rowid) from table1 a inner join table2 b on (lower(b.term) = lower(substr(a.term,1,length(b.term term