[英]Postgres + Select query from Cache
I was wondering if Postgres had a feature like SQL_CACHE in mySQL. 我想知道Postgres是否在mySQL中具有SQL_CACHE之类的功能。 For example in mySQL I can do a query like "SELECT SQL_CACHE Product_ID, Product_Name, Product_Sku FROM Products" I want to know if I can do something similar in Postgres.
例如,在mySQL中,我可以执行类似“ SELECT SQL_CACHE Product_ID,Product_Name,Product_Sku FROM Products”的查询,我想知道是否可以在Postgres中执行类似的操作。
PostgreSQL automatically caches recently accessed data in memory, depending on your shared_buffers
configuration parameter. PostgreSQL根据您的
shared_buffers
配置参数自动将最近访问的数据缓存在内存中。 There's really no need for an SQL_CACHE
feature, since Postgres already does a great job of managing the tuple cache. 确实不需要
SQL_CACHE
功能,因为Postgres已经在管理元组缓存方面做得很好。
只需简单地转到/etc/postgresql/YOUREVERSION/main/posgresql.conf(* nix)(C:\\ Program Files \\ PostgreSQL \\ YOUREVERSION \\ data \\ postgresql.conf(win))找到shared_buffers,取消注释并指定需要的缓存大小。
In MySQL
, SQL_CACHE
doesn not select from cache, depending on query_cache_type
, this happens: 在
MySQL
,根据query_cache_type
, 不会从缓存中选择SQL_CACHE
,发生这种情况:
SELECT SQL_NO_CACHE
. SELECT SQL_NO_CACHE
开头的可缓存查询结果。 SELECT SQL_CACHE
. SELECT SQL_CACHE
开头的可缓存查询的缓存结果。 In essence, using SQL_NO_CACHE
with any setting other the 1
or SQL_CACHE
with any other setting the 2
is meaningless . 本质上,将
SQL_NO_CACHE
与其他设置1
或将SQL_CACHE
与其他设置2
是没有意义的 。
If this is still what you need in PostgreSQL: no idea, but I had to make this very clear. 如果这仍然是您在PostgreSQL中需要的:不知道,但是我必须非常清楚地说明这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.