mysql - 85万数据量的表,43个字段,25个常用查询字段,频繁增删查改,如何优化?
PHPz
PHPz 2017-04-17 11:28:14
0
3
654

目前系统有些查询(只是单表查询)不走索引导致系统速度变慢。

问题1:把25个字段全部加上索引是不是一个好的方案,会不会带来其他问题?
问题2:如果表数据量可能会在短期增长到800万,在不考虑分表的情况下,有没有什么比较好的方法?

PS:表引擎是 innodb.
服务器配置:双核cpu 2.4Ghz ,1G内存.. 除了跑mysql还跑了nginx.. 硬件确实有点拙计..

PHPz
PHPz

学习是最好的投资!

reply all(3)
黄舟

The only way to optimize without adding hardware is to improve the business logic, or add indexes appropriately (write speed is replaced by reading speed) or memory cache, but 1G of memory is also in short supply...

If you have a hardware budget, there are naturally a hundred ways to optimize it. The most crude and low-cost method is to add an SSD to store the database. If the average 800W data is 15K, then 240G is almost enough

小葫芦

Can be optimized for slow queries. The index is mainly effective for the conditional fields behind where. You can try to create it.

Indexes are good for querying, but adding data will slow down. It is estimated that too many indexes are not good.

阿神

Using PostgreSQL's GIN index is the simplest and most effective method. For details, please refer to: Optimization of high-concurrency, low-cardinality, multi-field, arbitrary combination queries

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template