这个视图是两个子查询用union all 组成的,单个执行都很快,放在一起union all 就超时,不管设置ob_query_timeout多少,其它查询没发现慢的。
MySQL [oceanbase]> set global ob_query_timeout=1200000000;
Query OK, 0 rows affected (0.19 sec)
MySQL [oceanbase]> select * from DBA_OB_LS_LOCATIONS;
ERROR 4012 (HY000): Timeout, query has reached the maximum query timeout: 1000000000(us), maybe you can adjust the session variable ob_query_timeout or query_timeout hint, and try again.
[root@ob-proxy ~]# mysql -h10.250.37.156 -P2883 -uroot@test1 -pRoot@123 -A oceanbase
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 2098274
Server version: 5.6.25 OceanBase_CE 4.1.0.0 (r100000202023040520-0765e69043c31bf86e83b5d618db0530cf31b707) (Built Apr 5 2023 20:26:14)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MySQL [oceanbase]>
MySQL [oceanbase]>
MySQL [oceanbase]>
MySQL [oceanbase]> SELECT
→ NOW(6) AS CREATE_TIME,
→ NOW(6) AS MODIFY_TIME,
→ LS_ID,
→ SVR_IP,
→ SVR_PORT,
→ SQL_PORT,
→ ZONE,
→ (CASE
→ ROLE
→ WHEN 1 THEN “LEADER”
→ ELSE “FOLLOWER”
→ END) AS ROLE,
→ (CASE
→ ROLE
→ WHEN 1 THEN MEMBER_LIST
→ ELSE NULL
→ END) AS MEMBER_LIST,
→ (CASE
→ ROLE
→ WHEN 1 THEN PAXOS_REPLICA_NUMBER
→ ELSE NULL
→ END) AS PAXOS_REPLICA_NUMBER,
→ (CASE
→ REPLICA_TYPE WHEN 0 THEN “FULL”
→ WHEN 5 THEN “LOGONLY”
→ WHEN 16 THEN “READONLY”
→ WHEN 261 THEN “ENCRYPTION LOGONLY”
→ ELSE NULL
→ END) AS REPLICA_TYPE
→ FROM
→ OCEANBASE.__ALL_VIRTUAL_CORE_META_TABLE
→ WHERE
→ TENANT_ID = EFFECTIVE_TENANT_ID();
Empty set, 1 warning (0.01 sec)
MySQL [oceanbase]> SELECT
→ GMT_CREATE AS CREATE_TIME,
→ GMT_MODIFIED AS MODIFY_TIME,
→ LS_ID,
→ SVR_IP,
→ SVR_PORT,
→ SQL_PORT,
→ ZONE,
→ (CASE
→ ROLE
→ WHEN 1 THEN “LEADER”
→ ELSE “FOLLOWER”
→ END) AS ROLE,
→ (CASE
→ ROLE
→ WHEN 1 THEN MEMBER_LIST
→ ELSE NULL
→ END) AS MEMBER_LIST,
→ (CASE
→ ROLE
→ WHEN 1 THEN PAXOS_REPLICA_NUMBER
→ ELSE NULL
→ END) AS PAXOS_REPLICA_NUMBER,
→ (CASE
→ REPLICA_TYPE WHEN 0 THEN “FULL”
→ WHEN 5 THEN “LOGONLY”
→ WHEN 16 THEN “READONLY”
→ WHEN 261 THEN “ENCRYPTION LOGONLY”
→ ELSE NULL
→ END) AS REPLICA_TYPE
→ FROM
→ OCEANBASE.__ALL_VIRTUAL_LS_META_TABLE
→ WHERE
→ TENANT_ID = EFFECTIVE_TENANT_ID()
→ AND TENANT_ID != 1 ;
±---------------------------±---------------------------±------±--------------±---------±---------±------±-------±---------------------±---------------------±-------------+
| CREATE_TIME | MODIFY_TIME | LS_ID | SVR_IP | SVR_PORT | SQL_PORT | ZONE | ROLE | MEMBER_LIST | PAXOS_REPLICA_NUMBER | REPLICA_TYPE |
±---------------------------±---------------------------±------±--------------±---------±---------±------±-------±---------------------±---------------------±-------------+
| 2023-05-10 17:55:21.680328 | 2023-05-10 17:55:24.726233 | 1 | 10.250.37.166 | 2882 | 2881 | zone1 | LEADER | 10.250.37.166:2882:1 | 1 | FULL |
| 2023-05-10 17:55:32.148298 | 2023-05-10 17:55:34.196359 | 1001 | 10.250.37.166 | 2882 | 2881 | zone1 | LEADER | 10.250.37.166:2882:1 | 1 | FULL |
±---------------------------±---------------------------±------±--------------±---------±---------±------±-------±---------------------±---------------------±-------------+
2 rows in set (0.02 sec)