Understanding views

If you want to perform a search on top of another search, try saving your search as a view. Then, you can use the saved view as a data source for a new search.

  • Only users with the Can administer ThoughtSpot or the Can manage data privilege can create views and link them.

  • While you cannot apply row-level security (RLS) to a view, you can apply row-level security to the view’s underlying table in order to restrict the data shown when searching on the view.

Introduction to views

You may have noticed that when you do a search on a data source, ThoughtSpot is only able to aggregate one column by one other column. Because of this, you may come across searches you can’t do in one pass, because they are essentially nested queries. But you can create the equivalent of nested queries using a view, which is an answer that you have saved for the purpose of building other searches on top of it.

You can use a view just like any other data source. You can even link it to other sources by defining a relationship. When you save an answer as a view, and then use it as a source in a new search, it is similar to doing a nested query in SQL, only much easier to create.

View workflow

Suppose you created a search on the sales fact table that shows the top ten Sales Reps by revenue, for the first quarter. Then you want to do some further investigation on that subset of data, such as ranking them by how much they discounted a specific product based on data from the orders fact table. Unless you save your first answer as a view, and then search over that view, you cannot get your answers.

Here are the high-level steps for creating and using views:

  1. Create the first search, and save it as a view.

  2. Create relationships or define joins to connect your view with any other data source.

  3. Create a new search that includes your view and the other sources linked with it.

  4. We recommend that you create a new worksheet that includes all these data sources.

    Creating a worksheet makes it easier for people to search using your view and any related tables.

Best practices for using views

  • When creating views, keep in mind the sizing recommendations for worksheets, for the final worksheet that you plan to use in modeling you data.

  • To be able to join a view with a base table, your installation must be configured to allow this. The view cannot have more than 5 tables, and the number of rows in the view cannot exceed 10 million rows.

  • The order of the objects being linked (joined) matters, because joins are directional. The table or view with the foreign key must be in the first (left) position. The table or view with the primary key must be in the second (right) position.

  • For best performance, views should have 50 or fewer columns, and no more than 10 million rows. If your View has more than 10 million rows, consider materializing it. If your View has more than 40 million rows, consider sharding it.

  • To improve performance, you can materialize the views.

  • You can use an ETL (extract, transform, load) processes to circumvent these limitations.

SQL views

You create a traditional ThoughtSpot view by saving a ThoughtSpot data search as a view. You can also create SQL views, by running SQL queries on your data, and saving the result as a SQL view.

For more information, see SQL views.



Was this page helpful?