SQL 服务器负担得起多少数据?
How many data did SQL Server affordable?
数据库:SQL Server 2014 标准版或更高版本;
服务器:MS Azure,不限 CPU 和 RAM
我们要设计我们新的后端架构,我们有大约 2000 万在一个 table,SQL 可能喜欢:
select * from xxxx
where (type=1 or type=2 or type=3) and someNumber<5000
order by xxxxxx
SQL与其他table没有任何关系。
这个SQL能马上回复吗? (在 500 到 1000 毫秒内)
当数据增长到1亿,还能负担得起吗?
或者有什么技巧可以优化吗? (如 sql 查看、缓存等)
您的查询可以更容易地写成:
select *
from xxxx
where type in (1, 2, 3) and someNumber < 5000
order by xxxxxx;
这很难优化。您可以在 xxxx(type, someNumber)
上尝试索引。这个索引在这个查询版本上会更好:
select *
from ((select * from xxxx where type = 1 and somenumber < 5000) union all
(select * from xxxx where type = 2 and somenumber < 5000) union all
(select * from xxxx where type = 2 and somenumber < 5000)
) x
order by xxxxxx;
SQL Azure 应该对你有好处。我在 SQL Azure 上有一个数据库,在一个 table 中有超过 2.5 亿条记录,这是一个标准的 2 层数据库,不是很昂贵。如果您有良好的索引和简单的查询,它会很好地工作。最终你应该创建一个数据库并试一试。
您还可以使用 table 分区,这可以帮助某些人提高性能和管理如此大的 table。
在 Stackify,我们在 SQL Azure 上为我们的多租户 SaaS 产品管理超过 1,000 个数据库。
数据库:SQL Server 2014 标准版或更高版本;
服务器:MS Azure,不限 CPU 和 RAM
我们要设计我们新的后端架构,我们有大约 2000 万在一个 table,SQL 可能喜欢:
select * from xxxx
where (type=1 or type=2 or type=3) and someNumber<5000
order by xxxxxx
SQL与其他table没有任何关系。 这个SQL能马上回复吗? (在 500 到 1000 毫秒内)
当数据增长到1亿,还能负担得起吗?
或者有什么技巧可以优化吗? (如 sql 查看、缓存等)
您的查询可以更容易地写成:
select *
from xxxx
where type in (1, 2, 3) and someNumber < 5000
order by xxxxxx;
这很难优化。您可以在 xxxx(type, someNumber)
上尝试索引。这个索引在这个查询版本上会更好:
select *
from ((select * from xxxx where type = 1 and somenumber < 5000) union all
(select * from xxxx where type = 2 and somenumber < 5000) union all
(select * from xxxx where type = 2 and somenumber < 5000)
) x
order by xxxxxx;
SQL Azure 应该对你有好处。我在 SQL Azure 上有一个数据库,在一个 table 中有超过 2.5 亿条记录,这是一个标准的 2 层数据库,不是很昂贵。如果您有良好的索引和简单的查询,它会很好地工作。最终你应该创建一个数据库并试一试。
您还可以使用 table 分区,这可以帮助某些人提高性能和管理如此大的 table。
在 Stackify,我们在 SQL Azure 上为我们的多租户 SaaS 产品管理超过 1,000 个数据库。