Re: Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function

From: Justin <justin(at)emproshunts(dot)com>
To: APseudoUtopia <apseudoutopia(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Switching from MySQL: ON DUPLICATE KEY UPDATE, plpgsql function
Date: 2009-06-28 17:17:55
Message-ID: 4A47A5C3.4040106@emproshunts.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
APseudoUtopia wrote:
<blockquote
cite="mid:27ade5280906280922p2bd7ca35x549ae5993223a87a(at)mail(dot)gmail(dot)com"
type="cite"><!---->
<pre wrap="">thread, then logs out (intending to read all the other forum threads
at some point in the future when they log in again). If I used a VIEW,
it would automatically consider all those unread forum posts to be
read when the user logs out.

</pre>
That wouldn't work. What if a user logs in, reads only one forum<br>
</blockquote>
<br>
You are keeping a list of all the forums a user has read,  i would not
worry about making sure the table tracking user activity has duplicate
key values. The select can be limited to return just on row with the
highest time stamp then compare this result to figure out what forms
the user has not read yet.  This eliminates one of problems but creates
a problem where table tracking user activity is going bloat but in low
traffic times delete the duplicate values.<br>
<br>
A similar topic was discussed  on the performance  mailing list, where
updates are hung for several seconds for a similar tracking table...<br>
<a class="moz-txt-link-freetext" href="http://archives.postgresql.org/pgsql-performance/2009-06/msg00300.php">http://archives.postgresql.org/pgsql-performance/2009-06/msg00300.php</a><br>
<br>
 <br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.5 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-06-28 17:27:35 Re: partitioning question -- how to guarantee uniqueness across partitions
Previous Message mobiledreamers 2009-06-28 16:51:41 Re: horizontal sharding