The fastest solution is to import all documents during database creation, either with the CREATE DB command or the corresponding XQuery function:
CREATE DB name-of-db /path/to/documents
db:create('db', '/path/to/documents')
The database command ADD, or db:add, can be used as well to import more than one document at a time.
If your XML input has been properly indented to improve readibility, you can reduce the size of your database by dropping superfluous whitespace during the import:
SET STRIPWS ON; CREATE DB ...
db:create('db', '/path/to/documents', (), map { 'stripws': true() })
> Have you ever loaded 9 million documents into a basex database?
What’s the approximate size of the 32,000 documents?
In principle, it’s no problem to add 10 million documents or more to a database as long as the input doesn’t exceed specific limits [1]. If you exceed the limits, you can create multiple databases and access them with a single query [2].
> I load the documents using the BaseXClient and the ADD method.
Are you using the Java implementation of the client? Feel free to share some code with us.
Hope this helps,
Christian