Thank you for the responses! I was going to go with a materialized view, but
then realized that since the dataset is static it’s really no different from
just creating a new table and indexing that. The suggestions provide useful
advice for the future though.
Cheers,
Demitri
> On Dec 30, 202
Karsten Hilbert writes:
> Am Wed, Dec 30, 2020 at 02:37:59PM -0500 schrieb Demitri Muna:
>> I want to index the results of these repeated, unchanging calculations to
>> speed up other queries. Which mechanism would be best to do this? Create
>> additional columns? Create another table?
> A mate
> On Dec 30, 2020, at 11:48, Christophe Pettus wrote:
>
> This might be a good use for a generated column.
>
> https://www.postgresql.org/docs/current/ddl-generated-columns.html
I take that back; the generation formula has to be immutable as well. Perhaps
a column populated by a trig
> On Dec 30, 2020, at 11:37, Demitri Muna wrote:
> I want to index the results of these repeated, unchanging calculations to
> speed up other queries. Which mechanism would be best to do this? Create
> additional columns? Create another table?
This might be a good use for a generated column.
Am Wed, Dec 30, 2020 at 02:37:59PM -0500 schrieb Demitri Muna:
> I want to index the results of these repeated, unchanging calculations to
> speed up other queries. Which mechanism would be best to do this? Create
> additional columns? Create another table?
A materialized view ?
Karsten
--
GPG
Hi Tom,
> On Dec 30, 2020, at 11:50 AM, Tom Lane wrote:
>
> I would call this a bug if it were a supported case, but really you are
> doing something you are not allowed to. Functions in indexed expressions
> are required to be immutable, and a function that looks at the contents of
> a table -
Demitri Muna writes:
> I’m getting stuck on a problem I was hoping I could get some help with. I’m
> trying to create an index for the results of a function that touches two
> tables like this and get the following error:
> CREATE INDEX my_idx ON mytable (first_time(id));
> ERROR: could not re