这是使用mysql的好方法吗?

时间:2022-09-06 18:46:43

I am building a web app, and I am thinking about how I should build the database.

我正在构建一个Web应用程序,我正在考虑如何构建数据库。

The app will be feed by keywords, then it will retrieve info for those keywords and save it into the database with a datestamp. The info will be from different source like, num of results from yahoo, diggs from the last month that contains that keyword, etc.

应用程序将通过关键字提供,然后它将检索这些关键字的信息并使用日期戳将其保存到数据库中。信息将来自不同的来源,例如来自yahoo的结果,包含该关键字的上个月的diggs等。

So I was thinking the a simple way to do it would be to have a table with an id and keyword column where the keywords would be stored, and another table for ALL the data with a id(same as keyword), datestamp, data_name, data_content.

所以我认为一个简单的方法就是拥有一个带有id和关键字列的表,其中存储关键字,另一个表用于所有具有id(与关键字相同)的数据,datestamp,data_name, data_content。

Is this a good way to use mysql or could this in someway make queries slower or sometihng? should I build tables for each type of data I want to use? I am mostly looking for a good performance on the application.

这是一个使用mysql的好方法,还是可以使查询更慢或更慢?我应该为我想要使用的每种类型的数据构建表吗?我主要是在寻找应用程序的良好性能。

Another reason I would like to use only one table for the data is that I can easly add more data_name(s) without touching the db.

我想只使用一个数据表的另一个原因是我可以轻松添加更多data_name(s)而无需触及数据库。

3 个解决方案

#1


0  

The second table i.e, the table which contains various information about keywords ,id column in this table can be used as a foreign key to the first table id column

第二个表,即包含关于关键字的各种信息的表,该表中的id列可以用作第一个表id列的外键

#2


0  

Is this a good way to use mysql or could this in someway make queries slower or sometihng? should I build tables for each type of data I want to use? I am mostly looking for a good performance on the application.

这是一个使用mysql的好方法,还是可以使查询更慢或更慢?我应该为我想要使用的每种类型的数据构建表吗?我主要是在寻找应用程序的良好性能。

A lot of big MySQL players(like for example flickr) use MySQL as a simple KV(key-value) store.

许多大型MySQL播放器(例如flickr)使用MySQL作为简单的KV(键值)存储。

Furthermore if you are concerned with performance you should cache your data in memcached/redis(there is nothing which can beat memory).

此外,如果您关注性能,则应将数据缓存在memcached / redis中(没有什么可以打败内存)。

#3


0  

I have another recommendation: index your content. If you plan on storing content and be able to search using keywords, then use mysql to store the details of your document, like author, text and some other info and use Lucene to create an index. Lucene is originally for Java, but has ports to many languages, and PHP is no exception.

我有另一个建议:索引你的内容。如果您计划存储内容并能够使用关键字进行搜索,那么使用mysql存储文档的详细信息,如作者,文本和其他一些信息,并使用Lucene创建索引。 Lucene最初用于Java,但有许多语言的端口,PHP也不例外。

You can use Zend framework to manage Lucene indexes, with very little effort, browse thru the documentation or look for a tutorial online. The thing of this recommendation is simple: - You'll improve your search time drastically - Your keyword acceptance will be higher, Lucene will give power to search

您可以使用Zend框架来管理Lucene索引,只需很少的工作,浏览文档或在线查找教程。这个建议很简单: - 你会大大缩短你的搜索时间 - 你的关键词接受度会更高,Lucene会给搜索带来力量

I hope I can help! Best luck!

我希望我能帮忙!好运!

#1


0  

The second table i.e, the table which contains various information about keywords ,id column in this table can be used as a foreign key to the first table id column

第二个表,即包含关于关键字的各种信息的表,该表中的id列可以用作第一个表id列的外键

#2


0  

Is this a good way to use mysql or could this in someway make queries slower or sometihng? should I build tables for each type of data I want to use? I am mostly looking for a good performance on the application.

这是一个使用mysql的好方法,还是可以使查询更慢或更慢?我应该为我想要使用的每种类型的数据构建表吗?我主要是在寻找应用程序的良好性能。

A lot of big MySQL players(like for example flickr) use MySQL as a simple KV(key-value) store.

许多大型MySQL播放器(例如flickr)使用MySQL作为简单的KV(键值)存储。

Furthermore if you are concerned with performance you should cache your data in memcached/redis(there is nothing which can beat memory).

此外,如果您关注性能,则应将数据缓存在memcached / redis中(没有什么可以打败内存)。

#3


0  

I have another recommendation: index your content. If you plan on storing content and be able to search using keywords, then use mysql to store the details of your document, like author, text and some other info and use Lucene to create an index. Lucene is originally for Java, but has ports to many languages, and PHP is no exception.

我有另一个建议:索引你的内容。如果您计划存储内容并能够使用关键字进行搜索,那么使用mysql存储文档的详细信息,如作者,文本和其他一些信息,并使用Lucene创建索引。 Lucene最初用于Java,但有许多语言的端口,PHP也不例外。

You can use Zend framework to manage Lucene indexes, with very little effort, browse thru the documentation or look for a tutorial online. The thing of this recommendation is simple: - You'll improve your search time drastically - Your keyword acceptance will be higher, Lucene will give power to search

您可以使用Zend框架来管理Lucene索引,只需很少的工作,浏览文档或在线查找教程。这个建议很简单: - 你会大大缩短你的搜索时间 - 你的关键词接受度会更高,Lucene会给搜索带来力量

I hope I can help! Best luck!

我希望我能帮忙!好运!