toast-columns.td 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. $ set-sql-timeout duration=1s
  10. #
  11. # Test that we can ingest unchanged toasted values
  12. #
  13. > CREATE SECRET mysqlpass AS '${arg.mysql-root-password}'
  14. > CREATE CONNECTION mysql_conn TO MYSQL (
  15. HOST mysql,
  16. USER root,
  17. PASSWORD SECRET mysqlpass
  18. )
  19. $ mysql-connect name=mysql url=mysql://root@mysql password=${arg.mysql-root-password}
  20. # Insert data pre-snapshot by generating 16kB of uncompressible data to force
  21. # TOASTed storage by concatenating 1024 random MD5 hashes, each being 128bit
  22. $ mysql-execute name=mysql
  23. DROP DATABASE IF EXISTS public;
  24. CREATE DATABASE public;
  25. USE public;
  26. CREATE TABLE t1 (a int, b text);
  27. SET SESSION group_concat_max_len = 32768;
  28. # necessary because the limit is not respected by group_concat
  29. CREATE TABLE temp_rand (rand_value TEXT);
  30. INSERT INTO temp_rand SELECT rand() FROM mysql.time_zone t1, mysql.time_zone t2 LIMIT 1024;
  31. INSERT INTO t1 SELECT 1, group_concat(md5(rand_value) SEPARATOR '') FROM temp_rand;
  32. DELETE FROM temp_rand;
  33. INSERT INTO temp_rand SELECT rand() FROM mysql.time_zone t1, mysql.time_zone t2 LIMIT 1024;
  34. INSERT INTO t1 SELECT 2, group_concat(md5(rand_value) SEPARATOR '') FROM temp_rand;
  35. DROP TABLE temp_rand;
  36. > CREATE SOURCE mz_source
  37. FROM MYSQL CONNECTION mysql_conn
  38. FOR ALL TABLES;
  39. > SELECT a, length(b) FROM t1;
  40. 1 32768
  41. 2 32768
  42. # Update the rows without touching the TOASTed column
  43. $ mysql-execute name=mysql
  44. UPDATE t1 SET a = 3;
  45. > SELECT a, length(b) FROM t1;
  46. 3 32768
  47. 3 32768