Hello Richard !

Yes I do see "because the implementation parsing the JSON anew each time" and this is a recurring pattern in some sqlite functions, would be nice if we could have a "session/query/row" storage space to store query information that can be reused, for example on the json functions we could reuse an already parsed json field several times, another example we could have session/query/row variables.

We could have something like "sqlite3_set_auxdata" but with granularity for row/query/session and as a bonus would be nice to have session variables like https://dev.mysql.com/doc/refman/5.7/en/user-variables.html .

Cheers !

On 23/03/17 08:30, Richard Hipp wrote:
On 3/22/17, Domingo Alvarez Duarte <mingo...@gmail.com> wrote:
Hello Richard !

I noticed that sqlite do not use any memoization in json1 functions.

For example jsonExtractFunc and others parse the json string every time
it's called even when the json string is the same.

minimal example : "select json_extract(json, '$.name') name,
json_extract(json, '$.address') name from some_table;"

Could be possible to have some kind of memoization as a general option
for any sqlite functions ?'
In paragraph 3.0 of https://www.sqlite.org/json1.html:  "All json1
functions currently throw an error if any of their arguments are BLOBs
because BLOBs are reserved for a future enhancement in which BLOBs
will store the binary encoding for JSON."

But let me ask this:  Have you actually measured a performance
problem?  Or are you just assuming that because the implementation
parses the JSON anew each time it see it that it must therefore be
inefficient?


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

Reply via email to