SQLite 数据库的大小有限制吗? [英] is there a limit to the size of a SQLite database?

查看:80
本文介绍了SQLite 数据库的大小有限制吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了他们的限制常见问题解答,他们讨论了许多限制,除了整个数据库的限制.

I have read their limits FAQ, they talk about many limits except limit of the whole database.

推荐答案

这很容易从 实施限制页面:

一个 SQLite 数据库文件被组织成页面.每个页面的大小是 512 和 SQLITE_MAX_PAGE_SIZE 之间的 2 的幂.SQLITE_MAX_PAGE_SIZE 的默认值为 32768.

An SQLite database file is organized as pages. The size of each page is a power of 2 between 512 and SQLITE_MAX_PAGE_SIZE. The default value for SQLITE_MAX_PAGE_SIZE is 32768.

...

SQLITE_MAX_PAGE_COUNT 参数通常设置为 1073741823,是单个数据库文件中允许的最大页数.尝试插入新数据会导致数据库文件变得比这更大将返回 SQLITE_FULL.

The SQLITE_MAX_PAGE_COUNT parameter, which is normally set to 1073741823, is the maximum number of pages allowed in a single database file. An attempt to insert new data that would cause the database file to grow larger than this will return SQLITE_FULL.

所以我们有 32768 * 1073741823,也就是 35,184,372,056,064(35 万亿 个字节)!

So we have 32768 * 1073741823, which is 35,184,372,056,064 (35 trillion bytes)!

您可以修改源代码中的 SQLITE_MAX_PAGE_COUNTSQLITE_MAX_PAGE_SIZE,但这当然需要为您的应用程序自定义构建 SQLite.据我所知,除了在编译时之外,没有办法以编程方式设置限制(但我很乐意被证明是错误的).

You can modify SQLITE_MAX_PAGE_COUNT or SQLITE_MAX_PAGE_SIZE in the source, but this of course will require a custom build of SQLite for your application. As far as I'm aware, there's no way to set a limit programmatically other than at compile time (but I'd be happy to be proven wrong).

这篇关于SQLite 数据库的大小有限制吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆