Hi Eliot,

When stored XQuery values are requested, they are always fully
materialized in main-memory. Depending on the size, that may take a
while.

The following query can be used to create a map with 1 million entries
and store it in a database. It takes around 1200 ms on my machine:

let $data := map:merge((1 to 1000000) ! map:entry(., string()))
return db:put-value('my-db', $data, 'map')

The result is a file called `map.basex` that’s locally stored in
`data/my-db/values/`. With the following query, this file is parsed,
and the map is re-created, which takes around 500 ms:

map:size(db:get-value('my-db', 'map'))

If you increase the number of entries, you’ll observe that the
execution times increase more or less linearly.

If you need index-based access to database entries with a short
startup time, classical databases may still be the best fit.

Cheers,
Christian

Reply via email to