什么是一个好的学习数据库设计的开源数据库?(设计DBMS,而不是规范化表等)

时间:2022-09-10 13:02:24

As stated in the question, I'm not looking for help on database design in the terms of creating tables, normalization, etc.

如问题中所述,我并不是在创建表、规范化等方面寻求数据库设计方面的帮助。

As a programming project, I'm looking to write my own DBMS. This is for a learning experience more than anything, so reinventing the wheel is kinda the purpose.

作为一个编程项目,我想写我自己的DBMS。这是一种学习经验,所以重新发明*是目的。

I started my search by looking at SQLite - I found my and old SVN branch from 2001~2004, which is amazingly commented, but it's still a lot to digest all at once. But even so, I've been going through it for about an hour or two, and my head is already on hyperdrive with ideas.

我开始寻找SQLite -我在2001~2004年发现了我和老的SVN分支,这是令人惊讶的评论,但是它仍然需要大量的去理解。但即便如此,我也经历了大约一两个小时,我的头脑已经被各种想法控制在超光速上了。

So I'm asking here hoping to see if anyone knows of a small and very basic DBMS that I could get some ideas or inspiration from as far as query parsing, storing data, building a search, etc.

我想问的是,是否有人知道一个小型的非常基本的DBMS,我可以从查询解析、存储数据、构建搜索等方面得到一些想法或启发。

Thanks!

谢谢!

6 个解决方案

#1


1  

I have been told that the PostgreSQL source code is very well documented and structured.
But it obviously does not qualify as a "small basic DBMS".

我被告知,PostgreSQL源代码有很好的文档和结构化。但它显然不符合“小型基础数据库管理系统”的要求。

Apart from that the only "small" ones that I'm aware of are Java based DBMS:

除此之外,我所知道的“小”的是基于Java的DBMS:

Not sure if a Java based implementation will help you.

不确定基于Java的实现是否会帮助您。

#2


1  

There is Edward Sciore's SimpleDB (not related to Amazon's SimpleDB), "A Simple Java-Based Multiuser System for Teaching Database Internals". It's in Java, but I think that the ideas will translate fairly easy to C.

有Edward Sciore的SimpleDB(与Amazon的SimpleDB没有关系),“一个简单的基于java的多用户系统,用于教授数据库内部知识”。它是用Java写的,但我认为这些想法会很容易转化成C。

From http://www.cs.bc.edu/~sciore/simpledb/intro.html:

从http://www.cs.bc.edu/ ~ sciore / simpledb / intro.html:

SimpleDB is a multi-user transactional database server written in Java, which interacts with Java client programs via JDBC. The system is intended for pedagogical use only. The code is clean and compact. The APIs are straightforward. The learning curve is relatively small. Everything about it is geared towards improving the experience of a database system internals course. Consequently, the system is intentionally bare-bones. It implements only a small fraction of SQL and JDBC, and does little or no error checking. Although it is a great teaching tool, I can't imagine that anyone would want to use it for anything else.

SimpleDB是用Java编写的多用户事务数据库服务器,它通过JDBC与Java客户机程序交互。该系统仅用于教学用途。代码简洁明了。这些api很简单。学习曲线相对较小。有关它的一切都是为了改进数据库系统内部过程的体验。因此,这个系统是故意的。它只实现了SQL和JDBC的一小部分,几乎不做错误检查。虽然它是一个很好的教学工具,但我无法想象任何人会想把它用于任何其他用途。

There is a book too:

还有一本书:

Database Design and Implementation

数据库设计与实现

#3


1  

As stated previously, SQLite, JavaDB and SimpleDB are good examples. I would add Berkeley DB to the list. Berkleley DB is well documented, has been around for several years, has several available APIs as well as multiple access methods like HASH, QUEUE and RECNO in addition to the traditional B-tree. Berkeley DB is a key/value database library written in C. Berkeley DB XML is an XML database library written in C++ on top of Berkeley DB. Berkeley DB Java Edition is a 100% Java key/value database library. All of them are available under a GPL-like license and the source code is included in the distribution.

如前所述,SQLite、JavaDB和SimpleDB是很好的例子。我将把Berkeley DB添加到列表中。Berkleley DB有很好的文档记录,它已经存在了好几年了,它有几个可用的api,还有多个访问方法,比如哈希、队列和RECNO,除了传统的B-tree。Berkeley DB是用C. Berkeley DB编写的键/值数据库库,XML是在Berkeley DB之上用c++编写的XML数据库库。Berkeley DB Java Edition是一个100%的Java key/value数据库库。所有这些都可以通过类似gpl的许可证获得,源代码包含在发行版中。

Berkeley DB's SQL API incorporates the SQLite API, basically implementing the BDB key/value pair data store underneath the SQLite query layer. Berkeley DB was also the first data storage implementation underneath MySQL, again taking a SQL query layer and storing the data in a simple key/data value data format. It's certainly an interesting way of looking at the problem -- if you have a flexible, fast, scalable, reliable data store, you can then layer any type of API or data representation/abstraction on top of it. This is exactly what Berkeley DB does, providing a choice between the core key/value pair data storage or XML, SQL, Java Collections or a POJO-like Persistence Layer on top of the base key/value pair infrastructure.

Berkeley DB的SQL API集成了SQLite API,基本上实现了SQLite查询层下面的BDB键/值对数据存储。Berkeley DB也是MySQL之下的第一个数据存储实现,它使用SQL查询层并以简单的键/数据值数据格式存储数据。这当然是一种看待问题的有趣方式——如果您有一个灵活、快速、可伸缩、可靠的数据存储,那么您就可以在其之上分层任何类型的API或数据表示/抽象。这正是Berkeley DB所做的,它提供了在核心键/值对数据存储或XML、SQL、Java集合或基本键/值对基础结构之上的类似pojo的持久性层之间的选择。

Berkeley DB is about as close to a "pure" data storage engine as you're going to find. It makes no assumptions about structure, content or the format of the data being stored. It allows the upper layers to provide those abstractions while the lower layer focused on fast, scalable, reliable storage. That's one of the reasons why Berkeley DB is so widely used -- it's simplicity and focus makes it very fast, reliable and scalable.

Berkeley DB接近于“纯”数据存储引擎。它对存储的数据的结构、内容或格式没有任何假设。它允许上层提供这些抽象,而下层关注快速、可伸缩、可靠的存储。这就是为什么Berkeley DB被广泛使用的原因之一——它的简单性和专注性使它非常快速、可靠和可伸缩。

Disclaimer: I'm one of the Product Managers for Berkeley DB, so clearly I'm a little biased. But, I've also been working on database products for 25 years and I know a little about DBMS internals. :-)

免责声明:我是Berkeley DB的产品经理之一,显然我有点偏见。但是,我已经在数据库产品上工作了25年了,我对DBMS的内部情况略知一二。:-)

Good luck in your research.

祝你研究顺利。

Dave

戴夫

#4


0  

You may have a look at the Apache Derby database. It's a full fledged RDBMS implementation; Well, it's written entirely in Java though. and, it definitely is not a small and simple implementation. But it can serve as a good reference.

您可以查看一下Apache Derby数据库。它是一个成熟的RDBMS实现;不过,它完全是用Java编写的。而且,它绝对不是一个小而简单的实现。但它可以作为一个很好的参考。

#5


0  

Maybe SQLite is a good start. It is as simple as possible (no network layer, simplistic locking, etc), but it understands real SQL, has indexes and constraints, and is implemented in C. Its storage is peculiar, though.

也许SQLite是个好的开始。它尽可能简单(没有网络层、简单锁定等),但是它理解真正的SQL,具有索引和约束,并且是用c实现的。

#6


0  

If you want a simple relational database system that uses SQL query language then SQLite is it. Keep on reading that code.

如果您想要一个使用SQL查询语言的简单关系数据库系统,那么SQLite就是它。继续阅读代码。

But if you are not hung up on fully relational data stores, then google for B+tree source code. The B+tree is the fundamental data structure that allows you to maintain a sorted index on disk, and 15-20 years ago there were several packages of C source code that implemented this. It is much simpler because there is no SQL, and basically two parts, one to manage blocks on the disk and the other to manipulate the B+Tree structure.

但是,如果您没有完全依赖关系数据存储,那么谷歌表示B+树源代码。B+树是基本的数据结构,允许您在磁盘上维护排序后的索引。15-20年前,有几个C源代码包实现了这一点。它要简单得多,因为没有SQL,基本上有两个部分,一个用于管理磁盘上的块,另一个用于操作B+树结构。

Once you understand that, you could go back to the SQLite code and no doubt identify similar modules amidst the rest of the code.

一旦您理解了这一点,您就可以回到SQLite代码中,毫无疑问地在其余代码中识别类似的模块。

Sometimes the best way to learn is to retrace some historical steps.

有时,最好的学习方法是回顾一些历史步骤。

#1


1  

I have been told that the PostgreSQL source code is very well documented and structured.
But it obviously does not qualify as a "small basic DBMS".

我被告知,PostgreSQL源代码有很好的文档和结构化。但它显然不符合“小型基础数据库管理系统”的要求。

Apart from that the only "small" ones that I'm aware of are Java based DBMS:

除此之外,我所知道的“小”的是基于Java的DBMS:

Not sure if a Java based implementation will help you.

不确定基于Java的实现是否会帮助您。

#2


1  

There is Edward Sciore's SimpleDB (not related to Amazon's SimpleDB), "A Simple Java-Based Multiuser System for Teaching Database Internals". It's in Java, but I think that the ideas will translate fairly easy to C.

有Edward Sciore的SimpleDB(与Amazon的SimpleDB没有关系),“一个简单的基于java的多用户系统,用于教授数据库内部知识”。它是用Java写的,但我认为这些想法会很容易转化成C。

From http://www.cs.bc.edu/~sciore/simpledb/intro.html:

从http://www.cs.bc.edu/ ~ sciore / simpledb / intro.html:

SimpleDB is a multi-user transactional database server written in Java, which interacts with Java client programs via JDBC. The system is intended for pedagogical use only. The code is clean and compact. The APIs are straightforward. The learning curve is relatively small. Everything about it is geared towards improving the experience of a database system internals course. Consequently, the system is intentionally bare-bones. It implements only a small fraction of SQL and JDBC, and does little or no error checking. Although it is a great teaching tool, I can't imagine that anyone would want to use it for anything else.

SimpleDB是用Java编写的多用户事务数据库服务器,它通过JDBC与Java客户机程序交互。该系统仅用于教学用途。代码简洁明了。这些api很简单。学习曲线相对较小。有关它的一切都是为了改进数据库系统内部过程的体验。因此,这个系统是故意的。它只实现了SQL和JDBC的一小部分,几乎不做错误检查。虽然它是一个很好的教学工具,但我无法想象任何人会想把它用于任何其他用途。

There is a book too:

还有一本书:

Database Design and Implementation

数据库设计与实现

#3


1  

As stated previously, SQLite, JavaDB and SimpleDB are good examples. I would add Berkeley DB to the list. Berkleley DB is well documented, has been around for several years, has several available APIs as well as multiple access methods like HASH, QUEUE and RECNO in addition to the traditional B-tree. Berkeley DB is a key/value database library written in C. Berkeley DB XML is an XML database library written in C++ on top of Berkeley DB. Berkeley DB Java Edition is a 100% Java key/value database library. All of them are available under a GPL-like license and the source code is included in the distribution.

如前所述,SQLite、JavaDB和SimpleDB是很好的例子。我将把Berkeley DB添加到列表中。Berkleley DB有很好的文档记录,它已经存在了好几年了,它有几个可用的api,还有多个访问方法,比如哈希、队列和RECNO,除了传统的B-tree。Berkeley DB是用C. Berkeley DB编写的键/值数据库库,XML是在Berkeley DB之上用c++编写的XML数据库库。Berkeley DB Java Edition是一个100%的Java key/value数据库库。所有这些都可以通过类似gpl的许可证获得,源代码包含在发行版中。

Berkeley DB's SQL API incorporates the SQLite API, basically implementing the BDB key/value pair data store underneath the SQLite query layer. Berkeley DB was also the first data storage implementation underneath MySQL, again taking a SQL query layer and storing the data in a simple key/data value data format. It's certainly an interesting way of looking at the problem -- if you have a flexible, fast, scalable, reliable data store, you can then layer any type of API or data representation/abstraction on top of it. This is exactly what Berkeley DB does, providing a choice between the core key/value pair data storage or XML, SQL, Java Collections or a POJO-like Persistence Layer on top of the base key/value pair infrastructure.

Berkeley DB的SQL API集成了SQLite API,基本上实现了SQLite查询层下面的BDB键/值对数据存储。Berkeley DB也是MySQL之下的第一个数据存储实现,它使用SQL查询层并以简单的键/数据值数据格式存储数据。这当然是一种看待问题的有趣方式——如果您有一个灵活、快速、可伸缩、可靠的数据存储,那么您就可以在其之上分层任何类型的API或数据表示/抽象。这正是Berkeley DB所做的,它提供了在核心键/值对数据存储或XML、SQL、Java集合或基本键/值对基础结构之上的类似pojo的持久性层之间的选择。

Berkeley DB is about as close to a "pure" data storage engine as you're going to find. It makes no assumptions about structure, content or the format of the data being stored. It allows the upper layers to provide those abstractions while the lower layer focused on fast, scalable, reliable storage. That's one of the reasons why Berkeley DB is so widely used -- it's simplicity and focus makes it very fast, reliable and scalable.

Berkeley DB接近于“纯”数据存储引擎。它对存储的数据的结构、内容或格式没有任何假设。它允许上层提供这些抽象,而下层关注快速、可伸缩、可靠的存储。这就是为什么Berkeley DB被广泛使用的原因之一——它的简单性和专注性使它非常快速、可靠和可伸缩。

Disclaimer: I'm one of the Product Managers for Berkeley DB, so clearly I'm a little biased. But, I've also been working on database products for 25 years and I know a little about DBMS internals. :-)

免责声明:我是Berkeley DB的产品经理之一,显然我有点偏见。但是,我已经在数据库产品上工作了25年了,我对DBMS的内部情况略知一二。:-)

Good luck in your research.

祝你研究顺利。

Dave

戴夫

#4


0  

You may have a look at the Apache Derby database. It's a full fledged RDBMS implementation; Well, it's written entirely in Java though. and, it definitely is not a small and simple implementation. But it can serve as a good reference.

您可以查看一下Apache Derby数据库。它是一个成熟的RDBMS实现;不过,它完全是用Java编写的。而且,它绝对不是一个小而简单的实现。但它可以作为一个很好的参考。

#5


0  

Maybe SQLite is a good start. It is as simple as possible (no network layer, simplistic locking, etc), but it understands real SQL, has indexes and constraints, and is implemented in C. Its storage is peculiar, though.

也许SQLite是个好的开始。它尽可能简单(没有网络层、简单锁定等),但是它理解真正的SQL,具有索引和约束,并且是用c实现的。

#6


0  

If you want a simple relational database system that uses SQL query language then SQLite is it. Keep on reading that code.

如果您想要一个使用SQL查询语言的简单关系数据库系统,那么SQLite就是它。继续阅读代码。

But if you are not hung up on fully relational data stores, then google for B+tree source code. The B+tree is the fundamental data structure that allows you to maintain a sorted index on disk, and 15-20 years ago there were several packages of C source code that implemented this. It is much simpler because there is no SQL, and basically two parts, one to manage blocks on the disk and the other to manipulate the B+Tree structure.

但是,如果您没有完全依赖关系数据存储,那么谷歌表示B+树源代码。B+树是基本的数据结构,允许您在磁盘上维护排序后的索引。15-20年前,有几个C源代码包实现了这一点。它要简单得多,因为没有SQL,基本上有两个部分,一个用于管理磁盘上的块,另一个用于操作B+树结构。

Once you understand that, you could go back to the SQLite code and no doubt identify similar modules amidst the rest of the code.

一旦您理解了这一点,您就可以回到SQLite代码中,毫无疑问地在其余代码中识别类似的模块。

Sometimes the best way to learn is to retrace some historical steps.

有时,最好的学习方法是回顾一些历史步骤。