Search Postgresql Archives

Re: view management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Nov 16, 2007 4:01 PM, Joshua D. Drake <jd@xxxxxxxxxxxxxxxxx> wrote:
> On Fri, 16 Nov 2007 13:57:24 -0700
> "Ed L." <pgsql@xxxxxxxxxxxxx> wrote:
>
> > I have a question about view management...
> >
> > I often have need for views that reference views that reference
> > views, and so on.  When I need to make a small update to one of
> > the views, I am faced with having to drop and recreate all
> > dependent views even if the driving change just adds another
> > column to the view, for example.  I might have to drop and
> > recreate many tens of views just to make a change to a single
> > view.  What a PITA.  How do others manage this?
>
> I use stored procedures instead.

IMO, this approach has a lot of problems...not only does it force you
to think of your database access in terms of inputs and outputs in
advance.  Furthermore it can force your queries using the functions
into awkward or suboptimal plans.  I think functions are appropriate
for certain tasks that are better handled in procedural manner for
various reasons, but it's very good style to keep applications
interfacing to the database as much as possible through views.  All
procedure access is ok, but is too much abstraction and creates
headaches down the line.  Furthermore, it hides the problem asked by
the OP, not solves it, since the database merely forces you to check
the dependencies by creating the view, whereas functions displace that
check down the line which might result in missed dependency issues.

merlin

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux