pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Lewis <mark.lewis@mir3.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ron Peacetree <rjpeace@earthlink.net>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] Releasing memory during External sorting?
Date: Fri, 23 Sep 2005 10:43:02 -0700
Message-ID: <1127497383.23567.218.camel@archimedes> (raw)
In-Reply-To: <5021.1127495844@sss.pgh.pa.us>
References: <2559192.1127494115558.JavaMail.root@elwamui-huard.atl.sa.earthlink.net>
	<5021.1127495844@sss.pgh.pa.us>

operations != passes.  If you were clever, you could probably write a
modified bubble-sort algorithm that only made 2 passes.  A pass is a
disk scan, operations are then performed (hopefully in memory) on what
you read from the disk.  So there's no theoretical log N lower-bound on
the number of disk passes.

Not that I have anything else useful to add to this discussion, just a
tidbit I remembered from my CS classes back in college :)

-- Mark

On Fri, 2005-09-23 at 13:17 -0400, Tom Lane wrote:
> Ron Peacetree <rjpeace@earthlink.net> writes:
> > 2= No optimal external sorting algorithm should use more than 2 passes.
> > 3= Optimal external sorting algorithms should use 1 pass if at all possible.
> 
> A comparison-based sort must use at least N log N operations, so it
> would appear to me that if you haven't got approximately log N passes
> then your algorithm doesn't work.
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match




view thread (16+ messages)  latest in thread

Message-ID: <1127497383.23567.218.camel@archimedes>
Permalink:  ../1127497383.23567.218.camel@archimedes/
Also on:    postgresql.org/message-id/1127497383.23567.218.camel@archimedes

 · 

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: mark.lewis@mir3.com, tgl@sss.pgh.pa.us, rjpeace@earthlink.net, simon@2ndquadrant.com, pgsql-hackers@postgresql.org
  Subject: Re: [PERFORM] Releasing memory during External sorting?
  In-Reply-To: <1127497383.23567.218.camel@archimedes>

* 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