Re: [sqlite] Theoretical write performance for low-throughput devices

2019-10-22 Thread Rowan Worth
On Mon, 21 Oct 2019 at 23:28, Jonathan Brandmeyer wrote: > Or, how many times is each page written by SQLite for an insert-heavy > test? The answer appears to be "4", but I can only account for two of > those four. > > I'm working on an embedded system that uses a log-structured > filesystem on

Re: [sqlite] Theoretical write performance for low-throughput devices

2019-10-22 Thread Wout Mertens
On Mon, Oct 21, 2019 at 5:28 PM Jonathan Brandmeyer < jbrandme...@planetiq.com> wrote: > I'm working on an embedded system that uses a log-structured > filesystem on raw NAND flash. This is not your typical workstation's > managed flash (SATA/NVMe), or portable managed flash (SD/USB). It's a >

Re: [sqlite] Can SQLite do this in a single query?

2019-10-22 Thread Winfried
Yes, I forgot the column mode_id in the Employee's table. Thanks, I'll read up on the features SQLite's SELECT has to offer. At worst, I'll just run a simpler query multiple times. https://www.sqlite.org/lang_select.html -- Sent from: http://sqlite.1065341.n5.nabble.com/

Re: [sqlite] Can SQLite do this in a single query?

2019-10-22 Thread Petr Jakeš
> Yes, I forgot the column mode_id in the Employee's table. > > Thanks, I'll read up on the features SQLite's SELECT has to offer. At > worst, > I'll just run a simpler query multiple times. > Will the results of simple query multiple times help you somehow? Think about how to join two or more

Re: [sqlite] Can SQLite do this in a single query?

2019-10-22 Thread Keith Medcalf
CREATE TABLE employees(employee_id, city_id, mode_id); CREATE TABLE citys(city_id, city_txt); CREATE TABLE modes(mode_id, mode_txt); select city_txt, mode_txt, total(1) over (partition by city_txt, mode_txt) / total(1) over (partition by city_txt) as percentage from

Re: [sqlite] Can SQLite do this in a single query?

2019-10-22 Thread David Raymond
Or something like this using the new filter clause from 3.30. As written it should show it with two decimal points. (not tested for typos) select CITY_TXT as CITY, round(100.0 * total(Employee_Count) filter (where MODE_TXT = 'WALKING') / total(Employee_Count), 2) as WALKING, round(100.0 *

Re: [sqlite] Theoretical write performance for low-throughput devices

2019-10-22 Thread Jonathan Brandmeyer
On Tue, Oct 22, 2019 at 2:03 AM Wout Mertens wrote: > This probably won't change a thing, but I wonder why you wouldn't set the > sqlite page size to 2KB? Hopefully this means lots of aligned writes. At one point, the row blobs were exactly 1024 bytes. This isn't great for 4kB pages, but it is

Re: [sqlite] Can SQLite do this in a single query?

2019-10-22 Thread Keith Medcalf
This eliminates the duplicate denominator calculation: select city_txt, mode_txt, ( select total(1) from employees, citys, modes where employees.city_id == citys.city_id and employees.mode_id == modes.mode_id and

Re: [sqlite] Theoretical write performance for low-throughput devices

2019-10-22 Thread Jonathan Brandmeyer
On Mon, Oct 21, 2019 at 5:47 PM Richard Hipp wrote: > > On 10/21/19, Jonathan Brandmeyer wrote: > > > > No significant change. The target filesystem only caches non-aligned > > writes, so there usually isn't anything for it to do on fsync anyway. > > > > OK. I don't have any more ideas at the

Re: [sqlite] Can SQLite do this in a single query?

2019-10-22 Thread Keith Medcalf
Hmmm. That gives the wrong answers compared to doing it the "old fashioned way". You still have to "paint the fence" yourself, though now the table data is not sparse, thus easier to paint (since each value goes in the next cell, and you start a new row when the city_txt changes). You

Re: [sqlite] Theoretical write performance for low-throughput devices

2019-10-22 Thread Keith Medcalf
Ok, skip that. locking_mode=EXCLUSIVE (1) takes care of that. -- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users On >Behalf Of Keith Medcalf >Sent: Tuesday, 22 October, 2019

Re: [sqlite] Theoretical write performance for low-throughput devices

2019-10-22 Thread Keith Medcalf
>and only one thread accesses that connection at a time. The target >lacks mmap(), posix file locks, and multiple address spaces, so this >seemed like the right settings to use. So what happens to the shm file? Is in not normally just an ordinary file that is mmap'ped? What would be the

[sqlite] mailinglists.sqlite.org

2019-10-22 Thread nomad
I observe the following on the mailinglists.sqlite.org web server: 1. http requests are responded to normally instead of redirecting to https, which leaves users passwords exposed when modifying subscription options. 2. https requests are served up with a TLS certficate for

Re: [sqlite] Can SQLite do this in a single query?

2019-10-22 Thread Keith Medcalf
On Tuesday, 22 October, 2019 23:24, Doug wrote: >Please explain one phrase in the select: > total(1) over (partition by city_txt, mode_txt) >Is "total" a function and does "1" refer to city_txt? >I can't wrap my head around what's going on with this phrase. total() is a built-in aggregate

Re: [sqlite] Can SQLite do this in a single query?

2019-10-22 Thread Doug
Please explain one phrase in the select: total(1) over (partition by city_txt, mode_txt) Is "total" a function and does "1" refer to city_txt? I can't wrap my head around what's going on with this phrase. Doug > -Original Message- > From: sqlite-users > On Behalf Of Keith Medcalf >