Re: Are views created 'on the fly'

From: richard terry <rterry(at)pacific(dot)net(dot)au>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Are views created 'on the fly'
Date: 2009-07-05 07:34:44
Message-ID: 200907051734.44884.rterry@pacific.net.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Sun, 5 Jul 2009 04:00:18 pm Andreas Kretschmer wrote:
> richard terry <rterry(at)pacific(dot)net(dot)au> wrote:
> > I had an occasion to generate a unique key on a complex view and noticed
> > that every time I opened the view in pgAdmin, that the start key changes,
> > does that mean that every time one references a view it is created 'on
> > the fly', before you query it for data?
>
> A VIEW is nothing else than a stored query. Every time you query the
> VIEW, your query is replaced by the definition of the view.
>
> You need a unique key on that view? Well, you can use PG 8.4 and its
> build-in row_number(() - function.
>
>
> Andreas
> --
> Really, I'm not out to destroy Microsoft. That will just be a completely
> unintentional side effect. (Linus Torvalds)
> "If I was god, I would recompile penguin with --enable-fly." (unknown)
> Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

thanks.

Richard

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2009-07-06 05:14:33 Re: variable use for selects
Previous Message Andreas Kretschmer 2009-07-05 06:00:18 Re: Are views created 'on the fly'