Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.2, 10.3, 10.4, 10.5, 10.6
-
None
Description
The speed of JSON_MERGE_PATCH and synonyms depends significantly on the length of values in the merged JSON document, even if the values are not merged with anything. I suppose it is worth checking whether it is an expected effect.
drop table if exists t; |
create table t (f_1 JSON, f_100 JSON, f_10000 JSON) engine=MyISAM; |
insert into t values ('{"x":"a"}',CONCAT('{"x":"',REPEAT('a',100),'"}'),CONCAT('{"x":"',REPEAT('a',10000),'"}')); |
|
SELECT BENCHMARK(100000,JSON_MERGE_PATCH( f_1, '{}' )) from t; |
SELECT BENCHMARK(100000,JSON_MERGE_PATCH( f_100, '{}' )) from t; |
SELECT BENCHMARK(100000,JSON_MERGE_PATCH( f_10000, '{}' )) from t; |
10.2 067465cd |
MariaDB [test]> SELECT BENCHMARK(100000,JSON_MERGE_PATCH( f_1, '{}' )) from t; |
+-------------------------------------------------+ |
| BENCHMARK(100000,JSON_MERGE_PATCH( f_1, '{}' )) | |
+-------------------------------------------------+ |
1 row in set (0.030 sec) |
|
MariaDB [test]> SELECT BENCHMARK(100000,JSON_MERGE_PATCH( f_100, '{}' )) from t; |
+---------------------------------------------------+ |
| BENCHMARK(100000,JSON_MERGE_PATCH( f_100, '{}' )) | |
+---------------------------------------------------+ |
1 row in set (0.062 sec) |
|
MariaDB [test]> SELECT BENCHMARK(100000,JSON_MERGE_PATCH( f_10000, '{}' )) from t; |
+-----------------------------------------------------+ |
| BENCHMARK(100000,JSON_MERGE_PATCH( f_10000, '{}' )) | |
+-----------------------------------------------------+ |
1 row in set (3.778 sec) |
Reproducible on 10.2-10.6.
MySQL 5.7, 8.0 have the similar effect.