我可以/应该针对 SQLite 数据库运行我的网站吗?

发布于 2024-08-06 15:41:01 字数 270 浏览 7 评论 0原文

我即将构建一个新的个人博客/作品集网站(将用 ASP.NET 编写),并且我将针对 SQLite 数据库运行它。造成这种情况的原因有几个:

  1. 该网站不会获得太多流量 交通情况,据我所知, SQLite 能够支持相当多的 大量并发用户阅读 无论如何
  2. 我可以备份所有内容 很容易,只需下载数据库 通过 FTP
  3. 我无需支付托管费用 公司每个月都会有巨额的 我几乎不会的SQL2008数据库 使用

那么,我应该这样做,还是这是一个疯狂的想法?

I'm about to build a new personal blog/portfolio site (which will be written in ASP.NET), and I'm going to run it against a SQLite database. There are a few reasons for this:

  1. The site will not be getting a lot
    of traffic, and from what I've read,
    SQLite is able to support quite a
    lot of concurrent users for reading
    anyway
  2. I can back up all the content
    easily, just by downloading the db
    over FTP
  3. I don't have to pay my hosting
    company every month for a huge
    SQL2008 database that I'm hardly
    using

So, should I go for it, or is this a crazy idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

淡水深流 2024-08-13 15:41:01

我不太确定#2(如果 SQLite 在 FTP 程序读取文件时对文件进行更改会发生什么?)但除此之外,没有理由更喜欢一个数据库而不是另一个数据库(除非这些数据库之一只是不能做你需要的事情)。

[编辑] 使用在线备份创建用于 FTP 下载的文件。这将确保文件内容完好无损。

更好的是,向您的网站添加一个页面(带有密码),只需按一下按钮即可创建文件,以便您的浏览器可以下载该文件。

I'm not so sure about #2 (what happens if SQLite makes changes to the file while the FTP program is reading it?) but other than that, there is no reason to prefer one DB over the other (unless one of those DBs just can't do what you need).

[EDIT] Use an online backup to create the file for FTP download. That will make sure the file content is intact.

Even better, add a page (with password) to your site which creates the file at the press of a button, so your browser can download it.

伴随着你 2024-08-13 15:41:01

对于低流量网站来说,只要主要是读取流量就可以了。如果是我,我会使用 SQL Compact Edition(与 Sqlite 相同的好处 - 单文件,无服务器),只是因为我是 LINQ 专家,并且 LINQ 提供程序“内置”,但 Sqlite有一个不错的 LINQ 库和托管支持。确保您的托管公司允许非托管代码,或者您使用 Sqlite 的托管端口(但不知道其当前的稳定性)。

It's just fine for a low traffic site as long as it's mostly read traffic. If it were me, I'd use SQL Compact Edition instead (same benefits as Sqlite- single file, no server), just because I'm a LINQ-head and the LINQ providers are "in the box" for it, but Sqlite has a decent LINQ library and managed support as well. Make sure your hosting company allows unmanaged code, or that you use the managed port of Sqlite (don't know its current stability though).

吃兔兔 2024-08-13 15:41:01

经验法则是,如果站点可以在一台服务器上运行
那么 SQLite 就足够了。这就是它的创造者
SQLite,D. Richard Hipp,在大约 13 分钟时说道
第 26 集 30 秒 FLOSS 周刊
播客。

直接音频链接(MP3 文件,24 MB,51 分 15 秒)。

A rule of thumb is that if the site can run on one server
then SQLite is sufficient. That is what the creator of
SQLite, D. Richard Hipp, said at approximately 13 min
30 secs into episode 26 of the FLOSS Weekly
podcast.

Direct audio link (MP3 file, 24 MB, 51 min 15 sec).

不交电费瞎发啥光 2024-08-13 15:41:01

SQLite 可以轻松处理这个问题 - 去做吧。

SQLite can handle this easily - go for it.

紅太極 2024-08-13 15:41:01

您应该检查一下,但我认为 SQL 2008 Express 版本是免费的。
不管怎样,我一直在.NET环境中使用SQLite,它工作得很好(但我没有做过任何负载测试)。
如果您还没有决定,您仍然可以使用 LINQ 提供程序,它允许您稍后从一个数据库切换到另一个数据库,而无需重写 SQL 代码(我认为 DbLinq)。
如果您打算备份数据库,则必须首先确保该数据库目前未被使用。

You should check, but I think that the Express version of SQL 2008 is free of charge.
Anyway, I've been working with SQLite from .NET environment, and it works quite fine (but I haven't done any load test).
And if you're not decided yet, you still can use a LINQ provider which will allow you later to switch from one database to another without rewriting your SQL code (I think to DbLinq, for example).
If you plan to backup you database, you must ensure first that it is not used at the moment.

ι不睡觉的鱼゛ 2024-08-13 15:41:01

SQLite 为您解答:

http://sqlite.org/whentouse.html

中低音量 =好的,
高容量 = 不要

在你的情况下使用它,使用 sqlite 就可以了

SQLite answer this for you:

http://sqlite.org/whentouse.html

low-medium volume = okay,
high volume = don't use it

in your case its a-ok to use sqlite

不及他 2024-08-13 15:41:01

一般来说,是的。

但您应该意识到 SQLite 并不支持“真正的”DBMS 中您可能习惯的所有功能。例如,没有外键、唯一索引等约束,并且据我所知,某些(更高级的)数据类型不可用。

您应该在此处此处。如果您能接受这一点,就没有理由不使用 SQLite。

Generally, yes.

But you should be aware of the fact that SQLite does not support everything that you might be used to from a 'real' DBMS. E.g. there are no constraints like foreign keys, unique indexes and the like, and AFAIK some (more advanced) datatypes are not available.

You should check for the various limitations here and here. If you can get along with that there's no reason to not use SQLite.

青朷 2024-08-13 15:41:01

我会说不。首先,我不知道您使用的提供商是谁,但使用我的提供商 (goDaddy) 非常便宜,每月 2.99 美元左右。我有 1 个 sql server 数据库和 10 个 mysql 数据库。
不知道这个能便宜多少。

其次,为什么要冒险?大多数提供商计划至少包括 MySQL 数据库。你可以连接起来。

I'd say no. First off, I don't know who you are using for a provider, but with my provider (goDaddy), it's pretty cheap at $2.99 a month or so. I get 1 sql server db and 10 mysql dbs.
I don't know how much cheaper this can get.

Secondly, why risk it? Most provider plans include at least MySQL database. You can hook up with that.

请持续率性 2024-08-13 15:41:01

一般来说,SQLite 并不适合高流量网站,但它可以在每天点击量为 100,000 次或更少的网站上表现良好。 SQLite org 网站每天的点击量超过 500,000 次,每天生成 200 万次或更多的数据库交互......全部由 SQLite 处理。

以下是一些可以显着提高 SQLite 性能的方法:

  • 为表建立索引
  • 对多个命令使用事务,而不是一次执行一个命令。
  • 了解预写日志记录

使用 SQLite 对上述各项进行 Google 搜索...您的数据库性能将显着提高。

SQLite 数据库实际上比 MySQL、PostGRE、MS SQL Server 数据库或其他基于托管服务器的数据库更快,原因有两个:

1)。 SQLite 通常与网站存储在同一台计算机上,而不是单独的服务器计算机上,从而消除了往返网络延迟响应时间。

2.) 对于较小的读/写请求,SQLite 引擎执行的代码要少得多,速度也更快。

对于较小的网站,像 SQLite 这样的较小的数据库引擎实际上可以更快、更高效。

In general, SQLite isn't meant for a high-traffic website, but it can do quite well on websites getting 100,000 hits/day or less. The SQLite org website gets more than 500,000 hits/day, and generates 2 million or more DB interactions/day ... all handled by SQLite.

Here are some things that will dramatically speed up SQLite's performance:

  • Index your tables
  • Use transactions for multiple commands instead of executing one at a time.
  • Learn about write-ahead logging

Do a Google search on each of the above with SQLite ... your DB performance will improve dramatically.

An SQLite DB can actually be faster than a MySQL, PostGRE, MS SQL Server DB, or other hosted server-based DBs for 2 reasons:

1). SQLite is usually stored on the same machine as the website, rather than a separate server machine, eliminating round trip network latency response times.

2.) For smaller read/write requests, the SQLite engine is executing far less code, which can also be faster.

For a smaller website, a smaller DB engine like SQLite could actually be faster and more efficient.

夜声 2024-08-13 15:41:01

您使用任何 SQL 功能吗? SUM、AVG、SORT BY 等,如果是,请使用 SQLite。如果没有,只需使用纯 txt 文件来存储数据。还要确保数据库位于 httpdocs 文件夹之外,否则无法通过 Web 访问。

Are you using any SQL functionality? SUM, AVG, SORT BY, etc, if yes go use SQLite. If not, just use plain txt files to store your data. Also make sure that the database is outside the httpdocs folder or it is not web accessible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文