MySQL8之JSON数组查询总结

郭慕荣博客园 / 2023-05-16 / 原文

目前有两种方式如下所示

select t0.* from acc_account_item t0  
where JSON_OVERLAPS (executable_store_ids -> '$[*]',CAST( '["86aafddcd17a4af68cc18b84fc933e93","305daadfde5b4167abcf2b57e37fcfbc"]' AS JSON ))
  select t0.* from acc_account_item t0  
where   t0.tenant_id = '86b23699cff44e75afd9b6a3970ee81a' and JSON_OVERLAPS(executable_store_ids, JSON_ARRAY("86aafddcd17a4af68cc18b84fc933e93"))

以上是两种查询方式,具体要看下哪种方式走了索引