On 2018/05/24 5:41 PM, x wrote:
The parameter N is the approximate number of virtual machine 
instructions<https://sqlite.org/opcode.html> that are evaluated between 
successive invocations of the callback X.

Would it not have been better if N was the number of milliseconds between 
invocations? It’s not much use if you want to abort from a lengthy “select 
count(*) from Tbl” as there are only a couple of virtual machine instructions 
whereas “select count(*) from Tbl,Tbl” might have billions of VMI’s.

I think VM steps generally happen in quick succession, never minutes apart.

Either way, milliseconds elapsed is equally useless - plus what could possibly be easier than measuring time yourself?

Pseudo code example, but it will work for near any platform with some numeric representation of "time".
...
curtime = now;
elapsed = curtime - prevtime;
prevtime = curtime;
...
print elapsed;
...


What you cannot do, is deduce VM steps like that, so indeed you are better off with the progress handler reporting VM steps (which you cannot deduce) rather than elapsed time (which you can).

What we REALLY want however, is to know the final intended VM steps so that curstep/finalstep will give us some idea of the progress, but it is impossible to know (even in principle) before the actual query result have been produced at least once.

So at this point we are condemned to reporting to the user something like "Look mate, it's still busy, but at least the current VM steps > previous VM steps, so it ain't hung. Shall we wait some more, or cancel?" - to which the good user hopefully do not cancel prematurely (though that is hard to expect with zero confidence in which exact VM milestone constitutes "premature"). Luckily this is less of a problem in custom system code, since you can test every query, even on big data. It gets hard when you make a DB manager of sorts in which allowing ANY query is a necessity.

Point being: There is no good answer to this.


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to