On 28 June 2018 at 21:38, Luca Ferrari wrote:
> CREATE INDEX idx_year
> ON expenses ( EXTRACT( year FROM day ) );
>
> why is the planner not choosing to use such index on a 'year' raw query?
>
> EXPLAIN SELECT * FROM expenses
> WHERE year = 2016;
The expression in the where clause must match the
Hi all,
in order to better understand this feature of 10, I've created a table
like this:
CREATE TABLE expenses(
...
day date,
year int,
CHECK( year = EXTRACT( year FROM day ) )
);
so that I can ensure 'year' and 'day' are tied together:
SELECT
count(*) FILTER( WHERE year = 2016 ) AS