Skip to main content
Bring your team and maximize your impact at Dreamforce. Register three or more to unlock $999 passes.

Create a Workspace and Run Your First Query

Learning Objectives

After completing this unit, you’ll be able to:

  • Create and manage a workspace in the Query Editor.
  • Explain how a workspace defines query access via data spaces.
  • Construct a basic Data 360 SQL query using Query Editor features.
  • Apply best practices for query performance, such as using the LIMIT clause.

The Role of a Workspace

Remember Cara Ng from the previous unit? Before she can confirm that AW Computing's new engagement data stream is flowing correctly, she needs to create a workspace.

Think of a workspace as your personalized, controlled environment within the Query Editor. When you create a workspace, you must select the data space you want to work in. The data space selection determines what data your queries can access. If you choose the wrong data space, you won’t be able to find the customer data you need for your analysis. If you select the wrong data space, close the workspace and create a new one.

By creating this workspace, Cara ensures her queries operate within the correct security and access protocols, and that she can find the right objects for her analysis.

Create Your First Query

Now that Cara Ng has created her Q3 Engagement Validation workspace, she’s ready to write her first query to analyze the customer data at AW Computing.

Query Editor provides a panel that lists all the data lake objects (DLOs), data model objects (DMOs), calculated insight objects (CIOs), and data graphs available in your selected data space. Instead of typing the object name manually, we recommend you start with a basic SELECT * FROM ... query autopopulated from the object you select. You can also name and save your queries for easy use and future reference.

Query Best Practices

Well-written queries are efficient and prevent performance issues. When you are writing your Data 360 SQL, keep these best practices in mind, especially before implementing logic for complex features.

  • Filter early: Use WHERE clauses to reduce data scanned
  • Select specific fields: Avoid SELECT * statements in production queries. Use specific fields for performance, and reserve SELECT * as an initial exploration shortcut only.
  • Limit results: Use LIMIT for large datasets
  • Optimize joins: Include key qualifiers and proper indexing
  • Consider your data’s indexed field: For best performance, filter and join on indexed fields. Data 360 automatically indexes objects based on category—Profile and Other category objects are indexed on their primary key field, and Engagement category objects are indexed on their event time field. Using these fields in your WHERE and ON clauses helps your query run faster.

Improve Performance with Secondary Indexes

When the default index isn't enough, you can create a secondary index on a data lake object (DLO) or materialized data model object (DMO) to filter and join on a field other than the primary key or event time field. Secondary indexes work well for large objects you frequently filter on a field with many distinct values, such as customer ID, phone number, email, or Global ID; for range lookups, such as finding customers within a defined zip code range; and for speeding up materialized DMOs like customer segments or aggregated metrics.

A secondary index only matches directly on the indexed field. It doesn't work with calculations, functions, or fuzzy patterns. Pair a secondary-index filter with AND so it narrows the result set before other conditions run. Keep these limits in mind:

  • Only materialized DMOs (Derived, Bridge, or Transform types) support secondary indexes.
  • Indexes refresh daily, so they work best on data that doesn't update more than once every 24 hours.
  • Creating and refreshing an index consumes batch-transform credits, and queries using one can cost more credits than the rows they return. Secondary indexes pay off best on objects queried at least 10,000 times a day.

With her workspace saved and her first query validated, Cara now has the data confidence she needs to walk into her Q3 leadership review with a validated engagement stream.

Remember, the Query Editor is your safe place to test and refine your SQL logic before implementing it in other Data 360 features. Try out more advanced queries in the Data Exploration with Data 360 SQL Queries.

Resources

Comparta sus comentarios de Trailhead en la Ayuda de Salesforce.

Nos encantaría saber más sobre su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios en cualquier momento en el sitio de Ayuda de Salesforce.

Más información Continuar a Compartir comentarios