Re: Optimze usage of immutable functions as relation - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Re: Optimze usage of immutable functions as relation
Date
Msg-id 20181024.120245.134697149.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
In response to Re: Optimze usage of immutable functions as relation  (Aleksandr Parfenov <asp437@gmail.com>)
Responses Re: Optimze usage of immutable functions as relation
List pgsql-hackers
Hello.

# It might be better that you provided self-contained test case.

As the discussion between Heikki and Tom just upthread, it would
be doable but that usage isn't typical. The query would be
normally written as followings and they are transformed as
desired.

select '|'||subject||'|', ts_rank_cd(body_tsvector,q) from 
messages where body_tsvector @@ to_tsquery('tuple&header&overhead');

or (this doesn't look normal, thought..)

select '|'||subject||'|', ts_rank_cd(body_tsvector,q) from 
messages, (select to_tsquery('tuple&header&overhead') as q) q
where body_tsvector @@ q;

This means that the wanted pull up logic is almost already
there. You should look on how it is handled.


At Sat, 20 Oct 2018 01:31:04 +0700, Aleksandr Parfenov <asp437@gmail.com> wrote in
<CACdpekK1oDy7-_HnXOaREa_8HM2r-fsp8iv5e6p8aWOdGdK8Mg@mail.gmail.com>
> Hi,
> 
> Thank you for the review.
> I fixed a typo and some comments. Please find new version attached.

I had the following error with the following query.

=# explain select * from pg_stat_get_activity(NULL) a join log(100000.0) p on a.pid = p.p;
ERROR:  no relation entry for relid 2


As Andrew pointed, you are missing many things to do.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Unordered wait event ClogGroupUpdate
Next
From: David Fetter
Date:
Subject: Re: Log timestamps at higher resolution