Re: BUG #18607: UNION ALL discards all foreign key relations + indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: sanskar(at)flintk12(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18607: UNION ALL discards all foreign key relations + indexes
Date: 2024-09-09 16:29:40
Message-ID: 3208238.1725899380@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> CREATE OR REPLACE VIEW v3.temp_view AS
> SELECT * FROM users WHERE id = 'e-1'
> UNION ALL
> SELECT * FROM users WHERE id = 'e-2';

> Either way when the view is created, the indexes and the related relations
> of the foreign key references are being dropped.

Views do not have either indexes or foreign keys.

> What + Why? I am processing the result of the union in another CTE which now
> is not having access to indices and so it is performing a seq scan!

This seems to be a performance complaint, rather than a valid bug
report. You might find it helpful to read

https://wiki.postgresql.org/wiki/Slow_Query_Questions

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-09-09 16:39:37 Re: [EXT]: Re: BUG #18604: Regression in PostgreSQL 16.4: pg_dump Prevents Essential System Table Modifications
Previous Message PG Bug reporting form 2024-09-09 15:16:33 BUG #18607: UNION ALL discards all foreign key relations + indexes