Explore Sample Data with Data Tools

  • tutorial
    +
    Use Couchbase Capella’s Data Tools to explore and work with your data.

    Your trial database comes with a sample dataset. You can use this data to try out Capella’s Data Tools.

    To start exploring your data, you can:

    View and Edit Documents with the Documents Viewer

    Documents in Capella are grouped through buckets. You can add scopes and collections to a bucket to group related documents together.

    For more information about buckets, scopes, and collections, see Data Service.

    To view and edit a document in your database:

    1. Go to Data Tools  Documents.

    2. In the Limit field, enter 8.

    3. In the travel-sample bucket in the database schema browser (left pane), navigate to the airport collection in the inventory scope.

    4. Hover over the airport collection until get documents appears, and click get documents.

    5. In the right pane, click airport_1261.

    6. In the Edit Document window, change the airport’s city from "Amiens" to "Rouen".

    7. Click Save Document.

    The document airport_1261 now has its city set to "Rouen".

    Run Your First Query with the Query Tab

    To run your first query:

    1. Go to Data Tools  Query.

    2. In the query editor, paste the following query:

      SELECT route.airlineid, airline.name, route.sourceairport, route.destinationairport
      FROM `travel-sample` route
      INNER JOIN `travel-sample` airline
      ON route.airlineid = META(airline).id
      WHERE route.type = "route"
      AND route.destinationairport = "SFO"
      ORDER BY route.sourceairport;
    3. Press Enter or click Run Query.

      The results from the query are displayed in JSON format.

    To view how Capella executed the query in a graphical format, select the Plan tab.

    The Query results show a data-flow diagram with query operators. The initial scans display on the right, and the final output of the query displays on the left.

    The Query results highlight any operators that might use a lot of resources. For example, in this query, the Fetch operator takes almost 90% of the total time spent on the query.

    For more information about how to use the tools on the Query tab, see Query Tab.

    Speed Up Your Query with an Index

    You can use the Index Service to improve query performance:

    1. With the same query in the query editor, click Index Advice.

    2. In the query results, copy the recommended CREATE INDEX command from the index_statement attribute without the quotation marks:

    3. Replace the query in the query editor with the CREATE INDEX command.

    4. To create the index, click Run Query.

    5. Click History.

    6. To load the original query back into the query editor, in the list of queries, click the SELECT query.

    7. To run the query again, click Run Query.

    With the index, the query execution time changes from around 172ms to 24ms.

    For more information about indexes in Capella, see Index Service.

    Next Steps

    After you query sample data, you can Explore the SDK Playground to see how to access your data with the Couchbase SDKs.

    If you want to connect to your database:

    1. Generate database credentials to securely connect and control access to your database. For more information, see Configure Database Credentials

    2. Add your current IP address as an allowed IP for your database. For more information, see Configure Allowed IP Addresses

    3. Generate a Code Snippet that helps you connect your database to your application.

    4. Choose and install a Couchbase SDK

    5. (Optional) Download the security certificate for your database and add it to your application’s server machine or IDE:

      1. From the Start page, go to Settings  Security Certificate.

      2. Click Download.