首页 > 解决方案 > 如何在 sqlite3 中跟踪查询速度?

问题描述

我的远程服务器有 200Gb RAM,我将它设置cache_size为 5000000page_size到 4096,这意味着它应该能够加载 20 GB 数据,但是当我像select count(table1.item1) from table1, table2 on table1.id = table2.id where table2.item1=1234;在 2.5 TB 数据库上运行查询时,它显示内存使用量只有大约 1 Gb,CPU 使用率是 0 到 7%,查询永远不会结束,我等了 24 小时.. 所以我能以某种方式跟踪那里已经加载了多少数据,加载数据时的速度是多少, 或类似的东西?

表结构:

table1:
   id integer primary key,
   item1 integer

table2:
   id integer,
   item1 integer

-- the DB without index was 0.8 TB after the three indices is now 2.5 TB
indices on: table1.item1, table2.id, table2.item1

标签: databasesqlitecachingram

解决方案


推荐阅读