tinyTot's recent timeline updates
tinyTot

tinyTot

V2EX member #381609, joined on 2019-02-01 11:58:00 +08:00
tinyTot's recent replies
Dec 11, 2021
Replied to a topic by tinyTot 问与答 看下上传图片
Dec 10, 2021
Replied to a topic by zhengxiexie V2EX v2ex 图片上传终极解决方法
Dec 10, 2021
Replied to a topic by tinyTot 问与答 看下上传图片
Dec 9, 2021
Replied to a topic by tinyTot MySQL mysql select * 与 select 具体字段 到底哪个快?
1 、指定的 uid 数据量在 300 条时,经常查询的一个用户,指定字段的速度=0.122; * 的速度=0.217
1 、指定的 uid 数据量在 300 条时,不经常查询的一个用户,指定字段的速度=0.311; * 的速度=0.210
2 、指定的 uid 数据量在小于 15 条时,不经常查询的一个用户,指定字段的速度=0.456; * 的速度=0.217

在增加 uid 的索引后,两条 sql 查询时间 大致都在 0.02x

考虑到还有网络传输,最终决定还是指定字段查询

不过对于这个问题还是有点疑惑
Dec 9, 2021
Replied to a topic by tinyTot MySQL mysql select * 与 select 具体字段 到底哪个快?
show variables like '%query_cache%';

have_query_cache YES
query_cache_limit 1048576
query_cache_min_res_unit 4096
query_cache_size 0
query_cache_type OFF
query_cache_wlock_invalidate OFF



show status like 'Qcache%';

Qcache_free_blocks 0
Qcache_free_memory 0
Qcache_hits 0
Qcache_inserts 0
Qcache_lowmem_prunes 0
Qcache_not_cached 5036
Qcache_queries_in_cache 0
Qcache_total_blocks 0
Dec 9, 2021
Replied to a topic by tinyTot MySQL mysql select * 与 select 具体字段 到底哪个快?
字段一共 15 个; 数据量 80 万左右; sql 里面只有主键索引;
order by id 不如 order by created_at 快
select * 比 select 具体字段快
不知道是不是 select * mysql 有相关查询缓存的原因

SELECT `id`, `no`, `amount`, `type`, `note`, `created_at` FROM `charge` WHERE `uid` = 11 ORDER BY `created_at` DESC LIMIT 15 OFFSET 0;

SELECT * `charge` WHERE `uid` = 11 ORDER BY `id` DESC LIMIT 15 OFFSET 0;
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5611 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 32ms · UTC 08:26 · PVG 16:26 · LAX 01:26 · JFK 04:26
♥ Do have faith in what you're doing.