pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joel Fradkin <jfradkin@wazagua.com>
Cc: 'Dave Held' <dave.held@arrayservicesgrp.com>
Cc: 'PERFORM' <pgsql-performance@postgresql.org>
Subject: Re: speed of querry?
Date: Fri, 15 Apr 2005 10:06:06 -0400
Message-ID: <2799.1113573966@sss.pgh.pa.us> (raw)
In-Reply-To: <000001c541bc$c538fab0$797ba8c0@jfradkin>
References: <000001c541bc$c538fab0$797ba8c0@jfradkin>

"Joel Fradkin" <jfradkin@wazagua.com> writes:
> "Merge Join  (cost=49697.60..50744.71 rows=14987 width=113) (actual
> time=11301.160..12171.072 rows=160593 loops=1)"
> "  Merge Cond: ("outer".locationid = "inner".locationid)"
> "  ->  Sort  (cost=788.81..789.89 rows=432 width=49) (actual
> time=3.318..3.603 rows=441 loops=1)"
> "        Sort Key: l.locationid"
> "        ->  Index Scan using ix_location on tbllocation l
> (cost=0.00..769.90 rows=432 width=49) (actual time=0.145..2.283 rows=441
> loops=1)"
> "              Index Cond: ('SAKS'::text = (clientnum)::text)"
> "  ->  Sort  (cost=48908.79..49352.17 rows=177352 width=75) (actual
> time=11297.774..11463.780 rows=160594 loops=1)"
> "        Sort Key: a.locationid"
> "        ->  Merge Right Join  (cost=26247.95..28942.93 rows=177352
> width=75) (actual time=8357.010..9335.362 rows=177041 loops=1)"
> "              Merge Cond: ((("outer".clientnum)::text =
> "inner"."?column10?") AND ("outer".id = "inner".jobtitleid))"
> "              ->  Index Scan using ix_tbljobtitle_id on tbljobtitle jt
> (cost=0.00..243.76 rows=6604 width=37) (actual time=0.122..12.049 rows=5690
> loops=1)"
> "                    Filter: (1 = presentationid)"
> "              ->  Sort  (cost=26247.95..26691.33 rows=177352 width=53)
> (actual time=8342.271..8554.943 rows=177041 loops=1)"
> "                    Sort Key: (a.clientnum)::text, a.jobtitleid"
> "                    ->  Index Scan using ix_associate_clientnum on
> tblassociate a  (cost=0.00..10786.17 rows=177352 width=53) (actual
> time=0.166..1126.052 rows=177041 loops=1)"
> "                          Index Cond: ((clientnum)::text = 'SAKS'::text)"
> "Total runtime: 12287.502 ms"

It strikes me as odd that the thing isn't considering hash joins for
at least some of these steps.  Can you force it to (by setting
enable_mergejoin off)?  If not, what are the datatypes of the join
columns exactly?

			regards, tom lane



view thread (22+ messages)  latest in thread

Message-ID: <2799.1113573966@sss.pgh.pa.us>
Permalink:  ../2799.1113573966@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2799.1113573966@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jfradkin@wazagua.com, dave.held@arrayservicesgrp.com
  Subject: Re: speed of querry?
  In-Reply-To: <2799.1113573966@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox