【问题标题】:Is it ok to mix storage engines on same database?可以在同一个数据库上混合存储引擎吗?
【发布时间】:2015-05-17 01:46:30
【问题描述】:

我有一个 OpenCart 项目,数据库中有大约 50,000 种产品。我已将网络托管从 VPS 切换到专用服务器,并且我看到了一些改进,但网站仍然滞后。

在 VPS 上,所有表都是 MyISAM 和 mysql 5.1.x.x 上的 latin1_swedish_ci 排序规则。在新服务器上,我已切换到 TokuDB 和 MariaDB 10 。对于某些表,我不得不删除 FULLTEXT 索引,我发现性能有所下降(所有表现在都在 TokuDB 上)。

将某些表切换回 MyISAM(只是为了使用 FULLTEXT 索引)是一个明智的决定吗? OpenCart 有一些查询加入了很多表……如果有些在 TokuDB 上,有些在 MyISAM 上,会有惩罚吗?我只求性能,资源排在第二位。

非常感谢!

【问题讨论】:

  • 是的。完全可以接受,但这可以解释为意见。
  • 每个引擎都有其优点和缺点。了解about them 并根据应用程序使用表的方式为每个表选择适当的引擎。
  • InnoDB 现在有全文。而且它似乎比 MyISAM 的 FT 更快。
  • 通常可以混合引擎。能否请您添加 my.cnf、RAM 和放置大多数活动表的表大小(未压缩)

标签: mysql opencart collation mariadb storage-engines


【解决方案1】:

如果您知道自己在做什么以及为什么要这样做,那就没问题了。

不同的引擎使用内存和磁盘存储的方式非常不同。对于 OLTP 类型系统,InnoDB 通常比 MyISAM 更明智(您在尝试不同的引擎之前检查过争用吗?)。但是,您添加到缓冲池(以提高 InnoDB 性能)的任何内存都不再可用于 VFS 或排序缓冲区(有助于提高 MyISAM 性能)。

我真的很难想象 TokuDB 如何让任何成为电子商务网站的存储基础。它的全部是关于获得更快的插入和更新写入,以及对 SSD 的低维护 - 选择性能很少比其他引擎好。

【讨论】:

    【解决方案2】:

    我认为是正确的,我在一个数据库中混合了存储引擎,并且数据库的速度是正确的。

    无论如何,如果您将 opencart 与很多产品(50,000 个)一起使用,我建议您在(所有)表上创建索引,如果这样做可以提高速度。

    我做了以下事情:

        #Tabla category campo parent_id
    CREATE INDEX i_parent_id ON category (parent_id);
    
    #Tabla category_description campo language_id
    CREATE INDEX i_category_description ON category_description (language_id);
    
    #Tabla category_path campos path_id y level
    CREATE INDEX i_category_path ON category_path (path_id,level);
    
    #Tabla category_to_store campo store_id
    CREATE INDEX i_category_to_store ON category_to_store (store_id);
    
    #Tabla manufacturer_to_store campo store_id
    CREATE INDEX i_manufacturer_to_store ON manufacturer_to_store (store_id);
    
    #Tabla product campos manufacturer_id, date_added, date_modified
    CREATE INDEX i_product ON product (manufacturer_id, date_added, date_modified);
    
    #Tabla product campos model, sku, upc, ean,(como veis donde tengais la referencia etc) y con tipo FULLTEXT (si el campo es de caracteres no de números)
    CREATE FULLTEXT INDEX i_product_fulltext ON product (model, sku, upc, ean);
    
    #Tabla product_description campo language_id
    CREATE INDEX i_product_description ON product_description (language_id);
    
    #Tabla product_to_category campo category_id
    CREATE INDEX i_product_to_category ON product_to_category (category_id);
    
    #Tabla product_to_store campo store_id
    CREATE INDEX i_product_to_store ON product_to_store (store_id);
    
    #Tabla setting campo store_id, serialized
    CREATE INDEX i_setting ON setting (store_id, serialized);
    
    #Tabla url_alias campo query con tipo FULLTEXT
    CREATE FULLTEXT INDEX i_url_alias ON url_alias (query);# 6936 filas afectadas.
    
    #Tabla zone campo country_id
    CREATE INDEX i_zone ON zone (country_id);
    
    #Tabla zone campo name y code con tipo FULLTEXT
    CREATE FULLTEXT INDEX i_zone_fulltext ON zone (name,code);
    

    你必须在你的桌子上加上“前缀”。

    类似这样的: http://www.codigojavaoracle.com/desarrollo-web/mejorar-la-velocidad-en-opencart/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-05
      • 1970-01-01
      • 2019-01-02
      • 1970-01-01
      • 2011-02-21
      • 1970-01-01
      • 2017-04-21
      • 1970-01-01
      相关资源
      最近更新 更多