Re: [sqlite] count(*)

2006-07-18 Thread Brannon King
I know that this list has been over the issues of using ROWID to get the count. Nevertheless, I was thinking, if you never do any deletes the last ROWID should contain the count. It's too bad you can't do an offset of negative one so that it would start at the back. That should be darn fast.

[sqlite] Re: Re: I need help making this code run faster

2006-07-18 Thread Igor Tandetnik
Brannon King wrote: Thanks, Igor, you've inspired and saved me yet again. The subqueries you had used for the x/yEnd did not work, but the rest did and I have that maxim information beforehand anyway. Here's how it shook down: select cast(cast((xStart+xEnd) as double)/2/15518.5 as integer)

RE: [sqlite] Re: I need help making this code run faster

2006-07-18 Thread Brannon King
Thanks, Igor, you've inspired and saved me yet again. The subqueries you had used for the x/yEnd did not work, but the rest did and I have that maxim information beforehand anyway. Here's how it shook down: select cast(cast((xStart+xEnd) as double)/2/15518.5 as integer) cellX,

[sqlite] Re: I need help making this code run faster

2006-07-18 Thread Igor Tandetnik
Brannon King wrote: I'm wondering if the following query can be done as a single query rather than running it in a (nested) loop. Suppose a database with five columns; xStart, yStart, xEnd, yEnd, score. I need the maximum score at the midpoint of the line quantized to a 64x64 grid. Psuedo

RE: [sqlite] I need help making this code run faster

2006-07-18 Thread Brannon King
I can see no difference in my time measurements in changing the "order by desc limit 1" to "max". > >I'm wondering if the following query can be done as a single query > >rather than running it in a (nested) loop. > > > >Suppose a database with five columns; xStart, yStart, xEnd, yEnd, >

[sqlite] I need help making this code run faster

2006-07-18 Thread Brannon King
I'm wondering if the following query can be done as a single query rather than running it in a (nested) loop. Suppose a database with five columns; xStart, yStart, xEnd, yEnd, score. I need the maximum score at the midpoint of the line quantized to a 64x64 grid. Psuedo code: query = prepare("

[sqlite] timer in shell.c part II

2006-07-18 Thread Brannon King
Thanks to Carl Clemens, I now have a working shell with a timer in it. I've posted the shell.c on the contrib page along with a Windows exe compiled using VC71. It is built on the latest shell.c version and should compile on Linux as well, though I have not tested that. (My Linux box is down

Re: [sqlite] how to flush database to disk?

2006-07-18 Thread Dennis Cote
[EMAIL PROTECTED] wrote: It seems unlikely. It wasn't a system crash; actually, I just killed my application process. Anything the app had written out to disk already, should have still been there after the restart. It's very disturbing -- I'm hearing that SQLite should automatically flush

Re: [sqlite] how to flush database to disk?

2006-07-18 Thread drh
[EMAIL PROTECTED] wrote: > > It's very disturbing -- I'm hearing that SQLite should automatically flush to > disk, and that what I observed shouldn't be possible. I'm relying on it to > keep my data safe (backups notwithstanding). Yet in practice, it really did > roll back two days' worth of

Re: [sqlite] how to flush database to disk?

2006-07-18 Thread joe
On Jul 18, 2006, at 16:40 UTC, Nuno Lucas wrote: > Any chance of being the OS file system that "rollbacked" the files > after the crash? It seems unlikely. It wasn't a system crash; actually, I just killed my application process. Anything the app had written out to disk already, should have

Re: [sqlite] how to flush database to disk?

2006-07-18 Thread Nuno Lucas
On 7/14/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I've just lost a couple of days' worth of data when my app crashed. (Well, the data wasn't a total loss thanks to backup plans, but the database itself essentially reverted to its state of 2 days ago.) This is despite my app doing a

Re: [sqlite] count(*)

2006-07-18 Thread Nemanja Corlija
On 7/18/06, Sripathi Raj <[EMAIL PROTECTED]> wrote: Hi Jay, I have a database whose size is around 250 MB. I have a table which has around 140,000 records. Doing a count(*) on that takes me 473 seconds. I believe it's not supposed to take that much time. SQLite does not keep count of rows in

Re: [sqlite] count(*)

2006-07-18 Thread Sripathi Raj
Never mind, it was a problem with the disk. On moving to a faster disk, the time taken dropped to 8 seconds which I guess is still slow. Raj On 7/18/06, Sripathi Raj <[EMAIL PROTECTED]> wrote: Hi Jay, I have a database whose size is around 250 MB. I have a table which has around 140,000