最近公司有个toG单体应用项目,根据业务需求,需要持久化数据,通常我们都会使用mysql等关系型数据库,但是这个项目只是单机部署,而且对内存使用有较高的要求,所以想在机器上部署个 mysql 数据库,不仅内存占用大,而且比较重,所以,技术选型考虑轻量化的数据库SQLite。
SQLite是什么
SQLite是一个进程内的库,实现了自给自足的、无服务器的、零配置的、事务性的 SQL 数据库引擎。它是一个零配置的数据库,这意味着与其他数据库不一样,您不需要在系统中配置。
以下是SQLite的官网介绍:
SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine. SQLite is the most used database engine in the world. SQLite is built into all mobile phones and most computers and comes bundled inside countless other applications that people use every day. More Information…
The SQLite file format is stable, cross-platform, and backwards compatible and the developers pledge to keep it that way through the year 2050. SQLite database files are commonly used as containers to transfer rich content between systems [1] [2] [3] and as a long-term archival format for data [4]. There are over 1 trillion (1e12) SQLite databases in active use [5].
翻译过来后:
SQLite是C语言实现的小型、快速、独立、高可靠性、多功能的SQL数据库引擎。SQLite是世界上使用最对的数据库引擎。SQLite内置在手机和大多数计算机中,并捆绑在人们每天使用的许多应用。
SQLite文件格式是稳定的、跨平台的、向后兼容的,并且开发人员保证这种状态到2050年。SQLite数据库文件通常用作在系统之间传输富文本的容器,作为长期的存档格式。目前超过1万亿SQLite数据库在使用中。
为什么要使用SQLite
- 不需要一个单独的服务器进程或操作的系统(无服务器的)。
- SQLite 不需要配置,这意味着不需要安装或管理。
- 一个完整的 SQLite 数据库是存储在一个单一的跨平台的磁盘文件。
- SQLite 是非常小的,是轻量级的,完全配置时小于 400KiB,省略可选功能配置时小于250KiB。
- SQLite 是自给自足的,这意味着不需要任何外部的依赖。
- SQLite 事务是完全兼容 ACID 的,允许从多个进程或线程安全访问。
- SQLite 支持 SQL92(SQL2)标准的大多数查询语言的功能。
- SQLite 使用 ANSI-C 编写的,并提供了简单和易于使用的 API。
- SQLite 可在 UNIX(Linux, Mac OS-X, Android, iOS)和 Windows(Win32, WinCE, WinRT)中运行。
由于时间有限,今天就写到这了,使用教程待续。
文档信息
- 本文作者:yindongxu
- 本文链接:https://iceblow.github.io/2022/06/26/SqLite%E6%95%B0%E6%8D%AE%E5%BA%93/
- 版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)