[MDEV-30823] Long running SELECT in MariaDB version > 10.4 Created: 2023-03-09 Updated: 2024-01-26 |
|
| Status: | Needs Feedback |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.6 |
| Fix Version/s: | 10.6 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Matej | Assignee: | Dave Gosselin |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Hello, we are using this SQL:
I performed several testing cases with this result: Looking that version of MariaDB higher than 10.4 spend a lot of time on Creating sort index (96%). Can you advise what is wrong if there is any parameter that can be changed? We are using default configuration |
| Comments |
| Comment by Daniel Black [ 2023-03-09 ] |
|
What is the ANALYZE FORMAT=json query output (as {noformat} enclosed text)? Did running ANALYZE TABLE on the affected table change the query plan and/or response time? Can you include EXPLAIN plans from MySQL as comparison? |
| Comment by Matej [ 2023-03-10 ] |
|
Hello, sorry I don't know what you mean by ANALYZE FORMAT. Data are stored in regular rows in Database, the output format is also regular format row format. No JSON is involved. Yes, I tried ANALYZE tables and also fix, but I performed tests on fresh DB which was created only for testing purposes. I made mistake in the description. To be exact SQL that we are executing does not begin by EXPLAIN (wrong copy-paste), I fixed the description. I executed EXPLAIN for several DB engines. The output is in attachments. |
| Comment by Sergei Golubchik [ 2023-03-30 ] |
|
It meant to run ANALYZE FORMAT=JSON SELECT FLOOR(MIN(IF (... etc. |
| Comment by Matej [ 2023-03-30 ] |
|
Hello, got it. Here is the output: MySQL-latest.json |
| Comment by Dominik Shaim [ 2023-10-28 ] |
|
Any progress about this? We are still facing this problem. |
| Comment by Dave Gosselin [ 2024-01-18 ] |
|
Unless I'm missing something, Baloga can you please provide schemas for the tables referenced by this query? Either the output of SHOW CREATE TABLE for each table, the CREATE TABLE statements themselves, or a SQL file that I can load to recreate the tables locally. |
| Comment by Matej [ 2024-01-19 ] |
|
Hello, here it is. Unfortunately I am not able to provide data as there are sensitive customer ifnormation. s08_a_a-2024-01-19-12-02-01.sql |
| Comment by Dave Gosselin [ 2024-01-23 ] |
|
Hi Baloga, thank you for providing the SQL script to create the tables. After looking a bit further, we note that within the ANALYZE FORMAT=JSON output, the stock_0 table finds itself in a different position in the table join order when compared against 10.4. Additionally, the 'rows' field, which reflects the number of rows that the optimizer expects to find in the table, is 1 while the observed number of rows ('r_rows') is about 150. This is a surprising finding as we expect these numbers to be very similar to one another. |