Re: Getting a random row
От
Grzegorz Jaśkiewicz
Тема
Re: Getting a random row
Дата
Msg-id
2f4958ff0910130839j3ff81dd6s8500e4650121c2d0@mail.gmail.com
Ответ на
Re: Getting a random row (Shaul Dar)
Список
Дерево обсуждения
Getting a random row Shaul Dar <shauldar@gmail.com>
Re: Getting a random row Grzegorz Jaśkiewicz <gryzman@gmail.com>
Re: Getting a random row Shaul Dar <shauldar@gmail.com>
Re: Getting a random row Grzegorz Jaśkiewicz <gryzman@gmail.com>
Re: Getting a random row bricklen <bricklen@gmail.com>
Re: Getting a random row Robert Haas <robertmhaas@gmail.com>
Re: Getting a random row Michael Glaesemann <grzm@seespotcode.net>
Re: Getting a random row Shaul Dar <shauldar@gmail.com>
Re: Getting a random row Scott Marlowe <scott.marlowe@gmail.com>
Re: Getting a random row Thom Brown <thombrown@gmail.com>
Re: Getting a random row Pavel Stehule <pavel.stehule@gmail.com>
Re: Getting a random row Scott Marlowe <scott.marlowe@gmail.com>
Re: Getting a random row Віталій Тимчишин <tivv00@gmail.com>
Re: Getting a random row Thomas Kellerer <spam_eater@gmx.net>
2009/10/13 Shaul Dar <shauldar@gmail.com>
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.
change the default of that column to use sequence.
For instance, lookup CREATE SEQUENCE in manual, and ALTER TABLE .. SET DEFAULT ..
for example of how it looks, just create table foo(a serial), and check its definition with \d+ foo
For instance, lookup CREATE SEQUENCE in manual, and ALTER TABLE .. SET DEFAULT ..
for example of how it looks, just create table foo(a serial), and check its definition with \d+ foo
--
GJ
В списке pgsql-performance по дате отправления