EXPLAIN ANALYZE SELECT * FROM user_rankings_v2
WHERE keyword = 'test' ORDER BY date DESC
LIMIT 1;
Limit (cost=6.66..12.10 rows=1 width=94) (actual time=0.113..0.119 rows=0 loops=1)
-> Append (cost=6.66..697.51 rows=127 width=94) (actual time=0.110..0.117 rows=0 loops=1)
-> Index Scan using user_rankings_v2_2022_08_keyword_date_idx on user_rankings_v2_2022_08 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2022_07_keyword_date_idx on user_rankings_v2_2022_07 (cost=0.15..16.20 rows=3 width=94) (actual time=0.007..0.007 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2022_06_keyword_date_idx on user_rankings_v2_2022_06 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2022_05_keyword_date_idx on user_rankings_v2_2022_05 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2022_04_keyword_date_idx on user_rankings_v2_2022_04 (cost=0.13..8.14 rows=1 width=94) (actual time=0.004..0.004 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2022_03_keyword_date_idx on user_rankings_v2_2022_03 (cost=0.13..8.14 rows=1 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2022_02_keyword_date_idx on user_rankings_v2_2022_02 (cost=0.13..8.14 rows=1 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan Backward using user_rankings_v2_2022_01_date_keyword_asin_position_idx on user_rankings_v2_2022_01 (cost=0.12..8.14 rows=1 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_12_keyword_date_idx on user_rankings_v2_2021_12 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_11_keyword_date_idx on user_rankings_v2_2021_11 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_10_keyword_date_idx on user_rankings_v2_2021_10 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_09_keyword_date_idx on user_rankings_v2_2021_09 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_08_keyword_date_idx on user_rankings_v2_2021_08 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_07_keyword_date_idx on user_rankings_v2_2021_07 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_06_keyword_date_idx on user_rankings_v2_2021_06 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_05_keyword_date_idx on user_rankings_v2_2021_05 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_04_keyword_date_idx on user_rankings_v2_2021_04 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_03_keyword_date_idx on user_rankings_v2_2021_03 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_02_keyword_date_idx on user_rankings_v2_2021_02 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2021_01_keyword_date_idx on user_rankings_v2_2021_01 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2020_12_keyword_date_idx on user_rankings_v2_2020_12 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2020_11_keyword_date_idx on user_rankings_v2_2020_11 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2020_10_keyword_date_idx on user_rankings_v2_2020_10 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2020_09_keyword_date_idx on user_rankings_v2_2020_09 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2020_08_keyword_date_idx on user_rankings_v2_2020_08 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2020_07_keyword_date_idx on user_rankings_v2_2020_07 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2020_06_keyword_date_idx on user_rankings_v2_2020_06 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2020_05_keyword_date_idx on user_rankings_v2_2020_05 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
-> Index Scan using user_rankings_v2_2020_04_keyword_date_idx on user_rankings_v2_2020_04 (cost=0.15..16.20 rows=3 width=94) (actual time=0.002..0.002 rows=0 loops=1)
Index Cond: (keyword = 'test'::text)
Planning Time: 3.453 ms
Execution Time: 0.396 ms
Ты скорее всего не понял смысл плана. План - это намерения что-то сделать. Но не обязательно он будет сканировать всю таблицу. Если найдет в 1 партишене - то остановится быстрее. Но план это не может показать т.к. у планировщика нет такой информации.