# Number of rows drastically increased of upgrade to Percona MySQL 8.0.34

**URL:** <https://forums.percona.com/t/number-of-rows-drastically-increased-of-upgrade-to-percona-mysql-8-0-34/33195>\
**Category:** Percona Server for MySQL 8.0\
**Tags:** mysql, percona\
**Created:** [September 17, 2024, 2:43pm UTC](https://forums.percona.com/t/number-of-rows-drastically-increased-of-upgrade-to-percona-mysql-8-0-34/33195 "2024-09-17T14:43:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![virin\_t](https://avatars.discourse-cdn.com/v4/letter/v/b38774/32.png) [@virin\_t](https://forums.percona.com/u/virin_t)\
**Post date:** [September 17, 2024, 2:43pm UTC](https://forums.percona.com/t/number-of-rows-drastically-increased-of-upgrade-to-percona-mysql-8-0-34/33195/1 "2024-09-17T14:43:44Z")

</div>

Hi

Recently I have upgraded one of the replica to new version Percona MySQL 8.0.34 , after that I have modified tables CHARSET and collation as well.

For many tables the number of rows have increased after altering table to change charset and collation.

While I understand pt-table-sync and pt-table-checksum are helpful , I am trying to understand potential cause

and what would better approach to check what are the differences.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [September 17, 2024, 5:36pm UTC](https://forums.percona.com/t/number-of-rows-drastically-increased-of-upgrade-to-percona-mysql-8-0-34/33195/2 "2024-09-17T17:36:00Z")

</div>

> [@virin\_t](#):
>
> For many tables the number of rows have increased after altering table to change charset and collation.

Hello @virin_t. That’s impossible. Rows are not magically created when you change character sets, or collations. Did you perhaps mean row size? or table size on disk?

Please show some evidence using COUNT(\*) of the table before changing character set and after changing.

---

<div class="post-metadata">

**Author:** ![virin\_t](https://avatars.discourse-cdn.com/v4/letter/v/b38774/32.png) [@virin\_t](https://forums.percona.com/u/virin_t)\
**Post date:** [September 17, 2024, 6:12pm UTC](https://forums.percona.com/t/number-of-rows-drastically-increased-of-upgrade-to-percona-mysql-8-0-34/33195/3 "2024-09-17T18:12:29Z")

</div>

Hi @matthewb

I understand, I was kind of surprised as well. I understand that there might difference of table size (as we are changing charset) and other possible reasons, but I am telling about number of rows only

below is one of the examples

before  
orders\_quotes\_data | utf8mb3\_general\_ci | 211.61 | 40751651 |

after  
±-------------------±-----------±-----------+  
| Table | Size in GB | Total Rows |  
±-------------------±-----------±-----------+  
| orders\_quotes\_data | 292.54 | 62290700 |  
±-------------------±-----------±-----------+

I remember doing pt-online schema change for the above table to alter charset

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [September 17, 2024, 7:16pm UTC](https://forums.percona.com/t/number-of-rows-drastically-increased-of-upgrade-to-percona-mysql-8-0-34/33195/4 "2024-09-17T19:16:29Z")

</div>

Could you please use COUNT(\*)? There is no way that changing the character set added 22 million rows.

> [@virin\_t](#):
>
> I remember doing pt-online schema change for the above table to alter charset

Hmm. Ok. There’s a possibility here that some rows could have been duplicated due to the triggers that pt-osc uses to keep the shadow table and original table in sync. Can you provide the full command used? Can you provide the CREATE TABLE for this table?

---

<div class="post-metadata">

**Author:** ![virin\_t](https://avatars.discourse-cdn.com/v4/letter/v/b38774/32.png) [@virin\_t](https://forums.percona.com/u/virin_t)\
**Post date:** [September 18, 2024, 6:15am UTC](https://forums.percona.com/t/number-of-rows-drastically-increased-of-upgrade-to-percona-mysql-8-0-34/33195/5 "2024-09-18T06:15:21Z")

</div>

Hi @matthewb

here is the command that was used

```auto
pt-online-schema-change \
  --alter="CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" \
  --max-load threads_running=500 \
  --max-lag=30 \
  --set-vars lock_wait_timeout=1,foreign_key_checks=0,sql_log_bin=0 \
  --no-check-replication-filters \
  --no-drop-old-table \
  --execute \
  h=XXXXX,D=XXXXXXXX,t=orders_quotes_data 2>&1 | tee -a /tmp/orders_quotes_data_pt-osc_dryrun.log

```

show create table after charset update

```auto
  CREATE TABLE `orders_quotes_data` (
  `id` int unsigned NOT NULL DEFAULT '0',
  `one_id` bigint unsigned DEFAULT NULL,
  `is_persisted` tinyint unsigned NOT NULL DEFAULT '0',
  `xxx` mediumblob,
  `info` blob,
  PRIMARY KEY (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED

```

---

<div class="post-metadata">

**Author:** ![CTutte](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ctutte/32/1341_2.png) [@CTutte](https://forums.percona.com/u/CTutte)\
**Post date:** [September 19, 2024, 6:15pm UTC](https://forums.percona.com/t/number-of-rows-drastically-increased-of-upgrade-to-percona-mysql-8-0-34/33195/6 "2024-09-19T18:15:31Z")

</div>

Hi virin\_t!

The correct way to check the amount of rows is to do a “select count(\*)” (do note that this will trigger a full table scan and cause very high disk read activity. Execute outside business hours).

The above outputs you showed look like from “information\_schema” (IS). IS will only show estimate information and might have outdated information. Rebuilding the table might have refreshed the metadata and thus showing a different result/size.

If both count(\*) and pt-table-checksum shows the correct amount of rows in both primary and replica then the most likely explanation is that the metadata from the table was outdated. Else let us know

Regards
