r/SQL • • 5d ago

Discussion How practical are ERDs when coding?

Post image
0 Upvotes

It was my belief in the beginning of 2025 that this project would help ppl who work with databases. There were three main ideas I thought should be different from how it's been done for decades:

  1. There should be no proprietary syntax.
  2. ERDs must be rendered on the fly while coding (so no need for a separate tool or website)
  3. Cursor on a code segment must render that exact schema instantaneously (vs. rendering giant schemas all at once).

What's you perspective on this in 2026?


r/SQL • • 5d ago

BigQuery Is SQL becoming obsolete?

0 Upvotes

I had an interest with sql when mentioned by a minor subject of mine and its relation to my current major management accounting. I would like to learn and add that to my future resumé but I can help but feel its useless now because of AI where english words are automatically translated into codes. So is there a demand for this in the future? Or should I focus my resources elsewhere?


r/SQL • • 6d ago

SQL Server Wire level intelligent response caching solution for SQL Server - Change Tracking Mode

3 Upvotes

Hey, I've posted before on some of my custom TDS listener stuff. All custom TDS wire protocol in c#. I think this one is probably my most useful one so far. I had posted one earlier on the first cut TTL mode, but this demo covers the more sophisticated one, the change tracking mode.

Full Open Source Code (MIT): https://github.com/TroBeeOne/DaffyZoom
Nuget Install and Instructions: https://www.nuget.org/packages/Daffyzoom
Hour long podcast on how it works (it's ~98% correct but it made a couple mistakes): https://www.youtube.com/watch?v=mwMDmuLjCCY

What it does:

- It solves the problem of 1000+ repeated slow queries that are hitting stale tables. It also helps you identify those slow queries so you can 'actually fix' the indexes, plans, the proper way.

- Sits on the wire in-between client and SQL server

- On the return from SQL Server message it tee's the call, one sync back to client, another async to my caching system. If a repeat query (above 5 second default setting) if tables haven't changed, it now returns instant cache, 0 seconds. if table changed? it reruns the 7 second query and updates the cache on the way back..

- I have data warehouse mode, ttl, just caches everything repeated. with expiration.

- I have change tracking mode (this is the demo I'm showing today). This caches unless a change is made, then it runs the query as normal and refreshes cache.

- Change Tracking Mode requires change tracking enabled on target tables for repeated query. You might think, well, we're now hitting SQL Server 2 times? Yes, but the check is a microsecond. And if you're serving cache from a 10 second query instantly, and ppl are hitting that report at 8am 1000 times, you saved some compute time and made your clients super happy!

- I DO support Entra Service Credentials, but I do not support MFA. I also don't support kerberos yet, I could, but that would require me setting up a domain controller VM, and with little interest so far, no incentive.

Anyway, I haven't tested this in a major production environment yet, so if you do choose to try it, as with anything, test it well and let me know if you find issues.

Here's the demo, cheers. If you try it and run into questions or have issues, let me know. It only caches long queries. It doesn't poll SQL Server for all queries, only the slow ones. It doesn't cache things with getdate() or CRUD related operations obviously. Its all in the documentation / code.


r/SQL • • 6d ago

SQL Server How much does Microsoft Azure SQL Database actually cost per month for personal learning?

3 Upvotes

I'm currently learning SQL Server and exploring Azure SQL Database. I have created a few databases for practice, mainly to practice SQL queries, tables, relationships, stored procedures, and other database concepts.

I'm curious about the actual monthly cost of running a few small databases on Azure.

I have a few questions:

How much does it cost monthly to host 2–3 small Azure SQL databases?

Do databases incur charges even when they are not being used?

Is there any free tier or student offer available for Azure SQL Database?

Which is cheaper for learning purposes: DTU-based pricing, vCore, or Serverless?

Can Serverless automatically pause the database when it's idle and significantly reduce costs?

Are there any hidden or additional charges for storage, backups, or other services?

Is it possible to use Azure SQL for practice without spending much money?

I am looking for real experiences from people who have used Azure SQL Database, especially students, developers, or beginners who use it for learning and personal projects.

I would also appreciate it if someone could share their approximate monthly bill for a small database setup and suggest the most economical option for a beginner.

Thanks in advance!


r/SQL • • 6d ago

SQLite Using Lean to formally verify an optimised SQLite B-tree traversal

Thumbnail
reddit.com
2 Upvotes

r/SQL • • 6d ago

PostgreSQL Text column is storing accented text weirdly

Thumbnail reddit.com
0 Upvotes

r/SQL • • 5d ago

PostgreSQL If JOIN combines tables, why do we have so many different types of JOINs?

0 Upvotes

I understand how joins work in SQL, but I've always wondered why we need so many variations like INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.

At the end of the day, we're just joining two tables based on a condition. Is the difference mainly about deciding which rows to retain when there isn't a match, or is there more to it than that?

Curious how others think about this, especially when working with real-world queries. Is there a particular join type you find yourself using most often, and why?


r/SQL • • 6d ago

SQL Server Negative reseed risks

8 Upvotes

One of the Sqlserver tables had an int identity column and maxed out the value. Team planned to reseed the identity from the lowest-ve value so that it can run on the same datatype for another 5 or 6 years. I am thinking that this would be a costly mistake if they plan to migrate this data into a new platform. The original solution was to change this to a bigint. Since this field has 300+ fks all those need to be dropped and recreated. What could possibly go wrong by choosing a -ve value reseed? I see the daily seed count is topping approximately 1 to 1.5million ids.


r/SQL • • 7d ago

PostgreSQL Foreign keys for array column elements

7 Upvotes

Postgres foreign keys can't check the elements of an array column, so a
product_ids bigint[] can hold ids that don't exist, and deleting the referenced
row leaves them dangling.

I wrote an extension that enforces it with triggers:

SELECT anyfk.add('orders(product_ids)', 'products(id)');

Feedback welcome.

https://github.com/Vinnu124/pg_anyFK


r/SQL • • 7d ago

PostgreSQL Have u run Databricks Lakebase for AI agent RAG…

0 Upvotes

If you have, how did Postgres vector + BM25 search hold up in prod As compare to a dedicated vector DB, specially on cold starts?


r/SQL • • 8d ago

PostgreSQL Where did I go wrong?

Thumbnail
gallery
29 Upvotes

For context, photos 1-2 show the original prompt + my answer. Photo 3 shows the solution. The output is somewhat similar to the correct answer, but not quite the same.

When I move the "status = 'Completed'" either to the "WHERE" section or to the JOIN section as "AND status = 'Completed'" it solves the problem, but not sure exactly why.


r/SQL • • 7d ago

MySQL Two production CAP traps I rarely see covered in interview guides (MySQL Group Replication reads & Cassandra QUORUM)

2 Upvotes

Most CAP explanations stop at labeling MySQL "CP" and Cassandra "AP", which falls apart once you look at default configs:

1. MySQL Group Replication is CP on writes, not reads by default. A 2-of-3 majority commit guarantees two nodes certified the transaction, but the third node can still lag slightly while applying its queue. Because group_replication_consistency defaults to EVENTUAL, a normal read on that lagging node still returns stale data unless you route critical reads to the primary or enable BEFORE_AND_AFTER.

2. Cassandra W=QUORUM + R=QUORUM is not strict linearizability. If a coordinator writes to R1 and crashes before reaching R2/R3, the client sees a write error — yet a subsequent quorum read hitting R1 triggers read-repair and resurrects the "failed" write. True linearizability requires Paxos Lightweight Transactions (SERIAL).

If anyone prefers a visual walkthrough of these failure modes alongside the 2018 GitHub 43-second partition and PACELC, I put together an animated deep dive here: https://youtu.be/17j1S5OOOAM


r/SQL • • 9d ago

SQL Server Friday Feedback - increasing the number of steps in the histogram

Thumbnail reddit.com
12 Upvotes

r/SQL • • 9d ago

PostgreSQL Databricks Agent memory pipelines can now run always-on (Beta)

6 Upvotes

Disclosure: I'm a Solutions Architect at Databricks.

Agent memories can lag behind conversations. If a user corrects your agent on which revenue source to use, that fix might not reach memory until the next ~24-hour scheduled run.

Memory pipelines distill facts, preferences, and corrections from session history into a memory store backced by Lakebase. They can now run always-on, so they process conversations as they happen.

  • Fresher memory: corrections can show up in later conversations the same day.
  • Hands-off: no runs or schedules to manage.
  • Incremental: each run processes only what's new since the last checkpoint.

A run starts for an actor when one of their sessions has 10+ new items, or has at least one new item and 30 minutes of inactivity.

Things to know:

  • Maintenance applies to all of an actor's memories, including ones the agent saved directly.
  • It's in Beta.

To turn it on:

agentbricks memory pipeline update <pipeline-id> --trigger always-on

Has anyone tried memory pipelines yet? Are you using Lakebase today? Are you running them on a schedule or always-on? To try it today, install databricks-agentbricks 0.7.0+. The identity creating the pipeline needs access to both stores and the distillation model.


r/SQL • • 9d ago

PostgreSQL So for my SQL schema should I make it so my post table has an array filled with tags (3 at most) and I search for those tags using ARRAY_CONTAINS or should i just make a table for tags and link the posts as a foreign key?

5 Upvotes

Which one is more efficient?


r/SQL • • 9d ago

SQLite Belay - formal verification for SQLite statements

Thumbnail
vihren.dev
7 Upvotes

r/SQL • • 10d ago

PostgreSQL PostgreSQL 19 Released!

Thumbnail
postgresql.org
68 Upvotes

r/SQL • • 10d ago

Discussion I built a free, open-source interactive guide to SQL & Database Internals with an in-browser WASM SQLite 3 workbench

17 Upvotes

Hi everyone,

I wanted to share a free, open-source project I've been building called SQL in Depth, aimed at going beyond basic SQL syntax into database internals from first principles.

Live site: https://sql-in-depth.vedgupta.in

GitHub repo: https://github.com/innovatorved/sql-in-depth

What's included:

- 180 structured units covering relational theory, indexing, storage engines, query planning/execution, transactions, and concurrency

- 36 interactive simulators to visualize how database internals actually behave

- An in-browser WASM SQLite 3 Workbench so you can run queries and experiment directly without local setup

- A Table-Level Relational Visualizer to inspect joins, filtering, and relational operations step by step

Everything is free, open-source, and runs directly in the browser. I'd really appreciate any feedback from the r/SQL community — especially on topics that could go deeper, edge cases in the simulators, or anything that could be made clearer.


r/SQL • • 9d ago

Discussion I made a free set of 54 short SQL exercises that tell you *why* your query is wrong, not just that it is

Thumbnail
reddit.com
1 Upvotes

r/SQL • • 10d ago Bravo

PostgreSQL I made a PostgreSQL EXPLAIN ANALYZE visualizer that does the loop arithmetic for you

Post image
28 Upvotes

This is PostgreSQL only. Paste EXPLAIN ANALYZE output, JSON or text.

The numbers in a plan are per loop, and EXPLAIN leaves the multiplying to you. rows=3 loops=206880 is 620,640 rows. The page does that arithmetic and draws it:

  • The thicker the line, the more rows went through it, and the key spells out the sum from your own plan: 621K rows = 3 × 206,880 loops.
  • Where the planner’s guess was off by more than 2×, the guess is drawn on the line: planner guessed 612, got 207K.
  • Each node’s time is its own, without its inputs, so the times add up to the run.
  • Copy link puts the plan in the link itself, after the #, so you can drop it into a Slack thread or an answer here. Nothing is uploaded; whoever has the link has the plan.

https://seqora.dev/explain/

No account. It draws one plan at a time and can’t see your database, so no index suggestions.

I make Seqora, a desktop database client, and this is its plan view. In the app it runs EXPLAIN on your own connection, and that part is Pro (14-day trial, no card). The page is free.

The key and the plain-words help came from comments on an earlier post. If it draws one of your plans wrong, send me the link.


r/SQL • • 10d ago

Discussion I made a free set of 54 short SQL exercises that tell you *why* your query is wrong, not just that it is

0 Upvotes

Hi, I'm a data engineer and I built SQL Dojo https://sqldojo.dev to practise SQL the way I wish I had learned it: lots of short steps, each one checked, with an explanation when you get it wrong.

What it looks like:

  • Each step asks a question about a realistic dataset (an online shop, a SaaS, product events…) and checks your result.
  • When it's wrong, it tells you how: too many rows, missing rows (and which ones), values that differ, and the likely cause, like a join that duplicates rows or a NULL hiding in a NOT IN.
  • A "step by step" view runs your query one clause at a time, in the order the database actually runs it (FROM, then WHERE, then GROUP BY…). This is the thing that made SQL click for a lot of people I've taught.
  • Spaced reviews bring back the steps you struggled with.

It runs in your browser: no install, no database to set up, no account needed to start.

The white belt (54 steps, about 3 hours, from your first SELECT to joins and GROUP BY) and the reference library are free. The later belts (window functions, CTEs, data modeling, interview runs) are a one-time payment, no subscription, and you don't need them to get value from the free part. There a also a practice section with real datasets.

I'd really like feedback from people learning right now: where did you get stuck, was an explanation unclear, is the pace right?


r/SQL • • 10d ago

BigQuery He creado una extensión gratuita para Chrome que muestra cuánto costará una consulta de BigQuery antes de pulsar Ejecutar.

Thumbnail
reddit.com
0 Upvotes

r/SQL • • 11d ago

BigQuery BigQuery Query Optimization: Myths vs. What Actually Saves Money

Thumbnail
alvin.ai
12 Upvotes

r/SQL • • 11d ago

SQLite Learning SQL with Python?

Post image
1 Upvotes

This 👉interactive SQLite demonstration helps student understand relational databases.

The sqlite3 extension of 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 makes database content visible alongside Python's data structures. The demo shows how to:

  • Create tables with primary and foreign keys.
  • Model relationships between students, courses, and teachers.
  • Insert data and observe how the database changes.
  • Combine multiple tables using SQL JOIN operations.
  • Use parameterized queries.

The final query answers a seemingly simple question: Which teachers teach Alice, and for which courses? Answering this question involves joining five tables!

With 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡, students can step through the Python program and inspect the database content at every step, directly in their browser, without installing anything.

See 👉other 𝐦𝐞𝐦𝐨𝐫𝐲_𝐠𝐫𝐚𝐩𝐡 visualizations.