pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Julius Tuskenis <julius@nsoft.lt>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: [Fwd: performance: view or function?]
Date: Thu, 8 May 2008 10:42:43 -0600
Message-ID: <dcc563d10805080942u249839f3o2033aa6c4f98eb68@mail.gmail.com> (raw)
In-Reply-To: <4822D2E6.2090004@nsoft.lt>
References: <4822D2E6.2090004@nsoft.lt>

On Thu, May 8, 2008 at 4:16 AM, Julius Tuskenis <julius@nsoft.lt> wrote:
> Hello,
>
>  I have one question - what is the difference between the view and a
> function returning a data set? I mean the performance. Which is better to
> use? If its the same, I would use functions, because I could use other
> languages not just SQL to get the results I want.

Note that functional indexes may be a good choice for certain actions.
 If you always look up tuples based on something like "where
a*80+b<100 or something then a functional index on ((a*80+b)) might be
more useful than a view.  You can also create a custom immutable
function and index on that to make it a bit cleaner.



view thread (4+ messages)  latest in thread

Message-ID: <dcc563d10805080942u249839f3o2033aa6c4f98eb68@mail.gmail.com>
Permalink:  ../dcc563d10805080942u249839f3o2033aa6c4f98eb68@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10805080942u249839f3o2033aa6c4f98eb68@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott.marlowe@gmail.com, julius@nsoft.lt
  Subject: Re: [Fwd: performance: view or function?]
  In-Reply-To: <dcc563d10805080942u249839f3o2033aa6c4f98eb68@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox