Re: [sqlite] Announcement of Copy - A cross platform syncing app, that uses SQLite as its backend

2013-03-02 Thread dd
>>The integrity check just takes too long so we don't.

pragma quick_check; doesn't take much tme.
http://www.sqlite.org/pragma.html#pragma_quick_check


On Sun, Mar 3, 2013 at 8:00 AM, Jason Dictos  wrote:

> >> .
> >
> > Thanks for the details.  What programming language do you use?  (Dropbox
> > uses Python.)
> >
>
> C++
>
> >> Early on we figured out quite quickly not leverage the read/write
> >> locking models of SQLite
> >
> > Do you use WAL mode?
> >
>
> I played with it early on but I didn't know how stable the feature was and
> didn't need any of its features at the time, so not at this time.
>
> > I'm also curious roughly what you do with your schema.  It looks like the
> > Dropbox on Android schema has elements of implementing a tree with
> > everything in one big table and no triggers.
> >
>
> We have a file table which is our representation of what the cloud
> currently thinks of things. Then we diff what the filesystem thinks and
> describe the differences to the cloud. Once the cloud accepts the event we
> update our file table. We are careful with triggers and foreign keys since
> SQLite slows to a crawl when we have those and decide to delete a few
> thousand rows.
>
> > Do you use any of SQLite's extensibilty such as adding your own
> collations
> > or user defined functions.
> >
>
> We did have some stored procedures early on but we soon found ways to use
> the sql language a bit better, which is always a faster option and
> guarantees use of indices in some cases. We still may have a couple I think
> but they are not used very much.
>
> >> As it stands now, our customers periodically have random I/O errors
> >> ...
> >
> > As you have large deployments, random stuff does happen.  We have a web
> > service with several requests per second from browsers all over the world
> > and sadly have to use HTTP (cough *IE* cough) rather than the SSL we
> > normally use.  Even though TCP/IP is checksummed there are sporadic
> > corruptions that come through (typically bit flips here and there).
> >
> > 8 years ago there were lots of CPU random errors:
> >
> >  http://blogs.msdn.com/b/oldnewthing/archive/2005/04/12/407562.aspx
> >
> > Do you run an integrity check at startup on the database?  I did so with
> > BitPim, but we didn't have analytics so there was no idea how often
> > corruption happened.
> >
>
> The integrity check just takes too long so we don't. We are currently
> brainstorming ways of detecting corruption quickly.
>
> > There has been an open feature request for a while to have data checksums
> > to deal with the case that what SQLite thinks it wrote is not what is
> > later returned:
> >
> >  http://www.sqlite.org/src/tktview?name=72b01a982a
> >
>
> Thanks for the info Roger
>
> Jason
>
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.11 (GNU/Linux)
> >
> > iEYEARECAAYFAlExZhYACgkQmOOfHg372QTLBgCgsbidy6oQfmAeS4OWq4OBSmFI
> > zxEAn04lneghgvr+ww76AQWzycZ3x+Q0
> > =eya6
> > -END PGP SIGNATURE-
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> Copy, by Barracuda, helps you store, protect, and share all your amazing
> things. Start today: www.copy.com.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Announcement of Copy - A cross platform syncing app, that uses SQLite as its backend

2013-03-02 Thread Jason Dictos
>> .
> 
> Thanks for the details.  What programming language do you use?  (Dropbox
> uses Python.)
> 

C++

>> Early on we figured out quite quickly not leverage the read/write
>> locking models of SQLite
> 
> Do you use WAL mode?
> 

I played with it early on but I didn't know how stable the feature was and 
didn't need any of its features at the time, so not at this time.

> I'm also curious roughly what you do with your schema.  It looks like the
> Dropbox on Android schema has elements of implementing a tree with
> everything in one big table and no triggers.
> 

We have a file table which is our representation of what the cloud currently 
thinks of things. Then we diff what the filesystem thinks and describe the 
differences to the cloud. Once the cloud accepts the event we update our file 
table. We are careful with triggers and foreign keys since SQLite slows to a 
crawl when we have those and decide to delete a few thousand rows.

> Do you use any of SQLite's extensibilty such as adding your own collations
> or user defined functions.
> 

We did have some stored procedures early on but we soon found ways to use the 
sql language a bit better, which is always a faster option and guarantees use 
of indices in some cases. We still may have a couple I think but they are not 
used very much. 

>> As it stands now, our customers periodically have random I/O errors
>> ...
> 
> As you have large deployments, random stuff does happen.  We have a web
> service with several requests per second from browsers all over the world
> and sadly have to use HTTP (cough *IE* cough) rather than the SSL we
> normally use.  Even though TCP/IP is checksummed there are sporadic
> corruptions that come through (typically bit flips here and there).
> 
> 8 years ago there were lots of CPU random errors:
> 
>  http://blogs.msdn.com/b/oldnewthing/archive/2005/04/12/407562.aspx
> 
> Do you run an integrity check at startup on the database?  I did so with
> BitPim, but we didn't have analytics so there was no idea how often
> corruption happened.
> 

The integrity check just takes too long so we don't. We are currently 
brainstorming ways of detecting corruption quickly.

> There has been an open feature request for a while to have data checksums
> to deal with the case that what SQLite thinks it wrote is not what is
> later returned:
> 
>  http://www.sqlite.org/src/tktview?name=72b01a982a
> 

Thanks for the info Roger

Jason

> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> 
> iEYEARECAAYFAlExZhYACgkQmOOfHg372QTLBgCgsbidy6oQfmAeS4OWq4OBSmFI
> zxEAn04lneghgvr+ww76AQWzycZ3x+Q0
> =eya6
> -END PGP SIGNATURE-
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Copy, by Barracuda, helps you store, protect, and share all your amazing
things. Start today: www.copy.com.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Informal question

2013-03-02 Thread jic


"Simon Slavin" asked...


Although there are many hobbyist programmers here, many of us are clearly 
using SQLite
for our serious day jobs, and not just for playing with.  So why is this 
list busy over the

weekends rather than during the working week ?


We are putting in place what we got over the weekend. :-) 


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] backup api for sqlite4?

2013-03-02 Thread Richard Hipp
On Sat, Mar 2, 2013 at 3:30 PM, Rob Turpin  wrote:

> So I'm assuming saving in memory databases isn't an option with sqlite4.
>

Not in a single step at this time.

You could, I suppose, implement the equivalent of the ".dump" command from
the shell.

The underlying data storage in SQLite4 is a simple key/value pair database
with blobs for both key and value.  You could probably implement a command
that would very efficiently copy all key/values from one database into
another, in key order.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] backup api for sqlite4?

2013-03-02 Thread Rob Turpin
So I'm assuming saving in memory databases isn't an option with sqlite4.

On Sat, Mar 2, 2013 at 5:58 AM, Richard Hipp  wrote:

> On Sat, Mar 2, 2013 at 5:52 AM, Rob Turpin  wrote:
>
> > The backup API for sqlite3
> >
> > sqlite3_backup_init
> > sqlite3_backup_step
> > sqlite3_backup_finish
> >
> > I can't find anything similar in sqlite4.  Is there any, or plans for it?
> >
>
> There are no pressing plans.  It isn't on the to-do list.
>
> The SQLite3 backup mechanism operates deep down at the page level of the
> b-tree storage engine.  But SQLite4 does not use a b-tree storage engine,
> it uses LSM, so the SQLite3 backup mechanism isn't directly applicable.
> Some entirely need implementation method would need to be devised.
>
>
> >
> > Thanks,
> > Rob
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite-users Digest, Vol 63, Issue 2

2013-03-02 Thread Peter Haworth
Hi Igor,
Foreign keys are about maintaining the integrity of your database not
performance so using a foreign key and creating an index are two different
subjects.

The foreign key will prevent an application from creating entries in the
table that don't have a matching entry in the parent end of the foreign key
specification.  Remember that foreign key enforcement is off by default in
SQLite and you must issue a PRAGMA foreign_keys=ON every time you open the
database to enforce them.

Whether to have an index on any column, not just foreign keys, is more
complicated. If there are a small number of entries in the table with the
foreign key or if the number of unique values of the foreign key is small
compared to the total number of entries in the table, it probably isn't
worth creating an index.  I think I read somewhere that unless the number
of unique values is 20% or more, using an index may not result in any
performance. improvements

Really the only way to check the performance is to use EXPLAIN QUERY PLAN
with and without an index, using SELECT statements that are exactly the
same as will be used by your application.

As for adding the foreign key specification to an existing table, there are
a number of third party products that will do that for you along with many
other DDL functions that are not provided by the SQLite DDL.  My
SQLiteAdmin program is one of them, available at www.lcsql.com.

Pete
lcSQL Software 

> So basically what you said is:
> "Don't make a foreign key. Instead create an index on the foreign key
> field and it will speed
> things up"
>
> Am I right?
>
> What about making both foreign key and index? Will this improve it even
> further?
>
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Informal question

2013-03-02 Thread Kevin Benson
On Sat, Mar 2, 2013 at 11:37 AM, Simon Slavin  wrote:

> Although there are many hobbyist programmers here, many of us are clearly
> using SQLite for our serious day jobs, and not just for playing with.  So
> why is this list busy over the weekends rather than during the working week
> ?
>
> Simon.
>

Paraphrasing Lewis Carroll ...The hurrier we go, the behinder we get !
--
   --
  --
 --Ô¿Ô--
K e V i N
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is there a way to create a foreign key in existing table?

2013-03-02 Thread kyan
On Sat, Mar 2, 2013 at 6:02 PM, Simon Slavin  wrote:
> Nevertheless, you do now understand that there are no magic undocumented 
> calls in SQLite that people are using to do things like his.  Which is what 
> your question was.

OK, thanks again.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite 3.7.16 beta

2013-03-02 Thread Eric Sink


FWIW:  I am working on a project which uses SQLite extensively.  We 
generally use 3.7.11 on our client side and 3.7.15.2 on our server. I 
just switched both to this 3.7.16 beta, and all our automated tests 
still pass.


--
E


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Suggestion for cache_size pragma documentation

2013-03-02 Thread Richard Allen
Regarding the 'cache_size' pragma
documentation@http://www.sqlite.org/pragma.html -

Could a note be added stating the version number(3.7.10) where a negative
cache_size began to mean a number of kByte instead of a number of
pages? In earlier versions, a negative cache_size was interpreted as
number of pages, and if your page size was large sqlite would use
more memory than expected.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Break on cumulative sum

2013-03-02 Thread Michael Black
And I just noticed that should probably be

when new.BreakPoint <=


-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Gert Van Assche
Sent: Saturday, March 02, 2013 10:49 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Break on cumulative sum

Michael, this is working perfectly!
I learned a lot with your code.
Thanks a lot for your help.

gert

2013/3/2 Michael Black 

> I think your "K" row was a typo on the CumulativeValue?
>
> CREATE TABLE [Test] (TextField, ValueField, CumulativeValue,  BreakPoint
> DEFAULT 10, GroupName);
> CREATE TABLE [MyGroup](GroupName);
> insert into [MyGroup] values(1);
> create trigger trig1 before insert on [Test]
> when 10 <= (select sum(ValueField) from [Test] where GroupName=(select
> GroupName from [MyGroup]))
> begin
> update [MyGroup] set GroupName = (select GroupName+1 from
> [MyGroup]);
> end;
> create trigger trig2 after insert on [Test]
> begin
> update [Test] set GroupName = (select GroupName from [MyGroup])
> where
>  rowid=new.rowid;
> update [Test] set CumulativeValue = (select sum(ValueField) from
> [Test] where GroupName=(select GroupName from [MyGroup])) where
> rowid=new.rowid;
> end;
> insert into [Test] values('A', '2', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('B', '3', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('C', '2', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('D', '4', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('E', '5', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('F', '1', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('G', '1', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('H', '5', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('I', '11', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('J', '8', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('K', '2', null, '10',(select GroupName from
> MyGroup));
> select * from [Test];
> A|2|2|10|1
> B|3|5|10|1
> C|2|7|10|1
> D|4|11|10|1
> E|5|5|10|2
> F|1|6|10|2
> G|1|7|10|2
> H|5|12|10|2
> I|11|11|10|3
> J|8|8|10|4
> K|2|10|10|4
>
>
> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:
> sqlite-users-boun...@sqlite.org] On Behalf Of Gert Van Assche
> Sent: Saturday, March 02, 2013 7:47 AM
> To: sqlite-users
> Subject: [sqlite] Break on cumulative sum
>
> All, I don't know how to achieve this: I need to put the cumulative sum in
> a field, and create a group as soon as that cumulative sum is over a
> breakpoint value (10).
>
> This is an example table:
>
> CREATE TABLE [Test] (TextField, ValueField, CumulativeValue,  BreakPoint
> DEFAULT 10, GroupName);
> insert into [Test] values('A', '2', null, '10');
> insert into [Test] values('B', '3', null, '10');
> insert into [Test] values('C', '2', null, '10');
> insert into [Test] values('D', '4', null, '10');
> insert into [Test] values('E', '5', null, '10');
> insert into [Test] values('F', '1', null, '10');
> insert into [Test] values('G', '1', null, '10');
> insert into [Test] values('H', '5', null, '10');
> insert into [Test] values('I', '11', null, '10');
> insert into [Test] values('J', '8', null, '10');
> insert into [Test] values('K', '2', null, '10');
>
> I'd like to end up with a table that looks like this:
>
> TextField ValueField CumulativeValue BreakPoint GroupName
> A 2 2 10 1
> B 3 5 10 1
> C 2 7 10 1
> D 4 11 10 1
> E 5 5 10 2
> F 1 6 10 2
> G 1 7 10 2
> H 5 12 10 2
> I 11 11 10 3
> J 8 8 10 4
> K 2 2 10 4
>
> I spent hours trying to update the CumulativeValue field untill the
> BreakPoint value is crossed, and restarting the cumulative counter, but I
> have too little sql knowledge to do this.
>
> Could anyone help me?
>
> thanks
>
> gert
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Break on cumulative sum

2013-03-02 Thread Gert Van Assche
Michael, this is working perfectly!
I learned a lot with your code.
Thanks a lot for your help.

gert

2013/3/2 Michael Black 

> I think your "K" row was a typo on the CumulativeValue?
>
> CREATE TABLE [Test] (TextField, ValueField, CumulativeValue,  BreakPoint
> DEFAULT 10, GroupName);
> CREATE TABLE [MyGroup](GroupName);
> insert into [MyGroup] values(1);
> create trigger trig1 before insert on [Test]
> when 10 <= (select sum(ValueField) from [Test] where GroupName=(select
> GroupName from [MyGroup]))
> begin
> update [MyGroup] set GroupName = (select GroupName+1 from
> [MyGroup]);
> end;
> create trigger trig2 after insert on [Test]
> begin
> update [Test] set GroupName = (select GroupName from [MyGroup])
> where
>  rowid=new.rowid;
> update [Test] set CumulativeValue = (select sum(ValueField) from
> [Test] where GroupName=(select GroupName from [MyGroup])) where
> rowid=new.rowid;
> end;
> insert into [Test] values('A', '2', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('B', '3', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('C', '2', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('D', '4', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('E', '5', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('F', '1', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('G', '1', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('H', '5', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('I', '11', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('J', '8', null, '10',(select GroupName from
> MyGroup));
> insert into [Test] values('K', '2', null, '10',(select GroupName from
> MyGroup));
> select * from [Test];
> A|2|2|10|1
> B|3|5|10|1
> C|2|7|10|1
> D|4|11|10|1
> E|5|5|10|2
> F|1|6|10|2
> G|1|7|10|2
> H|5|12|10|2
> I|11|11|10|3
> J|8|8|10|4
> K|2|10|10|4
>
>
> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:
> sqlite-users-boun...@sqlite.org] On Behalf Of Gert Van Assche
> Sent: Saturday, March 02, 2013 7:47 AM
> To: sqlite-users
> Subject: [sqlite] Break on cumulative sum
>
> All, I don't know how to achieve this: I need to put the cumulative sum in
> a field, and create a group as soon as that cumulative sum is over a
> breakpoint value (10).
>
> This is an example table:
>
> CREATE TABLE [Test] (TextField, ValueField, CumulativeValue,  BreakPoint
> DEFAULT 10, GroupName);
> insert into [Test] values('A', '2', null, '10');
> insert into [Test] values('B', '3', null, '10');
> insert into [Test] values('C', '2', null, '10');
> insert into [Test] values('D', '4', null, '10');
> insert into [Test] values('E', '5', null, '10');
> insert into [Test] values('F', '1', null, '10');
> insert into [Test] values('G', '1', null, '10');
> insert into [Test] values('H', '5', null, '10');
> insert into [Test] values('I', '11', null, '10');
> insert into [Test] values('J', '8', null, '10');
> insert into [Test] values('K', '2', null, '10');
>
> I'd like to end up with a table that looks like this:
>
> TextField ValueField CumulativeValue BreakPoint GroupName
> A 2 2 10 1
> B 3 5 10 1
> C 2 7 10 1
> D 4 11 10 1
> E 5 5 10 2
> F 1 6 10 2
> G 1 7 10 2
> H 5 12 10 2
> I 11 11 10 3
> J 8 8 10 4
> K 2 2 10 4
>
> I spent hours trying to update the CumulativeValue field untill the
> BreakPoint value is crossed, and restarting the cumulative counter, but I
> have too little sql knowledge to do this.
>
> Could anyone help me?
>
> thanks
>
> gert
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Informal question

2013-03-02 Thread Richard Hipp
On Sat, Mar 2, 2013 at 11:37 AM, Simon Slavin  wrote:

> Although there are many hobbyist programmers here, many of us are clearly
> using SQLite for our serious day jobs, and not just for playing with.  So
> why is this list busy over the weekends rather than during the working week
> ?
>

According to server logs, the number of visitors (with unique IP addresses)
to the SQLite website drops by about half on weekends.   So at least in
terms of website traffic, most of the action happens during the work week.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite 3.7.16 beta

2013-03-02 Thread Richard Hipp
On Sat, Mar 2, 2013 at 11:36 AM, Simon Slavin  wrote:

>
> On 2 Mar 2013, at 4:29pm, Richard Hipp  wrote:
>
> >   (1)  http://www.sqlite.org/draft/releaselog/3_7_16.html
>
> "Enhance the command-line shell so that a non-zero argument to the ".exit"
> command causes the shell to exist immediately without cleanly shutting down
> the database connection."
>
> I'm guessing 'exist' --> 'exit'.
>

Fixed.


>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Informal question

2013-03-02 Thread Simon Slavin
Although there are many hobbyist programmers here, many of us are clearly using 
SQLite for our serious day jobs, and not just for playing with.  So why is this 
list busy over the weekends rather than during the working week ?

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite 3.7.16 beta

2013-03-02 Thread Simon Slavin

On 2 Mar 2013, at 4:29pm, Richard Hipp  wrote:

>   (1)  http://www.sqlite.org/draft/releaselog/3_7_16.html

"Enhance the command-line shell so that a non-zero argument to the ".exit" 
command causes the shell to exist immediately without cleanly shutting down the 
database connection."

I'm guessing 'exist' --> 'exit'.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLite 3.7.16 beta

2013-03-02 Thread Richard Hipp
The anticipated release date for SQLite 3.7.16 is currently 2013-03-12.
Additional information about the forthcoming 3.7.16 release:

   (1)  http://www.sqlite.org/draft/releaselog/3_7_16.html
   (2)  http://www.sqlite.org/draft/download.html
   (3)  http://www.sqlite.org/checklists/3071600

See a summary of changes at (1).  Download a snapshot of the latest code
(in the form of an amalgamation "sqlite3.c" source file) from (2).  The
status board at (3) will show the current state of release testing.  When
the status board goes all green, we will cut the release.  The links above,
and indeed the entire http://www.sqlite.org/draft/ sub-website, will be
updated periodically between now and the official release so check back
frequently.

Please report any problems encountered.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is there a way to create a foreign key in existing table?

2013-03-02 Thread Simon Slavin

On 2 Mar 2013, at 3:19pm, kyan  wrote:

> Thank you for your response Simon.
> 
> On Sat, Mar 2, 2013 at 3:51 PM, Simon Slavin  wrote:
>> SQLite isn't at its root a DDL.  It's a C API, fully documented here:
>> 
>> 
>> 
>> That's SQLite and that's its full documentation.  As designed, to add SQLite 
>> facilities to your programming project you simply include the C source code 
>> (.c and .h files) that implements those commands into your project.  That's 
>> the 'amalgamation source' you see us talking about on this list.
> 
> I am familiar with the C API. I have successfully built the
> amalgamation with Embarcadero CBuilder, translated the C API to Object
> Pascal and linked the .obj file that CBuilder output to Delphi
> programs with success, This way I don't need to distribute the SQLite
> dll, the C source is directly linked in Delphi. And I have written a
> thin Object Pascal object layer on top of the C API which allows me to
> use SQLite in Delphi programs.

What you did there for Delphi is roughly the same thing people who make SQLite 
DLLs do.  They make a thin shim that allows them to use SQLite calls from 
something other than C.  So you already know what they're doing.

>> Any DDL you see is someone trying to make some or all of those things 
>> accessible as a DDL.  People who make DDLs for SQLite can put as many or as 
>> few of these things into their DDL as they like, along with as many things 
>> they made up themselves as they like.  There is more than one DDL and for 
>> all we know they might all be different to one-another.  If you want to know 
>> about a particular DDL, go find the documentation for that DDL.
> 
> But... if I understand correctly adding some DDL extensions to SQLite
> would mean modifying its SQL parser so that it can parse e.g. the
> expression "ALTER TABLE tab DROP COLUMN col" and its engine in order
> to be able to execute it. Wouldn't that mean modifying the source?

That would be one way to do it, but there are others.  One would be to insert a 
check in whatever they use for '_exec()' so before it passed the statement to 
SQLite it would check to see if it was one they wanted to implement themselves. 
 Then instead of passing just one statement to _exec() they could pass more 
than one or even do something entirely different themselves.

>> (There are complications which mean that you cannot do exactly the above and 
>> expect everything to work perfectly.  I'm using it just as a demonstration.)
> 
> I am already doing that but it is very difficult to do with FKs.

Yes, foreign keys are one example of why I included the text I put in the 
brackets.

Nevertheless, you do now understand that there are no magic undocumented calls 
in SQLite that people are using to do things like his.  Which is what your 
question was.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is there a way to create a foreign key in existing table?

2013-03-02 Thread kyan
Thank you for your response Simon.

On Sat, Mar 2, 2013 at 3:51 PM, Simon Slavin  wrote:
> SQLite isn't at its root a DDL.  It's a C API, fully documented here:
>
> 
>
> That's SQLite and that's its full documentation.  As designed, to add SQLite 
> facilities to your programming project you simply include the C source code 
> (.c and .h files) that implements those commands into your project.  That's 
> the 'amalgamation source' you see us talking about on this list.

I am familiar with the C API. I have successfully built the
amalgamation with Embarcadero CBuilder, translated the C API to Object
Pascal and linked the .obj file that CBuilder output to Delphi
programs with success, This way I don't need to distribute the SQLite
dll, the C source is directly linked in Delphi. And I have written a
thin Object Pascal object layer on top of the C API which allows me to
use SQLite in Delphi programs.

> Any DDL you see is someone trying to make some or all of those things 
> accessible as a DDL.  People who make DDLs for SQLite can put as many or as 
> few of these things into their DDL as they like, along with as many things 
> they made up themselves as they like.  There is more than one DDL and for all 
> we know they might all be different to one-another.  If you want to know 
> about a particular DDL, go find the documentation for that DDL.

But... if I understand correctly adding some DDL extensions to SQLite
would mean modifying its SQL parser so that it can parse e.g. the
expression "ALTER TABLE tab DROP COLUMN col" and its engine in order
to be able to execute it. Wouldn't that mean modifying the source? I
would prefer not to do that for various reasons, the main one being
that I would have to learn C (I can read it but never coded with it)
and then make myself very familiar with the code of SQLite itself in
order to have it execute the introduced DDL, which is far beyond my
scope.

On the other hand, if you mean executing the "introduced" DDL in the
context of my own application, read ahead.

> Having said that, the GUI admin tools and DDLs which implement something like 
> adding/removing constraints usually doesn't include new low-level C code to 
> fiddle with the database like the source code does.  They normally does it by 
> using various API calls in a way that looks like you're doing just one call.  
> For instance, to add a new constraint to an existing table ...
>
> ALTER TABLE myTable ADD CONSTRAINT (capacity > 0)   <-- imaginary command for 
> discussion only
>
> they do this:
>
> 1. Get the old table definition as a text string.
> 2. Add the constraint to the definition.
> 3. Create a new table with this new definition.
> 4. Copy all the data in the old table into the new table.
> 5. Drop the old table.
> 6. Rename the new table with the old table's name.
>
> You can do all the above yourself using just SQLite commands which are 
> already in the API.  All they've done is specify one command in the DDL which 
> does them all for just one call.
>
> (There are complications which mean that you cannot do exactly the above and 
> expect everything to work perfectly.  I'm using it just as a demonstration.)

I am already doing that but it is very difficult to do with FKs. Even
if you disable FK enforcement for the duration of the above sequence
of actions one may end up with invalid FKs, for instance using renamed
or dropped columns. Even worse the consequences will not be evident
until the first time the FK is enforced as part of a DML statement,
where you get a pretty generic error (constraint failed). This means
that the database schema is in an inconsistent state.

So in order to do a structural change properly one would have to:

-Disable FK enforcement to avoid losing detail records when the table
is dropped.
-Find FKs that are affected by the coming change.
-Perform the change doing the sequence you illustrated.
-Repeat the sequence for any tables linked with FKs to fix or drop
them since it is impossible to alter a table's FK without recreating
the table.
-Reenable FKs.

Ok, it can be done but it is tedious at best, hence my original
question. I thought that some tool writer had a better solution they
wouldn't mind sharing.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Break on cumulative sum

2013-03-02 Thread Michael Black
I think your "K" row was a typo on the CumulativeValue?

CREATE TABLE [Test] (TextField, ValueField, CumulativeValue,  BreakPoint 
DEFAULT 10, GroupName);
CREATE TABLE [MyGroup](GroupName);
insert into [MyGroup] values(1);
create trigger trig1 before insert on [Test]
when 10 <= (select sum(ValueField) from [Test] where GroupName=(select 
GroupName from [MyGroup]))
begin
update [MyGroup] set GroupName = (select GroupName+1 from [MyGroup]);
end;
create trigger trig2 after insert on [Test]
begin
update [Test] set GroupName = (select GroupName from [MyGroup]) where
 rowid=new.rowid;
update [Test] set CumulativeValue = (select sum(ValueField) from [Test] 
where GroupName=(select GroupName from [MyGroup])) where rowid=new.rowid;
end;
insert into [Test] values('A', '2', null, '10',(select GroupName from MyGroup));
insert into [Test] values('B', '3', null, '10',(select GroupName from MyGroup));
insert into [Test] values('C', '2', null, '10',(select GroupName from MyGroup));
insert into [Test] values('D', '4', null, '10',(select GroupName from MyGroup));
insert into [Test] values('E', '5', null, '10',(select GroupName from MyGroup));
insert into [Test] values('F', '1', null, '10',(select GroupName from MyGroup));
insert into [Test] values('G', '1', null, '10',(select GroupName from MyGroup));
insert into [Test] values('H', '5', null, '10',(select GroupName from MyGroup));
insert into [Test] values('I', '11', null, '10',(select GroupName from 
MyGroup));
insert into [Test] values('J', '8', null, '10',(select GroupName from MyGroup));
insert into [Test] values('K', '2', null, '10',(select GroupName from MyGroup));
select * from [Test];
A|2|2|10|1
B|3|5|10|1
C|2|7|10|1
D|4|11|10|1
E|5|5|10|2
F|1|6|10|2
G|1|7|10|2
H|5|12|10|2
I|11|11|10|3
J|8|8|10|4
K|2|10|10|4


-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Gert Van Assche
Sent: Saturday, March 02, 2013 7:47 AM
To: sqlite-users
Subject: [sqlite] Break on cumulative sum

All, I don't know how to achieve this: I need to put the cumulative sum in
a field, and create a group as soon as that cumulative sum is over a
breakpoint value (10).

This is an example table:

CREATE TABLE [Test] (TextField, ValueField, CumulativeValue,  BreakPoint
DEFAULT 10, GroupName);
insert into [Test] values('A', '2', null, '10');
insert into [Test] values('B', '3', null, '10');
insert into [Test] values('C', '2', null, '10');
insert into [Test] values('D', '4', null, '10');
insert into [Test] values('E', '5', null, '10');
insert into [Test] values('F', '1', null, '10');
insert into [Test] values('G', '1', null, '10');
insert into [Test] values('H', '5', null, '10');
insert into [Test] values('I', '11', null, '10');
insert into [Test] values('J', '8', null, '10');
insert into [Test] values('K', '2', null, '10');

I'd like to end up with a table that looks like this:

TextField ValueField CumulativeValue BreakPoint GroupName
A 2 2 10 1
B 3 5 10 1
C 2 7 10 1
D 4 11 10 1
E 5 5 10 2
F 1 6 10 2
G 1 7 10 2
H 5 12 10 2
I 11 11 10 3
J 8 8 10 4
K 2 2 10 4

I spent hours trying to update the CumulativeValue field untill the
BreakPoint value is crossed, and restarting the cumulative counter, but I
have too little sql knowledge to do this.

Could anyone help me?

thanks

gert
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is there a way to create a foreign key in existing table?

2013-03-02 Thread Simon Slavin

On 2 Mar 2013, at 1:24pm, kyan  wrote:

> On Tue, Jan 1, 2013 at 8:01 PM, Peter Haworth  wrote:
>> There are plenty of third party tools out there that will take care of
>> adding/removing constraints to existing tables and a whole lot of other
>> functions that aren't available in SQLite's DDL, while accounting for all
>> their secondary effects.
> 
> About these functions that are not available in DDL, are they part of
> SQLite source? Are they part of the interface? They don't seem to be
> documented anywhere. Maybe they are available only for third party
> tool developers? How can someone get documentation for them?

SQLite isn't at its root a DDL.  It's a C API, fully documented here:



That's SQLite and that's its full documentation.  As designed, to add SQLite 
facilities to your programming project you simply include the C source code (.c 
and .h files) that implements those commands into your project.  That's the 
'amalgamation source' you see us talking about on this list.

Any DDL you see is someone trying to make some or all of those things 
accessible as a DDL.  People who make DDLs for SQLite can put as many or as few 
of these things into their DDL as they like, along with as many things they 
made up themselves as they like.  There is more than one DDL and for all we 
know they might all be different to one-another.  If you want to know about a 
particular DDL, go find the documentation for that DDL.

Having said that, the GUI admin tools and DDLs which implement something like 
adding/removing constraints usually doesn't include new low-level C code to 
fiddle with the database like the source code does.  They normally does it by 
using various API calls in a way that looks like you're doing just one call.  
For instance, to add a new constraint to an existing table ...

ALTER TABLE myTable ADD CONSTRAINT (capacity > 0)   <-- imaginary command for 
discussion only

they do this:

1. Get the old table definition as a text string.
2. Add the constraint to the definition.
3. Create a new table with this new definition.
4. Copy all the data in the old table into the new table.
5. Drop the old table.
6. Rename the new table with the old table's name.

You can do all the above yourself using just SQLite commands which are already 
in the API.  All they've done is specify one command in the DDL which does them 
all for just one call.

(There are complications which mean that you cannot do exactly the above and 
expect everything to work perfectly.  I'm using it just as a demonstration.)

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Break on cumulative sum

2013-03-02 Thread Gert Van Assche
All, I don't know how to achieve this: I need to put the cumulative sum in
a field, and create a group as soon as that cumulative sum is over a
breakpoint value (10).

This is an example table:

CREATE TABLE [Test] (TextField, ValueField, CumulativeValue,  BreakPoint
DEFAULT 10, GroupName);
insert into [Test] values('A', '2', null, '10');
insert into [Test] values('B', '3', null, '10');
insert into [Test] values('C', '2', null, '10');
insert into [Test] values('D', '4', null, '10');
insert into [Test] values('E', '5', null, '10');
insert into [Test] values('F', '1', null, '10');
insert into [Test] values('G', '1', null, '10');
insert into [Test] values('H', '5', null, '10');
insert into [Test] values('I', '11', null, '10');
insert into [Test] values('J', '8', null, '10');
insert into [Test] values('K', '2', null, '10');

I'd like to end up with a table that looks like this:

TextField ValueField CumulativeValue BreakPoint GroupName
A 2 2 10 1
B 3 5 10 1
C 2 7 10 1
D 4 11 10 1
E 5 5 10 2
F 1 6 10 2
G 1 7 10 2
H 5 12 10 2
I 11 11 10 3
J 8 8 10 4
K 2 2 10 4

I spent hours trying to update the CumulativeValue field untill the
BreakPoint value is crossed, and restarting the cumulative counter, but I
have too little sql knowledge to do this.

Could anyone help me?

thanks

gert
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is there a way to create a foreign key in existing table?

2013-03-02 Thread kyan
On Tue, Jan 1, 2013 at 8:01 PM, Peter Haworth  wrote:
> There are plenty of third party tools out there that will take care of
> adding/removing constraints to existing tables and a whole lot of other
> functions that aren't available in SQLite's DDL, while accounting for all
> their secondary effects.

About these functions that are not available in DDL, are they part of
SQLite source? Are they part of the interface? They don't seem to be
documented anywhere. Maybe they are available only for third party
tool developers? How can someone get documentation for them?

Thank you in advance.

Constantine.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] backup api for sqlite4?

2013-03-02 Thread Richard Hipp
On Sat, Mar 2, 2013 at 5:52 AM, Rob Turpin  wrote:

> The backup API for sqlite3
>
> sqlite3_backup_init
> sqlite3_backup_step
> sqlite3_backup_finish
>
> I can't find anything similar in sqlite4.  Is there any, or plans for it?
>

There are no pressing plans.  It isn't on the to-do list.

The SQLite3 backup mechanism operates deep down at the page level of the
b-tree storage engine.  But SQLite4 does not use a b-tree storage engine,
it uses LSM, so the SQLite3 backup mechanism isn't directly applicable.
Some entirely need implementation method would need to be devised.


>
> Thanks,
> Rob
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is there a way to create a foreign key in existing table?

2013-03-02 Thread Ryan Johnson

On 01/03/2013 8:08 PM, Stephen Chrzanowski wrote:

On Fri, Mar 1, 2013 at 11:48 AM, Ryan Johnson
wrote:


On 01/03/2013 11:10 AM, Stephen Chrzanowski wrote:


***I'm waiting for the repair man to show up to fix my waterheater...
so...
I'm bored. This is going to be to the point at the beginning, but get
wordy
and technical near the end. ;)  Super over kill. ahem


Nice explanation... just a couple of nitpicks:



Thanks gents. :]



  You will ALWAYS incur slower speeds when using foreign keys in either a

join
or "ON [DELETE/UPDATE]".  Additional look ups have to happen, which means
more
time spent, which typically is the millisecond range per lookup.


I can't think of any reason a foreign key constraint would impact the cost
of joins in any query. The cost is entirely at update time (when you have
to enforce the constraint).


Wouldn't you have to do a look up to procure the list of keys to see what
is actually part of the result set, or would that be decided within the
WHERE logic/filtering?
WHERE does that. Let's say you have table P and F, and the foreign key 
is P.PK=F.FK. With no index at all, it will fetch all rows from P, 
throwing away those that don't match their filters. Then it will fetch 
all rows from F, also throwing away mismatches. Then it will do an 
(expensive) join comparing all rows in P with all rows in F, returning 
only the ones having P.PK = F.FK.


However, if (most likely) you've told sqlite3 that P.PK is a primary 
key, the plan changes: Fetch and filter rows from F side, and for each 
match, then use F.FK to "probe" the index sqlite3 automatically on P.PK. 
That will give only rows for which F.FK=P.PK, and can be vastly faster.


If you create an additional index whose field(s) make it easier to apply 
the WHERE filter on F, sqlite3 can use that instead of a scan. Think if 
you had an index on (last-name,first-name). A query that filters for a 
certain last name can use that index, but a query that filters by first 
name can't (try looking up your first name in a phone book if you don't 
believe me!).


If you created an index on F.FK (which doesn't happen automatically), 
and created other indexes on fields involved in the filters for P, then 
the engine *might* look at its stats and decide it's actually faster to 
use the index to filter P, then probe F using that index. That would 
happen if it thinks the filters on P allow fewer rows past than the 
filters on F do. Choosing which index(es) to create is mostly black 
magic: which ones are actually useful depends strongly on which query 
and data you have, and how smart the optimizer is, and how up-to-date 
your stats are (from ANALYZE).


Meanwhile, a foreign key constraint does the following:
- Whenever you insert or update F, it will blow up if there is not a 
matching P.PK in the database.
- When you delete from F, it will find the matching P.PK (which must be 
there, see above) and either delete them or give an error (depending on 
what you asked for).
- Whenever you read from F, it does absolutely nothing at all, because 
the constraint has already been enforced.


In other words, enforcing a FK constraint requires running queries very 
similar to the one you're trying to run... on every single update. P.PK 
also has the constraint that it must be unique, again requiring queries 
on every insert/update. All those queries can use the PK index just like 
yours do. That's one of the reasons sqlite3 creates that PK index 
automatically, the performance hit of enforcing PK and FK constraints 
would be ridiculous otherwise.


HTH,
Ryan

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is there a way to create a foreign key in existing table?

2013-03-02 Thread Ryan Johnson

On 01/03/2013 4:09 PM, Igor Korot wrote:

Ryan,

On Fri, Mar 1, 2013 at 12:48 PM, Ryan Johnson
 wrote:

On 01/03/2013 2:23 PM, Igor Korot wrote:

Hi, guys,

On Fri, Mar 1, 2013 at 8:48 AM, Ryan Johnson
 wrote:

On 01/03/2013 11:10 AM, Stephen Chrzanowski wrote:

***I'm waiting for the repair man to show up to fix my waterheater...
so...
I'm bored. This is going to be to the point at the beginning, but get
wordy
and technical near the end. ;)  Super over kill. ahem

Nice explanation... just a couple of nitpicks:

Very nice indeed.
Here is what I'm trying to with little more detail.

I am using C API in a C++ based program.
What I'm trying to do is decrease the time the program displays the
main frame window.

Basically during construction I am calling SELECT ... WHERE
.PK = .FK.
Problem is when  was created I didn't make the foreign key.

Check the output of `explain query plan' but I suspect the join already uses
an index on .PK (if that PK was really declared as such, there will
be an index on it). The foreign key (or lack thereof) has nothing to do with
this situation.

Depending on what conditions you have in the where clause, some additional
indexes could be helpful. For example, if you want "where .z between
:X and :Y" (where X and Y are parameters passed in from your code), then an
index on .c will speed things up drastically because it will allow
fetching only the range of records that match the predicate. The improvement
is even more pronounced for equality predicates. As a completely bogus
example:

create table foo(x integer primary key, y, z);
create table bar(a integer primary key, b, c, x integer);
explain query plan select * from foo join bar using(x) where z between 30
and 50 and c = 10;

0|0|1|SCAN TABLE bar (~10 rows)
0|1|0|SEARCH TABLE foo USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)


create index foo_z on foo(z);
create index bar_c on bar(c);
explain query plan select * from foo join bar using(x) where z between 30
and 50 and c = 10;

0|0|1|SEARCH TABLE bar USING INDEX bar_c (c=?) (~10 rows)
0|1|0|SEARCH TABLE foo USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)


The row estimates are worthless (it's an empty database and I never ran
ANALYZE) but you get the idea: without an index, it scans all of bar for
matching rows (= slow) and then joins it to foo using the latter's primary
key index. With the index, it probes bar_c for precisely the data needed (=
fast), then uses foo's primary key index to complete the join as before. In
general, you can use at most one index per table. So, for example, you can't
use both foo_z and the primary key index on foo, so it decides to use the pk
index because that's predicted to be more beneficial; statistics could
easily push that the other way, though (for example, if there's only one or
two rows with c=10). The pk index on bar, on the other hand, is useless for
this query because we don't care what bar.a is; using bar_c index is the
obvious choice there.

I'm afraid I didn't follow your explanation of the grid and update stuff,
but hopefully the above at least helps you make the query fast.

So basically what you said is:
"Don't make a foreign key. Instead create an index on the foreign key
field and it will speed things up"
Foreign keys have nothing to do with query optimization. Use them only 
if they enforce a constraint your application needs enforced.


An index on the foreign key field will probably not be useful, but the 
optimizer has the final say on that (depending on the data you stored 
and the exact nature of your query). If EXPLAIN QUERY PLAN reports using 
an index for every table it accesses, though, creating another index is 
unlikely to help.




Am I right?

What about making both foreign key and index? Will this improve it even further?

Most likely neither will improve performance in your situation.

If you think you still need more performance, you'll have to (at a 
minimum) post the query you use, the schema it runs on, and the output 
of EXPLAIN QUERY PLAN after you have run ANALYZE.


Ryan

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] backup api for sqlite4?

2013-03-02 Thread Rob Turpin
The backup API for sqlite3

sqlite3_backup_init
sqlite3_backup_step
sqlite3_backup_finish

I can't find anything similar in sqlite4.  Is there any, or plans for it?

Thanks,
Rob
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users