lenmore 最近的时间轴更新
lenmore

lenmore

V2EX 第 4657 号会员,加入于 2011-01-04 10:27:51 +08:00
GAE练手:http://msdn.ez58.net/
lenmore 最近回复了
买了 unraid 正版,我认为 unraid 的存储模式是最适合家用的。
如果只查询 “是”,大胆的建索引吧,效率非常高。查询“否”,配合其他字段建组合索引,效率同样杠杠的。我们上亿的表都这么干,一点问题没有。
囤了两个米动 1S 手表
如果大小不一的盘组逻辑盘,我理解你用的只是 LVM 。
LVM 是可以做到数据盘热迁移的。

参考:
https://www.thegeekdiary.com/centos-rhel-how-to-migrate-storage-lvm-with-pvmove-command/
没必要 redis 。几千万数据,建好索引,MySQL 没有任何问题。
278 天前
回复了 msmmbl 创建的主题 问与答 mongo 自建高可用,一定是 3 台服务器起步吗
推荐 3 个节点
但是预算实在紧张,可以考虑 1 主 1 从 + 1 个 Arbiter ,参考: https://www.mongodb.com/docs/manual/core/replica-set-arbiter/
MySQL 可以试下这个,以前写的应付检查的……
导出成 excel ,去掉表头就行了。

SET @table_schema='test';

SELECT column_name, DATA_TYPE, COLUMN_COMMENT
FROM (
SELECT table_name, '' AS column_name, '' AS DATA_TYPE, '' AS COLUMN_COMMENT, -4 AS ORDINAL_POSITION FROM information_schema.tables WHERE table_schema=@table_schema
UNION
SELECT table_name, CONCAT('表名:', table_name) AS column_name, '' AS DATA_TYPE, '' AS COLUMN_COMMENT, -3 AS ORDINAL_POSITION FROM information_schema.tables WHERE table_schema=@table_schema
UNION
SELECT table_name, CONCAT('用途:', table_comment) AS column_name, '' AS DATA_TYPE, '' AS COLUMN_COMMENT, -2 AS ORDINAL_POSITION FROM information_schema.tables WHERE table_schema=@table_schema
UNION
SELECT table_name, '字段名' AS column_name, '字段类型' AS DATA_TYPE, '描述' AS COLUMN_COMMENT, -1 AS ORDINAL_POSITION FROM information_schema.tables WHERE table_schema=@table_schema
UNION
SELECT table_name, column_name, CONCAT(DATA_TYPE, CASE WHEN CHARACTER_MAXIMUM_LENGTH IS NOT NULL THEN CONCAT('(', CHARACTER_MAXIMUM_LENGTH, ')') WHEN NUMERIC_PRECISION IS NOT NULL THEN CONCAT('(',NUMERIC_PRECISION, CASE WHEN NUMERIC_SCALE>0 THEN CONCAT(',',NUMERIC_SCALE) ELSE '' END , ')') WHEN DATETIME_PRECISION > 0 THEN CONCAT('(', DATETIME_PRECISION, ')') ELSE '' END) AS DATA_TYPE, COLUMN_COMMENT,ORDINAL_POSITION FROM information_schema.columns WHERE table_schema=@table_schema
) AS t
ORDER BY table_name, ORDINAL_POSITION;
用 percent_rank 窗口函数,然后对 pct 分组,统计出各组的平均分。

e.g.
select floor(pct*100 /25) as grp, avg(n)
from (
select n, percent_rank() over(order by n) as pct
from public.global_number order by n
) as t
group by floor(pct*100 /25)
order by grp
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1592 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 17:08 · PVG 01:08 · LAX 09:08 · JFK 12:08
Developed with CodeLauncher
♥ Do have faith in what you're doing.