Re: Getting a random row

Поиск
Список
Период
Сортировка
От Shaul Dar
Тема Re: Getting a random row
Дата
Msg-id 234efe30910130830y2c95fb48mc67fd6401f589db0@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Getting a random row  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Ответы Re: Getting a random row  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Список pgsql-performance
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 + the new column would also become nonconsecutive after further deletions. The nice thing about Oracle's "rownum" is that it' a pseudo-column", not a real one, and AFAIK is always valid.

Suggestions?

-- Shaul

2009/10/13 Grzegorz Jaśkiewicz <gryzman@gmail.com>


On Tue, Oct 13, 2009 at 4:17 PM, Shaul Dar <shauldar@gmail.com> 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 earlier filtering).
what do yo umean ? you can restrict range of integer column (or any other type) with constraints, for instance CHECK foo( a between 1 and 100);
 
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!.
 


--
GJ

В списке pgsql-performance по дате отправления:

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: Getting a random row
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: Getting a random row