Launch Week Day 5: Database Analytics with AI Insights

Database analytics are available to all Turso users.

Cover image for Launch Week Day 5: Database Analytics with AI Insights

The theme of our launch week this week is SQLite for Production, and one of the most important things you need to do in any development environment, let alone in production, is analyze queries.

Until now, Turso users have had to use our Platform API or the Turso CLI to do bespoke analysis themselves. Today we're announcing that database analytics are available to Turso users on all plans — Try it now.

We're also including an experimental AI Insights beta feature that is available now.

More on that later.

#About Analyzing Queries

When running an application in production, it is critical that you are able to quickly grasp its performance characteristics: how long queries take, and which queries are using more of your allowances for the resources you are billed for.

In the Turso Database Analytics tab, you will now see the database latency for your queries. Notice that this is not the latency as seen by the client, so it doesn't take into account the geographical location of the replicas.

It is also possible to see the most expensive queries, sorted by number of rows touched. This will give users insights on where to start the optimization process.

You can also see the progression of rows read or written over time, helping you understand how particular sequences of operations may have impacted your allowances.

You can also filter database analytics to show insights for the last 24 hours, 7 days, and for all or a specific database.

#AI Insights to help you understand your queries

Seeing which queries are using up your allowances is just the first step. It is also important to understand what those queries are doing, and possible steps to optimize them. Would an index help? Do you have too many indexes?

To help with that, Turso Database Analytics also ships with an AI-powered query explainer, powered by GPT-4. This feature, called AI Insights, is an early experimental beta, and during the beta period will be free for all users.

Please note, as the AI query analysis feature needs to read and understand your database schema, it has a usage cost of a few rows read associated with it. That cost is incurred even if your database is empty, since the query analyser needs to read your system tables.

#Try it out for yourself

Login and try it yourself. As always, we'd welcome your feedback on Discord — so please don't hesitate to join and help shape the future of not just this feature, but the Turso platform as a whole.