Skip site navigation (1) Skip section navigation (2)

EXPLAIN doesnt show Datum sorts explicitly

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: EXPLAIN doesnt show Datum sorts explicitly
Date: 2007-10-05 10:58:42
Message-ID: 1191581922.4223.315.camel@ebony.site (view raw or flat)
Thread:
Lists: pgsql-hackers
Something to add to the TODO:

EXPLAIN doesn't show Datum sorts explicitly that occur because of
DISTINCT aggregates in the SELECT clause.

EXPLAIN looks like this

postgres=# explain select count(distinct col3) from blah3;
                            QUERY PLAN                             
-------------------------------------------------------------------
 Aggregate  (cost=5221.00..5221.01 rows=1 width=4)
   ->  Seq Scan on blah3  (cost=0.00..4471.00 rows=300000 width=4)
(2 rows)

though trace_sort demonstrates sort(s) are taking place.

This can also be seen in the start up cost and total cost of the
Aggregate node, but the unwary might not notice the sorts taking place
when viewing the EXPLAIN.

It might also account for some people thinking SeqScans are slow on
Postgres.

Perhaps we can add a "distinct sorts=N" line to that node?

This would need reconsidering anyway for when/if we have hashed distinct
processing, since there's currently nowhere to hang the differing
explain output that would generate. 

-- 
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com


pgsql-hackers by date

Next:From: Pavel StehuleDate: 2007-10-05 11:30:13
Subject: Re: default_text_search_config
Previous:From: Gregory StarkDate: 2007-10-05 10:24:04
Subject: Re: Release Notes Overview

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group