Re: [sqlite] File handles for database on OS X keeps growing.

2017-05-19 Thread Simon Slavin
On 20 May 2017, at 1:34am, Map Pin Support wrote: > I have an app which makes thousands of individual inserts into a SQLite3 > database. > I use FMDB as a Cocoa wrapper for SQLite. This is not normal for SQLite. I don’t think you can get much help here.

Re: [sqlite] File handles for database on OS X keeps growing.

2017-05-19 Thread Jens Alfke
> On May 19, 2017, at 5:34 PM, Map Pin Support > wrote: > > What I am seeing is the app crash as a result of “too many files open”, > however I believe I am opening the database file only once: It’s been a while since I’ve used FMDB, but IIRC it opens a

[sqlite] File handles for database on OS X keeps growing.

2017-05-19 Thread Map Pin Support
I have an app which makes thousands of individual inserts into a SQLite3 database. I use FMDB as a Cocoa wrapper for SQLite. Sqlite v 3.18.0 FMDB v 2.6.2 What I am seeing is the app crash as a result of “too many files open”, however I believe I am opening the database file only once: if

Re: [sqlite] SQLite in memory

2017-05-19 Thread Wout Mertens
Note that, as I understand it, if you use only a single connection for the CherryPi server, all the threads on the server will be running the queries sequentially. Try using a database connection per thread? On Thu, May 18, 2017, 8:47 PM Gabriele Lanaro wrote: >

Re: [sqlite] auntondex with unique and integer primary key

2017-05-19 Thread David Raymond
This is the only reason I can think of for the redundancy and was actually thinking of it earlier. Consider the basic "select count(*) from ...;" If you've got a lot of fields, or if they're large fields, then the fanout of your records means you may have to get a whole bunch of pages to find

Re: [sqlite] auntondex with unique and integer primary key

2017-05-19 Thread Paul Sanderson
Ahh - I always let SQLite decide what index to use as I assume that it knows best. I have never used "indexed by" to force the use of a specific index - I see the issue with backward compatibility now. Thanks Richard Paul www.sandersonforensics.com skype: r3scue193 twitter: @sandersonforens Tel

Re: [sqlite] auntondex with unique and integer primary key

2017-05-19 Thread Keith Medcalf
No. You asked for the extra index to be created in the table specification. It is not the job of the database engine to correct your errors (it is not even possible to know if it is an error). If you declared that you want an extra UNIQUE index on an INTEGER PRIMARY KEY (which is

Re: [sqlite] NOT NULL integer primary key

2017-05-19 Thread Keith Medcalf
On Thursday, 18 May, 2017 10:17, Paul Sanderson wrote: > Create table test (id integer not null primary key, data text); > insert into test values (null, 'row1'); > select * from test; > 1, row1 > I know that if you provide a NULL value to a column define as

Re: [sqlite] auntondex with unique and integer primary key

2017-05-19 Thread Richard Hipp
On 5/19/17, Paul Sanderson wrote: > > Yes Unique is redundant in the create statement, but it would be a small > optimisation, unless I am missing something, for SQLite to detect this and > not create the autoindex to start with. > That would be great, if we had

Re: [sqlite] auntondex with unique and integer primary key

2017-05-19 Thread Paul Sanderson
I think you guys might be missing my point :) We know the integer primary key is an alias for the rowid - but as that table is created we also get a completely redundant index, a second b-tree, which is essentially a one to one mapping of rowids 1=1, 2=2, 3=3 etc. The index takes up space that

Re: [sqlite] auntondex with unique and integer primary key

2017-05-19 Thread Joseph L. Casale
> -Original Message- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On > Behalf Of Paul Sanderson > Sent: Friday, May 19, 2017 12:08 PM > To: SQLite mailing list > Subject: Re: [sqlite] auntondex with unique and integer

Re: [sqlite] auntondex with unique and integer primary key

2017-05-19 Thread Paul Sanderson
Thanks Simon I am aware that a PK must be unique :) It's not me that's declaring it as unique - I get to look at thousands of databases that other people create and it is these where I have noticed it (Chrome and Skype are two). I just thought it might be an area for optimisation as a redundant

Re: [sqlite] auntondex with unique and integer primary key

2017-05-19 Thread J. King
On May 19, 2017 1:21:49 PM EDT, Paul Sanderson wrote: >Is the autoindex associated when using unique with an integer primary >key >definition redundant? > >I have seen a number of DBs/tables created in the following form: > >Create table test(id integer unique

Re: [sqlite] auntondex with unique and integer primary key

2017-05-19 Thread Simon Slavin
On 19 May 2017, at 6:21pm, Paul Sanderson wrote: > Is the autoindex associated when using unique with an integer primary key > definition redundant? > > I have seen a number of DBs/tables created in the following form: > > Create table test(id integer unique

Re: [sqlite] auntondex with unique and integer primary key

2017-05-19 Thread Joseph L. Casale
> -Original Message- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On > Behalf Of Paul Sanderson > Sent: Friday, May 19, 2017 11:22 AM > To: General Discussion of SQLite Database us...@mailinglists.sqlite.org> > Subject: [sqlite] auntondex with unique and

Re: [sqlite] Thank you for your work

2017-05-19 Thread Richard Hipp
On 5/19/17, Claudio Bantaloukas wrote: > > Lo and behold, the latest version handled these queries without issue, > halved the time it took to run some other queries and has apparently not > introduced any new issues. > It's always nice to hear that we did something

[sqlite] auntondex with unique and integer primary key

2017-05-19 Thread Paul Sanderson
Is the autoindex associated when using unique with an integer primary key definition redundant? I have seen a number of DBs/tables created in the following form: Create table test(id integer unique primary key); Insert into test values (1); Insert into test values (2); Insert into test values

[sqlite] Thank you for your work

2017-05-19 Thread Claudio Bantaloukas
I had recently been tasked with verifying why our previous (and ancient) version of SQLite was having difficulty parsing some long and complicated queries our software was throwing at it. Before embarking in the full quest, I tried a more recent version to see whether things had improved. Lo

[sqlite] FTS5 bug in SQLite 3.18.0

2017-05-19 Thread Krzysztof Małysa
When SQLIte is compiled with sanitizers they report invalid readouts and undefined-behavior: ``` sqlite3.c:188900:5: runtime error: index 11 out of bounds for type 'char [8]' SUMMARY: AddressSanitizer: undefined-behavior sqlite3.c:188900:5 in sqlite3.c:189142:30: runtime error: index 12 out of