json_tree virtual table -- on disk or in memory?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

json_tree virtual table -- on disk or in memory?

Akshat Jiwan Sharma
Hi sqlite-users community,

I was looking at the json1 extension and came to know that json_tree
<https://sqlite.org/json1.html#jtree> is implemented as a virtual table.
Does that mean that the json_tree table is stored in memory after the json
is parsed by sqlite?

If so, for querying json data will I be limited by the memory of my
machine?

What happens when json_tree is unable to parse all the json rows in the
database, that is the size of the json columns increase the memory on the
machine?

Is there any way to measure the size of this table?

Thanks,
Akshat
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: json_tree virtual table -- on disk or in memory?

Richard Hipp-3
On 4/20/17, Akshat Jiwan Sharma <[hidden email]> wrote:
> Does that mean that the json_tree table is stored in memory after the json
> is parsed by sqlite?

Yes.

>
> If so, for querying json data will I be limited by the memory of my
> machine?

How big are your JSON strings that storing the entire string in memory
at once is a problem?

>
> Is there any way to measure the size of this table?
>

Do you mean, how much memory does it use?  You might use the
sqlite3_memory_used() interface before and after starting the virtual
table in order to figure that out.

--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: json_tree virtual table -- on disk or in memory?

Jens Alfke-2
In reply to this post by Akshat Jiwan Sharma

> On Apr 20, 2017, at 11:02 AM, Akshat Jiwan Sharma <[hidden email]> wrote:
>
> Does that mean that the json_tree table is stored in memory after the json
> is parsed by sqlite?

Yes, but only for the row being evaluated.

It sounds like you’re thinking of json_tree creating a database table that contains all the rows of the real table; that’s not how it works. It simply creates a thing that behaves as a table, whose “rows” are the elements of the JSON collection given as a parameter. After that database row is done being evaluated, the virtual table is disposed.

—Jens
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users