MySQL单表缓存

发布于 2024-12-11 02:55:31 字数 132 浏览 0 评论 0原文

我正在使用一堆简单的 SELECT 查询访问一个相当静态的表。
为了提高性能,我正在考虑为该数据编写自己的内存缓存
但这感觉就像在做数据库的肮脏勾当。

是否有针对特定表的粒度缓存机制?

I am hitting a fairly static table with bunch of simple SELECT queries.
In order to increase performance, I am considering writing my own memory cache for that data.
But it feels like doing DB's dirty deeds.

Is there such a thing as a granular caching mechanism for a specific table?

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

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

发布评论

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

评论(3

瘫痪情歌 2024-12-18 02:55:31

如果您使用 InnoDB,MySQL 会自动为您缓存表,并为索引的常用部分创建哈希索引。
我建议您增加 MySQL 可以使用的内存量,它应该可以自行解决您的问题。
默认情况下,MySQL 的设置是为了节省空间,而不是为了快速运行。

以下是一些可帮助您进行调整的链接:

http://www.debianhelp.co.uk /mysqlperformance.htm
http://www.mysqlperformanceblog.com/2006/09/29/what-to-tune-in-mysql-server-after-installation/" mysqlperformanceblog.com/2006/09/29/what-to-tune-in-mysql-server-after-installation/

还可以使用索引并编写更智能的查询。
但如果您不向我们展示查询,我无法为您提供帮助。

If you use InnoDB, MySQL will automatically cache the table for you, and create hash-indexes for often used parts of the index.
I suggest you increase the amount of memory MySQL has at its disposal and it should take care of your problems all by itself.
By default MySQL is setup to conserve space, not to run fast.

Here are a few links to get you going with tuning:

http://www.debianhelp.co.uk/mysqlperformance.htm
http://www.mysqlperformanceblog.com/2006/09/29/what-to-tune-in-mysql-server-after-installation/

Also use indexes and write smarter queries.
But I cannot help you there if you don't show us the query.

山有枢 2024-12-18 02:55:31

有一个内存数据库(如innodb)。您可以在创建表时选择它。

There is a memory database (like innodb). You select that at table creation time.

谁把谁当真 2024-12-18 02:55:31

您可以尝试将静态 ISAM 表复制到定义为内存驻留的临时表中。 OTOH,在我看来,该表可能已经被缓存,所以这可能没有多大帮助。请向我们展示您的查询怎么样?

You can try copying your static ISAM table into a temporary table that is by definition ram-resident. OTOH, it seems likely to me that the table is already cached, so that might not help much. How about showing us your query?

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