r/mysql • • Jan 11 '26

discussion MySQL users be warned: git commits in mysql-server significantly declined 2025

Thumbnail
optimizedbyotto.com
167 Upvotes

r/mysql • • Jul 21 '26

discussion Leaving MySQL after 25 years of reliable stability

67 Upvotes

I figured I'd write a reality-based "kudos" on MySQL.

I run a small software company. In 2001, I made a website content manager that ran on MySQL 4. It is somewhat similar to what WordPress would become, though it predated WordPress by a couple of years.

I am writing this in July of 2026. MySQL 4 has been rock solid, running my website, and other websites, for 25 years. I did not tinker with it. It kept working.

Yet, my paid software development work was not in MySQL. In that same 2001 time frame when I chose MySQL, I was approached by a client who wanted me to implement a Microsoft SQL Server database engine for their custom business software, which had until then been using Microsoft Access as its database engine.

They liked what I did, and wanted more. They remained my client for about 20 years, until COVID-19 hit them very hard: their main business involved in-person trade shows.

Over time, I became highly skilled in working with the Microsoft SQL Server database engine, including migrating Visual BASIC for Applications (a.k.a. VBA) custom program code from Microsoft Access into the database language of Microsoft SQL Server: Transact-SQL (a.k.a. T-SQL).

There were some compelling reasons to also migrate my website content manager from the MySQL 4 database engine to the Microsoft SQL Server database engine, since the latter was what I was most comfortable working with.

It’s like one of my automotive clients who standardized on using Ford vans and trucks, yet they also have one old International truck that just refuses to die, so they keep using it, and it keeps working.

I figured that leaving MySQL was not urgent, since I do know MySQL 4 well enough to be able to fix any problems if they were to arise. Yet, none did. 

The recent 25 years of my life have been tumultuous. The recent 25 years have been tumultuous for America too. So my attention often went to whatever was the newest crisis, not always to what made calm, strategic sense.

Also, as the saying goes: "If it ain't broke, don't fix it." So, I just stayed on MySQL for my content manager. For 25 years, the software based on MySQL 4 kept running flawlessly. But more impressively: MySQL 4 kept running flawlessly.

My website content manager is a fairly sophisticated piece of software that includes 119 database tables, A/B testing, various logs, and so on. The logs grew and grew … for 25 years.

Finally, the logs in MySQL 4 grew to be large enough to run the virtual machine out of disk space. Yes, I could have cleared the logs, but that doesn’t shrink the MySQL 4 database. Some additional work would be needed to make the database smaller again.  And that, I didn’t really want to do. Yes, I could have increased the disk space.  But …

I had lived the great American tradition, of kicking the can down the road, for 25 years.

I decided that if I was ever going to migrate away from MySQL, this was the best time. So I did. And now my website content manager runs on Microsoft SQL Server, where it is indeed easier for me (emphasis on "for me") to work with it, such as if I want to implement significant changes to the software, such as table structure changes.

I'm not saying Microsoft SQL Server is better than MySQL. But I'm reminded of the time when a colleague mused: "Sometimes, the best tool for the job is the tool you know best." There some merit to his argument (and, I concede, much merit to the contrary too).

After 25 years, I finally decommissioned the virtual machine on which MySQL 4 had been running.

That is a very long time for a database engine. So, a massive "kudos" to MySQL 4 and the people who made it.

For me, the migration was fairly intricate. I'd hoped it would be as simple as "download and run this conversion utility" but somehow that approach turned out to be non-viable for me. At some point, I stopped looking for easy solutions and I made my own process, and I powered through. No doubt: smarter people would have done it better.

Even so, if you might benefit from knowing the specific steps I took, feel free to ask.


r/mysql • • Apr 01 '23

discussion Some SQL Humor for Ya

Post image
55 Upvotes

r/mysql • • Jul 18 '23

question Granting Just-In-Time Access to Devs?

48 Upvotes

Got a bit of a head-scratcher here and was hoping some of you might have some bright ideas.

We're scaling, so we deal with more devs needing access and increased potential for things to go wrong and break. What we want to do is give JIT access.

Here's what we're hoping for:

Something that can dynamically grant access based on rules or triggers.

Quick setup and maintenance

Won't slow our databases down substantially

Any thoughts or tips on what we can use?

Thanks!


r/mysql • • Aug 27 '26 Mindblown

discussion 4 SQL mistakes that don't throw an error - they just give you the wrong answer

47 Upvotes

One of the most dangerous things about SQL:

A query can run perfectly… and still be completely wrong.

Here are 4 mistakes I wish someone had shown me earlier.

1. Accidentally turning a LEFT JOIN into an INNER JOIN

SELECT c.id, o.total
FROM customers c
LEFT JOIN orders o
    ON c.id = o.customer_id
WHERE o.status = 'paid';

Looks fine.

But customers without an order have NULL for o.status, so the WHERE condition removes them.

If you actually want to keep all customers:

SELECT c.id, o.total
FROM customers c
LEFT JOIN orders o
    ON c.id = o.customer_id
    AND o.status = 'paid';

2. COUNT(*) and COUNT(column) are not the same

SELECT COUNT(*)
FROM users;

Counts rows.

SELECT COUNT(phone_number)
FROM users;

Counts only rows where phone_number is NOT NULL.

That difference can quietly destroy a report.

3. JOINs can multiply your rows

Imagine:

  • 1 customer

  • 3 orders

  • 4 support tickets

Joining both tables directly can give you:

3 × 4 = 12 rows

Then you do:

SUM(order_amount)

…and suddenly your revenue is magically much higher than reality.

Always check your row count before and after joins.

4. NOT IN + NULL can ruin your day

SELECT *
FROM customers
WHERE id NOT IN (
    SELECT customer_id
    FROM blocked_customers
);

If that subquery contains a NULL, the result might not behave the way you expect.

I usually prefer:

SELECT *
FROM customers c
WHERE NOT EXISTS (
    SELECT 1
    FROM blocked_customers b
    WHERE b.customer_id = c.id
);

The lesson I'm slowly learning:

Writing SQL that runs is easy.
Writing SQL that returns the correct data is the hard part.

What other SQL mistake produces perfectly valid-looking but completely wrong results?

I want to make a list of the dangerous ones.


r/mysql • • Jan 23 '24

question Advice on audit trails for permissions

46 Upvotes

We have to audit all permissions given in our production mysql and postgresql. I saw a couple different tools that claim to do that. Looking to hear some feedback.

‌


r/mysql • • Mar 01 '21

discussion How I helped a client cut down 90% of server costs with MySQL

Thumbnail
kalaksi.com
46 Upvotes

r/mysql • • Nov 22 '17

MySQL backs a large number of websites. Net neutrality dies in a month if we don’t do something, putting all companies that rely on MySQL at risk. Take a stand!

Thumbnail
battleforthenet.com
46 Upvotes

r/mysql • • Sep 27 '15

Free (as in free beer and free speech) 238-slide MySQL query optimization course created by the Wikipedia DBA, updated to 5.7 (and including source)

Thumbnail
github.com
46 Upvotes

r/mysql • • Oct 18 '25

discussion What are the reasons *not* to migrate from MySQL to PostgreSQL?

44 Upvotes

With the recent news about mass layoffs of the MySQL staff at Oracle, no git commits in real time on GitHub since a long time ago, and with the new releases, there are clear signs that Oracle isn't adding new features. A lot of architects and DBAs are now scrambling for migration plans (if still on MySQL, many moved to MariaDB already).

For those running their own custom app with full freedom to rearchitect the stack, or using the database via an ORM that allows them to easily switch the database, many seem to be planning to migrate to PostgreSQL, which is mature and has a large and real open source community and wide ecosystem support.

What would the reasons be to not migrate from MySQL to PostgreSQL? Is autovacuuming in PostgreSQL still slow and logical replication tricky? Does the famous Uber blog post about PostgreSQL performance isues still hold? What is the most popular multi-master replication solution in PostgreSQL (similar to Galera)?


r/mysql • • Apr 01 '26

discussion Anybody knows how the Oracle layoffs have impacted the MySQL team?

Thumbnail
thenextweb.com
36 Upvotes

r/mysql • • Dec 25 '24

discussion How inefficient MySQL really is.

36 Upvotes

I was recently in a need of testing a feature on local copy of live database. It took a while to restore the dump, but I was really surprised with the numbers:

  • I started with new local (DBngin) MySQL 8.4 database.

  • GZ dump file was 4.3GB, and after unpacking the raw SQL dump is about 54GB.

  • The database after restoring is 90.96 GB. Which is no surprising with all the additional data (like indexes).

  • What really surprised me is how much data had to be written to restore this database! 13.96 TB written by the mysqld process and 233.77 GB read !!! All of this to restore 50GB SQL file and to store around 90 GB of data.

Why is that? Can somebody explain it to me? This is absolutely bizzare. I can post the screenshots if somebody is interested.

I'm going to test PostgreSQL next.


r/mysql • • Aug 13 '25

discussion From 1.5TB to 130GB in a Week - MySQL/RDS Cold Data Cleanup

33 Upvotes

A client had a MySQL RDS instance pushing 1.5 TB. On the surface it looked like a scaling success story, but about 99% of that data was years-old and untouched.

They had tried Percona’s pt-archiver before, but it was too complicated to run across hundreds of tables when they did not even know each table’s real access pattern. Here is how we handled it.

1. Query pattern analysis – We examined slow query logs and performance schema data to map actual access frequency, making sure we only touched tables proven to be cold for months or years.

2. Safe archival – Truly cold datasets were moved to S3 in compressed form, meeting compliance requirements and keeping the option to restore if needed.

3. Targeted purging – After archival, data was dropped only when automated dependency checks confirmed no active queries, joins, or application processes relied on it.

4. Index cleanup – Removed unused indexes consuming gigabytes of storage, cutting both backup size and query planning overhead.

5. Result impact – Storage dropped from 1.5 TB to 130 GB, replicas fell from 78 to 31, CPU load fell sharply, and the RDS instance size was safely downgraded.

6. Ongoing prevention – An agent now runs hourly to clean up in small batches, stopping the database from ever growing massively again.

No downtime. No application errors. Just a week of work that saved thousands annually and made the database far easier to operate.

Disclaimer: I am the founder of recost.io, which focuses on intelligent lifecycle management for AWS S3. After a successful pilot adapting our technology for MySQL/RDS, we are looking for design partners with large databases and different lifecycle challenges.


r/mysql • • Sep 11 '26

discussion How I actually debug a slow MySQL query, start to finish

31 Upvotes

Someone on my team asks why is the dashboard slow once a month, so I have a routine. Writing it out as most threads go straight to “add an index” before anyone has actually identified which query is slow.

This is the part people skip, and it is almost never the query you think it is. I set long_query_time to 0.2 on a copy , and let slow query log fill up . Then I run pt-query-digest over it , and group queries by shape . Not the big report everyone was blaming, but more often than not some tiny query the ORM is firing forty thousand times a page.

Then I read the plan. EXPLAIN tells you what the optimizer is planning to do, EXPLAIN ANALYZE (8.0.18+) actually executes the query and tells you what happened. There is one thing I always look at and that is rows examined vs rows returned. The issue is if it's reading two million rows to give you fifty. And the rest is trying to understand why.

type = ALL means it's reading every row. It is not always a problem - small tables or queries returning most rows may be faster with a full scan. Seeing Using filesort next to a LIMIT often means MySQL is sorting far more rows than it eventually returns, and the right index can often avoid that. Using temporary on a GROUP BY usually means it's building a temporary table along the way.

The thing that has wasted the most of my time is a perfectly good index that the optimizer refuses to use. Wrapping a column in a function will often do it. Unless you've deliberately created a functional index, an index on created_at can't help WHERE DATE(created_at) = .... The same goes for joining a number to a string, or columns with different collations. MySQL quietly converts the values, ignores the index, and the query still looks perfectly reasonable.

One of the biggest wins is when an index covers every column the query needs, so InnoDB never has to fetch the table rows and the plan shows Using index. One query I worked on last year went from about 900 ms to 12 ms just by adding one column to an index that already existed.

Before changing SQL, I also check whether the server is actually CPU-bound, waiting on disk, or simply backed up behind other queries. A perfect query won't save a saturated server.

I read plans in dbForge Studio for MySQL instead of a terminal because it keeps each profiling run, so I can tweak a query, rerun it, and immediately see what got cheaper. Everything above works perfectly well with plain EXPLAIN.

What's the weirdest reason you've seen MySQL ignore an index?


r/mysql • • Jun 06 '24

question Creating users and expanding roles across databases

31 Upvotes

We have quite a few types of databases in production. Legacy stuff from multiple companies we acquired and different products we have running now.

Recently realizing we are spending a lot of time over the course of the week creating users and expanding roles in each database. In my last company we had a shared user for each db which of course is bad for many reasons.

Looking for a way to automate some of the permission management to our production Mysqls (also postgreSQL, mssql and oracle db). Meaning, a way to have the lifecycle of users in all the databases managed from one place and hopefully also automatically.


r/mysql • • May 12 '19

Check out this SQL Cheatsheet !

31 Upvotes

This cheatsheet was made by me and a friend, we tried to separate and organize the content in order to have a cheatsheet with basic content, yet effective.

Here is a quick overview of the file hierarchy:

DDL (Data Definition Language)

  • CREATE
    – is used to create the database or its objects (like table, index, function, views, store procedure and triggers).

  • DROP
    – is used to delete objects from the database.

  • ALTER
    - is used to alter the structure of the database.

  • TRUNCATE
    – is used to remove all records from a table, including all spaces allocated for the records are removed.

  • COMMENT
    – is used to add comments to the data dictionary.

  • RENAME

DML (Data Manipulation Language)

  • SELECT
    – is used to retrieve data from the a database.

  • INSERT
    – is used to insert data into a table.

  • UPDATE
    – is used to update existing data within a table.

  • DELETE
    – is used to delete records from a database table.

DCL (Data Control Language)

  • GRANT
    -gives user’s access privileges to database.

  • REVOKE
    -withdraw user’s access privileges given by using the GRANT command.

TCL (Transaction Control Language)

  • COMMIT
    – commits a Transaction.

  • ROLLBACK
    – rollbacks a transaction in case of any error occurs.

  • SAVEPOINT
    –sets a savepoint within a transaction.

  • SET TRANSACTION
    –specify characteristics for the transaction.

Here is the guist link:

https://gist.github.com/kdev33/97951cb3b9dd1459898a93b5702ed4cb

Hope you find it useful! 😉


r/mysql • • Jul 27 '16

Why Uber Engineering Switched from Postgres to MySQL

Thumbnail
eng.uber.com
30 Upvotes

r/mysql • • May 23 '22

solved I've create a clickable excel file with a complete SQL Keywords list from w3schools. Hope you'll find it useful.

Thumbnail
docs.google.com
28 Upvotes

r/mysql • • Sep 24 '19

[RANT] MariaDB is becoming a disappointment...

28 Upvotes

I moved to MariaDB since it looked promising and was growing significantly.

However, honestly, these days I feel that I should start losing trust in MariaDB and possibly come back to MySQL.

A few reasons:

  1. MySQL 8 implemented LATERAL. This is something I absolutely love in SQL Server (CROSS APPLY), and I miss a lot in MariaDB.
    https://jira.mariadb.org/browse/MDEV-19078

  2. MariaDB implemented BACKUP STAGE, with the idea that backups can be made without locking the database. Guess what, it will only not lock for Enterprise Server. They have "no plans" to remove the lock in Community Server.
    https://jira.mariadb.org/browse/MDEV-20644
    What's the story with Percona Xtrabackup? Does it still do a lock at the end?

  3. I feel like Percona Toolkit is absolutely great, but I'm afraid of using it with MariaDB, as some incompatibility might exist. Persona simply seems to be more dedicated in getting things done for MySQL.

  4. Also, MariaDB seems to be disorganized in the things they implement, without proper documentation or properly reply to questions I asked in JIRA.For example, ROW_FORMAT vs PAGE_COMPRESSED - https://jira.mariadb.org/browse/MDEV-18586
    What's the point of the new Defragmentation implementation, when it LOCKS the table (worse than OPTIMIZE..) - https://jira.mariadb.org/browse/MDEV-18385

  5. Now, this might be common between MySQL and MariaDB, but how come hasn't Xtrabackup and MariaBackup implemented yet an automation command to restore a Single Database from a Full Backup, as a different name? (e.g. restore ProdDb from full backup, as ProdDb_Restore)Pretty sure this can be easily automated/implemented in Xtrabackup, since they have a very clear documentation on how to do that. https://jira.mariadb.org/browse/MDEV-18329

What do you think? Is MySQL 8 the way to go?

Migrating from MariaDB 10.x to MySQL isn't an easy thing, especially when your database is huge...

So, before I proceed with a project like this, do let me know your thoughts...!


r/mysql • • Jul 23 '21

discussion Open source products which turn SQL database into API with web UI (think Airtable and Google Spreadsheet alternatives). Low code.

27 Upvotes

Since I am a fan of SQL, and I am also pretty lazy web dev (haha) I was in a constant search for a "headless CMS" type of product BUT without shitty MongoDB or other NoSQL inside.

Airtable is a great SaaS product but has ridiculous limits. Strapi is primarily built with Mongodb. These two were off the table but the hybrid between these two was what I was dreaming about, and finally by mid 2020 the viable solutions started to emerge.

My use case is quickly deploying some CRM for employees, or just creating MVP for SaaS in a week or two. Google Sheets but much better and with custom UI to create rows. Laravel but 5x faster time-to-market and with minimum coding.

My requirements:

  1. the tool needs to respect SQL and SQL must be a first-class citizen without weird abstractions.

  2. The tool must generate REST API from SQL table.

  3. The tool must have adequate UI to edit table contents, convenient for project operators.

I think this low-code approach is a next big thing. So sharing my findings with you guys:

#1 Directus

https://github.com/directus/directus

This is my current favorite. Honest open source without trying to convert you into some "premium" package after you are hooked. Throw it on existing SQL tables and map them to form field using slick UI. Recently rewritten from PHP to Node.js - very fast, very beautiful. Vue.js on frontend. Still a lot of work but already looking like ready for production.

Works with MySQL and PostgreSQL.

#2 Baserow

https://github.com/bram2w/baserow

Nice project. Only PostgreSQL and looks like they are focused to converting you to premium version though.

Not tried to install it yet.

#3 NocoDB

https://github.com/nocodb/nocodb

A big release on HackerNews recently. Vue.js on frontend. Looks beautiful but pretty new, potentially a lot of upcoming changes, I think it's not ready for production yet.

Let me know if you have any experience with such tools, guys.


r/mysql • • Oct 15 '25

discussion Known Big companies using MySQL

26 Upvotes

I am currently working with a company who hired me to reduce their platform costs. After digging less than one minute I found they use Oracle (same brand) databases for something quite smaller than what I've achieved using MySQL (I obviously know MySQL is owned by the big O). They pay licenses, consulting hours, service hours and a lot of bs that at the end of the month, turn into a big check. The owner of the company is open to migrate to cheaper infrastructure as far as the end user experience is not affected 👏 (and invest time and money in such project since he is thinking long term 💪). I've done this several times. But he has a nice question: "tell me which big companies are currently using MySQL/MariaDB" and I was able to come with some (maybe outdated) examples like GitHub, UBER, Wikipedia (migrated to Maria),... but...

Do you guys have any other examples of companies using MySQL/MariaDB in their products? (A source next to the name would be much appreciated)


r/mysql • • Feb 03 '23

question Mac user - What's the best SQL GUI for personal use?

26 Upvotes

I used TablePlus at work, and it was amazing. Nice UI, Command palette, etc. It is not free tho, and a bit expensive for my personal use.

Any recommendations on good free-GUI for Mac? (at least free for personal projects)

Some experiences I had:

  • TablePlus 🥲💰

  • I had good memories of sequelPro but the project seems abandoned on Github

  • DBeaver: Not too much a fan of the UI/UX, or at least from few years ago on Linux it was meh

  • adminer: Simple, efficient, but lacking command palette and nice UI

A simple google query gives me easily 15 different softwares (https://blog.devart.com/best-mysql-client-for-mac.html), didn't know the ecosystem was so huge 😅

Best,

Edit: For now I currently use adminer in local


r/mysql • • Nov 03 '20

mod notice Rule and Community Updates

26 Upvotes

Hello,

I have made a few changes to the configuration of /r/mysql in order to try to increase the quality of posts.

  1. Two new rules have been added

    1. No Homework

    2. Posts Must be MySQL Related

  2. Posts containing the word "homework" will be removed automatically

  3. Posts containing links to several sites, such as youtube and Stack Overflow will be automatically removed.

  4. All posts must have a flair assigned to them.

If you see low quality posts, such as posts that do not have enough information to assist, please comment to the OP asking for more information. Also, feel free to report any posts that you feel do not belong here or do not contain enough information so that the Moderation team can take appropriate action.

In addition to these changes, I will be working on some automod rules that will assist users in flairing their posts appropriately, asking for more information and changing the flair on posts that have been solved.

If you have any further feedback or ideas, please feel free to comment here or send a modmail.

Thanks,

/r/mysql Moderation Team


r/mysql • • May 06 '26

discussion MySQL 9.7 Is Out and the Community Wins

25 Upvotes

MySQL 9.7 is out—and it’s a big win for the community. 🚀
From MySQL 8.0 reaching End-of-Life to key Enterprise features now available in Community Edition, this release brings real impact. Highlights include the Hypergraph Optimizer, improved replication observability, and full support for JSON Duality Views.
What should you upgrade to? What’s worth testing? And what’s still coming (vector search 👀)? https://blogs.oracle.com/mysql/mysql-9-7-is-out-and-the-community-wins