> On 22 Jan 2015, at 15:54, Pierre Hsieh <pierre.hs...@gmail.com> wrote:
> rule:
> 1. just one column which type is integer in table
> 2. this columns only has 1 and 2 for 50 times as following
> 
> 1
> 2
> 1
> 2
> 1
> 2
> 1
> 2
> .....

create table test as select b from generate_series(1,50) s1(a), 
generate_series(1,2) s2(b);

But since tables are unordered sets, you'll need something to order your data 
by when querying, so I'd use this:

create table test as select a, b from generate_series(1,50) s1(a), 
generate_series(1,2) s2(b);
select b from test order by a,b;


I'm kind of curious what kind of problem you're trying to solve. First you ask 
how to calculate the standard deviation of blocks of 50 records and now this. 
Are you sure those blocks are ALWAYS 50 records large? Never, say 49 or 51 
because some records either weren't stored at all or were stored in the wrong 
block? If that occurs, you're dealing with an increasing skew in your 
statistics. Perhaps the right thing to ask yourself is what groups those 50 
records together, what do they have in common?

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to