Re: Statistical Analysis
От | Steve Heaven |
---|---|
Тема | Re: Statistical Analysis |
Дата | |
Msg-id | 3.0.1.32.20000725084757.00b7bb30@mail.thornet.co.uk обсуждение исходный текст |
Ответ на | Re: Statistical Analysis (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-general |
At 20:18 24/07/00 -0400, you wrote: >Sigh, forgot to mention the solution. There's an undocumented function: > > * bool oidrand (oid o, int4 X)- > * takes in an oid and a int4 X, and will return 'true' > * about 1/X of the time. > >typically used like this: > >-- select roughly 1/10 of the tuples >SELECT * FROM onek WHERE oidrand(onek.oid, 10); > It doesnt seem to work as you explain. For a value of 1 you expect (nearly) all the tuples and two should return half, but that not what I'm finding. galore=> select count(*) from topten where room='HI'; count ----- 14 (1 row) galore=> SELECT * FROM topten WHERE room='HE' and oidrand(topten.oid, 1); type|data |norder|room |grp ----+-------------------------+------+------+--- B |0764552503 | 1|HE | B |0751327190 | 1|HE | B |0718144392 | |HE | B |0500280754 | |HE | B |0028610091 | 1|HE | (5 rows) galore=> SELECT * FROM topten WHERE room='HE' and oidrand(topten.oid, 2); type|data |norder|room |grp ----+-------------------------+------+------+--- B |0764552503 | 1|HE | B |0751327190 | 1|HE | B |0718144392 | |HE | (3 rows) galore=> SELECT * FROM topten WHERE room='HE' and oidrand(topten.oid, 7); type|data |norder|room |grp ----+-------------------------+------+------+--- B |0751327190 | 1|HE | B |0718144392 | |HE | (2 rows) -- thorNET - Internet Consultancy, Services & Training Phone: 01454 854413 Fax: 01454 854412 http://www.thornet.co.uk
В списке pgsql-general по дате отправления: