23 апреля 2012 г. 17:53 пользователь Kevin Grittner
написал:
> wrote:
>
>> select * from testt where id = (random()* 10)::integer;
>>
>> And sometimes it comes out something like this:
>> id | val
>> ---+
>> 11894 | 15051
>> 29233 | 42198
>> 80725 | 90213
>> 85688 | 100992
>> 8801
* wrote:
> Kevin Grittner ***:
>> what you have written will scan the entire table and give each
>> row a 1 in 10 chance of being selected.
>>
> Hmm, is this because random() marked as volatile (and would be
> called for every row)? Ups, I not taken this into account...
wrote:
> select * from testt where id = (random()* 10)::integer;
>
> And sometimes it comes out something like this:
> id | val
> ---+
> 11894 | 15051
> 29233 | 42198
> 80725 | 90213
> 85688 | 100992
> 88017 | 108075
> (5 rows)
> Here can be 2, 3 or other rows amount in result..
The following bug has been logged on the website:
Bug reference: 6607
Logged by: Sheplyakov Alexander
Email address: suvisor.r...@gmail.com
PostgreSQL version: 9.1.3
Operating system: Debian GNU/Linux Wheezy kernel ver 3.3.1
Description:
Create test table in such mann