Skip to main content
Matik Help Center home page Help Center
Matik Blog Case Studies
  1. Matik
  2. FAQ and Troubleshooting
  3. Troubleshooting

Best Practices for Enhancing Query Performance in Matik

When working with large datasets and complex queries, optimizing query performance is crucial. Here are some best practices for making your queries more efficient when using Matik:

 

Pre-Aggregation

  • Pre-Aggregate Tables: Perform aggregations at a higher level (e.g., monthly instead of daily) in your data warehouse (e.g., Snowflake). This reduces the volume of data processed during queries.

 

Efficient Filtering

  • Use WHERE Clauses Wisely: Filter using indexed columns to speed up data retrieval.
  • Limit Rows: Use the LIMIT and OFFSET clauses to return only the necessary rows.
  • Avoid Functions in WHERE Clauses: Using functions can prevent indexes from being used.

 

Joins and Subqueries

  • Optimize Joins:
    • Prefer inner joins over outer joins whenever possible.
    • Use indexed columns for joining tables.
  • Avoid Correlated Subqueries: These can slow down your query significantly. Use Common Table Expressions (CTEs) instead.

 

Aggregation and Sorting

  • Efficient GROUP BY: Only group by columns that are necessary.
  • Use WHERE Before Aggregation: Filter rows before aggregation using the WHERE clause and filter after aggregation using the HAVING clause.
  • Avoid DISTINCT Operations: Use them sparingly as they can be resource-intensive.
  • Optimize Sorting: Avoid ORDER BY unless required, as it consumes additional resources.

 

Additional Tips

  • Batch Operations: Use IN and BETWEEN operators to shorten and sometimes speed up queries.
  • Indexes: Set up indexes on fields that are commonly used in WHERE clauses to improve query speed.

 

Stepwise Query Optimization Example

Breaking down a complex query into simpler steps can greatly improve performance. You can follow these rules as a guide:

 

  1. Select Only the Fields You Need
    Start by selecting only the necessary fields from your tables. This reduces the amount of data processed and speeds up the query.

  2. Filter on Indexed Fields
    Use indexed fields in your WHERE clause to make filtering more efficient. Indexes help the database retrieve data faster.

  3. Do the Same for the Other Table
    Repeat the process for any other tables you need to join. Select only the necessary fields and apply filters on indexed columns.

  4. Join the Tables
    Once you have filtered and selected the required fields, join the tables. Ensure you are joining on indexed columns to improve performance.

Run Aggregations and Ordering
Finally, perform any necessary aggregations and ordering. By doing this as the last step, you ensure that you're working with the smallest possible dataset, which improves performance.

Was this article helpful?

Have more questions? Submit a request

Related articles

  • Tags Overview
  • Dynamic Content Overview
  • Matik App for Salesforce Setup
  • I'm experiencing presentation timeout and long runtime issues
  • Using SSO's to sign in to Matik (Okta, Onelogin, Azure, Google)

Articles in this section

  • Best Practices for Enhancing Query Performance in Matik
  • I'm not able to find a published template
  • I don't see the updates I have made to a template
  • Slides are appearing out of order or the wrong slides are being generated
  • I'm experiencing presentation timeout and long runtime issues
  • My Google add-on isn't loading
  • My Google Slides add-on won't tag slide objects
  • Testing Powerpoint Slides Isn't Working

Comments

0 comments

Please sign in to leave a comment.

Personalize data-driven content in minutes

Product

  • How it Works
  • Integrations
  • AI Features
  • Security

Solutions

  • Sales
  • Customer Success
  • Ops & Strategy
  • Data

Resources

  • Blog
  • Templates
  • AI + CS Resource Hub
  • Case Studies
  • Help Center

Company

  • About Us
  • Careers
  • Terms of Service
  • Privacy Policy

© 2024 Matik, Inc.