r/Database • • Sep 09 '25

Mongo or Postgre or MySQL

65 Upvotes

How to figure out which database to use for a project (probable startup idea)

there are likes, comments, reviews, image uploading and real users involved

its a web application for now, later to be converted to a PWA and then a mobile application hopefully


r/Database • • Sep 06 '25

Explore and learn the basics of SQL via typing practice

63 Upvotes

Hello 👋

I'm one of the software engineers on TypeQuicker.

Most of my previous jobs involved working with some SQL database (usually Postgres or MySQL) and throughout the day, I would frequently need to query some data and writing queries without having to look up certain uncommon keywords became a cause of friction for me.

In the past I used Anki cards to study various language keywords - but I find this makes it even more engaging and fun!

Helpful for discovery, learning and re-enforcing your SQL skill (or any programming language or tool for that matter)


r/Database • • Dec 20 '18

The Guardian newspaper switches from MongoDb to PostgreSQL

Thumbnail
theguardian.com
60 Upvotes

r/Database • • Aug 19 '18

Database Joke

59 Upvotes

My husband told me I should post this here since none of my friends understand my humor and I have no one to tell.

I’m a Cognos report developer/data analyst and I’m working closely with our data architect to get the data warehouse where we need it so I can build reports. One morning when I came in to work, my report showed No Data Available, so the data architect investigated why. He said the SSIS job hadn’t run for some reason. I said, “Poor SSIS, it didn’t wanna work, we don’t pay it enough, maybe it should join a union.”

Anyways, thanks for listening. Had to get it out of my system.


r/Database • • Oct 25 '11

SQL Server's Transaction Log - Why you need one, and what it does.

59 Upvotes

I started to write a reply to lockes, who was asking about why we need a transaction log. It was long enough, so I figured I'd share it here.


The transaction log is perhaps one of the most misunderstood parts of SQL Server's architecture, and is one of the most integral components of each database.

Why do we need a transaction log? Consider the ACID properties of transactions: Atomicity, Consistency, Isolation, Durability (http://en.wikipedia.org/wiki/ACID). Durability is the property that the transaction log assists us with - "once a transaction has been committed, it will remain so." The effect of this, is once your database engine tells you that the transaction is complete, it HAS to stay that way. This means that the transaction must be stored on disk, otherwise, if you have a power failure and your change was only in memory on the database server, you may restart your database engine and find that your change wasn't persisted.

OK, so we have to write the changes to disk before we can return a successful commit back to the application. A SQL Server database stores its rows on 8 KB pages, which can be laid out anywhere in the data file (.mdf or .ndf file extensions). A page can hold many rows (if each row is 20 bytes, you can fit about 400 rows on the page). Pages are the smallest unit of reading and writing, so if you modify one row on the page, the entire 8 KB page is written back to disk.

Imagine if you update 100 rows in a single transaction (UPDATE Products SET Price = Price + 1). Some of these rows could be at the start of the data file, some in the middle, and some at the end. You would need to drag the disk head to each position on the disk, write the updated page to disk (an 8 KB write), and move onto the next location, waiting for the disk to spin, and the disk head to move each time.


Enter the transaction log. Instead of making a randomly placed 8 KB write for each page that needs changing, the transaction log is a sequential file, capable of writing in 512 byte sectors (a sector being the smallest sized disk write operation). As it's sequential, you don't need to wait for the disk head to move to the next position to write the next change - the next position is already right under the disk head. This means you can lay the changes down on disk very rapidly, which keeps the end user happy.

While we are writing the change to the transaction log, we're also updating the in-memory version of the data page. Later on, a process named the Lazy Writer will come and commit these "dirty" data pages to disk. If you lose power, then all the dirty data pages in memory will be lost, but we have a record of all changes that occurred in the database. Each operation in the transaction log has a Log Sequence Number (LSN), which is like the odometer in your car - it's a unique, ever increasing number. Each data page records which LSN was last used on that page, and when the database starts up, it will scan through the transaction log, and check to see that each operation in the log has been changed on the data page (i.e., the Lazy Writer successfully wrote that page back to disk). If it hasn't, the change is made to the data page again (not re-written to the transaction log). The end result is that the database is back in a consistent state.

Note that we can also rollback a transaction. This is controlled by the transaction log storing the previous value as well as the changed value. If the transaction is rolled back, the transaction log is read to get the previous value, and a new transaction log record is written to say that the row has been changed to the old value (in case the uncommitted value has been stored back to disk by the Lazy Writer- imagine a very long transaction of minutes or hours).


To re-iterate, the two main reasons for the transaction log are:

  1. Performance

  2. Durability

So, the transaction log is simply a list of all changes that have occurred in the database, whether data changes (as in our UPDATE example), or structural changes (grow a data file, or create new objects). This also gives us the ability to replay any operation that occurred in the database. If we take a copy of the database (a full backup), and then have copies of the transaction log from that point on, we can replay every operation and bring the database back to a consistent state at any point in time. For example, if you accidentally dropped a table, you can bring the database back to the point just before (either by a time (2:45pm), or by a specific LSN), and recover the data.

Another option is the concept of "log shipping". This is where you take your transaction log backups, and routinely (every few minutes) restore them onto another server. In the event of a distaster, you have a warm standby copy of the database ready to bring online.

This is a good place to take a rest.


To avoid running out of space, the transaction log needs to be reused at some point. At what point? How do we trigger this? This leads us to the concept of database recovery models, and the two most common are the "Full" recovery model and the "Simple" recovery model.

The Full recovery model puts all control onto the DBA. When you backup the transaction log, it will write the as-yet-un-backed-up log records to a backup file, and then remove ("truncate") the log. It will only truncate the log back to the point of the earliest open transaction, because it may need all the log records to roll back this transaction after the backup. If you don't back up the transaction log while in the Full recovery model, your log will continue to grow until you run out of space.

The Simple recovery model makes every thing easy. You don't back up the transaction log. When the log runs a "checkpoint" operation (triggered either by the DBA running "CHECKPOINT", or the log reaching 70% full), all dirty pages are flushed to disk, and the transaction log will be truncated (again, up to the point of the earliest open transaction). As you are not taking backups of the transaction log, you have no ability to restore to a specific point in time, as you don't have a complete log chain from the time of a full backup. The Simple transaction log only stores enough information to recover in the event of a loss of power.

There is another recovery model, Bulk Logged, which is similar to Full, but used when loading a large amount of data. It will log the changed extents (an extent is 8 pages, or 64 KB). This can be a lot more efficient than logging "now change this row, now change this row, now change this row", which could add up to more than 64 KB inside the log.


Sorry for the length - transaction logs are a complicated topic, and it's hard to get just the right amount of internal detail vs concepts! Any questions or comments?


r/Database • • Jul 02 '26

yesterday

57 Upvotes
yesterday
all those backups seemed a waste of pay
now my database has gone away
oh i believe in yesterday

suddenly
there's not half the fields there used to be
and there's a deadline hanging over me
the update ran so suddenly

i set something wrong
what it was, i could not say
now my column's gone 
and i long for yesterday-ay-ay-ay

yesterday
the need for backups seemed so far away
i knew my data was all here to stay
now i believe in yesterday

r/Database • • Nov 07 '25

MariaDB vs PostgreSQL: Understanding the Architectural Differences That Matter

Thumbnail
mariadb.org
57 Upvotes

r/Database • • Jul 21 '25

Database Schema Review

Post image
56 Upvotes

I'm planning on making a Fitness Tracking app with Users for my project and I wanted it to be a fully featured system. I've based it on a fitness program I applied for. This spreadsheet (spreadsheet not mine) is what I based the schema on.

I'm having trouble whether I should just put all the daily metric tracker in one table (hence DailyMetrics table) and omit every individual trackers to remove redundancy or keep it to have a more verbose information for each trackers made by the student.

Also, is my idea of habit tracking tables also correct?

If you'd like to see more of the diagram, you check it here

I'd appreciate every insight and criticism about my approach!


r/Database • • Jul 12 '11

How I landed my DBA job.

Thumbnail
imgur.com
56 Upvotes

r/Database • • Nov 29 '16

Say NO to Venn Diagrams When Explaining JOINs

Thumbnail
blog.jooq.org
55 Upvotes

r/Database • • Jul 24 '26

What's new in Postgres 19

Thumbnail
planetscale.com
54 Upvotes

r/Database • • Sep 18 '25

Elasticsearch Was Never a Database

Thumbnail
paradedb.com
53 Upvotes

r/Database • • Jan 07 '20

How do I create a database from scratch (something similar to mysql)

53 Upvotes

Hello.

I'm currently a junior in university and I have been messing around with SQL for years. I'm familiar with SQL and noSQL DB's, and the next step I want to take is to create a database from scratch (and make the query language etc). The latter should be done with grammars/compilers which wouldn't be too difficult. How do I actually make the database part itself? I' probably will have to use Rust / C++, don't think I can do transactions in Python, but I would like to do it in Python if possible.

Any resources you guys would recommend / research papers to read? Trying to do it as a side project for fun.

Thanks.


r/Database • • Apr 23 '20

Things I Wished More Developers Knew About Databases

Thumbnail
medium.com
52 Upvotes

r/Database • • Oct 28 '14

th RDBMS family tree

Post image
52 Upvotes

r/Database • • Apr 02 '23

There seems to be an anti-RDBMS cult out there

51 Upvotes

In the early 2000's many dot-com startups realized that DBA's didn't understand a start-up's needs, and thus "got in the way" of "moving fast and breaking things". Therefore, they started avoiding the RDBMS and/or DBA's by reinventing many of their features in app code. The RDBMS started being used a mere "dumb storage" with other functions being moved to app code.

There was a culture-misfit problem, I don't dispute that. But it's not a technology problem, but a management and training problem. DBA's needed to be educated on start-up practices and needs.

RDBMS skills thus atrophied, and such shops grew used to doing everything through apps and app interfaces (web-services & microservices). I'm open to new ideas, but I don't see their app-centric approach to data as an improvement. RDBMS do most data-oriented things BETTER because they are built with data in mind. It's also just wasted busy-work to JSON-itize everything, being more total code, more layers, and more things to manage and break.

For example, a stored procedure is often the simplest solution, but instead they make it a JSON web service. KISS usually dictates a stored procedure. And the database can also often be used as a communication conduit between many "sub-apps" (a non-monolith) such that a JSON interface layer is wasted busy work. YAGNI dictates "skippit!".

Many pro-appers will say "microservices can do X but RDBMS can't." I prove them otherwise, and they say, "well, um, but it's harder in a RDBMS". It usually turns out that it's "harder" because they are app coders, not DBA's or don't want to hire DBA's because they are used to appers and app-centric thinking. Top managers in many startups are coders, not DBA's, and so view every problem through an app-coder's perspective.

(Maybe for giant companies or non-critical "web-scale", RDBMS are not a good fit, but my observations focus on non-giant orgs. The app-centric approach may be better for "web scale", I don't know and can't say, but most readers probably don't work for Netflix-sized. The JSON fans also claim JSON-wrapping makes it easier to swap DB brands, but I'm skeptical; plus it's rare enough to not spend layers up front on it: YAGNI. When they overhaul a DB, a shop usually also overhauls the apps, making 1-to-1 swapping moot.) [edited.]

And also many current IT managers came up as a coder, and thus think app-first instead of database first, and thus don't understand how to leverage a database. At the very least, I sense a culture conflict: the Appers vs. DBers. Sometimes they imply DB-ing is obsolete and that I'm just a nostalgic geezer. However, I don't see the JSON-way a net simplifier. The Appers can't show clear-cut simplification. (The challenge still stands, bring it on!) The youngbies are just not used to fully leveraging the DB.


r/Database • • Apr 06 '25

Took me 6 months but made my first app!

50 Upvotes

r/Database • • Aug 25 '21

Plus It's An Oracle Shop

Post image
50 Upvotes

r/Database • • Jun 27 '26

Need advice: Understanding complex SQL scripts written by others

49 Upvotes

Hi everyone,

I need some advice from experienced SQL developers.I was working on different profile and switched to data engineering 6 months back.

I consider myself good/medium at writing SQL queries and solving problems from scratch. However, I struggle when I have to understand large existing SQL scripts (300–500+ lines).

I often get confused about:

Where the execution starts.

How different parts of the script are connected.

Which variables, CTEs, stored procedures, or temporary tables are affecting the final output.

How to mentally trace the flow of the script.

Because of this, reading someone else's code takes me much longer than writing my own.

How did you improve this skill? Are there any techniques, exercises, books, or real-world practices that helped you become comfortable reading large SQL scripts?

Also, is this something that simply improves with experience, or is there a structured way to learn it?

I'd really appreciate any advice. Thank you!


r/Database • • May 05 '21

HELP! I want to become a database administrator but have no clue where to begin!

49 Upvotes

I am a Junior in college and I am in the process of getting my Bachelor's degree for Business Administration with my focus on Information Systems. I'm currently taking the semester off (which is almost over) because school is too expensive and I needed more time to save money for it since I was in the process of moving to another state. I have recently come to the realization that I know absolutely nothing about databases. I still have about 2 1/2 years left before I get my Bachelor's but I'm no longer worried about the time I spend in school. I was hoping that other database administrators can explain the journey they took to get to where they are. I was doing some research and saw that most of the IT personnel get into their field by starting off doing help desk stuff but unfortunatey I don't know a lot about computers because I genuinely have barely learned anything that'll help me gain this knowledge through school. I went to community college and completed their pathway for my dream job to get into my current college which is known for being good for info systems and that kind of stuff. I hope this isn't too confusing but I just need more guidance on where to start, free or affordable boot camps to just start teaching myself, some requirements that most places have to even apply for a database administrator position, etc. Literally anything will help. Thanks !


r/Database • • Sep 13 '26

What would likely happen to Oracle database support if an AI bubble pop bankrupted Oracle?

48 Upvotes

Oracle the company is heavily leveraged on the bet AI will provide notable revenues soon. If that fails to materialize due to competition or other events, Oracle could end up in financial trouble and have to file for bankruptcy.

If so, what would likely happen to Oracle database support and progress? Which company or billionaire would likely buy up the discounted assets, if any?

This is a practical question for shops with a fair share of existing Oracle databases or apps. Perhaps an unlikely scenario, but not entirely far fetched.


r/Database • • Jun 25 '25

6 Data Structures to Save Storage

Post image
48 Upvotes

r/Database • • Sep 26 '24

Why do I hear ribbit noises whenever my dad is working?

48 Upvotes

hi i'd like to ask why do i hear ribbit noises whenever he's working.. i assume it's a database thing because my dad works in databases but when i search "database ribbit" up on google nothing works.. so i'd like to ask why is there ribbit noises? i can't ask him because when i do he just gives me an answer of like he's busy and databases and all that.. please someone help thank you


r/Database • • 13d ago

DigitalOcean, this is not how you launch an "Advanced" Postgres database...

47 Upvotes

Hey guys, for those of you using DigitalOcean: you may or may not know they're phasing out the Standard-tier Postgres plans in favour of a new Advanced tier on November 30.

Naturally, I benchmarked both to see if there was a difference. The results were so atrocious they defied my belief.

- Up to 436% higher p99 write latency (6.7 ms → 35.9 ms).

- ~50%-70% fewer write and read throughput

the new tier tops out at ~54k reads/s & 6.9k writes/s, versus the old Standard tier's 204k reads/s & 26.5k writes/s max.

- 5x slower startup times: 3m 19s → 16m 06s, averaged across 15 regions.

The results were averaged over 3 runs per DB, for all possible DB sizes (2->32vCPU).

This was done over two weeks of testing, running around 60 hours of wall-clock time and going through 100+ databases. It cost me a few hundred dollars to run.

If interested, I posted the full results & methodology on my blog post.

I believe the bottleneck is a fixed-process PgBouncer deployment. But I don't consider myself an expert in databases so would really appreciate if you could double-check my logic.