Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id B07B39F9FE1 for ; Sat, 18 Nov 2006 13:32:40 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 37250-04 for ; Sat, 18 Nov 2006 13:32:35 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.183]) by postgresql.org (Postfix) with ESMTP id 692B49F9425 for ; Sat, 18 Nov 2006 13:32:35 -0400 (AST) Received: by py-out-1112.google.com with SMTP id d32so627263pye for ; Sat, 18 Nov 2006 09:32:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=PkPkWRbQdQ5NemkdCK1470YmRZbSKemHqgKGjkiHPT2Dqy4sdWpypH+WVwyyOIAbP1rFmcJzXzQy/T3VepICfqvWEheA8aZfKGeb4LfrfYrG5dFfXUrrqV1oYQDcGE15NfN10ykkMxiUHAYXoZgm9ItGr3gKS2FDEk+/1Fles4w= Received: by 10.35.82.16 with SMTP id j16mr115214pyl.1163871153062; Sat, 18 Nov 2006 09:32:33 -0800 (PST) Received: by 10.35.80.10 with HTTP; Sat, 18 Nov 2006 09:32:32 -0800 (PST) Message-ID: Date: Sat, 18 Nov 2006 23:02:33 +0530 From: "Rajesh Kumar Mallah" To: "A. Kretschmer" Subject: Re: Random() Cc: pgsql-sql@postgresql.org In-Reply-To: <20061116191632.GA21285@a-kretschmer.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <55c095e90611161031h7a1ce42chd9a59a53ba7e7028@mail.gmail.com> <20061116191632.GA21285@a-kretschmer.de> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/194 X-Sequence-Number: 26846 On 11/17/06, A. Kretschmer wrote: > am Thu, dem 16.11.2006, um 16:31:14 -0200 mailte Ezequias Rodrigues da > Rocha folgendes: > > Hi list, > > > > I have a bigint collumn and I would like to generate a random number > within the > > numbers of my column. > > select from order by random() limit 1; This query will tend to get slower as the table grows because of the sorting. it possible to get a row from a random offset how about select from limit 1 offset 20000*random() ; ? regds mallah. > > > Andreas > -- > Andreas Kretschmer > Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) > GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >