Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id A55E92E02B0 for ; Wed, 9 Jan 2008 19:30:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 23144-03 for ; Wed, 9 Jan 2008 19:30:40 -0400 (AST) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.183]) by postgresql.org (Postfix) with ESMTP id 1D3712E021B for ; Wed, 9 Jan 2008 19:30:43 -0400 (AST) Received: by py-out-1112.google.com with SMTP id d37so659189pye.29 for ; Wed, 09 Jan 2008 15:30:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=kD4/FhjdWs+JvwTfcSrKUfDRIGHZ90s5galLGRKyagA=; b=Xzh6N5WXaOEjYrR70U/vFWMcXT6q9p3qULNLauhXWB0fRdJziMe8lBJrVOUunOoZEcWzTTLdi8P+PPyPhUbcuRJSV7qXkCNU2f9aATYSURo7wkRAATJFF6GYap+MKxMxKPVMPA4fvbj/jGEKmYu95uaSm19Wfve6RuQHq10WGss= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=fVPsDqjhR3ZxkVEjdw+HwPUY4zbnogcLMD95UHr/8AERjiwS+1+zV1W4PFegmqicHtZ0TULc9INUlu+L8kUBfBEljarO1dQjWdV44YkcN+iNJHxDWcLuxb4lsX8o+uOFh9wMtXSaEf/rGKKlnbXaOGgkvmPimFulAUFxLgXXnVQ= Received: by 10.35.102.1 with SMTP id e1mr1429404pym.32.1199921442229; Wed, 09 Jan 2008 15:30:42 -0800 (PST) Received: by 10.35.82.11 with HTTP; Wed, 9 Jan 2008 15:30:42 -0800 (PST) Message-ID: Date: Wed, 9 Jan 2008 23:30:42 +0000 From: "Jamie Tufnell" To: pgsql-sql@postgresql.org Subject: Re: Re: How to keep at-most N rows per group? periodic DELETEs or constraints or..? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080109152431.79AFF2E02F6@postgresql.org> <20080109182115.6E39C2E3239@postgresql.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/59 X-Sequence-Number: 29912 On 1/9/08, Erik Jones wrote: > On Jan 9, 2008, at 1:09 PM, Scott Marlowe wrote: > > On Jan 9, 2008 12:20 PM, Steve Midgley wrote: > >> This is kludgy but you would have some kind of random number test at > >> the start of the trigger - if it evals true once per every ten > >> calls to > >> the trigger (say), you'd cut your delete statements execs by about > >> 10x > >> and still periodically truncate every set of user rows fairly > >> often. > > > > And, if you always through a limit 50 on the end of queries that > > retrieve data, you could let it grow quite a bit more than 60 or 70... > > Say 200. Then you could have it so that the random chopper function > > only gets kicked off every 100th or so time. > > I like that idea. I do too! I'm going to have a shot at implementing this tomorrow. Thanks for all your opinions guys :-) Cheers, Jamie