[sqlite] CREATE INDEX time degradation

2008-06-18 Thread Alberto Simões
Hi. I have a simple table w1,w2,w3,w3, occs and I need indexes for columns w1 to w4. Creating them I got: $ time sqlite3 _.db 'CREATE INDEX wi1 ON tet (w1)' real3m48.159s user3m34.739s sys 0m5.590s $ time sqlite3 _.db 'CREATE INDEX wi2 ON tet (w2)' real9m0.107s user3m44.161s

Re: [sqlite] CREATE INDEX time degradation

2008-06-18 Thread Jay A. Kreibich
On Wed, Jun 18, 2008 at 01:39:34PM +0100, Alberto Sim?es scratched on the wall: > Hi. > > I have a simple table w1,w2,w3,w3, occs and I need indexes for columns w1 to > w4. > Creating them I got: > > $ time sqlite3 _.db 'CREATE INDEX wi1 ON tet (w1)' > real3m48.159s > $ time sqlite3 _.db

[sqlite] Question about PRAGMA journal_mode

2008-06-18 Thread Stefan Arentz
The documentation has the following about the OFF setting of JOURNAL_MODE: "The OFF journaling mode disables the rollback journal completely. No rollback journal is ever created and hence there is never a rollback journal to delete. The OFF journaling mode disables the atomic commit and rollback

Re: [sqlite] Question about PRAGMA journal_mode

2008-06-18 Thread Dennis Cote
Stefan Arentz wrote: > The documentation has the following about the OFF setting of JOURNAL_MODE: > > "The OFF journaling mode disables the rollback journal completely. No > rollback journal is ever created and hence there is never a rollback > journal to delete. The OFF journaling mode disables

Re: [sqlite] Question about PRAGMA journal_mode

2008-06-18 Thread D. Richard Hipp
On Jun 18, 2008, at 10:25 AM, Stefan Arentz wrote: > The documentation has the following about the OFF setting of > JOURNAL_MODE: > > "The OFF journaling mode disables the rollback journal completely. No > rollback journal is ever created and hence there is never a rollback > journal to

Re: [sqlite] splitting field data

2008-06-18 Thread cmartin
On Tue, 17 Jun 2008, Rich Shepard wrote: > You ought to normalize your data. Consider (and this is just off the top > of my head) two tables: one to hold categories and their descriptions, the > other to hold categories and items. Then you can select either specific > items, all items, or

Re: [sqlite] Client/Srever SQLite

2008-06-18 Thread John Stanton
I buffer input from a socket so that socket reads are performed in large chunks and extract characters from that buffer as needed by parsers etc. To write data to a socket I buffer the write into a memory mapped file and then use sendfile (TransmitFile on Windows) to move it out efficiently

Re: [sqlite] splitting field data

2008-06-18 Thread P Kishor
On 6/17/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have a table that contains 2 fields: ID, ITEMS, as: > > CREATE TABLE foo (ID INTEGER PRIMARY KEY, ITEMS); > INSERT INTO foo VALUES(1,item1;item2;item3); > INSERT INTO foo VALUES(2,item1;item4); > INSERT INTO foo

[sqlite] The APress SQLite Book

2008-06-18 Thread Stefan Arentz
Sorry if this is a little offtopic but I am curious what other people thing. Is it just me, or is the APress book 'The definitive guide to SQLIte' not very high quality? First, the index is completely unusable. The index is grouped by subject, so if you want to for example lookup where the book

Re: [sqlite] Question about PRAGMA journal_mode

2008-06-18 Thread Stefan Arentz
On Wed, Jun 18, 2008 at 10:39 AM, D. Richard Hipp <[EMAIL PROTECTED]> wrote: > > On Jun 18, 2008, at 10:25 AM, Stefan Arentz wrote: > >> The documentation has the following about the OFF setting of >> JOURNAL_MODE: >> >> "The OFF journaling mode disables the rollback journal completely. No >>

Re: [sqlite] The APress SQLite Book

2008-06-18 Thread Stephen Woodbridge
In general, I have been very happy with it. It is a great introduction and provides lots of examples. I think of it as more of a tutorial than a reference manual. The SQLite web site is a better reference manual, but lacks the examples and sample code that the book offers. Once you get the

[sqlite] rescueing data after accidental DROP

2008-06-18 Thread Mario Bludau
Is there any way to recover data from a sqlite3 database file after dropping all (2) tables in it? I can see all the data including the ones that were added directly before it happened are in the db file. Is there a tool or something that can parse the file for deleted entries? Thanks for your

Re: [sqlite] The APress SQLite Book

2008-06-18 Thread Peter A. Friend
On Jun 18, 2008, at 8:01 AM, Stefan Arentz wrote: > Sorry if this is a little offtopic but I am curious what other > people thing. > > Is it just me, or is the APress book 'The definitive guide to SQLIte' > not very high quality? > > First, the index is completely unusable. The index is

Re: [sqlite] The APress SQLite Book

2008-06-18 Thread Rich Shepard
On Wed, 18 Jun 2008, Stefan Arentz wrote: > Sorry if this is a little offtopic but I am curious what other people thing. Stefan, I think that Mike did an outstanding job with the book, and the appalling index is not his fault. I wrote to the publisher about it but never received a reply.

Re: [sqlite] splitting field data

2008-06-18 Thread cmartin
On Wed, 18 Jun 2008, P Kishor wrote: >> CREATE TABLE foo (ID INTEGER PRIMARY KEY, ITEMS); >> INSERT INTO foo VALUES(1,item1;item2;item3); >> INSERT INTO foo VALUES(2,item1;item4); >> INSERT INTO foo VALUES(3,item5;item3;item7); > > The above is incorrect SQL. If you run the above INSERT

Re: [sqlite] Getting a table size without counting

2008-06-18 Thread P Kishor
On 6/18/08, Stefan Arentz <[EMAIL PROTECTED]> wrote: > On Wed, Jun 18, 2008 at 11:51 AM, Scott Baker <[EMAIL PROTECTED]> wrote: > > Stefan Arentz wrote: > >> Is it possible to get the size of a table without running a count(*) > >> query on it? Even an approximated size would be good for me. >

Re: [sqlite] Client/Srever SQLite

2008-06-18 Thread Alexey Pechnikov
В сообщении от Wednesday 18 June 2008 18:42:25 John Stanton написал(а): > The magic potion is the ability to embed Sqlite in the application > server and avoid IPCs and multiple processes. Why not multiple processes? And what about threads? If Sqlite library is used in multi-threaded

Re: [sqlite] Long delay for delete/select row in database

2008-06-18 Thread Alexey Pechnikov
В сообщении от Tuesday 17 June 2008 20:59:19 Dennis Cote написал(а): > I would recommend that you change your database schema an combine your > timestamp string and subsecond integer field into a single floating > point julian day number that provides both pieces of information in > units of days

Re: [sqlite] How can I count the number of times a word present in text indexed with FTS 3?

2008-06-18 Thread Scott Hess
There is not currently any support for this in fts. Put another way, you can count the words like you'd count them without fts :-). Long-term, I do plan to add support for figuring out some meta-information about tokens across the index, but there's nothing really driving that at this time.

Re: [sqlite] Getting a table size without counting

2008-06-18 Thread Dennis Cote
P Kishor wrote: > On 6/18/08, Stefan Arentz <[EMAIL PROTECTED]> wrote: >> On Wed, Jun 18, 2008 at 11:51 AM, Scott Baker <[EMAIL PROTECTED]> wrote: >> > Stefan Arentz wrote: >> >> Is it possible to get the size of a table without running a count(*) >> >> query on it? > > This question comes up

Re: [sqlite] CREATE INDEX time degradation

2008-06-18 Thread Alberto Simões
On Wed, Jun 18, 2008 at 3:15 PM, Jay A. Kreibich <[EMAIL PROTECTED]> wrote: > On Wed, Jun 18, 2008 at 01:39:34PM +0100, Alberto Sim?es scratched on the > wall: >> [...] > > What is the original ordering of the data? In order to index the > data, it needs to be sorted, and the sort can get

Re: [sqlite] Long delay for delete/select row in database

2008-06-18 Thread Alexey Pechnikov
В сообщении от Wednesday 18 June 2008 21:32:46 Dennis Cote написал(а): > Alexey Pechnikov wrote: > > There is problem for select one row by time - we must use query > > select * from events where time || =julianday('2008-06-16 23:59:59.999'); > > and index is not used for this query. > > Maybe

Re: [sqlite] The APress SQLite Book

2008-06-18 Thread Samuel Neff
I loved the book. It had a very good introduction to SQL and even as an experienced SQL developer I learned a few things from that, the coverage of SQLite was a wonderful introduction, and it covered some advanced topics well. SQLite changes so much that a lot of things don't apply any more, so

Re: [sqlite] Long delay for delete/select row in database

2008-06-18 Thread Dennis Cote
Alexey Pechnikov wrote: > > I find get only _one_ row. I found correspond timestamp by other questions. I > don't want get more than one row. > In that case you would be better off to get the rowid of that row using the other questions. Then you can get the row of interest directly using the

Re: [sqlite] Getting a table size without counting

2008-06-18 Thread Teg
Hello Stefan, Wednesday, June 18, 2008, 11:47:53 AM, you wrote: SA> Is it possible to get the size of a table without running a count(*) SA> query on it? Even an approximated size would be good for me. SA> PostgreSQL has this value in a system table. Does SQLite have SA> something similar? SA>

Re: [sqlite] Long delay for delete/select row in database

2008-06-18 Thread Alexey Pechnikov
В сообщении от Wednesday 18 June 2008 22:44:16 Dennis Cote написал(а): > Alexey Pechnikov wrote: > > I find get only _one_ row. I found correspond timestamp by other > > questions. I don't want get more than one row. > > In that case you would be better off to get the rowid of that row using > the

Re: [sqlite] Long delay for delete/select row in database

2008-06-18 Thread Dennis Cote
Alexey Pechnikov wrote: > > I'm replicating my database using sqlite dump and load or sql queries. I'm > not > sure that rowid is not different after that. > If you assign each row an id (and even better make it an integer primary key) and use those id columns to link related records then

Re: [sqlite] Getting a table size without counting

2008-06-18 Thread Dennis Cote
Teg wrote: >> > Yeah, it's not that fast at all. I moved away from SQLite for one part > of my application because COUNT was slow. If the data's not in the OS > cache, it's real slow. > > One possibility would be to maintain an approximate count in a > different table. That didn't work for me

Re: [sqlite] Getting a table size without counting

2008-06-18 Thread P Kishor
There are several things to think about in this kind of a query -- On 6/18/08, Stefan Arentz <[EMAIL PROTECTED]> wrote: > On Wed, Jun 18, 2008 at 11:51 AM, Scott Baker <[EMAIL PROTECTED]> wrote: > > Stefan Arentz wrote: > >> Is it possible to get the size of a table without running a count(*) >

Re: [sqlite] Client/Srever SQLite

2008-06-18 Thread Alexey Pechnikov
В сообщении от Wednesday 18 June 2008 23:40:05 John Stanton написал(а): > Alexey Pechnikov wrote: > > В сообщении от Wednesday 18 June 2008 18:42:25 John Stanton написал(а): > >> The magic potion is the ability to embed Sqlite in the application > >> server and avoid IPCs and multiple processes. >

Re: [sqlite] Client/Srever SQLite

2008-06-18 Thread John Stanton
Alexey Pechnikov wrote: > В сообщении от Wednesday 18 June 2008 23:40:05 John Stanton написал(а): >> Alexey Pechnikov wrote: >>> В сообщении от Wednesday 18 June 2008 18:42:25 John Stanton написал(а): The magic potion is the ability to embed Sqlite in the application server and avoid

Re: [sqlite] Getting a table size without counting

2008-06-18 Thread Teg
Hello Dennis, Wednesday, June 18, 2008, 4:26:55 PM, you wrote: DC> Teg wrote: >>> >> Yeah, it's not that fast at all. I moved away from SQLite for one part >> of my application because COUNT was slow. If the data's not in the OS >> cache, it's real slow. >> >> One possibility would be to

Re: [sqlite] Long delay for delete/select row in database

2008-06-18 Thread Alexey Pechnikov
В сообщении от Thursday 19 June 2008 00:22:37 Dennis Cote написал(а): > Alexey Pechnikov wrote: > > I'm replicating my database using sqlite dump and load or sql queries. > > I'm not sure that rowid is not different after that. > > If you assign each row an id (and even better make it an integer

[sqlite] configure syntax error on HP

2008-06-18 Thread Andrea Connell
I'm trying to compile 3.5.9 on an HP-UX 11i v1 machine but I can't get past step one... I unpacked the amalgamation, cd'd to the directory, and ran './configure' - that didn't work so I tried 'sh ./configure' like the install instructions suggest. I got a syntax error right away.

Re: [sqlite] configure syntax error on HP

2008-06-18 Thread D. Richard Hipp
On Jun 18, 2008, at 5:38 PM, Andrea Connell wrote: > I'm trying to compile 3.5.9 on an HP-UX 11i v1 machine but I can't get > past step one... > > I unpacked the amalgamation, cd'd to the directory, and ran > './configure' - that didn't work so I tried 'sh ./configure' like the > install

Re: [sqlite] Getting a table size without counting

2008-06-18 Thread Alexey Pechnikov
В сообщении от Thursday 19 June 2008 01:09:42 Teg написал(а): > I doubt the COUNT in Sqlite could be any faster. You really notice the > slowdown though, the first time you access the DB and nothing's in > cache. I think, you can use index directly as create index id_idx on mytable(id); select

Re: [sqlite] Segmentation Fault when using mod_python / mod_wsgi

2008-06-18 Thread Eric Holmberg
This is now officially off-topic since the problem is in the Python SQLite wrappers and Apache instead of the SQLite C code. Regardless, I would like to post the cause and solution so that anybody who ends up here while doing a web search will know the solution. > Program received signal

Re: [sqlite] Long delay for delete/select row in database

2008-06-18 Thread Dennis Cote
Alexey Pechnikov wrote: > > I have same database on host A and host B. On _both_ hosts I can > insert/update/delete/select rows and periodically synchronize databases. > Oh. That's a different issue that you didn't mention before. It definitely makes things more complicated. > CREATE TABLE

Re: [sqlite] Getting a table size without counting

2008-06-18 Thread Dennis Cote
Alexey Pechnikov wrote: > > I think, you can use index directly as > create index id_idx on mytable(id); > > select count(id) from mytable where id>0; > > explain query plan select count(id) from mytable where id>0; > 0|0|TABLE mytable WITH INDEX id_idx > > It's better than use count(*) with

Re: [sqlite] configure syntax error on HP

2008-06-18 Thread Andrea Connell
>On Jun 18, 2008, at 5:38 PM, Andrea Connell wrote: > >> I'm trying to compile 3.5.9 on an HP-UX 11i v1 machine but I can't get >> past step one... >> >> I unpacked the amalgamation, cd'd to the directory, and ran >> './configure' - that didn't work so I tried 'sh ./configure' like the >> install

Re: [sqlite] configure syntax error on HP

2008-06-18 Thread D. Richard Hipp
On Jun 18, 2008, at 7:12 PM, Andrea Connell wrote: > I want to use the C API with a C++ class but when I try compiling... > > $ aCC -AA +W829 main.cpp sqlite3.c > main.cpp: > sqlite3.c: > Error 482: "sqlite3.c", line 532 # Array of unknown size; 'const char SQLite is written in C, not C++. You

Re: [sqlite] Getting a table size without counting

2008-06-18 Thread Stephen Woodbridge
Dennis Cote wrote: > Alexey Pechnikov wrote: >> I think, you can use index directly as >> create index id_idx on mytable(id); >> >> select count(id) from mytable where id>0; >> >> explain query plan select count(id) from mytable where id>0; >> 0|0|TABLE mytable WITH INDEX id_idx >> >> It's better

Re: [sqlite] Client/Srever SQLite

2008-06-18 Thread Simon Gornall
I wrote a simple client/server SQLite implementation a while ago - the tarball is at http://blog.gornall.net/assets/sqld.tar.bz2 though the network-connection to the server is a bit flaky at the moment... It's freeware, and comes with (C) server and (Objective C) client code. You'll need