临时行 - 是否可能? [英] Temp rows - is it possible?

查看:71
本文介绍了临时行 - 是否可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello pgsql-general,


我正在尝试实现一个表,当插入它们的会话断开连接时,这些行会自动删除
,有点像

我们自己替代pg_stat_activity。是否有可能和什么

方法我应该尝试实现这样的事情?


谢谢!


-

-Boris


-------------------------- - (广播结束)---------------------------

提示9:规划师会忽略你的欲望你的

加入列的数据类型不匹配时选择索引扫描

解决方案

你好丹尼斯,


2003年11月7日星期五,下午1:29:32,你写道:


DG> Boris Popov写道:

Hello pgsql-general,

我正在尝试实现一个包含行的表当插入它们的会话断开连接时自动被删除,有点像我们自己替代pg_stat_activity。我有可能尝试实现这样的事情吗?




DG>你想让它看得见谁?如果您不希望它显示为

DG>除了你正在编写的会话之外的任何人,只是没有

DG>提交它们并使用允许你的正确交易

DG>从你所在的会议中看到它们。


我希望每个人都能看到它们。这是一个会话池,

当我们的应用程序连接时会插入会话,当它断开连接时会被删除,但这只适用于优雅的断开连接,

我们都知道并非总是如此。所以我想要一个以某种方式通知会话断开连接的表格,并删除由该会话创建的行。


任意想法?


-

-Boris


------------ ---------------(播出结束)---------------------------

提示3:如果通过Usenet发布/阅读,请将相应的

subscribe-nomail命令发送到 ma ******* @ postgresql.org 这样你的

消息就可以干净地通过邮件列表


如果表格不必100%准确,您可以随时为行添加时间戳,并让已连接的客户更新其行,而旧行则为

周期性收获。


2003年11月7日星期五,Boris Popov写道:

我确实希望他们成为每个人都可以看到。这是一个会话池,当我们的应用程序连接时会插入会话,当它断开连接时会被删除,但这只适用于优雅的断开连接,我们都知道并不总是这样。案子。所以我想要一个表以某种方式通知会话断开并删除由该会话创建的行。

任何想法?



---------------------------(广播结束)---------------- -----------

提示3:如果通过Usenet发布/阅读,请发送适当的

subscribe-nomail命令给 ma ******* @ postgresql.org 以便您的

消息可以通过干净的邮件列表


Hello Ben,


2003年11月7日星期五,下午2:53:09 ,你写道:


B>如果表格不必100%准确,您可以随时加时间戳

B>行和已连接的客户端更新其行,而旧行获取

B>周期性地收获。


我希望有一个更自然的解决方案。在

中实现心跳应用程序是一个复杂功能我想不惜一切代价避免。


-Boris


B> 2003年11月7日星期五,Boris Popov写道:

我希望每个人都能看到它们。这是一个会话池,当我们的应用程序连接时会插入会话,当它断开连接时会被删除,但这只适用于优雅的断开连接,我们都知道并不总是这样。案子。所以我想要一个表以某种方式通知会话断开并删除由该会话创建的行。

任何想法?




---------------------------(广播结束)-------- -------------------

提示8:解释分析是你的朋友

Hello pgsql-general,

I''m trying to implement a table with rows that are automatically
deleted when the session that inserted them disconnects, sort of like
our own alternative to pg_stat_activity. Is it possible and what
approach should I be trying to achieve such a thing?

Thanks!

--
-Boris

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column''s datatypes do not match

解决方案

Hello Dennis,

Friday, November 7, 2003, 1:29:32 PM, you wrote:

DG> Boris Popov wrote:

Hello pgsql-general,

I''m trying to implement a table with rows that are automatically
deleted when the session that inserted them disconnects, sort of like
our own alternative to pg_stat_activity. Is it possible and what
approach should I be trying to achieve such a thing?



DG> who do you want it visible to? If you don''t want it visible to
DG> anybody but the session you are writing them from, just don''t
DG> commit them and use the right kind of transaction that allows you
DG> to see them from the session you are in.

I do want them to be visible to everybody. This is a sessions pool,
where sessions are inserted when our app connects and removed when it
disconnects, however this would only work for graceful disconnects,
which we all know isn''t always the case. So I want a table that is
somehow notified of a session disconnect and deletes rows created by
that session.

Any ideas?

--
-Boris

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly


If the table doesn''t have to be 100% accurate, you could always timestamp
the rows and have connected clients update their row, while old rows get
reaped periodicaly.

On Fri, 7 Nov 2003, Boris Popov wrote:

I do want them to be visible to everybody. This is a sessions pool,
where sessions are inserted when our app connects and removed when it
disconnects, however this would only work for graceful disconnects,
which we all know isn''t always the case. So I want a table that is
somehow notified of a session disconnect and deletes rows created by
that session.

Any ideas?


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly


Hello Ben,

Friday, November 7, 2003, 2:53:09 PM, you wrote:

B> If the table doesn''t have to be 100% accurate, you could always timestamp
B> the rows and have connected clients update their row, while old rows get
B> reaped periodicaly.

I was hoping for a more natural solution. Implementing a heartbeat in
the application is a complication I''d like to avoid at all cost.

-Boris

B> On Fri, 7 Nov 2003, Boris Popov wrote:

I do want them to be visible to everybody. This is a sessions pool,
where sessions are inserted when our app connects and removed when it
disconnects, however this would only work for graceful disconnects,
which we all know isn''t always the case. So I want a table that is
somehow notified of a session disconnect and deletes rows created by
that session.

Any ideas?



---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


这篇关于临时行 - 是否可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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