r/SQL • u/SippingOnLean4 • 5d ago
SQLite Using Lean to formally verify an optimised SQLite B-tree traversal
r/SQL • u/SippingOnLean4 • 5d ago
r/SQL • u/thisismugisha • 5d ago
r/SQL • u/Big-Somewhere-7132 • 5d ago
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 • u/shdw_0x0 • 5d ago
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 • u/clakshminarasu • 6d ago
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 • u/Global-Apartment-872 • 6d ago
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.
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 • u/Formal_Ad_626 • 7d ago
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 • u/UpstairsPrimary7449 • 6d ago
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 • u/erinstellato • 8d ago
r/SQL • u/Wise_Ear_4064 • 8d ago
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.
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:
To turn it on:
agentbricks memory pipeline update <pipeline-id> --trigger always-onHas 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.
Which one is more efficient?
r/SQL • u/neprotivo • 8d ago
r/SQL • u/innovatorved • 9d ago
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 • u/__cybermaxs__ • 9d ago
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:
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 • u/__cybermaxs__ • 10d ago
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:
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 • u/DiegoValladaresCL • 10d ago
r/SQL • u/Sea-Ad7805 • 10d ago
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:
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.
r/SQL • u/casmanrojo • 10d ago
Im somewhat new to SQL and i want to apply it to my personal life so its easy to keep my skills and knowledge of it fresh since its what i want to do in the future.
I was thinking about setting up a local PostgreSQL database to use with VSCode on my personal computer to just monitor and record my everyday things like my banking/budgeting, random projects that i fall into a hole working on, etc.
I wanted to get some opinions on if this is a good idea, is it safe security wise, is there a better way to go about this, should i just scrap this idea, etc.
Please let me know and educate me!
Everytime i look it up its mainly about business related things like for creating apps etc. but i dont really plan on using it for anything other than my personal projects and plans.
(I chose postgresql because its just one of the more common ones ive seen in job postings etc. and i saw its pretty much free locally)
r/SQL • u/deusaquilus • 11d ago
My write-up, measured on PG17, PG18 and PG19rc2. Declare both columns NOT NULL and PG19 runs NOT IN as an anti join: 1.1 s on PG18, 0.06 ms on PG19. Leave one nullable, even with zero NULLs in it, and PG19 skips the rewrite and stops hashing the list at 154,199 rows instead of 262,144, so 44 ms on PG18 became 101,734 ms. NOT EXISTS was fast on all three.