Re: [sqlite] Schema updates across threads in WAL & multithread mode

2019-10-18 Thread Ben Asher
Hi D. Richard Hipp. Sorry for the late reply. I had some email settings wrong somewhere, and I didn't realize I had a reply until I remembered this and checked the archives months later. You had written: >> >> Is there something we need to do proactively to ensure that schema update >> appears

Re: [sqlite] Schema updates across threads in WAL & multithread mode

2019-10-18 Thread Ben Asher
Hi Simon. Sorry for the late reply. I had some email settings wrong somewhere, and I didn't realize I had a reply until I remembered this and checked the archives months later. You had written: >Can I ask the maximum number of columns you expect to exist in that table ? I'm working up to trying

Re: [sqlite] Schema updates across threads in WAL & multithread mode

2019-10-18 Thread Ben Asher
Hi José. Sorry for the late reply. I had some email settings wrong somewhere, and I didn't realize I had a reply until I remembered this and checked the archives months later. You had asked: > Are you using BEGIN and END before and after the schema update? Yes that's correct. We are doing the

Re: [sqlite] Count Rows Inserted into FTS5 Index w/ External Content Table

2019-10-18 Thread Ben Asher
I should have included this in the first place. Here are the queries used to setup this table and an example: CREATE TABLE text (text TEXT NONNULL); CREATE VIRTUAL TABLE text_fts_index USING fts5(text, content=text, content_rowid=rowid, prefix='2 3 4 5 6 7 8 9 10', tokenize='unicode61'); INSERT

[sqlite] Count Rows Inserted into FTS5 Index w/ External Content Table

2019-10-18 Thread Ben Asher
Hello! I'm trying to write some code to keep an external content table in sync with the index. To do this, I need to be able to get some state about the index: either how many rows have been inserted so far or the max rowid that has been inserted into the index. However, if I try to run queries

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Keith Medcalf
Note that you might need to change the 2.22044604925031e-16 constant to 2 ULPs (4.44089209850063e-16) in order to get around some pathological rounding cases. It probably will not be noticeable faster since you are only saving a few machine cycles per iteration. It might be noticeable unless

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Bart Smissaert
> However, to optimize the calculation the following is more efficient I tested it, but didn't find it any faster. Naming makes it a lot clearer though. RBS On Fri, Oct 18, 2019 at 10:56 PM Keith Medcalf wrote: > > We are calculating the square root using Newtons Method of successive >

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Bart Smissaert
Thanks, I did see that, but can't use this on Android. RBS On Fri, Oct 18, 2019 at 11:41 PM Gabor Grothendieck wrote: > There is a stdev function for sqlite here: > https://www.sqlite.org/contrib//download/extension-functions.c?get=25 > > On Wed, Oct 16, 2019 at 7:57 PM Olaf Schmidt wrote: >

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Gabor Grothendieck
There is a stdev function for sqlite here: https://www.sqlite.org/contrib//download/extension-functions.c?get=25 On Wed, Oct 16, 2019 at 7:57 PM Olaf Schmidt wrote: > > Am 12.10.2019 um 16:47 schrieb Bart Smissaert: > > Sorry, I forgot to tell that. It is date column with an integer number. > >

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Bart Smissaert
> and calling that calculation yi (the AS keyword is omitted). Ah, indeed, simple! Thanks for that explanation. Will study this and try it out. RBS On Fri, Oct 18, 2019 at 10:56 PM Keith Medcalf wrote: > > We are calculating the square root using Newtons Method of successive > approximation

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Keith Medcalf
We are calculating the square root using Newtons Method of successive approximation https://pages.mtu.edu/~shene/COURSES/cs201/NOTES/chap04/sqrt.html (x>0)*(y+x/y)/2 yi is computing the new guess of the square root of x based on the last guess y and calling that calculation yi (the AS

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Bart Smissaert
Hi Olaf, Could you tell me what this is doing: ,(x>0)*(y+x/y)/2 yi Especially the yi after the 2 How does the yi relate to the preceding bit? RBS On Fri, Oct 18, 2019 at 8:26 PM Olaf Schmidt wrote: > Am 18.10.2019 um 19:45 schrieb Bart Smissaert: > > > Regarding: > > > > With r(s2, s, i)

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Bart Smissaert
Have tested this and CTE pure SQL method is a lot faster (about 4 x) than my previous method in code: strSQL = "SELECT ID, SD_BP FROM QR3PARAMS" RS1 = cConn.SQL1.ExecQuery(strSQL) strSQL = "UPDATE QR3PARAMS SET SD_BP = ? WHERE ID = ?" cConn.BeginTransaction Do While RS1.NextRow

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Bart Smissaert
Hi Olaf, OK, thanks, that works fine indeed. > Well, as with any other (single-value-returning) Sub-Select It is just that saw SQL's where the update part came after the CTE, eg:

Re: [sqlite] Excel Pivot Table

2019-10-18 Thread Alek Paunov
Forgot to mention the most important feature of spreadsheet datasources: Once you linked your e.g. pivot to a datasource, you always can refresh it (usually Ritgh Click/Refresh), after a DB data change. Kind Regards, Alek ___ sqlite-users mailing list

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Olaf Schmidt
Am 18.10.2019 um 19:45 schrieb Bart Smissaert: Regarding: With r(s2, s, i) As (Select 2, 1, 1 Union All Select s2, (s2>0)*(s+s2/s)*.5, i+1 From r Where Abs(s2-s*s)>1e-12 Limit 32 ) Select s From r Order By i Desc Limit 1 How would this work if I wanted to update all the values in a table

Re: [sqlite] Excel Pivot Table

2019-10-18 Thread Alek Paunov
Hi Dennis, On 2019-10-17 02:11, Harris, Dennis wrote: I sure this has been asked a 100 times but what is the best practice to get data from SQLITE to Excel? I would like to have a pivot table that updates upon open. Excel and it's leading open source alternative - LibreOffice Calc, both

Re: [sqlite] Standard deviation last x entries

2019-10-18 Thread Bart Smissaert
Hi Olaf, Regarding: With r(s2, s, i) As (Select 2, 1, 1 Union All Select s2, (s2>0)*(s+s2/s)*.5, i+1 From r Where Abs(s2-s*s)>1e-12 Limit 32 ) Select s From r Order By i Desc Limit 1 How would this work if I wanted to update all the values in a table column to have the square root? RBS On

Re: [sqlite] [EXTERNAL] Re: Limit on number of columns in SQLite table

2019-10-18 Thread Hick Gunter
If you should happen to have the need for storing columns that each have only a small set of possible values, maybe you would be better off looking into FastBit, which has coulmn-oriented storage -Ursprüngliche Nachricht- Von: sqlite-users

Re: [sqlite] [EXTERNAL] Re: Limit on number of columns in SQLite table

2019-10-18 Thread Hick Gunter
If you need to perform queries over the 100k rows, then normalization is the only practical way and reconstructing a row will similarly slow. But you have stated that you use case is "retrieving complete rows". In this case, SQLite does not need to know the 100k details of the row. Keep your