Databases for AI Apps: Why You Should Choose Neon DB | LLM Agent Tutorial
![Sheldon Niu](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2Fide6mbkk%2Fproduction%2F77d3f5e2569ddf41f731e970abd75c701d76feca-800x800.jpg%3Fw%3D96%26h%3D96%26fit%3Dcrop%26auto%3Dformat&w=256&q=75)
![Databases for AI Apps: Why You Should Choose Neon DB | LLM Agent Tutorial](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2Fide6mbkk%2Fproduction%2Fc6a735235795de91af9f620b4b90298aee2f12a3-1600x900.png%3Frect%3D0%2C50%2C1600%2C800%26w%3D2000%26h%3D1000%26fit%3Dmax%26auto%3Dformat&w=3840&q=75)
![Sheldon Niu](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2Fide6mbkk%2Fproduction%2F77d3f5e2569ddf41f731e970abd75c701d76feca-800x800.jpg%3Fw%3D96%26h%3D96%26fit%3Dcrop%26auto%3Dformat&w=256&q=75)
Neon DB is the most popular serverless PostgreSQL provider, and it is highly suitable for AI startups. Here's why:
Vector search made easy and fast
Neon enables you to store embeddings and query related documents based on vector similarity.
Unlike standard pg_vector, Neon DB supports a 20x faster version with the same capability: pg_embedding. This is crucial to ensure the AI chatbot responds quickly enough.
![pg_embedding is 20x faster than pg_vector](https://cdn.sanity.io/images/ide6mbkk/production/ee6dfab63994f7fd05412ecea0d20afdec1527e7-1538x860.png?w=3840&q=75&fit=clip&auto=format)
Neon DB can be used in Edge functions
This is crucial since AI chatbots often need a streaming API to serve the streaming text response returned by LLMs, and these endpoints often run on the Edge network to lower costs and latency.
Edge networks do not often support TCP connections; you must query databases through an HTTP API. Neon DB has built-in support and offers latencies as low as 10 ms.
![You can connect to Neon db in edge functions with less than 10ms latency](https://cdn.sanity.io/images/ide6mbkk/production/1f53cc70d06fb6d693a663db325820b3180bcd8c-2742x1562.png?w=3840&q=75&fit=clip&auto=format)
Neon DB is serverless and scales automatically
As a startup, your volume varies a lot, and you may not know the specifications you need, such as how large the storage should be, how powerful the CPU should be, and how many instances you need.
You also want to be charged for actual usage, so you don't have to purchase an AWS server and pay for the metal fee. This approach will also lower your real costs on the database.
![Neon db is auto scalable, made PostgreSQL really serverless](https://cdn.sanity.io/images/ide6mbkk/production/530a5e00e321eee95794ca1d2c308b913d0a3f1f-1450x610.png?w=3840&q=75&fit=clip&auto=format)
Neon DB can be queried by natural language instead of writing SQL
Neon DB is PostgreSQL, and AskYourDatabase provides the best support for Neon DB, enabling you to interact with your database using natural language.
Here's how to do it:
Get the connection string
Go to the console of your Neon DB, and copy your connection string:
![Get your connection string in Neon Console](https://cdn.sanity.io/images/ide6mbkk/production/e72fb0178839aab5a7107b342656e666b2f95dd7-2134x1304.png?w=3840&q=75&fit=clip&auto=format)
Download AskYourDatabase
Visit the Download Center to download the app. Open it, and click 'Connect' -> Select PostgreSQL, and input your connection string, then click 'Connect':
![Connect to your neon db in AskYourDatabase](https://cdn.sanity.io/images/ide6mbkk/production/6874998f87c03b2e6fafaec9e16a19dfb0b7b2e3-1300x713.webp?w=3840&q=75&fit=clip&auto=format)
Chat to get insights from Neon DB
![Chat with your neon database with AskYourDatabase](https://cdn.sanity.io/images/ide6mbkk/production/5a734ad4407edca1537c9058de9c9dd8220255c3-2622x1908.png?w=3840&q=75&fit=clip&auto=format)
You can use AskYourDatabase to create reports, visualizations, and make data modifications directly within AskYourDatabase.
Conclusion
Building AI apps requires several things like edge functions, fast vector search, and volume-based pricing. Using database providers like Neon DB can streamline your workflow and make your AI app respond faster than competitors.
With tools like AskYourDatabase, small teams don't need to set up complex BI dashboards; all they need to do is ask questions and get insights directly from the Neon database with the power of LLM.