explain-timestamps.td 3.4 KB

123456789101112131415161718192021222324252627282930313233343536
  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. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  10. ALTER SYSTEM SET allow_real_time_recency = true
  11. $ set-regex match=(s\d+|\d{13}|u\d+|\(\d+-\d\d-\d\d\s\d\d:\d\d:\d\d\.\d\d\d\)|true|false|\((\d+)\)) replacement=<>
  12. > CREATE TABLE t1 (a INT);
  13. # Strict serializable doesn't look at every object in the same time domain
  14. > SET TRANSACTION_ISOLATION = 'STRICT SERIALIZABLE';
  15. > EXPLAIN TIMESTAMP FOR SELECT * FROM t1
  16. " query timestamp: <> <>\n oracle read timestamp: <> <>\nlargest not in advance of upper: <> <>\n upper:[<> <>]\n since:[<> <>]\n can respond immediately: <>\n timeline: Some(EpochMilliseconds)\n session wall time: <> <>\n\nsource materialize.public.t1 (<>, storage):\n read frontier:[<> <>]\n write frontier:[<> <>]\n\nbinding constraints:\nlower:\n (IsolationLevel(StrictSerializable)): [<> <>]\n"
  17. # Serializable also doesn't look at every object in the same time domain
  18. > SET TRANSACTION_ISOLATION = 'SERIALIZABLE';
  19. > EXPLAIN TIMESTAMP FOR SELECT * FROM t1
  20. " query timestamp: <> <>\nlargest not in advance of upper: <> <>\n upper:[<> <>]\n since:[<> <>]\n can respond immediately: <>\n timeline: Some(EpochMilliseconds)\n session wall time: <> <>\n\nsource materialize.public.t1 (<>, storage):\n read frontier:[<> <>]\n write frontier:[<> <>]\n\nbinding constraints:\nlower:\n (StorageInput([User<>])): [<> <>]\n"
  21. # Real time recency shouldn't break anything
  22. > SET TRANSACTION_ISOLATION = 'STRICT SERIALIZABLE';
  23. > SET REAL_TIME_RECENCY TO TRUE
  24. > EXPLAIN TIMESTAMP FOR SELECT * FROM t1
  25. " query timestamp: <> <>\n oracle read timestamp: <> <>\n real time recency timestamp: 0 <>\nlargest not in advance of upper: <> <>\n upper:[<> <>]\n since:[<> <>]\n can respond immediately: <>\n timeline: Some(EpochMilliseconds)\n session wall time: <> <>\n\nsource materialize.public.t1 (<>, storage):\n read frontier:[<> <>]\n write frontier:[<> <>]\n\nbinding constraints:\nlower:\n (IsolationLevel(StrictSerializable)): [<> <>]\n"
  26. # Test autorouting explain timestamp queries
  27. > EXPLAIN TIMESTAMP FOR SELECT * from mz_internal.mz_cluster_replica_metrics
  28. " query timestamp: <> <>\n oracle read timestamp: <> <>\nlargest not in advance of upper: <> <>\n upper:[<> <>]\n since:[<> <>]\n can respond immediately: <>\n timeline: Some(EpochMilliseconds)\n session wall time: <> <>\n\nsource mz_internal.mz_cluster_replica_metrics_ind (<>, compute):\n read frontier:[<> <>]\n write frontier:[<> <>]\n\nbinding constraints:\nlower:\n (IsolationLevel(StrictSerializable)): [<> <>]\n"