Re: [sqlite] sqlite3 create index ... on conflict

2009-10-10 Thread Igor Tandetnik
Hajime MATSUMOTO wrote: > ALTER TABLE ADD COLUMN UNIQUE(avap_id, vacation_start_date) ON > CONFLICT REPLACE; > SQL error near line 3: near "ADD": syntax error First, it's ALTER TABLE tablename ADD ... . That's the immediate cause of the syntax error you get. But it's not going to fly anyway. You

Re: [sqlite] sqlite3 create index ... on conflict

2009-10-10 Thread Hajime MATSUMOTO
thank you for replying my question. i am wondering if i can use ALTER TABLE for two columns unique. i am showing my sql and also i tryed what you said. please take a look. CREATE TABLE AVP_VAC("avp_id", "vacation_start_date", "vacation_length", "vacation_status", "vacation_plan_note", "temp_char

Re: [sqlite] sqlite in-memory database far too slow in my use case (new benchmark inside)

2009-10-10 Thread Olaf Schmidt
"Ron Arts" schrieb im Newsbeitrag news:4ad10a9e.3040...@arts-betel.org... > Here's my new benchmark output: > > sqlite3 insert 50 records time: 17.19 secs > sqlite3 select 50 records time: 18.57 secs > sqlite3 prepared select 50 records time: 3.27 secs > glib2 hash tables insert 5000

Re: [sqlite] controlling changes

2009-10-10 Thread David Bicking
On Sat, 2009-10-10 at 19:31 +0100, Simon Slavin wrote: > On 10 Oct 2009, at 5:08pm, David Bicking wrote: > > > I have a table: > > CREATE TABLE Assets > > ( ControlDate Date > > , Amt > > ) > > There is no such column type as 'Date' in SQLite. You got TEXT, > INTEGER, REAL. Make sure you

Re: [sqlite] sqlite in-memory database far too slow in my use case (new benchmark inside)

2009-10-10 Thread Ron Arts
Jay A. Kreibich schreef: > On Sat, Oct 10, 2009 at 11:57:30PM +0200, Ron Arts scratched on the wall: > >> I'm expanding my benchmark to test just thaty, but I'm running into a >> problem. >> Here's my code (well part of it): >> >>sqlite3_stmt *stmt; >>rc = sqlite3_prepare(db, "select name

Re: [sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Simon Slavin
On 10 Oct 2009, at 10:57pm, Ron Arts wrote: > The sqlite3_bind_int immediately gives me an RANGE_ERROR (25). > Is there some obvious thing I'm doing wrong? I notice that your _prepare call puts single quotes around the variable, whereas you are binding an integer to it. But that's probably

Re: [sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Jay A. Kreibich
On Sat, Oct 10, 2009 at 11:57:30PM +0200, Ron Arts scratched on the wall: > I'm expanding my benchmark to test just thaty, but I'm running into a problem. > Here's my code (well part of it): > >sqlite3_stmt *stmt; >rc = sqlite3_prepare(db, "select name from company where id = '?'", -1, >

Re: [sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Ron Arts
Jay A. Kreibich schreef: > On Sat, Oct 10, 2009 at 07:24:33PM +0200, Ron Arts scratched on the wall: > >> I'm afraid the process of >> constructing SQL queries / parsing them by sqlite, and >> interpreting the results in my app, multiple times per >> event will be too slow. > > There should be

Re: [sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Simon Slavin
On 10 Oct 2009, at 9:27pm, Jay A. Kreibich wrote: > On Sat, Oct 10, 2009 at 07:38:08PM +0100, Simon Slavin scratched on > the wall: >> > >> Don't forget to use transactions, even for when you are just doing >> SELECTs without changing any data. > > Using transactions speeds up a long series of

Re: [sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Jay A. Kreibich
On Sat, Oct 10, 2009 at 07:38:08PM +0100, Simon Slavin scratched on the wall: > > On 10 Oct 2009, at 7:04pm, Roger Binns wrote: > > > Ron Arts wrote: > >> So I am wondering if I can drop the glib Hash Tables, and > >> go sqlite all the way. But I'm afraid the process of > >> constructing SQL quer

Re: [sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ron Arts wrote: > Using hash tables I can do 10 requests in .24 seconds > meaning around 40 req/sec. If you are just doing simple lookups (eg doing equality on a single column) then a hash table will always beat going through SQLite. But if y

Re: [sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Jay A. Kreibich
On Sat, Oct 10, 2009 at 07:24:33PM +0200, Ron Arts scratched on the wall: > I'm afraid the process of > constructing SQL queries / parsing them by sqlite, and > interpreting the results in my app, multiple times per > event will be too slow. There should be no need to construct and parse querie

Re: [sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Ron Arts
Ok, I just finished writing a test program. It creates an SQLite memory table and inserts 50 records, then it selects 50 times on a random key. After that it uses hash memory tables to do the same thing. Here is the test output: sqlite3 insert 50 records time: 17.21 secs sqlite3 sele

Re: [sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Simon Slavin
On 10 Oct 2009, at 7:04pm, Roger Binns wrote: > Ron Arts wrote: >> So I am wondering if I can drop the glib Hash Tables, and >> go sqlite all the way. But I'm afraid the process of >> constructing SQL queries / parsing them by sqlite, and >> interpreting the results in my app, multiple times per

Re: [sqlite] controlling changes

2009-10-10 Thread Simon Slavin
On 10 Oct 2009, at 5:08pm, David Bicking wrote: > I have a table: > CREATE TABLE Assets > ( ControlDate Date > , Amt > ) There is no such column type as 'Date' in SQLite. You got TEXT, INTEGER, REAL. Make sure you know what's going into that field. Also I don't understand your pri

Re: [sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ron Arts wrote: > So I am wondering if I can drop the glib Hash Tables, and > go sqlite all the way. But I'm afraid the process of > constructing SQL queries / parsing them by sqlite, and > interpreting the results in my app, multiple times per > event

Re: [sqlite] sqlite build issues on IBM's HP-UX 11i

2009-10-10 Thread Dr. David Kirkby
The title is a bit silly. HP-UX is distributed by HP, not IBM of course. Sorry for any confusion. dave ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] FTS3 performance oddity

2009-10-10 Thread Alexey Pechnikov
Hello! How about solution like to select rowid from my_fts_table where my_fts_table match @query2 and rowid in (select rowid from my_fts_table where my_fts_table match @query1) limit 21 I don't know about performance of this but rowid index may be used success. Best regards, Alexey Pechnik

Re: [sqlite] sqlite build issues on IBM's HP-UX 11i

2009-10-10 Thread Dr. David Kirkby
Rich Shepard wrote: > On Sat, 10 Oct 2009, Dr. David Kirkby wrote: > >> I work on the Sage maths project which aims to create a viable free open >> source alternative to Magma, Maple, Mathematica and Matlab. > > Dave, > > I've use Octave which is supposed to be a F/OSS equivalent to Matlab. >

[sqlite] sqlite in-memory database far too slow in my use case

2009-10-10 Thread Ron Arts
Hi, I am building a libevent based application that must be able to handle tens of thousands requests per second. Each request needs multiple database lookups. Almost all requests do the lookups on the primary key of the tables only. So far I have been using Hash Tables from the glib2 library. Bu

Re: [sqlite] exceptions to check constraints

2009-10-10 Thread Pavel Ivanov
> Can I put CHECK (Amt >=0), yet somehow allow the one or two accounts > that can be negative to be negative? I am assuming the answer is NO. > Am I correct? Yes, you're correct. > CREATE TABLE Assets > ( Nametext PRIMARY KEY > , Amt integer > , CF text -- Y if ac

Re: [sqlite] controlling changes

2009-10-10 Thread David Bicking
Can you show me what the constraint would look like? Thanks, David On Sat, 2009-10-10 at 09:11 -0700, Harold Wood & Meyuni Gani wrote: > You can do it as a constraint. > > -Original Message- > From: David Bicking > Sent: Saturday, October 10, 2009 9:08 AM > To: sqlite-users@sqlite.org >

Re: [sqlite] controlling changes

2009-10-10 Thread Harold Wood & Meyuni Gani
You can do it as a constraint. -Original Message- From: David Bicking Sent: Saturday, October 10, 2009 9:08 AM To: sqlite-users@sqlite.org Subject: [sqlite] controlling changes I have a table: CREATE TABLE Assets ( ControlDate Date , Amt ) Now, the business rules are you can

[sqlite] controlling changes

2009-10-10 Thread David Bicking
I have a table: CREATE TABLE Assets ( ControlDate Date , Amt ) Now, the business rules are you can INCREASE the Amt if the Current Date is the ControlDate in the record. You can DECREASE the amount if the Current Date is greater than or equal to the ControlDate. Can this be enforced v

[sqlite] exceptions to check constraints

2009-10-10 Thread David Bicking
I've never had to deliberately use check constraints in my projects, but I would like to use them on a new projects. I've googled the subject, but found no good explanations. I have a table CREATE TABLE Assets ( Nametext PRIMARY KEY , Amt integer ); Now, for 99% of the record

Re: [sqlite] sqlite3 create index ... on conflict

2009-10-10 Thread Simon Slavin
On 10 Oct 2009, at 9:27am, Hajime MATSUMOTO wrote: > i used to use "CREATE INDEX" with "ON CONFLICT". > i am sure it was able to do on sqlite 2.x.x. > but i tryed on sqlite3 it dose not work. You can use 'ON CONFLICT' in either of CREATE TABLE ALTER TABLE ADD COLUMN ... UNIQUE but not when def

[sqlite] TR: Tcl API - DROP TABLE when processing the results of a querry one row at a time

2009-10-10 Thread Cuaz.Elina
-Message d'origine- De : jm cuaz [mailto:jm.c...@orens.fr] Envoyé : vendredi 9 octobre 2009 16:13 À : sqlite-users@sqlite.org Objet : Tcl API - DROP TABLE when processing the results of a querry one row at a time Hello, SQlite 3.6.10 - no "shared-cahe mode" - no explicit transaction

Re: [sqlite] Wiki consisting of rows in a db table

2009-10-10 Thread Kees Nuyt
On Fri, 9 Oct 2009 17:08:01 -0600, Kelly Jones wrote: >Consider a wiki that lets you edit rows in a db table. Each page is a >row in the table, and has fields that anyone can edit. Like all wikis, >it keeps a history of edits (including who made the edits), and lets >you revert an edit, or even d

[sqlite] sqlite3 create index ... on conflict

2009-10-10 Thread Hajime MATSUMOTO
hi every one. i used to use "CREATE INDEX" with "ON CONFLICT". i am sure it was able to do on sqlite 2.x.x. but i tryed on sqlite3 it dose not work. dose anybody knows the probrem? Hajime ___ sqlite-users mailing list sqlite-users@sqlite.org http://sql