Re: Storing computed values

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Colin Wetherbee" <cww(at)denterprises(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Storing computed values
Date: 2008-04-21 19:21:05
Message-ID: 396486430804211221y6da92fadi9782b730bb119354@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 21, 2008 at 11:19 AM, Colin Wetherbee <cww(at)denterprises(dot)org> wrote:

> My impression of functional indexes is that they're useful mostly in WHERE
> queries, like the following.
>
> SELECT foo, bar, baz FROM some_table WHERE lower(foo) = 'qux';
>
> In this case, the index would be created on lower(foo).
>
> How would I get the value of the functional index out of the index in my
> case?

If this is the case, and you use Natural Foreign Keys, you only need
to select from your foo table:

SELECT Connect( location1, location2)
FROM Foo
WHERE location1 = ...
OR location2 = ...
OR connect(location1,location2) = ...; --this is where the
functional index would be useful

--
Regards,
Richard Broersma Jr.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Colin Wetherbee 2008-04-21 19:21:31 Re: Storing computed values
Previous Message Colin Wetherbee 2008-04-21 18:19:06 Re: Storing computed values