Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Export Database as SQL" doesn't respect Avg_row_length #1907

Open
bchanudet opened this issue Feb 12, 2024 · 1 comment
Open

"Export Database as SQL" doesn't respect Avg_row_length #1907

bchanudet opened this issue Feb 12, 2024 · 1 comment

Comments

@bchanudet
Copy link

Preconditions

  • HeidiSQL version: 12.6.0.6799 (latest nightly build available at this time)
  • Database type and version: MySQL 8.0.35
  • OS: Windows Server 2022 Standard

Describe the bug
I have a table named document containing binary data (8411 rows, 7GB in size).

When trying to copy the table to another database using the "Export Database as SQL" tool, HeidiSQL tries to fetch 10486 records (so the complete table data), but as it's over 7GB, it fails most of the time with a OOM error. I found this thread on the forum explaining where this 10486 number comes from.

Here's what I've looked at:

  • In the session manager, "Get full table status" is checked.
  • SHOW TABLE STATUS LIKE 'document'; works as expected. Avg_row_length shows 917116.
  • According to the calculation in the code, HeidiSQL should have tried to fetch 1170 records (1024 * 1024 * 1024 / 917116).
  • It looks like HeidiSQL considers Avg_row_length to be 0, but I haven't found why.
  • Short of having a Delphi license I don't think I can investigate further, but I'll be happy to give any details necessary.

To Reproduce

  1. Open a connection to a MySQL Database
  2. Export a table as SQL
  3. Everytime HeidiSQL tries to fetch 10486 records, no matter what the Avg_row_length is
@bchanudet
Copy link
Author

Hello,

It seems this bug is more random that I'd thought.

I have two similar servers, only the MySQL version is different by only one patch version:

  • Production system: Windows Server 2022 Standard, HeidiSQL 12.6.0.6799, and MySQL 8.0.34
  • Test system: Windows Server 2022 Standard, HeidiSQL 12.6.0.6799, and MySQL 8.0.35

My reproduction case as of now:

  • Open the connection to the MySQL Server as root user
  • Right-click on the document table, choose Export Database as SQL
  • For Table, select options Drop!! and Create
  • For Data, select Insert
  • For Max INSERT Size, leave 4096 as default
  • As target, select another Database on the same server and connection.

Production system

  • SHOW TABLE STATUS LIKE 'document'; shows 935921 for Avg_row_length
  • The SQL logs show SELECT * FROM document LIMIT 112;
  • Batchs seems to be 112, that seems correct according to what is computed in the code.

Test system

  • SHOW TABLE STATUS LIKE 'document'; shows 984525 for Avg_row_length
  • The SQL logs show SELECT * FROM document LIMIT 10486;
  • Batchs seems to be 10486, so it didn't use the Avg_row_length value.

The only difference I've found until now is the MySQL server version, but the changelog between the two version doesn't show any meaningful impact on the SHOW TABLE STATUS command.

Is there something else I can test to help investigate this further?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant