Skip to content
Sandadocs

Summaries

Smaller copies of a table's numbers that reports read instead of the table when they give exactly the same answer, kept current after every landing.

A summary is a smaller copy of one table's numbers, kept at a coarser grain: order lines added up by day and category rather than read line by line. A report that would add up millions of rows reads a few thousand instead, and a block that took seconds draws in a blink.

A report reads a summary only when it gives exactly the same answer as the table. When it cannot, or when rows have landed since it was built, the report reads the table as before. So a summary never changes a number. At worst it is not used.

You create summaries for a report that is slow, or from what Sanda suggests for questions that are slow or read often. Sanda works out which ones would help, shows you what they would cost, and builds them only when you agree.

Speed up a slow report

Only owners and admins can create a summary, because each one costs compute to build and to keep current.

  1. Open the report. When blocks read their table for longer than 2 seconds, or run out of time, a banner under the report's toolbar says how many, and each of those blocks shows speed up this report at its foot.
  2. Press Speed up this report on the banner to speed up the whole report, or speed up this report on one block to start from that block. The Speed up this report card opens over the report. It shows each summary Sanda suggests in words (for example order lines · by categories and day of order date), roughly how many rows and how large it would be, the numbers it keeps, the blocks it answers and how long each took, and roughly how much compute building it again costs after each landing.
  3. Tick the summaries to create. From the banner every one is ticked. From a block, only the ones that answer that block are, and you can tick the rest. A block no summary can answer is listed under These stay with the table with the reason, such as a number that counts distinct values.
  4. Press Create these summaries (or Create this summary). Sanda builds each ticked one, then checks it before any report reads it (see below). The card says what was created and what was not, and why.

The × on the banner hides it for that report in your browser. Each slow block keeps its own link.

Working out the plan counts the rows each summary would hold, which reads its table once, about as long as one slow block takes. Sanda proposes the fewest small summaries that answer the report's blocks. Blocks that need the same things share one summary, and blocks that need different ones get their own, because one summary by both would be as large as the finer of the two.

You can also ask Sam to speed a report up. Sam always asks before it creates or drops a summary, whatever its mode. See Sam actions and approvals.

How a summary is checked

Before any report reads a new summary, Sanda asks every block it was made for both ways, from the table and from the summary, at the same moment, and compares every cell and the type of every column. Any difference and the summary is dropped again, with a sentence saying so. A block that takes longer than 2 minutes from the table cannot be checked, and the summary is not kept.

A summary must also add back up to its table's own totals when it is built, be at least 20 times smaller than the table, and hold no more than 1,000,000 rows. One that would not is not kept, and says so.

What a summary can answer

A summary keeps its numbers by keys and at most one date, never by labels. A summary by category keeps the category's key, and a report joins the category's name to it as the table would. So a category renamed this morning reads its new name at once, and the summary answers by anything about categories, not just the column it was made for.

A report reads a summary when all of these hold:

  • Every column the block groups by is one the summary keeps, the date at a grain that fits (a summary by day answers by week, month, quarter and year; by month answers by quarter and year), or a column of a table reached through one of its keys.
  • Every filter is on such a column, or is a date range whose ends fall on whole days, weeks or months in your reporting time zone, as the summary keeps them.
  • Every number is one the summary keeps, defined the same way: sums, counts, smallest and largest values, and averages of whole numbers and decimals.

These stay with the table:

  • a count of distinct values, which cannot be added up again from a summary;
  • a sum or average of a floating-point column, whose total depends on the order rows are added in;
  • a number measured on another table, or a share of a total;
  • a block that reads two different dates, or lists rows rather than adding them up.

Summaries answer the same questions wherever they are asked: report blocks, a block's earlier period and trend, delivered reports, shared links, the reports portal, Sam's questions, and the first page of an OData feed.

Kept current after every landing

When rows land in a table a summary reads, Sanda builds the summary again: after a pull, a sync, a CSV upload, rows added to an intake table, or rows an agent loads. Only summaries whose tables changed are built again. Until a summary is rebuilt, reports read the table, so a block is slower for that while and never out of date.

Building and refreshing run on your warehouse's compute and are billed like any other query, and a summary's rows count toward your storage. Overview · Summaries shows the storage your summaries hold, and how many refreshes ran in the last 30 days with the compute they used. Because a summary also spares every block that reads it a read of the whole table, your compute may stay about where it was: see usage and metering. At most two summaries are built at once across Sanda, so a build may wait a minute for its turn. Builds wait while your workspace is suspended for its budget, or while the warehouse is over its limits. Reports read the table meanwhile.

If a report finds a summary out of date that no landing refreshed, Sanda builds it again, at most once every 10 minutes for a warehouse.

Recommendations

You do not have to notice a slow report yourself. Sanda counts every read from the table of a question a summary could answer, wherever it was asked: on a report, in a delivered report, or by Sam or a connected assistant. It notes how long each read took, and counts it as slow when it took longer than 2 seconds or ran out of time. A question a summary already answered is not counted, and neither is one asked again within a few seconds and answered from the first answer, because neither read the table.

The Optimise page then suggests, under Summaries:

  • Create a summary for questions no summary answers that, in the last 14 days, were either:

    • slow: read slowly at least 3 times, or
    • read often: read from the table at least 50 times, taking at least 500 milliseconds each on average. A question that reads faster than that reads a table too small for a summary to be much smaller.

    They are planned into the fewest small summaries the same way Speed up this report plans them. Creating one builds it and checks it against each of those questions before anything reads it. A summary is built again after every landing, so one suggested because its questions are read often saves compute when they are read more often than new rows land in its table. The reason says how often they were read, so you can judge.

  • Drop the summary for one nothing has read in 30 days, or one kept for a report none of whose blocks read it now.

  • Rebuild the summary for one whose refresh has not finished for a day.

The same suggestions are listed under Suggested on Data · Modelling · Summaries. Dismiss says no to a suggestion, and it is not raised again for that warehouse. Sam reads the same suggestions, mentions them once, and creates or drops a summary only when you agree.

When the semantic model changes

You change What happens to its summaries
A metric's definition The summary is built again with the new definition, on the approval it had, and the old one is retired.
The reporting time zone Every day boundary moves, so each summary is built again the same way.
A metric is removed The summary is built again without it, keeping the rest.
A table or column it is kept by is removed The summary is retired, with the reason.

These happen at the next landing. Until then, a number whose definition changed is read from the table, and the rest of the summary still answers.

The Summaries list

Go to Data · Modelling and open Summaries, listed under it in the left rail. Every member can read the list; only owners and admins can act on a summary.

Each summary shows its state:

State Means
fresh Built from the rows there now. Reports read it.
refreshing Rows have landed and it is being built again. Reports read the table until it is.
waiting for new rows Its last refresh could not finish, and the reason is shown. Reports read the table until it is built again.
building Being built and checked for the first time.
not kept It was never ready, and the reason is shown.

Select one to see its Rows (and how much smaller than its table it is), Size, what it Keeps, when it was Last built and the compute that took, how many block reads it has Answered, and who made it. Blocks it answers lists the blocks it was checked against, with how long each took From the table and From the summary.

  • Refresh now builds it again if anything it reads has changed, and leaves it alone if not.
  • Rebuild builds it again now, whatever has changed.
  • Drop removes it. Reports that read it read the table again, which is slower and gives the same answers.

Above your summaries, Suggested lists what Sanda suggests for this warehouse from questions that are slow or read often (see recommendations), each marked create, drop or rebuild. A summary to create says why under its name, with its figures: Slow · 10 slow reads in 14 days, Read often · 140 reads in 14 days, or Slow and read often with both.

Select one to see why, in figures, and what it does. A summary to create is marked slow, read often or both, and Questions it would answer lists each question with the report it was asked on, how many times it was read from the table (Reads), how many of those were slow (Slow), and how long a read took on average (Average). Owners and admins can press Create this summary, Drop it or Rebuild it, or Dismiss it so it is not suggested again for this warehouse. Members can read the suggestions too.

Where you see them

  • On a report: for owners and admins, the banner under the toolbar when blocks read slowly from their table, with Speed up this report.
  • On a block: hover over a chart or table to see where its answer came from and how long it took: Answered from a summary · 41 ms, or From the table · 4.2 s.
  • On the map: a table with summaries says so on its card, for example 2 summaries, linking to Data · Modelling · Summaries. A summary is never a card of its own and never appears in Sam's view of your tables.

Limits

  • A table keeps at most 20 summaries, and a workspace at most 20. The card says which blocks stay with the table when a limit is reached.
  • A summary must be at least 20 times smaller than its table, and hold no more than 1,000,000 rows.
  • The Sanda sample dataset is shared and read-only, so it keeps no summaries.
  • A summary can only be kept over tables whose changes Sanda can see, so one over a materialized view is not kept, and building it says why.

Something unclear or out of date? Tell us, and we will fix the page.