2009/10/14 Scott Marlowe
> On Wed, Oct 14, 2009 at 1:20 AM, Pavel Stehule
> wrote:
> > 2009/10/14 Thom Brown :
> >> 2009/10/14 Scott Marlowe :
> >> Why not just do something like:
> >>
> >> SELECT thisfield, thatfield
> >> FROM my_table
> >> WHERE thisfield IS NOT NULL
> >> ORDER BY RANDOM()
> >
On Wed, Oct 14, 2009 at 1:20 AM, Pavel Stehule wrote:
> 2009/10/14 Thom Brown :
>> 2009/10/14 Scott Marlowe :
>>>
>>> If what you're trying to do is emulate a real world app which randomly
>>> grabs rows, then you want to setup something ahead of time that has a
>>> pseudo random order and not rel
2009/10/14 Thom Brown :
> 2009/10/14 Scott Marlowe :
>>
>> If what you're trying to do is emulate a real world app which randomly
>> grabs rows, then you want to setup something ahead of time that has a
>> pseudo random order and not rely on using anything like order by
>> random() limit 1 or anyth
2009/10/14 Scott Marlowe :
>
> If what you're trying to do is emulate a real world app which randomly
> grabs rows, then you want to setup something ahead of time that has a
> pseudo random order and not rely on using anything like order by
> random() limit 1 or anything like that. Easiest way is
On Tue, Oct 13, 2009 at 9:17 AM, Shaul Dar wrote:
> Hi,
>
> I am running performance simulation against a DB. I want to randomly pull
> different records from a large table. However the table has no columns that
> hold sequential integer values (1..MAX), i.e. the columns all have "holes"
> (due to
2009/10/13 Grzegorz Jaśkiewicz :
>
>
> 2009/10/13 Shaul Dar
>>
>> Sorry, I guess I wasn't clear.
>> I have an existing table in my DB, and it doesn't have a column with
>> serial values (actually it did originally, but due to later deletions of
>> about 2/3 of the rows the column now has "holes").
2009/10/13 Grzegorz Jaśkiewicz :
>
>
> 2009/10/13 Shaul Dar
>>
>> Sorry, I guess I wasn't clear.
>> I have an existing table in my DB, and it doesn't have a column with
>> serial values (actually it did originally, but due to later deletions of
>> about 2/3 of the rows the column now has "holes").
Michael,
You are right. I didn't remember the semantics, and Oracle's rownum would
not have been helpful. But the new row_number() in 8.4 would probably do the
trick (though I use 8.3.7 :-( )
-- Shaul
2009/10/13 Michael Glaesemann
>
> On Oct 13, 2009, at 11:19 , Grzegorz Jaśkiewicz wrote:
>
>
2009/10/13 Shaul Dar
> Sorry, I guess I wasn't clear.
> I have an existing table in my DB, and it doesn't have a column with serial
> values (actually it did originally, but due to later deletions of about 2/3
> of the rows the column now has "holes"). I realize I could add a new serial
> column,
On Oct 13, 2009, at 11:19 , Grzegorz Jaśkiewicz wrote:
On Tue, Oct 13, 2009 at 4:17 PM, Shaul Dar wrote:
Also PG does not have a concept of an auto-increment pseudo-column
like
Oracle's "rownum". Any suggestions?
not true - it has sequences, and pseudo type serial. Rtfm!.
AIUI, rownum
Sorry, I guess I wasn't clear.
I have an existing table in my DB, and it doesn't have a column with serial
values (actually it did originally, but due to later deletions of about 2/3
of the rows the column now has "holes"). I realize I could add a new serial
column, but prefer not to change table +
Shaul Dar, 13.10.2009 17:17:
Also PG does not have a concept of an auto-increment pseudo-column
like Oracle's "rownum". Any suggestions?
Yes it does (at least 8.4)
SELECT row_number() over(), the_other_columns...
FROM your_table
So you could do something like:
SELECT *
FROM (
SELECT row_nu
On Tue, Oct 13, 2009 at 4:17 PM, Shaul Dar wrote:
> Hi,
>
> I am running performance simulation against a DB. I want to randomly pull
> different records from a large table. However the table has no columns that
> hold sequential integer values (1..MAX), i.e. the columns all have "holes"
> (due t
Hi,
I am running performance simulation against a DB. I want to randomly pull
different records from a large table. However the table has no columns that
hold sequential integer values (1..MAX), i.e. the columns all have "holes"
(due to earlier filtering). Also PG does not have a concept of an
aut
14 matches
Mail list logo