有多少记录版本 [英] how many record versions

查看:90
本文介绍了有多少记录版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

开始;

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.com> ;写道:

开始;
更新t set val = val + 1; - 1000次
提交;

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




你可能最好把计数器放在自己的桌子上并抽真空

表经常出现。几分钟持有交易不太可能是个好主意。此外,如果您在一次交易中进行多次更新

,您仍然会获得多行。


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

提示2:您可以使用取消注册命令一次性取消所有列表

(发送取消注册YourEmailAddressHere到 ma ******* @ postgresql.org


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

开始;
更新t set val = val + 1; - 1000次
承诺;
它创建了多少个记录版本? 1还是1000?


1000.

我正在实施一个
横幅计数器,每天增加至少2-3百万。我认为只要每隔几分钟就做一次,我就会作弊。那会不会有用?还是我还会创建尽可能多的唱片版本?




不会有所作为。你应该认真考虑使用

序列而不是普通的表格。


问候,tom lane


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

提示6:您是否搜索了我们的列表档案?

http://archives.postgresql.org


Manfred Koizar写道:< blockquote class =post_quotes>

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:您是否搜索了我们的列表档案?

http://archives.postgresql.org


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.com> 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.org)


David Garamond <li***@zara.6.isreserved.com> 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?

http://archives.postgresql.org


Manfred Koizar wrote:

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.



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?

http://archives.postgresql.org


这篇关于有多少记录版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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