database - 如何在 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
解决方案
推荐阅读
- sql - 在 sql 中查找唯一的路由
- android - Swift 和 Kotlin 的密钥派生函数库?
- python - 将标题名称分配给具有不同列数的 panda 数据表
- javascript - 登录后页面未使用 window.href 加载,但在我登录前转到 url 时加载
- flutter - 变量可以用作 dart 语言中命名参数的键吗?
- typescript - 在 TypeScript 中,如何将联合的每个值映射到单独的类型?
- c++ - 在 Microsoft Visual Studio 中为 Linux 机器编译 C++ 代码(使用 GDAL)
- javascript - 传递多个 multer 中间件
- mysql - Nodejs promise-mysql:con.query 不是函数
- ios - 目标 c 超类中的受保护变量在 swift 子类中不可访问