Re: [sqlite] ORDER BY is more than 10 times slower with 3.3.8 compared to 3.3.7

2006-12-29 Thread drh
Michael Sizaki [EMAIL PROTECTED] wrote: What has changed in 3.3.8 to make it so slow? There were no changes to the query optimizer between 3.3.7 and 3.3.8. None. Nada. Zilch. -- D. Richard Hipp [EMAIL PROTECTED]

Re: [sqlite] sqlite performance, locking threading

2006-12-29 Thread Emerson Clarke
Im not sure that the current situation of forced thread incompatibility is better than leaving it up to users to manage the threading. Usually it is assumed that a library is thread unsafe unless otherwise specified. Developing multithreaded applications is difficult, i wouldnt dispute that.

Re: [sqlite] sqlite performance, locking threading

2006-12-29 Thread Emerson Clarke
In general worker threads is not an efficient solution to the problem even if parallelism is available. There is nothing to be gained by having one thread handing off A to another set of worker threads because you have to synchronise on whatever queue/list/pipe you use to transfer the

Re: [sqlite] sqlite performance, locking threading

2006-12-29 Thread Joe Wilson
--- Emerson Clarke [EMAIL PROTECTED] wrote: Developing multithreaded applications is difficult, i wouldnt dispute that. But i do dispute the wisdom of actively making a library incompatible with threads. Actively? That's a bit much. There are constraints on the ability to pass SQLite

[sqlite] coldfusion and sqlite

2006-12-29 Thread Kurt Cleeren
Does anyone know how I can connect to an sqlite db with coldfusion? I was trying to do that with ODBC but it doesn't work like I want it to work. Does anyone have another id? Greetz Kurt

[sqlite] LEMON

2006-12-29 Thread Cesar Rodas
Where can i find a tutorial with examples of how to use LEMON parser... because i need to build interpreted language Thanks to all -- Cesar Rodas http://www.phpclasses.org/grank (A PHP implementation of PageRank)

Re: [sqlite] LEMON

2006-12-29 Thread Lloyd
Ethereal make use of Lemon On Fri, 2006-12-29 at 11:08 -0400, Cesar Rodas wrote: Where can i find a tutorial with examples of how to use LEMON parser... because i need to build interpreted language Thanks to all __ Scanned and protected by Email scanner

Re: [sqlite] ORDER BY is more than 10 times slower with 3.3.8 compared to 3.3.7

2006-12-29 Thread Michael Sizaki
== SUMMARY == == There is indeed no difference between 3.3.7 and 3.3.8 == However, sqlite hits the disk a lot in a temp file??!! == PRAGMA temp_store = MEMORY; helps == Why is sqlite hitting the disk with a 70MB database? Further tests shows that there is no difference between 3.3.7 and 3.3.8.

Re: [sqlite] sqlite performance, locking threading

2006-12-29 Thread drh
Emerson Clarke [EMAIL PROTECTED] wrote: Im not sure that the current situation of forced thread incompatibility is better than leaving it up to users to manage the threading. Usually it is assumed that a library is thread unsafe unless otherwise specified. Developing multithreaded

Re: [sqlite] ORDER BY is more than 10 times slower with 3.3.8 compared to 3.3.7

2006-12-29 Thread Michael Sizaki
Here's the screenshot showing the resource usage of the slow query: time ./sqlite3.3.8.exe db.sqlite SELECT * FROM files where id 20 ORDER BY size, name;|wc 19 204598 24676875 real4m49.947s user0m18.386s sys 0m13.318s Peak memory 35 MB

Re: [sqlite] ORDER BY is more than 10 times slower with 3.3.8 compared to 3.3.7

2006-12-29 Thread drh
Michael Sizaki [EMAIL PROTECTED] wrote: What surprises me, is that the temp file is not kept in cache. I have 2GB of memory and much bigger files can be kept in cache. Why is sqlite hitting the disk? What is going on here? The maximum file cache needed would be 70 MB for the database + 75

Re: [sqlite] Re: multiple selects in a single prepare

2006-12-29 Thread chetana bhargav
Actually I am trying to retrieve values in a single step. My queries need to be something like, select count(*) from tbl1 where state='Normal';select count(*) from tbl1 where state='Critical' I got to have these two as seperate, because if there's any critical need to display a diff icon, and

Re: [sqlite] LEMON

2006-12-29 Thread Cesar Rodas
Another URL where i can find a tutorial? On 29/12/06, Lloyd [EMAIL PROTECTED] wrote: Ethereal make use of Lemon On Fri, 2006-12-29 at 11:08 -0400, Cesar Rodas wrote: Where can i find a tutorial with examples of how to use LEMON parser... because i need to build interpreted language Thanks

[sqlite] Re: ORDER BY is more than 10 times slower with 3.3.8 compared to 3.3.7

2006-12-29 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: Are there some special flags that SQLite could pass to CreateFileW() to trick windows into doing a better job of caching temp files? FILE_ATTRIBUTE_TEMPORARY A file is being used for temporary storage. File systems avoid writing data back to mass storage if sufficient

[sqlite] Re: Re: multiple selects in a single prepare

2006-12-29 Thread Igor Tandetnik
chetana bhargav bhargav_chetana-/[EMAIL PROTECTED] wrote: Actually I am trying to retrieve values in a single step. My queries need to be something like, select count(*) from tbl1 where state='Normal';select count(*) from tbl1 where state='Critical' Why not select state, count(*) where

Re: [sqlite] multiple selects in a single prepare

2006-12-29 Thread drh
chetana bhargav [EMAIL PROTECTED] wrote: Actually I am trying to retrieve values in a single step. My queries need to be something like, select count(*) from tbl1 where state='Normal'; select count(*) from tbl1 where state='Critical' I got to have these two as seperate, because if

RE: [sqlite] LEMON

2006-12-29 Thread Downey, Shawn
http://www.hwaci.com/sw/lemon/lemon.html Sorry if this link has already been pointed out to you. http://www.webdotdev.com/nvd/server-side/c/lemon-parser-generator-tutori al.html Looks OK but I have not looked at this site before. Shawn M. Downey MPR Associates 10 Maxwell Drive, Suite 204

Re: [sqlite] LEMON

2006-12-29 Thread epankoke
I'm not familiar with Lemon, so I don't know if this will help: http://linuxgazette.net/106/chirico.html. Also, I'd highly recommend just doing a Google search for either Lemon Parser or Lemon Tutorial. -- Eric Pankoke Founder / Lead Developer Point Of Light Software

Re: [sqlite] ORDER BY is more than 10 times slower with 3.3.8 compared to 3.3.7

2006-12-29 Thread drh
Igor Tandetnik [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Are there some special flags that SQLite could pass to CreateFileW() to trick windows into doing a better job of caching temp files? FILE_ATTRIBUTE_TEMPORARY A file is being used for temporary storage. File systems avoid

[sqlite] Re: multiple selects in a single prepare

2006-12-29 Thread A. Pagaltzis
* chetana bhargav [EMAIL PROTECTED] [2006-12-29 17:20]: Actually I am trying to retrieve values in a single step. My queries need to be something like, select count(*) from tbl1 where state='Normal';select count(*) from tbl1 where state='Critical' I got to have these two as seperate,

Re: [sqlite] ORDER BY is more than 10 times slower with 3.3.8 compared to 3.3.7

2006-12-29 Thread Michael Sizaki
[EMAIL PROTECTED] wrote: Perhaps someone with more windows experience can correct me if my assertion above is incorrect. Are there some special flags that SQLite could pass to CreateFileW() to trick windows into doing a better job of caching temp files? It seems you've done it right:

Re: [sqlite] LEMON

2006-12-29 Thread Cesar Rodas
Lemon generates C files that could be compiled in Win or Linux Right? On 29/12/06, Downey, Shawn [EMAIL PROTECTED] wrote: http://www.hwaci.com/sw/lemon/lemon.html Sorry if this link has already been pointed out to you. http://www.webdotdev.com/nvd/server-side/c/lemon-parser-generator-tutori

[sqlite] Re: multiple selects in a single prepare

2006-12-29 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: SELECT count(state='Normal'), count(state='Critical') FROM tbl1; Wouldn't that just return the number of all rows in tbl1, twice? That probably should be SELECT sum(state='Normal'), sum(state='Critical') FROM tbl1; Igor Tandetnik

[sqlite] Re: multiple selects in a single prepare

2006-12-29 Thread A. Pagaltzis
* Igor Tandetnik [EMAIL PROTECTED] [2006-12-29 17:35]: Why not select state, count(*) where state in ('Normal', 'Critical') group by state; ? Clever! * [EMAIL PROTECTED] [EMAIL PROTECTED] [2006-12-29 17:40]: SELECT count(state='Normal'), count(state='Critical') FROM tbl1; How exactly

Re: [sqlite] sqlite performance, locking threadin

2006-12-29 Thread Ken
Emerson, You just need to lock the entire transaction using a mutex before hand. That means each thread will have its own sqlite cache. Reread the sqlite locking and concurrency guide, you'll see that SQLITE is NOT a transaction based system such as Postgress/mysql/ oracle. It locks

Re: [sqlite] sqlite performance, locking threadin

2006-12-29 Thread Emerson Clarke
Joe, Im interested to know what those constraints are and why ? The only reason i mentioned shared memory is because it provides a platform and filesystem agnostic way of handling ipc. Obvioulsy i dont know the ins and outs of the locking process, but i just thought it would make sense to have

Re: [sqlite] ORDER BY is more than 10 times slower with 3.3.8 compared to 3.3.7

2006-12-29 Thread Michael Sizaki
I went to implement this suggestion and quickly discovered that SQLite already uses the FILE_ATTRIBUTE_TEMPORARY flag on TEMP tables. Or at least I think it does. Can somebody with a symbolic debugger that runs on windows please confirm that the marked line of code in below (found in os_win.c)

Re: [sqlite] sqlite performance, locking threading

2006-12-29 Thread Joe Wilson
--- [EMAIL PROTECTED] wrote: On some older versions of Linux, SQLite is unable to pass database connections from one thread to another. But this is a problem with the threading libraries used in those older linux versions and is outside the control of SQLite. I do not think this issue comes

[sqlite] Creating a database from inside a program

2006-12-29 Thread Rob Richardson
Greetings! I need to be able to create a database with a known schema from inside a program. I used sqlite3.exe's .schema command to export the SQL needed to create the schema for my new database. I can create the database by the following steps: C:\: sqlite3 newdatabase.db Sqlite3

RE: [sqlite] LEMON

2006-12-29 Thread Downey, Shawn
yes Shawn M. Downey MPR Associates 10 Maxwell Drive, Suite 204 Clifton Park, New York 12065 518-371-3983 x113 (work) 860-508-5015 (cell) -Original Message- From: Cesar Rodas [mailto:[EMAIL PROTECTED] Sent: Friday, December 29, 2006 11:47 AM To: sqlite-users@sqlite.org Subject: Re:

Re: [sqlite] sqlite performance, locking threadin

2006-12-29 Thread Joe Wilson
My last message cites some of the peculiarities of POSIX fcntl() locking. Search the SQLite mailing list archives for more detailed info as it pertains to SQLite. As for having a single unified (locking) model - SQLite already employs such a strategy as best as is possible given the portable

Re: [sqlite] sqlite performance, locking threading

2006-12-29 Thread Emerson Clarke
Richard, First let me say thank you for your earilier suggestion regarding the compile time options and overlaoding of the os routines. It was exactly the kind of information i was searching to for and i am looking into using that strategy at the moment. Sorry if ive managed to offend you,

Re: [sqlite] sqlite performance, locking threading

2006-12-29 Thread Joe Wilson
This old mailing list thread better describes this proposed algorithm to contain all open/close/lock/unlock activity in a single work thread: http://www.mail-archive.com/sqlite-users@sqlite.org/msg15852.html --- Joe Wilson [EMAIL PROTECTED] wrote: As you already know, it's not just Linux -

Re: [sqlite] sqlite performance, locking threadi

2006-12-29 Thread Emerson Clarke
Ken, Thanks. Ok, i think i did miss the point with your test case. I assumed that it was always possible to perform multiple select, insert, delete, and update statements within a single transaction anyway. Which i guess relates to you last point. I dont see why if i have a single global

Re: [sqlite] Creating a database from inside a program

2006-12-29 Thread Clay Dowling
Open the database as per normal with sqlite3_open(). Then issue the SQL commands necessary to create your schema. I have a nice little utility I wrote which will take an SQLite schema dump and convert it to an array of C strings that you can issue in sequence (and thanks to Microsoft for the

Re: [sqlite] sqlite performance, locking threadi

2006-12-29 Thread Emerson Clarke
OK, thanks Joe. I will look up those peculiarities as you suggested, im interested in understanding what they are. I agree with you, DRH has done a great job. Sqlite is a fantastic piece of software and and outstanding example of the way open source should be. It is small, efficient and

Re: [sqlite] sqlite performance, locking threadi

2006-12-29 Thread Ken
The test server.c code is an example that has a single thread that performs the DB interactions each client thread, communicates via a queue interface. Each client will get serialized into the DBserver thread and get its work done. Thus eliminating any lower level locking and mutexing inside

Re: [sqlite] sqlite performance, locking thread

2006-12-29 Thread Emerson Clarke
Ken, Yes you cannot have multiple threads within the same transaction, and you cannot pass a connection between threads. I think we have an undestanding about the performance situation, and we are getting to the real heart of the issue, which why it is not possible to have a single transaction,

[sqlite] Re: Creating a database from inside a program

2006-12-29 Thread Igor Tandetnik
Clay Dowling clay-diPsFfokYAT2eFz/[EMAIL PROTECTED] wrote: Open the database as per normal with sqlite3_open(). Then issue the SQL commands necessary to create your schema. I have a nice little utility I wrote which will take an SQLite schema dump and convert it to an array of C strings that

[sqlite] Re: [updated] detect afs, --enable-locking-style, non-darwin fs detection

2006-12-29 Thread Adam Megacz
For the record, The author or authors of this code dedicate any and all copyright interest in this code to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of

Re: [sqlite] multiple selects in a single prepare

2006-12-29 Thread drh
Igor Tandetnik [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: SELECT count(state='Normal'), count(state='Critical') FROM tbl1; Wouldn't that just return the number of all rows in tbl1, twice? That probably should be SELECT sum(state='Normal'), sum(state='Critical') FROM tbl1; Yes,

Re: [sqlite] detect afs, --enable-locking-style, non-darwin fs detection

2006-12-29 Thread David Crawshaw
On 24/12/06, Adam Megacz [EMAIL PROTECTED] wrote: AFS (the Andrew FileSystem) supports whole-file locks but not byte-range locks. Unfortunately, it has a problematic feature whereby it will claim to grant requests for byte-range locks, but not actually perform any locking activity. This

Re: [sqlite] Creating a database from inside a program

2006-12-29 Thread Kees Nuyt
On Fri, 29 Dec 2006 12:33:46 -0500, you wrote: Sqlite3 newdatabase.db .read schemafile.txt But, when I issue this command from the DOS prompt, it gives me an error message saying that there is no command named read. Try input redirection: Sqlite3 newdatabase.db schemafile.txt If your

[sqlite] pragma read_uncommitted and threading

2006-12-29 Thread Ken
Hi all, I have a piece of code that utilizes test_server.c, (master thread) there are 3 threads, each performing seperate tasks, that get a conection (shared) and set PRAGMA read_uncommitted=1. My understanding is that this would allow each individual thread to

Re: [sqlite] sqlite performance, locking thread

2006-12-29 Thread Ken
Emereson, And you can't do this with oracle either, That is create a connection and pass it around between multiple threads.. Oracle would be very very unhappy if you did that. Oracle utilizes a context variable to distinguish between threads and utilizes precompiler flags to enable thread

Re: [sqlite] Creating a database from inside a program

2006-12-29 Thread Ken
I have a nice solution that really works well, at least from C... 1. Create a template Database. (using whatever method you like, either embedded in your code or via sqlite3). 2. Copy the database to a new file, using plane old cp, copy, or if you like an in code copy using open,

Re: [sqlite] pragma read_uncommitted and threading

2006-12-29 Thread drh
Ken [EMAIL PROTECTED] wrote: My thought was that if i wanted to perform selects concurrently on SMP system I would need 2 threads and each thread would be able to read concurrently I just don't see how this [test_server.c] improves concurrency... It improves write concurrancy.

[sqlite] Joining tables in a single file

2006-12-29 Thread Alberto Simões
Hi I am using SQLite to store ngrams from texts (bigrams, trigrams and tetragrams). This is not really important for the question; just imagine I have three tables A (int,int), B (int, int, int) and C (int, int, int, int). As the table keys are full rows and the tables get big, it is not quite

RE: [sqlite] Joining tables in a single file

2006-12-29 Thread Griggs, Donald
Regarding: I need something like: cat A.db B.db C.db full.db # kidding - Hi Alberto, My first inclination is to consider this a classic use of the ATTACH DATABASE command http://www.sqlite.org/lang_attach.html

Re: [sqlite] Joining tables in a single file

2006-12-29 Thread Alberto Simões
On 12/29/06, Griggs, Donald [EMAIL PROTECTED] wrote: Regarding: I need something like: cat A.db B.db C.db full.db # kidding - Hi Alberto, My first inclination is to consider this a classic use of the ATTACH DATABASE

Re: [sqlite] pragma read_uncommitted and threading

2006-12-29 Thread Ken
I ran everything through the test_server server and get the following results when using read_uncommitted=1 rc=[5] msg=[database is locked] when performing a client_step against a prepared select statement. I'd really like to track this down and find out if my code

Re: [sqlite] Joining tables in a single file

2006-12-29 Thread Ken
I think the attach is the way to go, but no need to insert, just select from the attached databases. sqlite3 master.db (master is empty). attach a.db A attach b.db B attach c.db C Then : select columns from a.A, b.b, c.c where Alberto Simões [EMAIL

Re: [sqlite] pragma read_uncommitted and threading

2006-12-29 Thread Ken
I found part of the issue, in switching servers around the test version did not enable the shared cache... My fault.. however I still recieved a RC 5 on a different write operation. Modifed the test_server code to repost the step and all was well. A better solution however is to cause the

Re: [sqlite] ORDER BY is more than 10 times slower with 3.3.8 compared to 3.3.7

2006-12-29 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Sizaki wrote: | I'm really puzzled why my system hits the disk so heavily Windows XP limits the maximum size of the cache (default 10MB!). There are zillions of pseudo-freeware programs out there to change it. You can also change it

[sqlite] Using sqlite.exe

2006-12-29 Thread Michael Hooker
I'm a fairly competent but amateur Delphi programmer and I can construct all the SQL statements I need. But I'm having enormous trouble making sqlite.exe work. Can some kind person please tell me exactly what, right down to the last dot and semi-colon, I should type in at the sqlite prompt to

Re: [sqlite] sqlite performance, locking threading

2006-12-29 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 You never answered the bit about whether indexing A can be done at the same time as B. (I get the feeling you have a certain design in mind and insist that SQLite changes to meet that design, rather than change your own design around the constraints

Re: [sqlite] Using sqlite.exe

2006-12-29 Thread P Kishor
On 12/29/06, Michael Hooker [EMAIL PROTECTED] wrote: I'm a fairly competent but amateur Delphi programmer and I can construct all the SQL statements I need. But I'm having enormous trouble making sqlite.exe work. Can some kind person please tell me exactly what, right down to the last dot and

Re: [sqlite] sqlite performance, locking threading

2006-12-29 Thread Emerson Clarke
Roger, I have deliberately tried to avoid giving too much detail on the architecture of the index since that was not the point and i didnt want to end up debating it. The design of the index is not the issue, suffice to say that i think you are over complicating things. It is a desceptively