常见 DB 基础细节

Mongo

  • cmds

      db.happygame_sdk.test.getIndexes();
      db.happygame_sdk.test.explain("executionStats").find({'playerid':'ad3e5eb8-a03c-5011-8f2d-ce32c2a7ab31'});

Mysql

  • 了解数据库的一些基本理论知识:

    • 数据的存储格式 (堆组织表 vs 聚簇索引表)

    • 并发控制协议 (MVCC vs Lock-Based CC)

    • Two-Phase Locking

    • 数据库的隔离级别定义 (Isolation Level)

  • 了解SQL本身的执行计划

  • 了解数据库本身的一些实现细节

  • 查看数据库空间占用:

      SELECT CONCAT(table_schema,'.',table_name) AS 'Table Name', 
          CONCAT(ROUND(table_rows/1000000,4),'M') AS 'Number of Rows', 
          CONCAT(ROUND(data_length/(1024*1024*1024),4),'G') AS 'Data Size', 
          CONCAT(ROUND(index_length/(1024*1024*1024),4),'G') AS 'Index Size',
          CONCAT(ROUND((data_length+index_length)/(1024*1024*1024),4),'G') AS'Total'
      FROM information_schema.TABLES WHERE table_schema LIKE 'weixin_game' order by Total desc;

Last updated