提交 8297f8a3 编写于 作者: R Ryuta Kamizono

Merge pull request #37465 from alpaca-tc/optimize_primary_keys

Fixed performance regression introduced MySQL 8.0
上级 278f2c43
* Fixed the performance regression for `primary_keys` introduced MySQL 8.0.
*Hiroyuki Ishii*
* `insert`, `insert_all`, `upsert`, and `upsert_all` now clear the query cache.
*Eugene Kenny*
......
......@@ -440,11 +440,11 @@ def primary_keys(table_name) # :nodoc:
query_values(<<~SQL, "SCHEMA")
SELECT column_name
FROM information_schema.key_column_usage
WHERE constraint_name = 'PRIMARY'
FROM information_schema.statistics
WHERE index_name = 'PRIMARY'
AND table_schema = #{scope[:schema]}
AND table_name = #{scope[:name]}
ORDER BY ordinal_position
ORDER BY seq_in_index
SQL
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册