Dennis <dennisr(at)visi(dot)com> writes:
> Hi, I am having bad luck with a query that should return zero rows but actually never returns (completes execution.)
Seems like you need a multicolumn index on t_week_f, and maybe also on
nb_products, so that the conditions shown as "filters" here could be
applied as index conditions instead.
I wonder also if your statistics are up to date --- are the rowcount
estimates shown in EXPLAIN reasonably sane?
regards, tom lane