Skip to content

Frequently Asked Questions (FAQ)

Kshitij Joshi edited this page May 26, 2026 · 1 revision

Frequently Asked Questions (FAQ) ❓

General Questions

What is Ask My PostgreSQL Database?

A natural language interface for PostgreSQL databases that lets you ask questions in plain English and get instant answers. It uses local AI (Ollama) to convert your questions into SQL queries.

Is it free?

Yes, 100% free and open source! No API costs, no subscriptions. Everything runs locally on your machine.

Do I need an API key?

No! Unlike other AI tools, this uses Ollama which runs entirely on your computer. No external API calls means no API keys needed (except optionally for embeddings).

What databases does it support?

Currently PostgreSQL 13+. Support for other databases (MySQL, MongoDB) is planned for future releases.


Installation & Setup

What are the system requirements?

Minimum:

  • 4GB RAM
  • 10GB disk space
  • Python 3.10+
  • Node.js 18+

Recommended:

  • 8GB+ RAM
  • 20GB disk space (for Ollama models)
  • SSD for faster performance

Which Ollama model should I use?

For most users: llama3.2 (2GB, fast, good accuracy)

Alternatives:

  • mistral - Good alternative to Llama
  • gemma4 - Larger, more capable (9.6GB)
  • qwen3.6 - Very capable but large (23GB)

Can I use my existing PostgreSQL database?

Yes! Just update the connection settings in backend/.env to point to your database.

Does it modify my database?

No! The application only executes SELECT queries (read-only). All dangerous operations (DROP, DELETE, INSERT, UPDATE) are blocked.


Usage

What kinds of questions can I ask?

Simple queries:

  • "Show me all employees"
  • "What's the average salary?"
  • "List all departments"

Complex queries:

  • "Who are the top 5 highest paid employees in Finance?"
  • "Which departments are over budget by more than 10%?"
  • "Show me employees hired in the last 6 months with salaries above $80k"

Analytical questions:

  • "What's the salary distribution by department?"
  • "Compare performance ratings across teams"
  • "Show me hiring trends over time"

Why are some queries rejected?

For safety, only SELECT queries are allowed. Queries containing dangerous keywords (DROP, DELETE, INSERT, UPDATE, etc.) are automatically blocked.

Can I save queries?

All queries are automatically logged to the ai_query_history table in your database. You can query this table to see your history.

How accurate is the SQL generation?

Accuracy depends on:

  • Model used - Larger models (gemma4, qwen3.6) are more accurate
  • Question clarity - More specific questions get better results
  • Schema complexity - Simpler schemas are easier to understand

Typical accuracy: 85-95% for well-formed questions.


Performance

How fast is it?

Typical response times:

  • Simple queries: 1-3 seconds
  • Complex queries: 3-8 seconds
  • With embeddings: +1-2 seconds

Speed depends on:

  • Ollama model size (smaller = faster)
  • Database size
  • Query complexity
  • Hardware (CPU, RAM, SSD)

Can I make it faster?

Yes!

  1. Use smaller models: llama3.2 instead of qwen3.6
  2. Optimize PostgreSQL: Add indexes, tune shared_buffers
  3. Use SSD: Much faster than HDD
  4. More RAM: Allows more database caching

How many queries can it handle?

There's no hard limit. For production use, consider:

  • Rate limiting (10-20 queries/minute per user)
  • Query caching
  • Connection pooling

Security

Is my data safe?

Yes! All processing happens locally. Your data never leaves your machine (unless you're using remote embeddings with OpenAI API).

Can it be hacked to run dangerous queries?

No. Multiple safety layers:

  1. Keyword blocking (DROP, DELETE, etc.)
  2. Query validation
  3. Read-only database user (optional but recommended)

Should I use it in production?

Yes, but add:

  • Authentication (JWT, OAuth)
  • Rate limiting
  • HTTPS/SSL
  • Database user with minimal permissions
  • Logging and monitoring

See Deployment Guide for details.


Troubleshooting

Backend won't start

"Database connection failed"

  • Check credentials in .env
  • Verify PostgreSQL is running: psql -U postgres
  • Test connection: psql -h localhost -U postgres -d dbname

"Could not connect to Ollama"

  • Check Ollama is running: ollama list
  • Start Ollama: ollama serve
  • Pull model: ollama pull llama3.2

"Port 8000 already in use"

# Find and kill process
lsof -ti:8000 | xargs kill -9

Frontend shows blank page

  1. Open browser console (F12)
  2. Look for errors
  3. Common issues:
    • Backend not running
    • Wrong API URL in App.jsx
    • CORS errors

Queries return errors

"Unsafe query"

  • Query contains blocked keywords
  • Try rephrasing without DELETE, DROP, etc.

"Query execution failed"

  • SQL syntax error (model made a mistake)
  • Table/column doesn't exist
  • Try rephrasing the question

Slow performance

  1. Check Ollama is using GPU: ollama ps
  2. Optimize PostgreSQL (see Performance Tuning)
  3. Try smaller model: ollama pull llama3.2
  4. Add database indexes

Embeddings / Semantic Search

What are embeddings?

Vector representations of text that enable semantic search - finding similar items by meaning, not just keywords.

Do I need embeddings?

No! The basic text-to-SQL works great without embeddings. Embeddings add semantic search capabilities but are optional.

How do I enable embeddings?

  1. Get OpenAI API key
  2. Run python generate_embeddings.py
  3. See Embeddings Guide

Can I use local embeddings (without OpenAI)?

Yes! You can use:

  • sentence-transformers (Python library)
  • Ollama embeddings API (experimental)

Development

Can I contribute?

Yes! See CONTRIBUTING.md

How do I add a new feature?

  1. Fork the repository
  2. Create feature branch
  3. Make changes
  4. Add tests
  5. Submit pull request

Can I customize the UI?

Yes! Edit frontend/src/App.css to change colors, fonts, layout.


Licensing

Can I use this commercially?

Yes! MIT License allows commercial use, modification, and distribution.

Do I need to credit the original author?

Not required, but appreciated! 😊


Still Have Questions?


← Back to Home

Clone this wiki locally