Skip to content

Frequently Asked Questions

Justin Makeig edited this page May 29, 2020 · 3 revisions

Why can’t I debug my Optic API queries?

In MarkLogic, Optic (and SQL and SPARQL) queries are evaluated in the database at a layer below a user’s JavaScript or XQuery code. The Optic API is effectively a builder for a query plan. That plan is evaluated as a whole such that it can be intelligently optimized. The database uses a variety of strategies such as reordering and cost-based optimization to dynamically execute Optic query plans. This is very similar to the way a mature relational database evaluates SQL. This query execution happens in C++, so there’s nothing to debug when you hit .result(). To better understand what the query optimizer is doing and where your bottlenecks are in Optic queries, use the the explain() method on a query plan.

Clone this wiki locally