Search Postgresql Archives

Re: Confusing performance of specific query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux