All pastes #167830 Raw Edit

Mine

public sql v1 · immutable
·published 2006-09-12 12:13 UTC
rendered paste body
EXPLAIN SELECT customer.last_name, address.phone, film.title	FROM rental INNER JOIN customer ON rental.customer_id = customer.customer_id		INNER JOIN address ON customer.address_id = address.address_id		INNER JOIN inventory ON (rental.inventory_id) = inventory.inventory_id		INNER JOIN film ON inventory.film_id = film.film_id	WHERE rental.return_date IS NULL		AND rental_date < CURRENT_DATE - (film.rental_duration || ' DAY')::INTERVAL		AND address.phone LIKE '19%';/*Nested Loop  (cost=358.72..365.61 rows=1 width=43)"  Join Filter: ("outer".rental_date < (('now'::text)::date - ((("inner".rental_duration)::text || ' DAY'::text))::interval))"  ->  Nested Loop  (cost=358.72..362.54 rows=1 width=35)"        ->  Merge Join  (cost=358.72..359.52 rows=1 width=37)"              Merge Cond: ("outer".customer_id = "inner".customer_id)"              ->  Sort  (cost=26.64..26.65 rows=3 width=29)"                    Sort Key: customer.customer_id"                    ->  Nested Loop  (cost=0.00..26.62 rows=3 width=29)"                          ->  Seq Scan on address  (cost=0.00..17.54 rows=3 width=19)"                                Filter: ((phone)::text ~~ '19%'::text)"                          ->  Index Scan using idx_fk_address_id on customer  (cost=0.00..3.01 rows=1 width=16)"                                Index Cond: (customer.address_id = "outer".address_id)"              ->  Sort  (cost=332.08..332.47 rows=155 width=14)"                    Sort Key: rental.customer_id"                    ->  Seq Scan on rental  (cost=0.00..326.44 rows=155 width=14)"                          Filter: (return_date IS NULL)"        ->  Index Scan using inventory_pkey on inventory  (cost=0.00..3.01 rows=1 width=6)"              Index Cond: ("outer".inventory_id = inventory.inventory_id)"  ->  Index Scan using film_pkey on film  (cost=0.00..3.04 rows=1 width=24)"        Index Cond: ("outer".film_id = film.film_id)"*/