Re: some points for FAQ

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: some points for FAQ
Date: 2007-10-09 20:58:47
Message-ID: 162867790710091358h59cec6bbp6b99a9f30db7f5d4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2007/10/9, Bruce Momjian <bruce(at)momjian(dot)us>:
> Pavel Stehule wrote:
> > 2007/10/9, Bruce Momjian <bruce(at)momjian(dot)us>:
> > > Pavel Stehule wrote:
> > > > 4.1)
> > > >
> > > > To SELECT a random row, use:
> > > > SELECT col
> > > > FROM tab
> > > > ORDER BY random()
> > > > LIMIT 1;
> > > >
> > > > + On bigger tables this solution is slow. Please, find smarter
> > > > solution on network.
> > > >
> > >
> > > Well, give me a better example that works.
> >
> > Better universal solution doesn't exist. Exists only unelegant
> > solutions - but mutch faster.
> >
> > SELECT id, ...
> > FROM data
> > WHERE id = ANY(ARRAY(
> > SELECT (random()*:max_id)::int
> > FROM generate_series(1,20)))
> > LIMIT 1;
> >
> > max_id is host variable ~ real max id + some
> >
> > -- fast solution if id is PK of data
>
> Right. We really only want general solutions in the FAQ.
>

ok. I accept it. Can be some note there? Not this strange select.

> > > > 4.19)
> > > >
> > > > + most of problems with invalid OIDs in cache are solved in PostgreSQL
> > > > 8.3. Please remeber, so every replanning of SQL statements needs time.
> > > > Write your application, they can exist without cache invalidation.
> > >
> > > Agreed. Item removed.
> > >
> >
> > Cache invalidation isn't 100% protection before this error message.
> > With specific using of EXECUTE statement, you can get this message
> > too. But all temp tables related problems are solved.
>
> OK, let's see how many bug reports we get and we can always re-add it.
>

It's true :). You have to try really wild things inside plpgsql procedures.

Pavel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-10-09 21:07:13 Re: some points for FAQ
Previous Message Jan Wieck 2007-10-09 20:58:07 Re: Skytools committed without hackers discussion/review