Not sure if using SQL against the database file would be any faster than exporting a CSV catalog from the calibre GUI (you may need to add the Create Catalog tool to a Toolbar or menu), or via the calibredb list command ==>>
The Command Line Interface
The database is loaded into memory when calibre is running.
However if you're determined to use SQL direct, I would suggest you copy the metadata.db file at the root of the library, and use something like
DB Browser for SQLite to do queries against it to export CSV, HTML etc. You'll need to spend a few minutes examining the schema but its fairly straightforward.
BR