Received: from mail.iconz.co.nz (mail.iconz.co.nz [210.48.22.36]) by hub.org (8.9.3/8.9.3) with ESMTP id UAA93910 for ; Thu, 23 Dec 1999 20:06:04 -0500 (EST) (envelope-from markir@hnz.co.nz) Received: from [192.173.20.11] (mail.hnz.co.nz [192.173.20.11]) by mail.iconz.co.nz (8.9.3/8.9.3) with SMTP id OAA202430945997597 for ; Fri, 24 Dec 1999 14:06:38 +1300 (NZDT) Received: from hiscorpxy01.hnz.co.nz by [192.173.20.11] via smtpd (for mail.iconz.co.nz [210.48.22.36]) with SMTP; 24 Dec 1999 01:01:09 UT Received: FROM hufin0.hnz.co.nz BY hiscorpxy01.hnz.co.nz ; Fri Dec 24 14:03:43 1999 +1300 Received: from hudev0.hnz.co.nz (markir@hudev0 [10.24.10.46]) by hufin0.hnz.co.nz with ESMTP (8.8.6 (PHNE_14041)/8.7.1) id OAA26655 for ; Fri, 24 Dec 1999 14:03:43 +1300 (NZDT) Received: (from markir@localhost) by hudev0.hnz.co.nz (8.8.6 (PHNE_15509)/8.7.1) id OAA26418 for pgsql-sql@postgresql.org; Fri, 24 Dec 1999 14:04:40 +1300 (NZDT) Date: Fri, 24 Dec 1999 14:04:40 +1300 (NZDT) From: Mark Kirkwood Message-Id: <199912240104.OAA26418@hudev0.hnz.co.nz> subject: Sorting Problem To: undisclosed-recipients:; Dear List, I gave been investigating how postgresql does sorting, using the query from my last posting : select d0.d0f1, count(f.f1) from dim0 d0, fact0 f where d0.d0key = f.d0key and d0.d0f1 between '1996-05-01' and '1996-05-31' group by d0.d0f1 ; There is about 5-7M of data to sort - all with the same sort key ( d0f1 ). I noticed that 19000K of temporary sort tables were written during query execution, so I tried using backend options ( -o ) of : -S 25000. Whilst there was no sort tables written with this option, the elapsed time for the query was longer ! ( 35s instead of 14s ) The platform is redhat 6.0 and pgsql 6.5.3 There is 160M ram with about 60M free during the query exec ( note that hpux 11 with pgsql 6.5.3 gives similar results too...) Is there something I need to set or unset, or is this expected ? Cheers Mark