By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
sale_id | book_id | customer_id | sale_date |
---|---|---|---|
1 | 3 | 47 | 2011-11-06 |
2 | 5 | 79 | 2012-05-16 |
3 | 11 | 78 | 2010-01-31 |
4 | 5 | 100 | 2011-07-16 |
5 | 4 | 23 | 2014-11-01 |
6 | 10 | 54 | 2012-09-25 |
7 | 7 | 76 | 2015-11-23 |
8 | 12 | 9 | 2013-07-25 |
9 | 11 | 18 | 2011-03-17 |
10 | 2 | 98 | 2011-07-04 |
11 | 5 | 20 | 2014-10-12 |
12 | 8 | 56 | 2013-04-12 |
13 | 12 | 46 | 2011-09-13 |
14 | 12 | 86 | 2011-09-13 |
15 | 3 | 12 | 2013-04-08 |
SELECT 15
DO
SELECT 7
year | jan | feb | mar | apr | may | jun | jul | aug | sep | oct | nov | dec |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 | 17 | 9 | 12 | 12 | 9 | 7 | 10 | 13 | 4 | 8 | 9 | 14 |
2011 | 7 | 11 | 14 | 11 | 10 | 12 | 9 | 14 | 8 | 13 | 14 | 15 |
2012 | 16 | 13 | 12 | 9 | 14 | 17 | 8 | 11 | 19 | 9 | 15 | 11 |
2013 | 16 | 10 | 8 | 14 | 13 | 15 | 15 | 4 | 15 | 13 | 11 | 13 |
2014 | 10 | 15 | 10 | 12 | 11 | 11 | 6 | 8 | 15 | 12 | 15 | 13 |
2015 | 13 | 7 | 16 | 9 | 12 | 11 | 11 | 15 | 5 | 8 | 23 | 16 |
2016 | 14 | 12 | 13 | 5 | 16 | 12 | 17 | 14 | 9 | 14 | 17 | 10 |
SELECT 7