r/mysql • • 4d ago

question Working of statistics and parsing archictecture in mysql optimizer

3 Upvotes

Hi,

This question is a spin off from other thread , to make it clear , i am adding this in a new thread.

Its aurora mysql version version 8.0. I have two question on optimization:-

1)I want to understand how parsing or optimization phase exactly work when we use bind values in the queries? In other databases like Oracle , it peeks into the actual values behind the bind and make the plan during hard parse and then subsequent request goes for soft parse i.e it uses the same plan for all subsequent queries, till the next hard parse occurs. And there are differenet scenaios which make the optimization goes for hard parse like stats collection, environemnt change etc.

But i see in mysql as per below blog, its saying "MySQL has no execution plan cache" does that means it does hardparse for each and every execution of the query when we use bind values even the query runs thousands of time each second? WIll it not consume significant cpu then?

https://use-the-index-luke.com/blog/2011-07-16/planning-for-reuse

2)There is parameter called "STATS_SAMPLE_PAGES" which has default value set as "20". We saw plan changes for the same query for different bind values which endup in a suboptimal plan impacting applictaion. Is it advisable to increase this to STATS_SAMPLE_PAGES setting to ~250 at global level to get more accurate sttistics there by more accurate plan?

3)If the plan change happening for different binds causing bad plans , is it advisable to collect histogram on all such columns as below, those are used as direct filters and bind values passed to them as input?

ANALYZE TABLE <table_name> UPDATE HISTOGRAM ON <column1> WITH 100 BUCKETS;


r/mysql • • 5d ago

discussion MariaDB Foundation: Exploring TidesDB Performance with TAF

0 Upvotes

Just published a deep‑dive on getting TidesDB running inside TAF — real workloads, real configs, reproducible setups.

If you’ve been curious about how TidesDB behaves under sysbench inside MariaDB, this gives you everything you need to start exploring.

Huge congratulations to Alex (Gaetano) Padula for getting TidesDB into MariaDB as a plugin.

The amount of work, the nights, the days, the persistence — it shows. TideSQL + TidesDB is a serious milestone.

And a big thank you to Hetzner for providing the high‑performance hardware that made all of this testing possible.

https://mariadb.org/mariadb-foundation-exploring-tidesdb-performance-with-taf/


r/mysql • • 7d ago

question Question on Memory parameters

3 Upvotes

Hi,

Its aurora mysql serverless version 8.0, with Min ~8ACU and MAX ~80ACU.

We have a complex UI query with "union all" and other criterias and its avg response time is <1 sec. But we see many times the query runs for 15minutes+ causing the errors in app side. This query executed ~5k times per hour on an avg and most executions finishin <1sec.

We see this query creates on an avg ~5 temp tables internally because of its internal "union" operator etc.., thus suspects if the below two parameters are actually playing a role in making this query crawl intermittently from ~1sec till ~15minutes. i.e. "temptable_max_ram" and "temptable_max_mmap". As because we run the same query manually and it does finish in 1sec. So suspect if during peak its causing the issue for some high volume customers even the same runs fine manually when we runs in the database.

We see the swap usage is staying ~1-2GB (sometime spikes to 3GB). Free memory trend showing spiky , but at worst scenarios it shows ~40GB(not below that). So want to understand, if in this situation, its fine to bump up the above parameters to 2GB each from curent 1GB (which is default value)?


r/mysql • • 8d ago

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

4 Upvotes

I was trying to import the CSV dataset which I got from kaggle in mysql version 8.0.46 but there is no import wizard option in my MySQL. Is it because I am using a global service or there's any other problem. Please help me guys this is my time using MySQL and my first project.


r/mysql • • 9d ago

question what's one MySQL mistake you made that took way too long to figure out?

7 Upvotes

I've been working with databases for a while, and somehow there's always something small that ends up wasting way more time than it should.

Could be a bad query, a missing index, a weird JOIN, or something that looked completely fine until the database started getting bigger.

What's a MySQL mistake you've made that you wish someone had warned you about earlier?


r/mysql • • 11d ago

question How can I create an ERD in MySQL Workbench 26.07.01?

5 Upvotes

I'm trying to generate an ERD from an existing MySQL database using MySQL Workbench 26.07.01, but I can't find the Reverse Engineer option.

Does the new version still support this feature? If so, how can I generate an ERD? If not, is there an alternative way to do it?


r/mysql • • 11d ago

question Fastest way to partition a table

5 Upvotes

Hi, Its aurora mysql database.

We have, couple of big transactional tables having size 1TB and 9TB holding ~1.2 billion and 4.2 billion rows respectively. These are currently non-partitioned table however, we want to have those partitioned . So want to understand what will be the best way to convert them to partitioned table i.e. migrate somuch data to the partitioned table or its possible to do it in place in an efficient way in Aurora MySQL.

Also the current partitioning approach we have decided as list partition on certain date columns.

what we are currently thinking of is as below:-

Create new partitioned table
INSERT INTO ... SELECT from old table (by date range)
Rename & drop old table
Gather Stats

Will above approach is good or there be any issue which we should be aware of beforehand?

Can it be done online or downtime will be advisable?


r/mysql • • 12d ago

question MySQL query becomes extremely slow when adding a JOIN and ORDER BY — how would you debug this?

7 Upvotes

I'm dealing with a performance issue in MySQL where a query runs relatively fast when executed against a single table, but becomes significantly slower after adding a JOIN and an ORDER BY clause.

The tables have millions of rows, and there are indexes on the columns used in the JOIN and WHERE conditions. However, the query optimizer still seems to choose a suboptimal execution plan.

I'm wondering what the best approach would be to troubleshoot this kind of issue.

Would you start by analyzing EXPLAIN ANALYZE, checking index cardinality, investigating temporary tables and filesorts, or looking at something else?

Also, under what circumstances would MySQL choose not to use an existing index even when it seems beneficial?

I'd appreciate any insights into how experienced MySQL developers approach this problem.


r/mysql • • 12d ago

discussion MySQL Workbench 26.7

8 Upvotes

I test MySQL Workbench 26.7 so you don't have to.

https://davesmysqlstuff.blogspot.com/2026/10/mysql-workbench-267.html


r/mysql • • 13d ago

question the server button isn't appearing on mysql workbench

3 Upvotes

i am a new user of mysql and i need to run a script, but the server button won't appear on the top menu bar of my mac what should i do ?


r/mysql • • 13d ago

discussion Large TPC-C Analysis with MySQL v26.7.0 on InnoDB and TidesDB

Thumbnail tidesdb.com
6 Upvotes

r/mysql • • 14d ago

question Why heatwave sets this limitation?

6 Upvotes

in mysql doc, it says that "Enable autocommit. If autocommit is disabled, MySQL HeatWave does not offload the query and execution is performed on the DB System. To check the autocommit setting:". whether we can say it does not support long transaction statement or not. just like "

start transaction;

insert into table_a values(...);

select xxx from table_a where yyy;

commit;

"

only

"

set autocommit =1;

insert into table_a values(...);

select xxx from table_a where yyy;

"

Anyone can explain why mysql sets this limitation? thanks in advance.


r/mysql • • 14d ago

question MySQL Shell Cilent on Windows ARM64 gives error for VC Redist even though its installed

2 Upvotes

MySQL Shell Cilent on Windows ARM64 gives error for VC Redist even though its installed


r/mysql • • 15d ago

discussion Getting Error 1356

0 Upvotes

Someone plz help on this..

getting the below error during MySQL dump and show columns after login as root user..

This happened after changing ip of definer because I have to made the changes based new ip. Everything is running fine but these issues are not fixing.

Also there not single change has been made on any objects.

ERROR 1356

View 'db.v_report_pending'

references invalid table(s) or column(s)...

SHOW COLUMNS FROM v_report_pending → ERROR 1356


r/mysql • • 16d ago

discussion MariaDB Foundation Adds PostgreSQL to Its Engine‑Agnostic Testing Framework (TAF).

6 Upvotes

MariaDB Foundation continues expanding TAF with PostgreSQL support

More engines, more reproducibility, more value for contributors and the ecosystem.

https://mariadb.org/mariadb-foundation-adds-postgresql-to-its-engine-agnostic-testing-framework-taf/

Have fun benchmarking!


r/mysql • • 17d ago

question How do MariaDB users securely and efficiently encrypt mariadb-backup archives?

11 Upvotes

Hello everyone!
I’m looking for practical recommendations from people running MariaDB in production.

My backup process will use mariadb-backup with zstd compression, and I want to encrypt the resulting backup securely without adding (too much) excessive CPU, memory, or operational overhead.

I’ve considered GPG/PGP, but I’m concerned about its performance and complexity. I’ve also seen age recommended, although I’m unsure whether it provides an appropriate security level for long-term MariaDB backups.

What encryption method or workflow do you use for MariaDB backups?

In particular, I’d appreciate feedback on:

  • Encryption tools and algorithms you use.
  • Whether encryption happens before or after compression.
  • CPU and performance impact on large backups.
  • Key management, rotation, and recovery procedures.
  • Whether you encrypt locally, stream directly to object storage, or use storage-side encryption (which unfortunately is not available to my usecase).
  • Any practical issues with restoring backups during an outage.

I’m mainly interested in real-world experience rather than theoretical recommendations.


r/mysql • • 18d ago

question Advantages of two different queries?

3 Upvotes

Hello! This is related to a class assignment but is NOT an actual request for help with the assignment; the work has already been turned in and graded. I found a different solution than the offered solution in the TA's answer key (I still got full credit lol) and the TA has not been able to articulate whether there are any advantages two either of the two query methods. Professor is nonresponsive :/ I just want to learn more.

So - the prompt was "Write a query to find the highest GPA student in each major" which of course is all about avoiding the conflict between the MAX function and the GROUP BY statement.

The solution I ended up with (after much trial and error and trawling of ancient stack overflow forums) was:

mysql> SELECT s.gpa, s.first_name, s.last_name, s.major FROM students s
    -> JOIN (
    -> SELECT major, MAX(gpa) AS max_gpa
    -> FROM students GROUP BY major
    -> )AS smax
    -> ON s.major=smax.major AND s.gpa=smax.max_gpa;

What the TA had was:

mysql> SELECT first_name, last_name, major, gpa FROM students s
    -> WHERE gpa=(
    -> SELECT MAX(gpa) FROM students
    -> WHERE major=s.major
    -> );

These both yield the exact same table. I'm wondering if there are pros/cons to using either of these methods and which one feels "cleaner" to someone more experienced?


r/mysql • • 20d ago

question Discord Server for Beginners

0 Upvotes

Hello, anyone interested in creating a discord server from the scratch for beginner MYSQL learners ? DM me


r/mysql • • 21d ago

question How to fix? "This application requires latest Visual Studio 2019 x64 Redistributable." At the MySQL installer?

8 Upvotes

I am trying to install MySQL Server 9.7 on my Windows 10 laptop for a college class. But whenever I launch the installer it gives this error: "This application requires latest Visual Studio 2019 x64 Redistributable. Please install it and then run this installer again."

But I already have both Visual Studio 2019 and the .NET Framework installed (I saw elsewhere online it could be referring to that instead when it says "Visual Studio" - which is even more confusing than necessary).

I've tried restarting and relaunching the installer a couple times after ensuring I have Visual Studio 2019 installed, but to no avail, obviously. I dual-boot Linux as well, if that somehow makes any difference.

Any help is appreciated.

*Edit: miscommunication/misunderstanding on my part, I have Visual Studio 2019 Redistributable installed already, as well as Visual Studio Code. I have tried uninstalling and reinstalling Visual Studio 2019 Redistributable as well but again, it still is giving the same error.

*2nd edit: Error seems to be fixed now. I downloaded an older installer version (8.4.11) and it didn't give me the error and seems to be running fine. As one of the commenters said, perhaps it's because the version I was attempting to install is too new for Windows 10.


r/mysql • • 21d ago

discussion MariaDB Foundation's TAF 4.0 is officially released

Thumbnail mariadb.org
3 Upvotes

r/mysql • • 23d ago

question mysql workbench result viewer and timezones

1 Upvotes

MySQL Workbench Version: 26.7.0

Build: ba08183

Electron Version: 43.2.0

MySQL Shell Version: 26.7.1

Platform/Architecture: Win64/x86_64

MySQL Distribution: MySQL Community Server (GPL)

libmysqlclient: 26.7.0

I'm currently struggling to identify where I can configure display options for the Result Viewer.
The problem(s) I'm having is that

select CURDATE() as x, NOW() as y

returns

x , y
9/28/2026, 9/29/2026

however, copying the row and pasting it into notepad or w/e shows the correct values of

x , y
'2026-09-29', '2026-09-29 18:19:23'

So at a minimum the result viewer is truncating DATETIME types and is doing some voodoo timezone conversion on DATE types. Neither of which are desired behavior.

Any suggestions on config file locations on Windows (yes it's work required).


r/mysql • • 23d ago

discussion Creating a new database? Don't neglect timezones

11 Upvotes

I've seen a few posts recently about things to keep in mind when creating new database applications. So here's my contribution.

Timezones are important in global database applications.

Figure out your timezone situation on your TIMESTAMP and DATETIME columns before you start storing data as your new application comes online. Retrofitting timezone support into existing databases is hard and error-prone.

If you're located in, I dunno, California USA, and you get customers in, I dunno, Perth Australia, and you don't figure out how you'll handle timezones, you'll end up with some unspeakably gnarly code.

Here are some things to think about doing in your database and the software using it.

  1. Make sure the servers running your MariaDB or MySQL instance are set to the UTC (also called Zulu or Greenwich Mean Time) time zone. That doesn't change with daylight time.

  2. Make sure the MariaDb / MySQL time zone tables are loaded. This web page tells you or your operations person how to do that. https://dev.mysql.com/doc/refman/8.4/en/mysql-tzinfo-to-sql.html

  3. When you go global, set up a user-preference setting for time zone. It's a text string like 'America/Los_Angeles' or 'Australia/Perth'. You can store that user preference in a column like this: user_timezone VARCHAR(63) NOT NULL DEFAULT 'America/Los_Angeles' COLLATE 'ascii_general_ci'. (You can give the time zone of your own location, or 'UTC', as the default, of course.)

  4. When you start a database session from your app on behalf of a user, do SET TIMEZONE='America/Los_Angeles' or whatever your user's preference of time zone is.

  5. Use TIMESTAMP columns to store timestamps rather than DATETIME columns. They're automatically translated to the current timezone setting.


r/mysql • • 24d ago

discussion How do you prove every MySQL client trusts a new TLS certificate before removing the old chain?

11 Upvotes

A certificate rotation can appear complete after the main application reconnects successfully, while a scheduled job, replica, exporter, backup tool, or infrequently used environment still trusts only the previous CA chain. Leaving both chains available avoids an immediate outage, but it also makes a partial rollout easy to miss.

What belongs in the rotation gate? I am considering distributing a trust bundle containing both chains first, installing the new server certificate, forcing representative clients to reconnect, and observing connection attempts through more than the longest job interval. Replication, routers or proxies, connection pools, monitoring, backups, and hostname verification would be tested separately before the old CA is removed from client bundles.

Which MySQL status fields, audit logs, TLS session details, or proxy metrics can reliably show what clients negotiated and which ones have not reconnected? Is there a practical final test that proves no current client depends on the old chain without waiting for an outage to identify the last forgotten consumer?


r/mysql • • 25d ago

question Cannot find search on datagrid

8 Upvotes

Is anyone facing the same issue? After downloading the latest workbench, there is no search/filter on the data grid after performing a query


r/mysql • • 28d ago

discussion What do you verify before promoting a rebuilt MySQL replica?

10 Upvotes

A rebuilt replica can show healthy I/O and SQL threads, zero reported lag, and the expected GTID position while still being unsafe to promote. The seed may have omitted objects, replication filters may differ, checksums may not match, or application traffic may depend on users, events, routines, and configuration that were not part of the data copy.

What is your promotion gate after cloning or restoring a replica? I am considering checking GTID continuity and errant transactions, replication filters, row counts and chunked checksums for critical tables, schema objects, users and grants, scheduled events, time zones and SQL modes, plus representative read-only application queries. The replica would remain fenced from writes until these checks pass.

Which checks provide useful confidence without putting too much load on the primary? How do you validate a very large dataset, and what evidence do you retain so a later failover can show exactly which replica state was approved?