ob 大小写敏感是哪个参数控制的

【 使用环境 】生产环境 or 测试环境 测试
【 OB or 其他组件 】 4.0
【 使用版本 】 4.0
【问题描述】清晰明确描述问题
【复现路径】问题出现前后相关操作
【附件及日志】推荐使用OceanBase敏捷诊断工具obdiag收集诊断信息,详情参见链接(右键跳转查看):

【SOP系列 22 】——故障诊断第一步(自助诊断和诊断信息收集)

-sql
有一个租户可以用这个sql 查询结果
select USEC_TO_TIME(request_time),QUERY_SQL from sql_audit
where QUERY_SQL like ‘%amm_acc%’

有一个租户要另外SQL 查询结果
select USEC_TO_TIME(request_time),QUERY_SQL from sql_audit
where QUERY_SQL like upper(’%amm_acc%’)

问题如下:
ob 大小写敏感是哪个参数控制的

OceanBase 数据库 MySQL 租户对象大小写默认值

https://www.oceanbase.com/knowledge-base/oceanbase-database-20000000017?back=kb

1 个赞

问题看上去不是说对象名的大小写

如果是数据的大小写敏感需要调整MySQL租户字符序,是 xxx_xx_ci 结尾的字符序,查询时不区分大小写
ci代表的是case insensitive,即大小写不敏感

2 个赞

字符比较校对规则,默认校对规则就是utf8mb4_general_ci,不区分大小写噢

2 个赞

表名大小写区分是参数lower_case_table_names控制
表数据区分大小写,需要看表的比较规则
utf8mb4_bin 表数据区分大小写
utf8mb4_general_ci 表数据不区分大小写

2 个赞

问题:存在 sql_audit表中的字段 QUERY_SQL 的对象名 在 taba

应该跟utf8mb4_bin 和 utf8mb4_general_ci 参数相关对吧?

表名大小写区分是参数lower_case_table_names控制
表数据区分大小写,需要看表的比较规则
utf8mb4_bin 表数据区分大小写
utf8mb4_general_ci 表数据不区分大小写

2 个赞

问题:存在 sql_audit表中的字段 QUERY_SQL 的对象名 在 taba

应该跟utf8mb4_bin 和 utf8mb4_general_ci 参数相关对吧?

表名大小写区分是参数lower_case_table_names控制
表数据区分大小写,需要看表的比较规则
utf8mb4_bin 表数据区分大小写
utf8mb4_general_ci 表数据不区分大小写

是的,这个视图来源表是__all_virtual_sql_audit这张表
CREATE TABLE __all_virtual_sql_audit (
svr_ip varchar(46) NOT NULL,
svr_port bigint(20) NOT NULL,
tenant_id bigint(20) NOT NULL,
request_id bigint(20) NOT NULL,
trace_id varchar(128) NOT NULL,
client_ip varchar(46) NOT NULL,
client_port bigint(20) NOT NULL,
tenant_name varchar(64) NOT NULL,
effective_tenant_id bigint(20) NOT NULL,
user_id bigint(20) NOT NULL,
user_name varchar(64) NOT NULL,
db_id bigint(20) unsigned NOT NULL,
db_name varchar(128) NOT NULL,
sql_id varchar(32) NOT NULL,
query_sql longtext NOT NULL,
plan_id bigint(20) NOT NULL,
affected_rows bigint(20) NOT NULL,
return_rows bigint(20) NOT NULL,
partition_cnt bigint(20) NOT NULL,
ret_code bigint(20) NOT NULL,
qc_id bigint(20) unsigned NOT NULL,
dfo_id bigint(20) NOT NULL,
sqc_id bigint(20) NOT NULL,
worker_id bigint(20) NOT NULL,
event varchar(64) DEFAULT NULL,
p1text varchar(64) DEFAULT NULL,
p1 bigint(20) unsigned DEFAULT NULL,
p2text varchar(64) DEFAULT NULL,
p2 bigint(20) unsigned DEFAULT NULL,
p3text varchar(64) DEFAULT NULL,
p3 bigint(20) unsigned DEFAULT NULL,
level bigint(20) DEFAULT NULL,
wait_class_id bigint(20) DEFAULT NULL,
wait_class# bigint(20) DEFAULT NULL,
wait_class varchar(64) DEFAULT NULL,
state varchar(19) DEFAULT NULL,
wait_time_micro bigint(20) DEFAULT NULL,
total_wait_time_micro bigint(20) DEFAULT NULL,
total_waits bigint(20) DEFAULT NULL,
rpc_count bigint(20) DEFAULT NULL,
plan_type bigint(20) NOT NULL,
is_inner_sql tinyint(4) NOT NULL,
is_executor_rpc tinyint(4) NOT NULL,
is_hit_plan tinyint(4) NOT NULL,
request_time bigint(20) NOT NULL,
elapsed_time bigint(20) NOT NULL,
net_time bigint(20) NOT NULL,
net_wait_time bigint(20) NOT NULL,
queue_time bigint(20) NOT NULL,
decode_time bigint(20) NOT NULL,
get_plan_time bigint(20) NOT NULL,
execute_time bigint(20) NOT NULL,
application_wait_time bigint(20) unsigned DEFAULT NULL,
concurrency_wait_time bigint(20) unsigned DEFAULT NULL,
user_io_wait_time bigint(20) unsigned DEFAULT NULL,
schedule_time bigint(20) unsigned DEFAULT NULL,
row_cache_hit bigint(20) DEFAULT NULL,
bloom_filter_cache_hit bigint(20) DEFAULT NULL,
block_cache_hit bigint(20) DEFAULT NULL,
disk_reads bigint(20) DEFAULT NULL,
execution_id bigint(20) NOT NULL,
session_id bigint(20) unsigned NOT NULL,
retry_cnt bigint(20) NOT NULL,
table_scan tinyint(4) NOT NULL,
consistency_level bigint(20) NOT NULL,
memstore_read_row_count bigint(20) DEFAULT NULL,
ssstore_read_row_count bigint(20) DEFAULT NULL,
data_block_read_cnt bigint(20) DEFAULT NULL,
data_block_cache_hit bigint(20) DEFAULT NULL,
index_block_read_cnt bigint(20) DEFAULT NULL,
index_block_cache_hit bigint(20) DEFAULT NULL,
blockscan_block_cnt bigint(20) DEFAULT NULL,
blockscan_row_cnt bigint(20) DEFAULT NULL,
pushdown_storage_filter_row_cnt bigint(20) DEFAULT NULL,
request_memory_used bigint(20) NOT NULL,
expected_worker_count bigint(20) NOT NULL,
used_worker_count bigint(20) NOT NULL,
sched_info varchar(16384) DEFAULT NULL,
fuse_row_cache_hit bigint(20) DEFAULT NULL,
user_client_ip varchar(46) NOT NULL,
ps_client_stmt_id bigint(20) NOT NULL,
ps_inner_stmt_id bigint(20) NOT NULL,
transaction_id bigint(20) NOT NULL,
snapshot_version bigint(20) unsigned NOT NULL,
snapshot_source varchar(128) NOT NULL,
request_type bigint(20) NOT NULL,
is_batched_multi_stmt tinyint(4) NOT NULL,
ob_trace_info varchar(4096) NOT NULL,
plan_hash bigint(20) unsigned NOT NULL,
user_group bigint(20) DEFAULT NULL,
lock_for_read_time bigint(20) NOT NULL,
params_value longtext NOT NULL,
rule_name varchar(256) NOT NULL,
proxy_session_id bigint(20) unsigned NOT NULL,
tx_internal_route_flag bigint(20) unsigned NOT NULL,
partition_hit tinyint(4) NOT NULL,
tx_internal_route_version bigint(20) unsigned NOT NULL,
flt_trace_id varchar(1024) NOT NULL,
pl_trace_id varchar(128) DEFAULT NULL,
plsql_exec_time bigint(20) NOT NULL,
network_wait_time bigint(20) unsigned DEFAULT NULL,
stmt_type varchar(128) DEFAULT NULL,
seq_num bigint(20) NOT NULL,
total_memstore_read_row_count bigint(20) NOT NULL,
total_ssstore_read_row_count bigint(20) NOT NULL,
proxy_user varchar(128) DEFAULT NULL,
format_sql_id varchar(32) NOT NULL,
PRIMARY KEY (svr_ip, svr_port, tenant_id, request_id),
KEY all_virtual_sql_audit_i1 (tenant_id, request_id) STORING (trace_id, client_ip, client_port, tenant_name, effective_tenant_id, user_id, user_name, db_id, db_name, sql_id, query_sql, plan_id, affected_rows, return_rows, partition_cnt, ret_code, qc_id, dfo_id, sqc_id, worker_id, event, p1text, p1, p2text, p2, p3text, p3, level, wait_class_id, wait_class#, wait_class, state, wait_time_micro, total_wait_time_micro, total_waits, rpc_count, plan_type, is_inner_sql, is_executor_rpc, is_hit_plan, request_time, elapsed_time, net_time, net_wait_time, queue_time, decode_time, get_plan_time, execute_time, application_wait_time, concurrency_wait_time, user_io_wait_time, schedule_time, row_cache_hit, bloom_filter_cache_hit, block_cache_hit, disk_reads, execution_id, session_id, retry_cnt, table_scan, consistency_level, memstore_read_row_count, ssstore_read_row_count, data_block_read_cnt, data_block_cache_hit, index_block_read_cnt, index_block_cache_hit, blockscan_block_cnt, blockscan_row_cnt, pushdown_storage_filter_row_cnt, request_memory_used, expected_worker_count, used_worker_count, sched_info, fuse_row_cache_hit, user_client_ip, ps_client_stmt_id, ps_inner_stmt_id, transaction_id, snapshot_version, snapshot_source, request_type, is_batched_multi_stmt, ob_trace_info, plan_hash, user_group, lock_for_read_time, params_value, rule_name, proxy_session_id, tx_internal_route_flag, partition_hit, tx_internal_route_version, flt_trace_id, pl_trace_id, plsql_exec_time, network_wait_time, stmt_type, seq_num, total_memstore_read_row_count, total_ssstore_read_row_count, proxy_user, format_sql_id) BLOCK_SIZE 16384 LOCAL
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = ‘none’ REPLICA_NUM = 3 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10
partition by list columns(svr_ip, svr_port)
(partition p0 values in (DEFAULT))

sql_audit表中的字段 QUERY_SQL 的对象名 就是原sql文本 实际的sql格式 和前说明的lower_case_table_names参数还有字符集没有关系,前面我发的文档和你的问题没啥关系,非常抱歉
,你也可以自己做测试。

1 个赞

query_sql里面就是数据了,所以受字节序的影响

1 个赞