我应该克隆或非规范化我的数据库以便携带吗?

时间:2021-01-23 07:33:53

I have a database that has lots of data and is all "neat", normalized (within reason - using EAV), and I have stored procedures to access and modify the data.

我有一个数据库,有很多数据,都是“整洁”,规范化(在合理范围内 - 使用EAV),我有存储过程来访问和修改数据。

I also have a WinForms application that users download to search and view this data (no inserts). To make things handy for use and updates, I've been using SQLite to store this data and it works really well.

我还有一个WinForms应用程序,用户下载该应用程序以搜索和查看此数据(无插入)。为了方便使用和更新,我一直在使用SQLite来存储这些数据,它运行得非常好。

I'm working on updating the entire process and I was wondering if I should use a denormalized view of the data to ship out to the users, ala the 1 table with all the properties as columns, or continue to use the same schema as the master database?

我正在努力更新整个过程,我想知道是否应该使用数据的非规范化视图发送给用户,将所有属性作为列的1表,或继续使用相同的模式作为列掌握数据库?

My initial thoughts are along the lines of :

我最初的想法是:

Denormalized View: Benefits... Provides a simple method of querying the data (since I'm not doing a lot of joins, just a bunch of column searching.

非规范化视图:优点...提供一种查询数据的简单方法(因为我没有做很多连接,只是一堆列搜索。

Cons... I'd have to manage a second data access layer. Granted I don't think it will be difficult, but it is still a bit more work.

缺点......我必须管理第二个数据访问层。当然,我认为这不会很困难,但仍然需要更多的工作。

If a new property is added, I'd have to modify the schema again and accomodate for the changes. Wheras I can simply query the property bag and work form there.

如果添加了新属性,我将不得不再次修改架构并适应更改。我可以简单地在那里查询属性包和工作表。

Same Schema: Pros... Same layout as master database, so updates are minimal, and I can even use the same queries when building my Data Access Layer since SQLite doesn't support stored procedures.

相同的架构:优点......与主数据库布局相同,因此更新很少,我甚至可以在构建数据访问层时使用相同的查询,因为SQLite不支持存储过程。

Cons... There is a lot of small tables for lookup codes and the like, so I could start running into issues when building the queries and managing it in the DAL.

缺点...查找代码等有很多小表,所以我可以在构建查询并在DAL中管理它时开始遇到问题。

How should I proceed?

我该怎么办?

1 个解决方案

#1


4  

If you develop your application to query views of the data rather than the underlying data itself, you will be able to keep the same database for both scenarios without concern or the need to alter your DAL.

如果您开发应用程序来查询数据视图而不是基础数据本身,那么您将能够为这两种方案保留相同的数据库而无需担心或需要更改DAL。

#1


4  

If you develop your application to query views of the data rather than the underlying data itself, you will be able to keep the same database for both scenarios without concern or the need to alter your DAL.

如果您开发应用程序来查询数据视图而不是基础数据本身,那么您将能够为这两种方案保留相同的数据库而无需担心或需要更改DAL。