Optimize Queries
While writing SQL queries can be challenging, ensuring that these queries are well-optimized and run efficiently is even more involved. The Query Assistant can help to apply optimization strategies to your queries, where possible.
Note
Some queries are inherently expensive to run. The Query Assistant can help to tune your query, but sometimes accelerating a query further is not possible.
Examples
Finding the most expensive NFT ever sold
You have a (working) query to obtain the most expensive NFT sale of all time, in USD:
SELECT usd_price FROM ethereum.nft_sales ORDER BY usd_price desc nulls last limit 1
However, this query runs too slowly. You can ask the Query Assistant to optimize it for you. In the Query Assistant input box, write:
The following query is trying to get the most expensive NFT sale in history.
SELECT usd_price FROM ethereum.nft_sales ORDER BY usd_price desc nulls last limit 1
Generate a significantly more optimized version
The Query Assistant outputs:
SELECT MAX(usd_price) FROM ethereum.nft_sales
Tips and Tricks
Learn some strategies to get the most out of the Query Assistant
Got questions? Join our Discord
Discord is the primary home of the Transpose developer community. Join us to ask questions, share your work, and get help.