PostgreSQL相当于MySQL内存表? [英] PostgreSQL equivalent of MySQL memory tables?

查看:79
本文介绍了PostgreSQL相当于MySQL内存表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PostgreSQL是否具有与MySQL 内存表?

Does PostgreSQL have an equivalent of MySQL memory tables?

这些MySQL内存表可以在会话之间持久化(即与在会话结束时删除的临时表不同).我一直无法使用PostgreSQL找到任何可以做到的事情.

These MySQL memory tables can persist across sessions (i.e., different from temporary tables which drop at the end of the session). I haven't been able to find anything with PostgreSQL that can do the same.

推荐答案

否,目前它们在PostgreSQL中不存在.如果确实需要内存表,则可以创建RAM磁盘,添加表空间为此,并在其上创建表.

No, at the moment they don't exist in PostgreSQL. If you truly need a memory table you can create a RAM disk, add a tablespace for it, and create tables on it.

如果您只需要在不同会话之间可见的临时表,则可以使用 UNLOGGED.这些不是真正的内存表,但是当表数据明显小于系统RAM时,它们的行为会令人惊讶地相似.

If you only need the temporary table that is visible between different sessions, you can use an UNLOGGED table. These are not true memory tables but they'll behave surprisingly similarly when the table data is significantly smaller than the system RAM.

另一种选择是全局临时表,但是从9.2开始,PostgreSQL不支持全局临时表(请参见注释).

Global temporary tables would be another option but are not supported in PostgreSQL as of 9.2 (see comments).

这篇关于PostgreSQL相当于MySQL内存表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆