Hello,

>author="Warren Young"
>On Mar 28, 2018, at 3:28 AM, rene <RZaumseil@> wrote:
>> 
>> My main goal is currently to reduce the startup time.
>
>That’s not what I understood from your first post.  Are you moving the
goalposts, or is indexed read of >stored data not actually the primary
problem?

Both are related. I need a fast startup time and the access should be
"reasonable" fast.

>> 1. parsing time is nearly the same between "nlohmann::json::parse(..)"
>> and
>> "insert into data values(json(..))”
>
>That’s good to know, but not too surprising.  It just means one particular
C parser and one particular C++ >parser happen to be about the same speed.

Yup.

>> insert into arrayname select
>> key,json_extract(value,'$.name'),json_extract(value,'$.id') from data,
>> json_each(data.json,'$.arrayname’)
>
>I’m suggesting that you don’t use SQLite’s JSON features at all.  Use this
other C++ JSON parser you >have, then construct INSERT queries for each row
from the parsed JSON data.

Oh no. Either I use the C++ parser or I use sqlite. The C++ parser has no
knobs to tune.
So it is a fixed first option. Now I'm try to be faster with sqlite :) With
this option I have more options in selecting data.

>Also, be sure to use prepared queries and bound parameters for something
like this.  Don’t rebuild the SQL >query each time:
>
>   https://www3.sqlite.org/c3ref/bind_blob.html
>
>Not only will it be faster, it’s also safer.

I have done this.

>> Necessary indexes are created after the insert statement.
>
>Good.
>
>> The database is ":memory:" and all commands are inside an transaction.
>
>Also good.

I have done some more experiments with json_tree(). But these are not
faster.
It would be really cool if the json_extract() function could support a
wildcard as array index and return all values p.e.

json_extract(data.json,'$.arrayname[*].name')

Oh, regarding json_extract(). If I do a "explain query .." on it, it always
do a table scan.
Is there a way to directly get values from json? At least there are some
id's returned from json_tree().
May be a function with this id as argument.


Thank you
Rene




--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to