[sqlite] Database growing while updating rows

2008-01-17 Thread Jean Collonville
Hello, I have an issue with my database (sqlite 3.4.2), runing some updates makes it use more filespace than needed. I am using this kind of schema : CREATE TABLE mytable (myKey TEXT PRIMARY KEY, myInt INTEGER, myBlob TEXT) 1st : Inserting a row Let's say that myBlob data is 256K.

Re: [sqlite] Can't understand out of memory error

2008-01-17 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nemanja Čorlija wrote: My problem is that I am running out of memory when trying to load 1.6GB sqlite3 db from disk to :memmory: db on a computer with 4GB of RAM. Your RAM isn't the problem. You are running out of address space. For a 32 bit

[sqlite] SQLite character comparisons

2008-01-17 Thread Fowler, Jeff
Hello All, I've used SQL Server for over 15 years, Oracle off on when I have no choice, but SQLite for a couple weeks. I've just learned (today) that SQLite respects trailing spaces when comparing two character fields. I.e. 'SQLITE' 'SQLITE ' Is this behavior intentional? Neither SQL Server

Re: [sqlite] Date arithmetic question

2008-01-17 Thread drh
Fowler, Jeff [EMAIL PROTECTED] wrote: Yes - I've looked over the current date functions. I would propose a single function addition that's hugely valuable in the business world. SQL Server has a function called datediff for date arithmetic. It accepts three parameters. The first indicates the

Re: [sqlite] Date arithmetic question

2008-01-17 Thread drh
Fowler, Jeff [EMAIL PROTECTED] wrote: Hello All, SQLite newbie here. I've looked through the email archives and website trying to find out how to compute the difference in months between two given dates. Each date is in -MM-DD HH:MM:SS format. The best I've been able to come up with

RE: [sqlite] Date arithmetic question

2008-01-17 Thread Fowler, Jeff
Yes - I've looked over the current date functions. I would propose a single function addition that's hugely valuable in the business world. SQL Server has a function called datediff for date arithmetic. It accepts three parameters. The first indicates the unit of scale (years, months, weeks, days,

Re: [sqlite] Date arithmetic question

2008-01-17 Thread Virgilio Fornazin
DATEDIFF should compute the difference by arithmetic subtracting M/Y in month case, if I'm not wrong ex: DateDiff (month, 1-1-2007, 3-30-2007) will return 2 Its that right ? A good reference for trying implementing it should be: http://www.sqlteam.com/article/datediff-function-demystified

RE: [sqlite] Date arithmetic question

2008-01-17 Thread Fowler, Jeff
You're right of course - I just noticed the question pertains to the algorithm, not the function itself. Sorry! I just ran a simple test using popular RDBMS product A on one of our internal databases, as follows: select 'year difference:', datediff(yy,'12/31/2007','1/1/2008') -- year difference:

Re: [sqlite] Date arithmetic question

2008-01-17 Thread Scott Baker
Fowler, Jeff wrote: Yes - I've looked over the current date functions. I would propose a single function addition that's hugely valuable in the business world. SQL Server has a function called datediff for date arithmetic. It accepts three parameters. The first indicates the unit of scale

RE: [sqlite] Date arithmetic question

2008-01-17 Thread Noah Hart
Not really that goofy, just very specific. The SQL Server manual describes it this way: Returns the number of date and time boundaries crossed between two specified dates. Regards, Noah Hart -Original Message- So datediff('month', '2008-02-01 23:59:59','2008-01-31 00:00:00') should

Re: [sqlite] Date arithmetic question

2008-01-17 Thread Markus Hoenicka
[EMAIL PROTECTED] writes: So datediff('month', '2008-02-01 23:59:59','2008-01-31 00:00:00') should return 1 even though the difference is really only 1 second? Seems goofy to me well, this is one second rounded up to the next full month...If that is the kind of information you want

Re: [sqlite] Date arithmetic question

2008-01-17 Thread drh
Fowler, Jeff [EMAIL PROTECTED] wrote: Remember gang, if you want to know how many seconds are between two timestamps, you wouldn't ask for a difference in months. You'd say something like DATEDIFF(seconds, t1, t2). So DATEDIFF doesn't really compute the difference between two dates. It

RE: [sqlite] Date arithmetic question

2008-01-17 Thread Fowler, Jeff
Remember gang, if you want to know how many seconds are between two timestamps, you wouldn't ask for a difference in months. You'd say something like DATEDIFF(seconds, t1, t2). - Jeff -Original Message- From: Markus Hoenicka [mailto:[EMAIL PROTECTED] Sent: Thursday, January 17, 2008

Re: [sqlite] Date arithmetic question

2008-01-17 Thread drh
Virgilio Fornazin [EMAIL PROTECTED] wrote: DATEDIFF should compute the difference by arithmetic subtracting M/Y in month case, if I'm not wrong ex: DateDiff (month, 1-1-2007, 3-30-2007) will return 2 Its that right ? So datediff('month', '2008-02-01 23:59:59','2008-01-31 00:00:00')

[sqlite] sqlite3 performace

2008-01-17 Thread Philip Nick
Greetings, Currently I am using sqlite3 in a multi-process/multi-threaded server setting. I use a Mutex to ensure only one process/thread can access the database at one time. The current flow of events: Get Mutex Open Database connection Run Query Close Database connection Release Mutex This

Re: [sqlite] sqlite3 performace

2008-01-17 Thread drh
Philip Nick [EMAIL PROTECTED] wrote: Greetings, Currently I am using sqlite3 in a multi-process/multi-threaded server setting. I use a Mutex to ensure only one process/thread can access the database at one time. The current flow of events: Get Mutex Open Database connection Run Query

Re: [sqlite] Date arithmetic question

2008-01-17 Thread P Kishor
On 1/17/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Fowler, Jeff [EMAIL PROTECTED] wrote: Remember gang, if you want to know how many seconds are between two timestamps, you wouldn't ask for a difference in months. You'd say something like DATEDIFF(seconds, t1, t2). So DATEDIFF

RE: [sqlite] SQLite character comparisons

2008-01-17 Thread Fowler, Jeff
By the way.. I found this snippet. If I read it right, it seems that IGNORING trailing spaces during string comparisons is ANSI standard. SQL Server follows the ANSI/ISO SQL-92 specification (Section 8.2, Comparison Predicate, General rules #3) on how to compare strings with spaces. The ANSI

Re: [sqlite] SQLite character comparisons

2008-01-17 Thread Zbigniew Baniewski
On Thu, Jan 17, 2008 at 10:43:20AM -0500, Fowler, Jeff wrote: I've used SQL Server for over 15 years, Oracle off on when I have no choice, but SQLite for a couple weeks. I've just learned (today) that SQLite respects trailing spaces when comparing two character fields. I.e. 'SQLITE' 'SQLITE

Re: [sqlite] SQLite character comparisons

2008-01-17 Thread Zbigniew Baniewski
On Thu, Jan 17, 2008 at 05:25:30PM -0500, Fowler, Jeff wrote: By the way.. I found this snippet. If I read it right, it seems that IGNORING trailing spaces during string comparisons is ANSI standard. I'm not sure. I was always avoiding such problem by trim-ming everything to be inserted;

Re: [sqlite] sqlite3 performace

2008-01-17 Thread Philip Nick
Thanks for replying, I have tried moving the Open/Close outside the mutex no change. As for using our own mutex, we started with early versions of sqlite and had to come up with our own solution. I was planning on looking into using the built in mutex's, but first I need to solve the performance

RE: [sqlite] sqlite3 performace

2008-01-17 Thread James Dennett
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Philip Nick Sent: Thursday, January 17, 2008 1:48 PM To: sqlite-users@sqlite.org Subject: [sqlite] sqlite3 performace Greetings, Currently I am using sqlite3 in a multi-process/multi-threaded

Re: [sqlite] sqlite3 performace

2008-01-17 Thread John Stanton
Areyou doing an sqlite3_finalize and checking to see that you actually close the DB? Philip Nick wrote: Thanks for replying, I have tried moving the Open/Close outside the mutex no change. As for using our own mutex, we started with early versions of sqlite and had to come up with our own

Re: [sqlite] Date arithmetic question

2008-01-17 Thread Gerry Snyder
[EMAIL PROTECTED] wrote: So datediff('month', '2008-02-01 23:59:59','2008-01-31 00:00:00') should return 1 even though the difference is really only 1 second? Seems goofy to me I have been staring at this until I'm getting goofy. Written as it is, isn't the time interval 1 second

Re: [sqlite] Date arithmetic question

2008-01-17 Thread drh
Gerry Snyder [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: So datediff('month', '2008-02-01 23:59:59','2008-01-31 00:00:00') should return 1 even though the difference is really only 1 second? Seems goofy to me I have been staring at this until I'm getting goofy.

[sqlite] Variable substitution (TCL SQLite)

2008-01-17 Thread Zbigniew Baniewski
I'm choosing desired column names dynamically, then store all the names in one variable, something like this... set columns column1, column2, column3 The names are chosen in much more complicated way, but the above is just a variable contents example. I'm trying then to fetch the data like

Re: [sqlite] Can't understand out of memory error

2008-01-17 Thread Nemanja Čorlija
On Jan 17, 2008 12:00 PM, Roger Binns [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nemanja Čorlija wrote: My problem is that I am running out of memory when trying to load 1.6GB sqlite3 db from disk to :memmory: db on a computer with 4GB of RAM. Your RAM isn't

Re: [sqlite] Variable substitution (TCL SQLite)

2008-01-17 Thread D. Richard Hipp
On Jan 17, 2008, at 10:23 PM, Zbigniew Baniewski wrote: I'm choosing desired column names dynamically, then store all the names in one variable, something like this... set columns column1, column2, column3 The names are chosen in much more complicated way, but the above is just a

RE: [sqlite] Date arithmetic question

2008-01-17 Thread Fowler, Jeff
Guys, I guess I'm the newest SQLite person on this email list and I know I'm definitely the dumbest. It seems like a lot of you are trying to justify why two dates that are one minute apart can have a function say they're one month apart. Don't look at it that way. Back when mainframes and

Re: [sqlite] Can't understand out of memory error

2008-01-17 Thread John Stanton
Nemanja Čorlija wrote: On Jan 17, 2008 12:00 PM, Roger Binns [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nemanja Čorlija wrote: My problem is that I am running out of memory when trying to load 1.6GB sqlite3 db from disk to :memmory: db on a computer with 4GB of