mysql分区 [英] mysql partitioning

查看:101
本文介绍了mysql分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只想验证数据库分区是否仅在数据库级别实现,当我们查询分区表时,我们仍然执行普通查询,查询没有什么特别的,优化是在解析查询时自动执行的,对吗?

just want to verify that database partition is implemented only at the database level, when we query a partitioned table, we still do our normal query, nothing special with our queries, the optimization is performed automatically when parsing the query, is that correct?

例如我们有一个名为地址"的表,其中有一个名为"country_code"和"city"的列.因此,如果我想获得美国纽约的所有地址,通常我会这样做:

e.g. we have a table called 'address' with a column called 'country_code' and 'city'. so if i want to get all the addresses in New York, US, normally i wound do something like this:

select * from address where country_code = 'US' and city = 'New York'

如果现在该表由"country_code"分区,我知道现在查询将仅在包含country_code = US的分区上执行.我的问题是我需要在sql语句中明确指定要查询的分区吗?还是我仍然使用前面的语句,数据库服务器会自动对其进行优化?

if now the table is partitioned by 'country_code', and i know that now the query will only be executed on the partition which contains country_code = US. My question is do I need to explicitly specify the partition to query in my sql statement? or i still use the previous statement and the db server will optimize it automatically?

提前谢谢!

推荐答案

分区对您编写的任何查询都是透明的.无需指定要查询的分区.

The partitioning is transparent to any queries you write. There is no need to specify what partition to query.

数据库仅使用下面的分区进行相应的优化,并且理想情况下会根据where子句减少需要搜索的数据或索引的数量.

The database just uses the partitions underneath to optimize accordingly and ideally reducing the amount of data or indexes it needs to search through based on you where clause.

这篇关于mysql分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆