有多少记录版本

编程入门 行业动态 更新时间:2024-10-15 12:34:16
本文介绍了有多少记录版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

开始; update t set val = val + 1; - 1000次 提交; 它创建了多少个记录版本? 1还是1000?我正在实施一个 横幅计数器,每天增加至少2-3百万。我认为我只会在每隔几分钟后才会作弊。那个 是否可以工作还是我还会创建尽可能多的唱片版本? - dave ---------------------------(广播结束)---------------- ----------- 提示4:不要杀死-9''邮政局长

解决方案

2004年5月23日星期日02:44:31 +0700, David Garamond< li *** @ zara.6.isreserved> ;写道:

开始; 更新t set val = val + 1; - 1000次提交; 它创建了多少个记录版本? 1还是1000?我正在实施一个横幅计数器,每天增加至少2-3百万。我认为只要每隔几分钟就做一次,我就会作弊。那个有用还是我还会创建多少个唱片版本?

你可能最好把计数器放在自己的桌子上并抽真空 表经常出现。几分钟持有交易不太可能是个好主意。此外,如果您在一次交易中进行多次更新 ,您仍然会获得多行。 --------- ------------------(广播结束)--------------------------- 提示2:您可以使用取消注册命令一次性取消所有列表 (发送取消注册YourEmailAddressHere到 ma ******* @ postgresql )

David Garamond< li***@zara.6.isreserved>写道:

开始; 更新t set val = val + 1; - 1000次承诺; 它创建了多少个记录版本? 1还是1000? 1000. 我正在实施一个横幅计数器,每天增加至少2-3百万。我认为只要每隔几分钟就做一次,我就会作弊。那会不会有用?还是我还会创建尽可能多的唱片版本?

不会有所作为。你应该认真考虑使用 序列而不是普通的表格。 问候,tom lane ---------------------------(广播结束)---------------- ----------- 提示6:您是否搜索了我们的列表档案? archives.postgresql

Manfred Koizar写道:

begin; update t set val = val + 1; - 1000次提交; 它创建了多少个记录版本? 1或1000?

1000

我正在实施一个横幅计数器,增加至少2-3百万一天。

多少行?每隔几百次更新后,或者每当有10%到20%的行被更新时,我就会把VACUUM表格更新,无论哪个更大。

实际上,每条记录每天增加的幅度可能只有数千美元。但是有很多横幅。每个记录都有一个(bannerid, campaignid,websiteid,date,countrycode)" dimensions"和(印象,点击)措施。该表目前有+ - 1.5-2 mil的记录(它是在 MyISAM MySQL中),所以我不确定我是否可以使用那么多的序列 汤姆建议。每次展示(横幅视图)和点击都会产生一个 的SQL语句(= MyISAM中的事务,因为MyISAM不支持 BEGIN + COMMIT )。 我正在考虑搬到Postgres,但我很担心MVCC 的事情。我之前曾尝试过简单地在MySQL中使用InnoDB,但是由于负载显着增加,所以必须将恢复为MyISAM。 - dave ---------------------------(播出结束)----- ---------------------- 提示6:您是否搜索了我们的列表档案? archives.postgresql

begin; update t set val=val+1; -- 1000 times commit; How many record versions does it create? 1 or 1000? I''m implementing a banner counter which is incremented at least 2-3 millions a day. I thought I''d cheat by only commiting after every few minutes. Would that work or would I still create as many record versions? -- dave ---------------------------(end of broadcast)--------------------------- TIP 4: Don''t ''kill -9'' the postmaster

解决方案

On Sun, May 23, 2004 at 02:44:31 +0700, David Garamond <li***@zara.6.isreserved> wrote:

begin; update t set val=val+1; -- 1000 times commit; How many record versions does it create? 1 or 1000? I''m implementing a banner counter which is incremented at least 2-3 millions a day. I thought I''d cheat by only commiting after every few minutes. Would that work or would I still create as many record versions?

You might be better off keeping the counter in its own table and vacuuming that table very often. It is unlikely that holding transactions open for several minutes is a good idea. Also if you are doing multiple updates in a single transaction, you are still going to get multiple rows. ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to ma*******@postgresql)

David Garamond <li***@zara.6.isreserved> writes:

begin; update t set val=val+1; -- 1000 times commit; How many record versions does it create? 1 or 1000? 1000. I''m implementing a banner counter which is incremented at least 2-3 millions a day. I thought I''d cheat by only commiting after every few minutes. Would that work or would I still create as many record versions?

Won''t make a difference. You should think seriously about using a sequence rather than an ordinary table for this. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? archives.postgresql

Manfred Koizar wrote:

begin;update t set val=val+1; -- 1000 timescommit;How many record versions does it create? 1 or 1000?

1000

I''m implementing abanner counter which is incremented at least 2-3 millions a day.

How many rows? I would VACUUM that table after every few hundred updates or whenever 10% to 20% of the rows have been updated, whichever is greater.

Actually, each record will be incremented probably only thousands of times a day. But there are many banners. Each record has a (bannerid, campaignid, websiteid, date, countrycode) "dimensions" and (impression, click) "measures". The table currently has +- 1,5-2 mil records (it''s in MyISAM MySQL), so I''m not sure if I can use that many sequences which Tom suggested. Every impression (banner view) and click will result in a SQL statement (= a "transaction" in MyISAM, since MyISAM doesn''t support BEGIN + COMMIT). I''m contemplating of moving to Postgres, but am worried with the MVCC thing. I''ve previously tried briefly using InnoDB in MySQL but have to revert back to MyISAM because the load increased significantly. -- dave ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? archives.postgresql

更多推荐

有多少记录版本

本文发布于:2023-11-30 03:48:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648617.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有多少   版本

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!