X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E6E7E9FA5D8 for ; Wed, 14 Jun 2006 08:09:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 44580-01 for ; Wed, 14 Jun 2006 08:09:39 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from fep05.ttnet.net.tr (mail.ttnet.net.tr [212.175.13.129]) by postgresql.org (Postfix) with ESMTP id 2C31C9F9CAA for ; Wed, 14 Jun 2006 08:09:37 -0300 (ADT) Received: from (192.168.8.105) by AVGW-I-1.ttnet.net.tr via smtp id 2848_24850ad8_fb96_11da_9a6f_001422175f0e; Wed, 14 Jun 2006 14:08:45 +0300 Received: from alamut ([212.174.26.173]) by fep05.ttnet.net.tr with ESMTP id <20060614110934.GEZM2298.fep05.ttnet.net.tr@alamut>; Wed, 14 Jun 2006 14:09:34 +0300 Received: from by AVGW-I-6.ttnet.net.tr via smtp id 67db_1dafdfa8_fb96_11da_8ae9_0011433771ac; Wed, 14 Jun 2006 14:08:32 +0300 Date: Wed, 14 Jun 2006 14:07:13 +0300 From: Volkan YAZICI To: =?iso-8859-1?B?QvZzevZybelueWkgWm9sdOFu?= Cc: pgsql-performance@postgresql.org Subject: Re: Precomputed constants? Message-ID: <20060614110713.GA2277@alamut.tdm.local> References: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3167.213.163.11.81.1150282434.squirrel@www.dunaweb.hu> User-Agent: Mutt/1.4.2.1i X-NAI-Spam-Rules: 0 Rules triggered X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/243 X-Sequence-Number: 19600 On Jun 14 12:53, Böszörményi Zoltán wrote: > # explain analyze select * from mxstrpartsbg where szam = > round(800000*random())::integer; AFAIK, you can use sth like that: SELECT * FROM mxstrpartsbg WHERE szam = (SELECT round(800000*random())::integer OFFSET 0); This will prevent calculation of round() for every row. Regards.