当前位置: 首页 > 软件库 > 数据库相关 > >

better-sqlite3

授权协议 MIT License
开发语言 C/C++
所属分类 数据库相关
软件类型 开源软件
地区 不详
投 递 者 岳浩宕
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

better-sqlite3 Build Status

The fastest and simplest library for SQLite3 in Node.js.

  • Full transaction support
  • High performance, efficiency, and safety
  • Easy-to-use synchronous API (better concurrency than an asynchronous API... yes, you read that correctly)
  • Support for user-defined functions, aggregates, virtual tables, and extensions
  • 64-bit integers (invisible until you need them)
  • Worker thread support (for large/slow queries)

Help this project stay strong! ��

better-sqlite3 is used by thousands of developers and engineers on a daily basis. Long nights and weekends were spent keeping this project strong and dependable, with no ask for compensation or funding, until now. If your company uses better-sqlite3, ask your manager to consider supporting the project:

How other libraries compare

select 1 row  get()  select 100 rows   all()   select 100 rows iterate() 1-by-1 insert 1 row run() insert 100 rows in a transaction
better-sqlite3 1x 1x 1x 1x 1x
sqlite and sqlite3 11.7x slower 2.9x slower 24.4x slower 2.8x slower 15.6x slower

You can verify these results by running the benchmark yourself.

Installation

npm install better-sqlite3

You must be using Node.js v10.20.1 or above. Prebuilt binaries are available for LTS versions.

If you have trouble installing, check the troubleshooting guide.

Usage

const db = require('better-sqlite3')('foobar.db', options);

const row = db.prepare('SELECT * FROM users WHERE id = ?').get(userId);
console.log(row.firstName, row.lastName, row.email);

Why should I use this instead of node-sqlite3?

  • node-sqlite3 uses asynchronous APIs for tasks that are either CPU-bound or serialized. That's not only bad design, but it wastes tons of resources. It also causes mutex thrashing which has devastating effects on performance.
  • node-sqlite3 exposes low-level (C language) memory management functions. better-sqlite3 does it the JavaScript way, allowing the garbage collector to worry about memory management.
  • better-sqlite3 is simpler to use, and it provides nice utilities for some operations that are very difficult or impossible in node-sqlite3.
  • better-sqlite3 is much faster than node-sqlite3 in most cases, and just as fast in all other cases.

When is this library not appropriate?

In most cases, if you're attempting something that cannot be reasonably accomplished with better-sqlite3, it probably cannot be reasonably accomplished with SQLite3 in general. For example, if you're executing queries that take one second to complete, and you expect to have many concurrent users executing those queries, no amount of asynchronicity will save you from SQLite3's serialized nature. Fortunately, SQLite3 is very very fast. With proper indexing, we've been able to achieve upward of 2000 queries per second with 5-way-joins in a 60 GB database, where each query was handling 5–50 kilobytes of real data.

If you have a performance problem, the most likely causes are inefficient queries, improper indexing, or a lack of WAL mode—not better-sqlite3 itself. However, there are some cases where better-sqlite3 could be inappropriate:

  • If you expect a high volume of concurrent reads each returning many megabytes of data (i.e., videos)
  • If you expect a high volume of concurrent writes (i.e., a social media site)
  • If your database's size is near the terabyte range

For these situations, you should probably use a full-fledged RDBMS such as PostgreSQL.

Documentation

License

MIT

  • 关于node-gyp node-gyp是一个用 Node.js 编写的跨平台命令行工具,用于为 Node.js 编译本机插件模块。它包含之前由 Chromium 团队使用的 gyp-next项目的供应副本,扩展以支持 Node.js 原生插件的开发。 node-gyp is a cross-platform command-line tool written in Node.js for comp

  • 最近需要安装个wechaty-puppet-padlocal,用yarn add wechaty-puppet-padlocal,安装报错,提示依赖的better-sqlite3 无法安装,原因是glibc-2.29 not found。好家伙!glibc是什么我都不知道,这是难为我大cv工程师啊。于是去宠幸了下度娘,得知glibc是GNU发布的libc库,即c运行库。glibc是linux系统中

  • 1. 安装 windows-build-tools, 注意用管理员身份启动终端(如果安装node的时侯已经安装了相关的tools就略过这一步) npm install --global windows-build-tools   这里有个点要注意一下,这个工具分版本 vs2015, vs2017, 默认是2017,如果是需要2015版安装时后面加参数 npm install --global wi

  • 1. 安装 windows-build-tools, 注意用管理员身份启动终端 npm install --global windows-build-tools   这里有个点要注意一下,这个工具分版本 vs2015, vs2017, 默认是2017,如果是需要2015版安装时后面加参数 npm install --global windows-build-tools --vs2015   如果不

  • Nodejs平台上操纵sqlite数据库的工具,语法简洁,运行效率高。 详细教程地址 安装 在工程中添加: yarn add better-sqlite3 对象类 better-sqlite3中的对象有两类,一个是Database类,一个是Statement类,Database对象可以实现数据库的连接和基本操作,Database.prepare()用于生成Statement对象,Statemen

  • 1、问题 最近在centos7上安装nodejs环境。并且使用到better-sqlite3包,但是一直安装失败。 2、解决方案 系统 centos7 node版本 v16.15.1 安装依赖时Better-SQLite3无法安装 原因:GCC版本(有时)与Centos7中的Better-SQLite3不兼容 解决: 需要root权限(以下命令在root账号下进行) sudo yum instal

  • 主要报错是这一行,坑爹的python2的编码问题 ,  UnicodeDecodeError: 'ascii' codec can't decode byte 0xd5 in position 11: ordinal not in range(128) 在 C:\Users\JXD文件夹中创建.npmrc文件, 并执行 npm config set python xxxxx(python3路径,

 相关资料
  • better-keyboard 是使用Javascript编写的移动端键盘组件,不支持使用rem和em做布局的项目 Options 参数 defaultResult: [] 默认值 containEl: body 父级容器 closeTitle: 完成 关闭按钮文本 max: 6 最大长度 Events 事件 onInput 点击数字按钮 onClose 键盘关闭 onClosed 关闭动画结束后

  • Better Player 是一个基于 video_player 和 Chewie 的高级视频播放器。它具有多种配置选项,解决了许多典型的用例,而且很容易运行。 Better Player 是 Chewie 中引入的理念的延续。更好的修复了常见的错误,增加了更多的配置选项并解决了典型的使用情况。 特性: 修复了常见错误 添加了高级配置选项 重构的玩家控制 播放列表支持 ListView 中的视频支

  • 该项目主要提供了用来监控 MySQL、Apache、Memcached 等服务程序的 Cacti 监控模板。

  • Ant Design Pro 是 Ant Design 官方推出的非常优秀的、开箱即用的、中台前端解决方案,而 React-Better-Admin 也是向 Ant Design Pro 学习,对标 Ant Design Pro,打造 "另一套" 优秀的、开箱即用的、中台前端解决方案。 特点 1、基于 TypeScript ������ 2、基于最新的 React 18 ������ 3、基于最流

  • Better BibTeX for Zotero Better BibTeX (BBT) is an extension for Zotero and Juris-M that makes it easier to manage bibliographic data, especially for people authoring documents using text-based toolch