Skip to Content
Mastering PostgreSQL 12 - Third Edition
book

Mastering PostgreSQL 12 - Third Edition

by Hans-Jürgen Schönig
November 2019
Beginner to intermediate
470 pages
11h 59m
English
Packt Publishing
Content preview from Mastering PostgreSQL 12 - Third Edition

Applying table constraints

What happens if filters are applied to the table? What will the optimizer decide to do in order to execute this query in the most efficient way possible? The following example shows us how the PostgreSQL planner will behave:

test=# EXPLAIN SELECT * FROM t_data WHERE t = '2016-01-04';                            QUERY PLAN -----------------------------------------------------------------  Append (cost=0.00..95.12 rows=23 width=40)    -> Seq Scan on t_data (cost=0.00..0.00 rows=1 width=40)          Filter: (t = '2016-01-04'::date)    -> Seq Scan on t_data_2016 (cost=0.00..25.00 rows=6 width=40)          Filter: (t = '2016-01-04'::date)    -> Seq Scan on t_data_2015 (cost=0.00..25.00 rows=6 width=40)          Filter: (t = '2016-01-04'::date)  -> Seq Scan on t_data_2014 (cost=0.00..25.00 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering PostgreSQL 11 - Second Edition

Mastering PostgreSQL 11 - Second Edition

Hans-Jürgen Schönig
Learning PostgreSQL 11 - Third Edition

Learning PostgreSQL 11 - Third Edition

Christopher Travers, Andrey Volkov
PostgreSQL Server Programming - Second Edition

PostgreSQL Server Programming - Second Edition

Usama Dar, Hannu Krosing, Jim Mlodgenski, Kirk Roybal

Publisher Resources

ISBN: 9781838988821Supplemental Content