On Wed, Apr 10, 2019 at 1:58 AM Jess Wren <[email protected]> wrote:
> -> Parallel Seq Scan on links
> (cost=0.00..4554.40 rows=75740 width=112)
>
> -> Function Scan on ts_parse
> (cost=0.00..12.50 rows=5 width=32)
> Filter: (tokid = 6)
> (23 rows)
>
>
>
> I am wondering if there is a more efficient way to do things? Some people
> on IRC mentioned that it might be better to declare a scalar function to
> return the host from ts_parse instead of the LATERAL query ... but I
> couldn't figure out how to do that, or if it was even preferable to the
> above from a performance standpoint ... any ideas on how I could improve
> the above.
>
May try indexing the parsed expression to avoid the seq scan on links,
something like:
create index on links (ts_parse('default', target));
and then run the explain (or explain analyze) to see if that improves
things. Certainly as the links table gets bigger this should help.