Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

6. Considerations when querying

Given Superset's shared usage, it's crucial to optimize queries and datasets while creating dashboards to ensure a seamless experience for all users

  1. Specify What You Need: Be clear about the data you need and only request the necessary fields to minimize the amount of data returned.

  2. Avoid SELECT *: Avoid using SELECT * as it retrieves all columns, which can be inefficient. Instead, explicitly list the columns you need.

  3. Filter Early: Apply filters and conditions early in your query to reduce the dataset size before any complex operations are performed.

  4. Use Joins Wisely: Be mindful of how you use joins, as they can be resource-intensive. Use INNER JOIN, LEFT JOIN, etc., as appropriate for your data relationships.

  5. Aggregate Smartly: When performing aggregations, consider the efficiency of GROUP BY and aggregation functions like COUNT, SUM, AVG, etc.

  6. Limit Results: Use the LIMIT clause to restrict the number of rows returned, especially when working with large datasets.

  7. Monitor Performance: Regularly monitor query performance, identify bottlenecks, and optimize slow queries.

  8. Avoid Nested Subqueries: Be cautious when using nested subqueries, as they can be complex and impact performance.

  9. Consider Data Types: Be aware of data types and conversions when filtering or manipulating data.

  10. Caching: Implement caching for frequently used queries to reduce database load.