MySQL,视图是全局视图还是每个会话/连接?

发布于 2024-10-13 04:06:13 字数 393 浏览 8 评论 0原文

我正在考虑创建一个视图来加快速度,我的问题是:视图是每个会话/连接的还是全局的?

示例:

User Foo issues a query that creates a VIEW X, then user Foo continues to query
against VIEW X.  
Meanwhile, User Bar issues the same query that creates a VIEW X because the creation and the name is hard coded into the function issuing the query.

现在,用户 Foo 和用户 Bar 是否使用相同的 VIEW X 或者它们各自拥有“私有”VIEW X?

I'm thinking of creating a VIEW to speed up things and my question is: Are VIEWS per session/connection or global?

Example:

User Foo issues a query that creates a VIEW X, then user Foo continues to query
against VIEW X.  
Meanwhile, User Bar issues the same query that creates a VIEW X because the creation and the name is hard coded into the function issuing the query.

Now, does user Foo and user Bar work with the same VIEW X or do they have "private" VIEW X each?

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

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

发布评论

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

评论(1

不甘平庸 2024-10-20 04:06:13

它们是在数据库中创建的,不受会话限制。如果不同会话的视图实际上是相同的,我认为您可以使用 CREATE OR REPLACE VIEW 。

They're created in the database and are not session bound. If the view actually is the same for the different sessions, you can just use CREATE OR REPLACE VIEW I think.

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