I need to get some random rows from a large(ish) table.
The following seems to be the most straight forward - but not the fastest.
SELECT * FROM table ORDER BY random() limit 200
Is there a faster/better approach?
cheers,
Torsten
___
sqlite-users
> Do the select and updates run inside a explicit transaction or they
> run in individual implicit transactions?
>
implicit - does that make a big difference in this case?
If you really want a single query you could write something like:
>
> WITH data(id, c1, c2 /*, ... */) AS (VALUES
>
a lot of complexity for such simple task.
Anyway - since WAL mode seems to work I will stick with that for now.
cheers,
Torsten
On Mon, May 28, 2018 at 9:10 PM Simon Slavin wrote:
> On 28 May 2018, at 7:56pm, Torsten Curdt wrote:
>
> > Just to clarify: I have a single thread - so
that exactly 1 thread does all the calls to SQLite. This mode
> is fastest.
>
> -Ursprüngliche Nachricht-
> Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> Im Auftrag von Torsten Curdt
> Gesendet: Montag, 28. Mai 2018 10:38
> An: sqlite-user
urning 1 (TRUE) if the current row (identified by the
> arguments) needs an update and the row-valued function new_data() returns
> the new values.
>
>
> -Ursprüngliche Nachricht-
> Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> Im Auftrag von T
all rows by single update query?
>
> 2018-05-27 20:30 GMT+02:00, Torsten Curdt <tcu...@vafer.org>:
> > I am doing a select, then iterate through the resultset and on each row
> > call update on that row.
> > I am using the golang driver and ran into the issue that on the up
There is no multi threading. Just a single thread and only one
connection/handle.
While iterating through the resultset I am also trying to execute an update
for every row. Along the lines of:
resultset = db.exec(`select`)
foreach row in resultset {
db.exec(`update`)
}
I don't want to
I am doing a select, then iterate through the resultset and on each row
call update on that row.
I am using the golang driver and ran into the issue that on the update the
database is still locked from the select.
https://github.com/mattn/go-sqlite3/issues/569
I have read
I've searching and reading quite a bit in the archives:
So far I found the proposal of a "rank" column
http://www.nabble.com/Ranking-in-fts.-td11034641.html
Also Scott mentioned the internal "dump_terms" and "dumpt_doclist" functions
9 matches
Mail list logo