Re: Confusing performance of specific query

From: Adam Endicott <leftwing17(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Confusing performance of specific query
Date: 2007-08-09 23:52:25
Message-ID: 1186703545.313720.39150@e9g2000prf.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Here's the output from explain analyze.

My desktop:
-----------------
Unique (cost=6732.86..7380.50 rows=504 width=677) (actual
time=844.345..1148.705 rows=65 loops=1)
-> Sort (cost=6732.86..6773.34 rows=16191 width=677) (actual
time=844.341..1099.446 rows=16191 loops=1)
Sort Key: movies_movie.title, movies_movie.id,
movies_movie.cinemasource_id, movies_movie.mpaa_rating_id,
movies_movie.advisory, movies_movie.teaser, movies_movie.review_id,
movies_movie.runtime, movies_movie.studio_url,
movies_movie.distributor_id, movies_movie.synopsis,
movies_movie.stars, movies_movie.main_image_id, movies_movie.trailer,
movies_movie.editors_pick
-> Hash Join (cost=56.34..700.88 rows=16191 width=677)
(actual time=6.871..53.314 rows=16191 loops=1)
Hash Cond: (movies_movie__moviescreening.movie_id =
movies_movie.id)
-> Seq Scan on movies_moviescreening
movies_movie__moviescreening (cost=0.00..421.91 rows=16191 width=4)
(actual time=0.098..19.090 rows=16191 loops=1)
Filter: (id IS NOT NULL)
-> Hash (cost=50.04..50.04 rows=504 width=677)
(actual time=6.676..6.676 rows=504 loops=1)
-> Seq Scan on movies_movie (cost=0.00..50.04
rows=504 width=677) (actual time=0.055..2.717 rows=504 loops=1)
Total runtime: 1270.106 ms
(10 rows)

Production server:
--------------------------
Unique (cost=7412.10..8059.74 rows=507 width=679) (actual
time=14465.619..14559.558 rows=65 loops=1)
-> Sort (cost=7412.10..7452.58 rows=16191 width=679) (actual
time=14465.613..14503.436 rows=16191 loops=1)
Sort Key: movies_movie.title, movies_movie.id,
movies_movie.cinemasource_id, movies_movie.mpaa_rating_id,
movies_movie.advisory, movies_movie.teaser, movies_movie.review_id,
movies_movie.runtime, movies_movie.studio_url,
movies_movie.distributor_id, movies_movie.synopsis,
movies_movie.stars, movies_movie.main_image_id, movies_movie.trailer,
movies_movie.editors_pick
-> Hash Join (cost=53.34..740.11 rows=16191 width=679)
(actual time=3.470..94.064 rows=16191 loops=1)
Hash Cond: ("outer".movie_id = "inner".id)
-> Seq Scan on movies_moviescreening
movies_movie__moviescreening (cost=0.00..443.91 rows=16191 width=4)
(actual time=0.040..34.362 rows=16191 loops=1)
Filter: (id IS NOT NULL)
-> Hash (cost=52.07..52.07 rows=507 width=679)
(actual time=3.366..3.366 rows=507 loops=1)
-> Seq Scan on movies_movie (cost=0.00..52.07
rows=507 width=679) (actual time=0.009..1.638 rows=507 loops=1)
Total runtime: 14568.621 ms
(10 rows)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2007-08-10 00:07:31 Re: UPDATES hang every 5 minutes
Previous Message Tom Lane 2007-08-09 23:42:18 Re: Confusing performance of specific query