Random function - Mailing list pgsql-performance

From Luis Roberto Weck
Subject Random function
Date
Msg-id 95311e45-95e3-970b-e54f-3a4595d55dbb@siscobra.com.br
Whole thread Raw
Responses Re: Random function  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Random function  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-performance
Hi,

I am trying to generate some random data using the random() function.

However, I am getting the same result over mulitiple rows. This is a 
sample of the SQL I am using:

select (select string_agg(random()::text,';')
           from pg_catalog.generate_series(1,3,1) )
   from generate_series(1,10,1)

And I am getting something like:

|string_agg |
+--------------------------------------------------------------+
|0.243969671428203583;0.692578794434666634;0.291524752043187618|
|0.243969671428203583;0.692578794434666634;0.291524752043187618|
|0.243969671428203583;0.692578794434666634;0.291524752043187618|
|0.243969671428203583;0.692578794434666634;0.291524752043187618|
|0.243969671428203583;0.692578794434666634;0.291524752043187618|
|0.243969671428203583;0.692578794434666634;0.291524752043187618|
|0.243969671428203583;0.692578794434666634;0.291524752043187618|
|0.243969671428203583;0.692578794434666634;0.291524752043187618|
|0.243969671428203583;0.692578794434666634;0.291524752043187618|
|0.243969671428203583;0.692578794434666634;0.291524752043187618|

If this is the expected output, is there a way to always generate random 
numbers?




pgsql-performance by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: JOIN on partitions is very slow
Next
From: Tom Lane
Date:
Subject: Re: Random function