search_path
的默认设置是 "$user",public
。根据manual :
The first element specifies that a schema with the same name as the current user is to be searched. If no such schema exists, the entry is ignored.
什么时候会检查 $user 模式是否存在?在 session 开始时?或者可能每次需要解决一个不合格的对象?如果我知道我只会在数据库中使用“公共(public)”模式,删除“$user”条目是否有意义?
我意识到这两种方式都不会在性能上产生明显的差异,但它可能会使设置更加明确......为什么在 search_path
中有一些永远不会被使用的东西?
最佳答案
如果你
know that I will only ever be using the "public"
.. 从 search_path
中删除 $user 非常有意义。你不会从中得到任何好处。
无论如何,我在所有集群中都这样做。
关于postgresql - 我应该从 PostgreSQL search_path 中删除 "$user"吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15453128/