Performance Degradation Caused by Configuring Case-Insensitive Character Sets

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 配置大小写不敏感字符集引起的性能下降

| username: Hacker007

Figure 1 shows a case-sensitive character set, while Figure 2 is configured with a case-insensitive character set. The query times on both sides seem to differ significantly. What’s going on here?

| username: tidb狂热爱好者 | Original post link

Could you share the SQL? We have also configured case insensitivity.

| username: Hacker007 | Original post link

After configuring case insensitivity, the date still needs to be formatted.

| username: Hacker007 | Original post link

How is your query performance?

| username: xfworld | Original post link

Let’s look at the execution plan. It’s easy to identify the issue through the execution plan.

I suspect it might be:

  1. Implicit conversion causing the index to be skipped.

  2. Not using the index, a full table scan would be much slower.

| username: tidb狂热爱好者 | Original post link

The left side of the inequality in the WHERE clause cannot use functions, it will result in a full table scan.

| username: 西伯利亚狼 | Original post link

  1. Try converting the SQL to all lowercase, it should be the same.
  2. Check the execution plan.
| username: ddhe9527 | Original post link

Check whether the character set and collation of the tables test_info, rent_test, and test_snapshot are consistent.

| username: 我是咖啡哥 | Original post link

You only changed some fields of some tables, right? Confirm whether the field types and collation of the associated fields are consistent.

| username: Hacker007 | Original post link

All consistent, all synchronized with the upstream MySQL.

| username: Hacker007 | Original post link

All the same.

| username: ddhe9527 | Original post link

Could you share the execution plans for the same SQL in these two scenarios?

| username: xuexiaogang | Original post link

It should be one using an index, and the other a full table scan.

| username: Hacker007 | Original post link

Performance is an issue, and another major problem is the conversion of date formats.

| username: Hacker007 | Original post link

Some query execution plans are different.



First, we can confirm that the data and table structure are the same on both sides.

| username: caiyfc | Original post link

There is so much blank space on the right, just make each column a little wider. The first column is covered, and a lot of other information is also covered. This is an invalid response. :joy:

| username: xfworld | Original post link

The things we are concerned about, you don’t release them :rofl:
This way, we can’t help you…

| username: Hacker007 | Original post link

It’s not just a performance issue now, but a syntax execution failure.

| username: Hacker007 | Original post link

It looks like the response above indicates a failure in execution, which seems to be a bug.

| username: xfworld | Original post link

Which version are you using?