Re: [sqlite] Speeding up slow select

2013-07-10 Thread Simon Slavin
On 11 Jul 2013, at 3:17am, Igor Tandetnik wrote: > SQLite believes that the fastest way is to start by finding > status_timeline_relationship records with timeline_id = 2, then join those > back to status and sort the result. > > It seems that

Re: [sqlite] Speeding up slow select

2013-07-10 Thread Igor Tandetnik
On 7/10/2013 9:56 PM, Tyler Spivey wrote: I'm trying to speed up this query, and don't understand why it's not using ix_status_created_at_sort. created_at_sort is a sorted column I'm using as part of a scrolling cursor for moving forward/backward through results, and the status table has

[sqlite] Speeding up slow select

2013-07-10 Thread Tyler Spivey
I'm trying to speed up this query, and don't understand why it's not using ix_status_created_at_sort. created_at_sort is a sorted column I'm using as part of a scrolling cursor for moving forward/backward through results, and the status table has ~36000 rows. SELECT status.text FROM status JOIN

[sqlite] SQLite Use of Indices

2013-07-10 Thread peter korinis
Please help me understand how query plan chooses an index given sqlite_stat1 table. I originally had created 4 single-column indices (L3, L4, C3, C4) on this large 2 table DB. Following Simon's suggestion to create better/combined/reverse indices, I created L2 and C2 but query plan still

[sqlite] dump command in shell using test_demovfs

2013-07-10 Thread Luca Sturaro
Hi, I'm trying to create a VFS for SQLite 3.7.17 porting. I started from testdemo_vfs.c using it first under linux compiling and link it (-DSQLITE_THREADSAFE=0 at compile time) Using this VFS (the behavior is the same on my embedded platform and under linux) I can create and access a db and

Re: [sqlite] Literature on the information theory behind SQL(lite)?

2013-07-10 Thread Stephan Beal
On Wed, Jul 10, 2013 at 11:57 AM, Stephan Beal wrote: > On Wed, Jul 10, 2013 at 3:27 AM, Jay A. Kreibich wrote: > >> SQL and Relational Theory (2nd Ed) by C.J. Date >> > http://shop.oreilly.com/product/0636920022879.do > > Follow-up... To quote the

Re: [sqlite] Calling sqlite3_column_int on a column with a too large number?

2013-07-10 Thread Richard Hipp
On Wed, Jul 10, 2013 at 9:55 AM, Paolo Bolzoni < paolo.bolzoni.br...@gmail.com> wrote: > The subject pretty much says it all. > I am curious to know what sqlite3 does when asking for the result value of > a column passing a type that is too small. > > For example in my system int are 32 bits as

Re: [sqlite] Calling sqlite3_column_int on a column with a too large number?

2013-07-10 Thread Igor Tandetnik
On 7/10/2013 9:55 AM, Paolo Bolzoni wrote: The subject pretty much says it all. I am curious to know what sqlite3 does when asking for the result value of a column passing a type that is too small. Casts it down to int. For example in my system int are 32 bits as result of a query I got a 10

[sqlite] Calling sqlite3_column_int on a column with a too large number?

2013-07-10 Thread Paolo Bolzoni
The subject pretty much says it all. I am curious to know what sqlite3 does when asking for the result value of a column passing a type that is too small. For example in my system int are 32 bits as result of a query I got a 10 billions: what happens using sqlite3_column_int to get that result?

Re: [sqlite] Unlock Notify problems

2013-07-10 Thread Owen Haynes
Thanks for the help, I have found the problem, it lies very deep in some query code which gives up reading new rows and never returns the read lock, was not easy to spot. Owen On 10 July 2013 12:42, Simon Slavin wrote: > > On 10 Jul 2013, at 12:28pm, Owen Haynes

Re: [sqlite] Unlock Notify problems

2013-07-10 Thread Simon Slavin
On 10 Jul 2013, at 12:28pm, Owen Haynes wrote: > I only call sqlite3_finalize() when the thread has finished with the > connection, which is when the thread is deleted. sqlite3_reset is used on B > after it it been notified, and when a query is a success. It looks like B >

Re: [sqlite] What number(2) means?

2013-07-10 Thread Michael Black
You're right that SQLite will ignore any field specifications... But it will not "treat the value as real". It will store whatever you give it. The system is typeless. http://www.sqlite.org/datatypes.html This is different than most other database systems. SQLite version 3.7.16.2 2013-04-12

Re: [sqlite] Unlock Notify problems

2013-07-10 Thread Owen Haynes
I only call sqlite3_finalize() when the thread has finished with the connection, which is when the thread is deleted. sqlite3_reset is used on B after it it been notified, and when a query is a success. It looks like B returns a code 100 in the step function sometimes, should I do something

Re: [sqlite] Literature on the information theory behind SQL(lite)?

2013-07-10 Thread Stephan Beal
On Wed, Jul 10, 2013 at 3:27 AM, Jay A. Kreibich wrote: > ... There are two mathematical systems that can be used to define and prove > the self-consistency of the Relational Model. One system is called > "Relational Algebra" and the other "Relational Calculus." The two >

Re: [sqlite] Reference to an undefined field

2013-07-10 Thread Stephan Beal
On Wed, Jul 10, 2013 at 12:37 AM, Igor Korot wrote: > Hi, ALL, > Consider following code: > > std::string query = "SELECT a FROM foo;"; > > sqlite3_prepare_v2( handle, query, -1, , 0 ); > sqlite3_step( stmt ); int id = sqlite_column_int( stmt, 0 ); > Right here the results

Re: [sqlite] What number(2) means?

2013-07-10 Thread Simon Slavin
On 10 Jul 2013, at 8:44am, Woody Wu wrote: > I have an old dabase, some integer columns were defined as type of > number(2). It limits the number of digits after the decimal point to 2. In other words, it’s what you might use if you wanted an amount of dollars

Re: [sqlite] What number(2) means?

2013-07-10 Thread fnoyanisi
This may help http://stackoverflow.com/questions/5562322/difference-between-int-and-int3-data-types-in-my-sql On 10/07/2013, at 6:33 PM, Woody Wu wrote: > On Wed, Jul 10, 2013 at 10:50:06AM +0200, Paolo Bolzoni wrote: >> Yes, I think it is possible to put only for >>

Re: [sqlite] What number(2) means?

2013-07-10 Thread Woody Wu
On Wed, Jul 10, 2013 at 10:50:06AM +0200, Paolo Bolzoni wrote: > Yes, I think it is possible to put only for > compatibility reasons. Maybe in some > other db systems you can set the magnitude? > Understood. I also don't know why there are number(2) in the schema that I saw. It's just a

Re: [sqlite] What number(2) means?

2013-07-10 Thread Paolo Bolzoni
Yes, I think it is possible to put only for compatibility reasons. Maybe in some other db systems you can set the magnitude? On Wed, Jul 10, 2013 at 10:06 AM, Woody Wu wrote: > On Wed, Jul 10, 2013 at 09:53:41AM +0200, Paolo Bolzoni wrote: >> See here: >>

Re: [sqlite] What number(2) means?

2013-07-10 Thread Woody Wu
On Wed, Jul 10, 2013 at 09:53:41AM +0200, Paolo Bolzoni wrote: > See here: > http://www.sqlite.org/datatype3.html > > I think it just means Integer. And its > size depends on the magnitude of the > number stored. > I've read the doc, it's not so easy to understand. Did you mean, in number(N),

Re: [sqlite] What number(2) means?

2013-07-10 Thread Paolo Bolzoni
See here: http://www.sqlite.org/datatype3.html I think it just means Integer. And its size depends on the magnitude of the number stored. On Wed, Jul 10, 2013 at 9:44 AM, Woody Wu wrote: > I have an old dabase, some integer columns were defined as type of > number(2).

[sqlite] What number(2) means?

2013-07-10 Thread Woody Wu
I have an old dabase, some integer columns were defined as type of number(2). What does this mean in sqlite3? What's the data ragne it can represent, and how much bytes it will consume when stored? Thanks in advance. -- I can't go back to yesterday - because I was a different person then

Re: [sqlite] Literature on the information theory behind SQL(lite)?

2013-07-10 Thread Paolo Bolzoni
On Wed, Jul 10, 2013 at 3:27 AM, Jay A. Kreibich wrote: > really *know* OOP. Similarly, even if you're an expert C++ developer, > if C++ is you're only OOP language, you still don't really get what > clean OOP is all about (because C++ sure as heck isn't that, even if >