
Two charts in the same product are both labelled "On-time delivery". One shows 94%. The other shows 91%.
Neither chart is broken. Each one was built with its own SQL, by a different person, in a different month, and the two queries treat a late delivery slightly differently.
A query library removes the second copy. The query is written once, checked and published, and every chart that needs the metric uses that one query.
What is a query library?
A query library is a shared catalog of queries that a team has checked and published for reuse. Each entry has a name, a description and a version history. A chart points to an entry in the library and does not hold its own copy of the SQL.
Three things separate it from a folder of saved SQL files:
- Status. A query is either a draft or published. Only published queries can be used in charts.
- Versions. Every publish creates a new version, and the earlier ones are kept.
- A link, not a copy. The chart refers to the query. A correction is made in one place.
Why do charts on the same data disagree?
In most analytics tools, each chart carries its own query. Someone builds the first chart, someone else copies its SQL for a second one and adjusts it, and from that moment the two can drift apart.
The differences are usually small and reasonable:
- one query leaves out cancelled orders and the other does not;
- one counts by order date and the other by delivery date;
- each uses a different timezone for "today";
- a later fix reached the original chart and not its copies.
The more charts there are, the more copies there are. In a product that serves many customers, the count grows again, because every customer has dashboards of their own.

How does a query library work?
The life of a reusable query has five steps.
- Write. Someone who knows the data writes the query and saves it as a draft.
- Check. The result is compared with a number the business already trusts, such as last month's invoice total.
- Publish. The query becomes version 1 and appears in the library for others to use.
- Reuse. Charts attach the published query. Each chart still chooses its own grouping, filters and chart type.
- Change. An edit is published as version 2. Charts stay on the version they were built with and show that an update is available. Someone decides when each chart moves.
Step 5 matters most. Without it, a change to a shared query changes every dashboard at once, including the ones your customers open every morning. With it, a change to a definition is a decision someone makes, chart by chart or all together. More on this in versioning embedded analytics.

Is a query library the same as a semantic layer?
No. Both exist so that a metric has one definition, and they go to different depths.
| Query library | Semantic layer | |
|---|---|---|
| What you define | Finished queries | Measures, dimensions and how tables join |
| Who writes the SQL | A person, once per query | The layer, for each request |
| How flexible it is | Each query answers the questions it was written for | Any valid combination of measures and dimensions |
| Effort to start | Low: it uses the SQL you already have | Higher: the data has to be modelled first |
A semantic layer is the more complete answer and the larger project. A query library is the smaller step, and the list of checked queries is a good starting list of metrics if you build a semantic layer later. The guide to a semantic layer for embedded analytics covers that route.
Why does it matter more when customers build their own charts?
Inside a company, two dashboards that disagree cost a meeting. In a product that shows analytics to its own customers, the customer sees the two numbers and concludes that the product is wrong.
The risk grows when customers build charts themselves. They cannot be expected to write correct SQL against your database, and they should not be able to. A query library gives them something safer to build from. The customer chooses the metric, the breakdown, the period and the chart type. The calculation is the one your team published.
That is the difference between self-service that creates support tickets and self-service analytics that customers can rely on.
A query library is one of two controls, and it does not replace the other. The library makes sure every customer gets the same calculation. A separate rule, applied on the server, makes sure each customer sees only their own rows. See multi-tenancy and row-level security.
What does it change for AI questions?
An AI assistant that writes SQL from nothing has to guess which column means revenue and how the tables join. A library gives it queries that someone has already checked.
That leaves a choice about how strict to be:
- Approved queries only. The assistant answers from published queries. It can answer fewer questions, and every number comes from a query a person has checked.
- New queries, checked before they run. The assistant may write a new query, and the system checks it before running it. It can answer more questions, but no person has checked the calculation.
Which one fits depends on what customers do with the number. A figure that ends up on an invoice needs the first.
What a query library does not fix
- Wrong data. If the source data is late or duplicated, every chart is wrong in the same way.
- What a metric should mean. Someone in the business still has to decide whether a cancelled order counts, and own that decision.
- Too many queries. A library with 400 near-identical queries is the old problem with a search box. It needs an owner, clear names and a habit of retiring what is no longer used.
- A slow query. Reuse does not make an expensive query cheaper to run.
How the Query library works in Sumboard
Sumboard released its Query library in November 2026.
- Folders, search and status. Queries sit in folders. You can search by name or description, and each query shows whether it is a draft, published, or has unpublished changes.
- Versions. Every publish creates a new version. Charts stay on their version and show when an update is available.
- Tenant rules apply to every query. The safeguards set on a data source apply to every reusable query. If a safeguard cannot be applied, Sumboard blocks running and publishing the query and says why.
- Use in any chart. You attach a published query to a chart in the chart editor and build on top of it.
- The SQL that runs is visible. The editor shows the query you wrote and the exact SQL sent to your database.
- One run for several charts. When several charts on a dashboard use the same query, Sumboard runs it once.
- Ask uses it too. Ask, the plain-language question box for your customers, can be set to use only approved queries, or to write new queries that are checked before they run.
The Query library is included in every plan, including Free. See pricing and the changelog.
Where to start
Pick the five metrics that appear in the most charts. For each one, find every copy of its query, compare them, agree on one, publish it and point the charts at it.
Comparing the copies is usually where the old disagreements come to light, and that is the useful part of the exercise.
Related guides
- What is self-service analytics?: what to decide before customers answer their own questions.
- Semantic layer for embedded analytics: the larger step after a query library.
- Self-Service Analytics articles: every article in this cluster.
Ready to launch customer-facing analytics?
Let your customers build their own dashboards inside your product. They see only their own data, and every number comes from a query you approved.



