mysql - 订单表,我把它分成好几个,我要查询订单,怎么用一条sql语句高效查询
高洛峰
高洛峰 2017-04-17 15:04:17
0
3
647
高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
PHPzhong

Inline query, join condition plus index, and all fields related to where need to be indexed

大家讲道理

It is best to determine which table to use for query based on the query conditions of the order, so that there is no need to query multiple tables.
If this is not possible, the general approach is to query multiple tables separately, and then use union all to put them into one result set.

阿神

There are several ways:
1. Partition, partition according to the conditions of your partitioning. After partitioning, the corresponding partition will be found according to your partitioning conditions
2. The tables of the myisam storage engine can be merged into one surface. However, the table structure is required to be consistent, see MRG_MYISAM
3. Multiple tables union all. It is more appropriate to require an index
4. Application judgment processing.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!