Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-20 Thread Keith Medcalf
-users- >boun...@mailinglists.sqlite.org] On Behalf Of x >Sent: Saturday, 20 January, 2018 11:12 >To: SQLite mailing list >Subject: Re: [sqlite] [EXTERNAL] get stmt row count > >Thanks very much for that explanation Keith. Why ROLLBACK rather than >END though? > > > >

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-20 Thread x
Lite mailing list Subject: Re: [sqlite] [EXTERNAL] get stmt row count Clemens is correct, the best way is to keep the transaction open (perhaps if necessary dedicate a connection to this data). In WAL the open transaction will continue to see the "same data snapshot" independent of o

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-20 Thread Keith Medcalf
lite-users- >boun...@mailinglists.sqlite.org] On Behalf Of x >Sent: Saturday, 20 January, 2018 02:42 >To: SQLite mailing list >Subject: Re: [sqlite] [EXTERNAL] get stmt row count > >>Getting both requires TWO queries (and may not be the same from one >nanosecond to the next). &g

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-20 Thread x
Thanks Clemens. From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> on behalf of Clemens Ladisch <clem...@ladisch.de> Sent: Saturday, January 20, 2018 10:39:15 AM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] [EXTERN

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-20 Thread Clemens Ladisch
x wrote: > is there an easy way of checking if the db file has been modified > since the RowIDs query has been run? The easiest way is to keep the transaction open, then you know that there have not been any modifications, as far as you can see. :o) > I’m sure I read something about a db

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-20 Thread x
e post. From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> on behalf of Keith Medcalf <kmedc...@dessus.com> Sent: Friday, January 19, 2018 12:12:15 PM To: SQLite mailing list Subject: Re: [sqlite] [EXTERNAL] get stmt row count Then you

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread Keith Medcalf
On Behalf Of Simon Slavin >Sent: Friday, 19 January, 2018 11:27 >To: SQLite mailing list >Subject: Re: [sqlite] [EXTERNAL] get stmt row count > > > >On 19 Jan 2018, at 3:22pm, David Raymond <david.raym...@tomtom.com> >wrote: > >> Keith & Simon, are you not bo

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread Keith Medcalf
volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of x >Sent: Friday, 19 January, 2018 11:10 >To: SQLite mailing list >Subject: Re: [sqlite] [EXTERNAL] get stmt row count > >>(and possibly numeric

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread Keith Medcalf
out anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of x >Sent: Friday, 19 January, 2018 08:50 >To: SQLite mailing list >Subject: Re: [sqlite] [EXTERNAL] get stmt row count > >Keith &

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread x
te mailing list Subject: Re: [sqlite] [EXTERNAL] get stmt row count >(and possibly numeric index) You’re on my wavelength Ryan as, I think, is David. Incidentally, the stmt1 query was suited to the harvesting of base table RowIDs that I’ve been banging on about in other threads. For the q

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread Simon Slavin
On 19 Jan 2018, at 3:22pm, David Raymond wrote: > Keith & Simon, are you not both missing the point? I want the rows and the > count but without having to run two queries. Yeah, I didn’t see that. Sorry. Simon. ___

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread x
.@tomtom.com> Sent: Friday, January 19, 2018 3:22:56 PM To: SQLite mailing list Subject: Re: [sqlite] [EXTERNAL] get stmt row count Maybe use a temp table as another possible solution? create temp table queryResults (id int); insert into queryResults select rowid from Tbl where Col > ?1 or

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread David Raymond
rowids. But it looks like it's running the CTE twice, which defeats the advantage. -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of x Sent: Friday, January 19, 2018 8:50 AM To: SQLite mailing list Subject: Re: [sqlite] [EXTERNAL] get st

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread R Smith
On 2018/01/19 2:16 PM, Simon Slavin wrote: On 19 Jan 2018, at 12:06pm, x wrote: Int Count=0; while (sqlite3_step(...)) Count++; That’s a slow way to count rows. Do it in SQL: SELECT COUNT(*) FROM MyTable WHERE b > 11; You get just one row back which makes

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread x
Keith & Simon, are you not both missing the point? I want the rows and the count but without having to run two queries. I tried the following (let stmt1 represent the original query and stmt2 the count(*) version of that query). stmt1 took 6+ secs for the first step. stmt2 took 6+ secs to get

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread Simon Slavin
On 19 Jan 2018, at 12:06pm, x wrote: > Int Count=0; > > while (sqlite3_step(...)) Count++; That’s a slow way to count rows. Do it in SQL: SELECT COUNT(*) FROM MyTable WHERE b > 11; You get just one row back which makes everything far faster. Simon.

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread Keith Medcalf
nal Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of x >Sent: Friday, 19 January, 2018 07:07 >To: SQLite mailing list >Subject: Re: [sqlite] [EXTERNAL] get stmt row count > >Gunter, I just ran a moderately complex query sorted on a n

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread x
10:27:30 AM To: 'SQLite mailing list' Subject: Re: [sqlite] [EXTERNAL] get stmt row count No. The only viable query plan is scan and sort (see "explain query plan" output). The sqlite3_prepare() family of calls creates the SQL program (see "explain" output) and sets ist initial

Re: [sqlite] [EXTERNAL] get stmt row count

2018-01-19 Thread Hick Gunter
No. The only viable query plan is scan and sort (see "explain query plan" output). The sqlite3_prepare() family of calls creates the SQL program (see "explain" output) and sets ist initial state. If the value you require is not null, you must call one of the sqlite3_bind() functions. This sets