Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Gregory Moore
David Wellman > Gesendet: Montag, 18. September 2017 10:27 > An: 'SQLite mailing list' <sqlite-users@mailinglists.sqlite.org> > Betreff: [EXTERNAL] [sqlite] Number of rows in answer set > > Hi, > > If I run a SELECT statement that returns an answer set is there

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Keith Medcalf
>BEGIN IMMEDIATE; >CREATE TEMPORARY TABLE mytemptable >AS >SELECT > INTO temp.mytemptable > FROM > WHERE ; >SELECT count(*) > FROM temp.mytemptable; >SELECT > FROM temp.mytemptable; >DROP TABLE temp.mytemptable; >COMMIT or ROLLBACK; Without the INTO clause of course, as SQLite3 does not

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Keith Medcalf
gistered company number: 3917021 Registered in England and Wales. > > >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Hick Gunter >Sent: 18 September 2017 09:37 >To: 'SQLite mailing list' >Subject: Re: [

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Simon Slavin
On 18 Sep 2017, at 1:59pm, J Decker wrote: > What if the select had an ORDER BY ? wouldn't it have to pull the full set > of rows ? No. Suppose you declare an index on the same sort order. Then SQLite could just read the rows starting from the top of the index. CREATE

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Richard Hipp
On 9/18/17, J Decker wrote: > What if the select had an ORDER BY ? wouldn't it have to pull the full set > of rows ? Not necessarily. The query planner works hard to try to get the rows to come out naturally in the correct order, without sorting, as doing so makes the query

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread J Decker
What if the select had an ORDER BY ? wouldn't it have to pull the full set of rows ? On Mon, Sep 18, 2017 at 5:11 AM, Simon Slavin wrote: > > > On 18 Sep 2017, at 10:41am, David Wellman > wrote: > > > So to answer my original question: there

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Simon Slavin
On 18 Sep 2017, at 10:41am, David Wellman wrote: > So to answer my original question: there isn't an api that gives this value > ** because ** SQLite doesn't build the full answer set before returning from > that first sqlite3_step function call. Correct.

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Dominique Devienne
On Mon, Sep 18, 2017 at 11:41 AM, David Wellman wrote: > [...] there isn't an api that gives this value ** because ** SQLite > doesn't build the full answer set before returning from that first > sqlite3_step function call. > [DD] Well, the answer is more that

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread David Wellman
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Richard Hipp Sent: 18 September 2017 10:03 To: SQLite mailing list Subject: Re: [sqlite] [EXTERNAL] Number of rows in answer set On 9/18/17, David Wellman <dwell...@ward-analytics.com> wrote: > sqlite3_step - this one runs the sq

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Rowan Worth
-- > Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > Im Auftrag von Rowan Worth > Gesendet: Montag, 18. September 2017 11:08 > An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> > Betreff: Re: [sqlite] [EXTERNAL] Number of rows in answer se

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Hick Gunter
ers [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Rowan Worth Gesendet: Montag, 18. September 2017 11:08 An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Betreff: Re: [sqlite] [EXTERNAL] Number of rows in answer set On 18 September 2017 at 16:52, David Wellman

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Hick Gunter
sqlite] [EXTERNAL] Number of rows in answer set On Mon, Sep 18, 2017 at 10:37 AM, Hick Gunter <h...@scigames.at> wrote: > SQLite uses some nifty heuristics to estimate the number of rows it > expects to process while formulating a query plan. [...] > Is there any way to get at that

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Rowan Worth
On 18 September 2017 at 16:52, David Wellman wrote: > To run a select statement the application code has to: > sqlite3_prepare: parse the sql, make sure it's valid, build the plan > (using "nifty heuristics" :-) ) > sqlite3_step - this one runs the sql, builds an

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Hick Gunter
...@mailinglists.sqlite.org] Im Auftrag von David Wellman Gesendet: Montag, 18. September 2017 10:53 An: 'SQLite mailing list' <sqlite-users@mailinglists.sqlite.org> Betreff: Re: [sqlite] [EXTERNAL] Number of rows in answer set Hi Hick, " The only way to come up with the exact number of

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Richard Hipp
On 9/18/17, David Wellman wrote: > sqlite3_step - this one runs the sql, builds an answer set and then returns > the first row No. sqlite3_step() does not "build the answer set". It only begins computing the answer, stopping at the first row. The sqlite3_step()

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread David Wellman
ited Kingdom, GU1 3SR Registered company number: 3917021 Registered in England and Wales. -Original Message- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Hick Gunter Sent: 18 September 2017 09:37 To: 'SQLite mailing list' Subject: Re: [sqlite] [EXTER

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Dominique Devienne
On Mon, Sep 18, 2017 at 10:37 AM, Hick Gunter wrote: > SQLite uses some nifty heuristics to estimate the number of rows it > expects to process while formulating a query plan. [...] > Is there any way to get at that estimate? That would be interesting to pre-size some result

Re: [sqlite] [EXTERNAL] Number of rows in answer set

2017-09-18 Thread Hick Gunter
Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von David Wellman Gesendet: Montag, 18. September 2017 10:27 An: 'SQLite mailing list' <sqlite-users@mailinglists.sqlite.org> Betreff: [EXTERNAL] [sqlite] Number of rows in answer set Hi, If