Re: Database tuning

Поиск
Список
Период
Сортировка
От Nevermind
Тема Re: Database tuning
Дата
Msg-id 20011221215319.C39983@nevermind.kiev.ua
обсуждение исходный текст
Ответ на Re: Database tuning  (Antonio Fiol Bonnín <fiol@w3ping.com>)
Список pgsql-general
Hello, Antonio Fiol Bonnin!

On Fri, Dec 21, 2001 at 06:41:41PM +0100, you wrote:

> XXX is a random value ranking from 0 (or 1) to the maximum id value. You
> generate it outside the database.
Maximum id is not good solution, beacuse some of ids between 0 (or 1)
could be missing for some reasons. You should:

select id from table;

Then chose random one outside SQL, and then:

select * from table where table.id = '$random_id';

This would be slower but will work for sure.

Another approach -- select random id outside SQL from 0 (or 1) to
maximum_id and then trying to select with 'where table.id =
'$random_id'' until you've got > 0 rows in result.

--
NEVE-RIPE

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

Предыдущее
От: "SHELTON,MICHAEL (Non-HP-Boise,ex1)"
Дата:
Сообщение: Re: Is the Windows Version Stable?
Следующее
От: Helge Bahmann
Дата:
Сообщение: udp port