Note: The current implementation of RETURN NEXT and RETURN QUERY stores the entire result set before returning from the function,as discussed above. That means that if a PL/pgSQL function produces a very large result set,performance might be poor: data will be written to disk to avoid memory exhaustion,but the function itself will not return until the entire result set has been generated. A future version of PL/pgSQL might allow users to define set-returning functions that do not have this limitation. Currently,the point at which data begins being written to disk is controlled by the 07002 configuration variable. Administrators who have sufficient memory to store larger result sets in memory should consider increasing this parameter.
考虑一次计算一个系统的行,或者为work_mem设置足够高的值以应对负载.请按照报价中提供的链接了解有关work_mem的更多信息.
一种方法是在函数中使用SET LOCAL 为work_mem设置一个非常高的值,这仅对当前事务有效.我在函数中添加了一条注释行.不要在全局范围内设置它,因为这可能会破坏您的服务器.阅读手册. (编辑:92站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|