I have a Citus 9.5 database (postgres 11) on Azure and executing a complicated query with CTEs.
The schema has a simple view from another schema as:
create view my_schema.table1 as select * from other_schema.table1
When my query joins to
my_schema.table1 it does a Seq Scan on the table which leads to poor performance.
However when my query joins directly to
other_schema.table1 it uses the primary key index which is fast.
I have run
ANALYZE [table] on both the table and the view.
Why does Postgres not use the index when I query via the view, but it does when I query via the table?