Re: Database tuning - Mailing list pgsql-general

From Nevermind
Subject Re: Database tuning
Date
Msg-id 20011221215319.C39983@nevermind.kiev.ua
Whole thread Raw
In response to Re: Database tuning  (Antonio Fiol Bonnín <fiol@w3ping.com>)
List 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 by date:

Previous
From: "SHELTON,MICHAEL (Non-HP-Boise,ex1)"
Date:
Subject: Re: Is the Windows Version Stable?
Next
From: Helge Bahmann
Date:
Subject: udp port