Re: Selecting random rows efficiently
От | Ron Johnson |
---|---|
Тема | Re: Selecting random rows efficiently |
Дата | |
Msg-id | 1062260304.669.566.camel@haggis обсуждение исходный текст |
Ответ на | Re: Selecting random rows efficiently (Rod Taylor <rbt@rbt.ca>) |
Ответы |
Re: Selecting random rows efficiently
|
Список | pgsql-performance |
On Sat, 2003-08-30 at 09:01, Rod Taylor wrote: > > i was hoping there was some trickery with sequences that would allow me to > > easily pick a random valid sequence number..? > > I would suggest renumbering the data. > > ALTER SEQUENCE ... RESTART WITH 1; > UPDATE table SET pkey = DEFAULT; > > Of course, PostgreSQL may have trouble with that update due to > evaluation of the unique constraint immediately -- so drop the primary > key first, and add it back after. And if there are child tables, they'd all have to be updated, too. -- ----------------------------------------------------------------- Ron Johnson, Jr. ron.l.johnson@cox.net Jefferson, LA USA "Whatever may be the moral ambiguities of the so-called demoratic nations and however serious may be their failure to conform perfectly to their democratic ideals, it is sheer moral perversity to equate the inconsistencies of a democratic civilization with the brutalities which modern tyrannical states practice." Reinhold Nieburhr, ca. 1940
В списке pgsql-performance по дате отправления: