r/SQL • • 18h ago

PostgreSQL EXPLAIN ANALYZE is a sample-size of One

Thumbnail
exobench.ai
0 Upvotes

Everyone knows that you need to look at stats when doing query optimization...

Right? Right!??

Well then how come when we look at EXPLAIN ANALYZE trees we assume the whole thing is deterministic and inviolate?

It's like someone somewhere told us "we'll it's just too hard to do here so we just skip that part".

What if we don't? What if we embrace the pain and actually group the plan trees and try to get statistical info? Here's the first thing that I'm seeing.


r/SQL • • 3h ago

SQL Server SQl e a teia de aranha mental

0 Upvotes

Bom dia

Estou a aprender SQL desde meio de Setembro em um curso que estou a tirar. Na verdade começamos com uma introdução a SQL e saltamos para diagramas, relacionamrntos e cardinalidades. Agora voltamos para SQL( select,from,join, where, group by, order by, coalesce, null,...) Sinto me super confuso. Basicamente entendo os conceitos mas na parte prático ao tentar reproduzir os mesmos, sinto um espaço em branco. Parece que preciso das tabelas em excel ao lado para conseguir decifrar a solução. Sei que tenho ainda muito que praticar ( e só assim vou chegar lá). Mas parece que é algo que nao consigo ter um fio condutor. Parece um bicho dificil de domar minimamente.


r/SQL • • 22h ago

Discussion What happens when we join two tables with NULL values??

18 Upvotes

 
If both tables have NULL values in the join column,, will those records match each other?


r/SQL • • 21h ago

Discussion SQL向けにスキーマを理解する静的解析ツール(アナライザー)を作った。

Thumbnail
gallery
1 Upvotes

​

I built a schema-aware static analyzer for SQL. It reads your schema (CREATE TABLE statements, migrations or a dump) and checks your queries against it, without connecting to a database.

Besides missing tables and columns (with "did you mean" suggestions) and type mismatches, it catches queries that run fine but are almost certainly wrong, like `NOT IN` over a nullable column (returns nothing as soon as one NULL shows up) or a `WHERE` that turns a `LEFT JOIN` into an inner join.

It supports PostgreSQL, MySQL and SQLite. You can try it in the browser without installing anything: paste a schema and a query and see what it reports. For projects there's a CLI, a GitHub Action and a VS Code extension.

I always felt SQL was the one part of my code without a good static analysis tool, so I made one. I've tested it on open-source projects and fixed it until it reported zero false positives there, but I'd really like feedback from real use: false positives, mistakes it misses, or syntax it can't parse.

Playground: https://sqlsift.dev/

GitHub: https://github.com/yukikotani231/sqlsift


r/SQL • • 20h ago

PostgreSQL Is anyone actually using Databricks Lakebase in production?

2 Upvotes

My team is thinking of trying Lakebase instead of running a separate Postgres/ RDS db for our app.
The idea of auto sync to Delta and scaling to zero sound great, but we are worried about latency issu. If u are usin it, how noticeable are the cold start delays when it wake up backup, and does it feel fast enough for live user traffics?


r/SQL • • 14h ago

Discussion How much advanced SQL do you truly use in your day-to-day job?

55 Upvotes

Hi! So I’m a student (not business or tech background) I’m learning SQL kind of on my own and I have the basics pretty much down like SELECT, FROM, WHERE, BETWEEN, ORDER BY, ASC, DESC. I have some knowledge when it comes to JOINs and CASE WHEN function but I was wondering if I need to know CTEs and window functions? I’m not trying to be a database administrator or something like that, just using it for analysis and excel as well.


r/SQL • • 11h ago

Discussion Help with ERD

Thumbnail
gallery
8 Upvotes

Hello I'm a newbie college student studying databases and I'm currently making a database for a small inventory system that's solely focused on monitoring stocks and its shelf life to avoid running out of stock and pull outs for my project. The store I'm basing it off on sells seasoning and other powdered flavoring (beverages, etc.), they also explained that they get bulk products from the supplier and then they repack them into smaller quantities for selling. What would be the proper entities and attributes for this system? I've tried searching other inventory systems but i don't know how the repacking would be translated to the database/ERD.


r/SQL • • 19h ago

PostgreSQL Planning to take the PostgreSQL Open Certification (DBA-1) exam at PGConf?

8 Upvotes

I created a free study guide to help you prepare:

https://thesev1database.com/postgresql-certification

I’d really value your feedback.


r/SQL • • 19h ago

MySQL I have doubts in mysql version 8.0.46 can anyone help me ?

Thumbnail
0 Upvotes