Return-Path: owner-postman
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with SMTP id NAA24237 for postgres-redist; Thu, 27 Apr 1995 13:33:59 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199504272033.NAA24237@nobozo.CS.Berkeley.EDU>
X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from eden.as.cmu.edu (root@EDEN.AS.CMU.EDU [128.2.247.5]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with ESMTP id NAA24227 for <postgres@nobozo.CS.Berkeley.EDU>; Thu, 27 Apr 1995 13:33:57 -0700
Received: from eden.as.cmu.edu (LOCALHOST [127.0.0.1]) by eden.as.cmu.edu (8.6.11/8.6.9) with ESMTP id QAA03205 for <postgres@nobozo.CS.Berkeley.EDU>; Thu, 27 Apr 1995 16:33:36 -0400
Message-Id: <199504272033.QAA03205@eden.as.cmu.edu>
X-Mailer: exmh version 1.5.3 12/28/94
To: postgres@postgres.Berkeley.EDU
Subject: Long running time for query
In-reply-to: Your message of "Thu, 27 Apr 1995 17:11:26 +0200."
             <199504271511.RAA16755@zen.gklw.co.at> 
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Date: Thu, 27 Apr 1995 16:33:35 -0400
From: Brian Gallew <bg11@eden.as.cmu.edu>
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Thu, 27 Apr 95 13:33:59 -0700
Resent-XMts: smtp

The following query take ~588 seconds to run:

retrieve (c.lname, c.fname, count = cust_freq_count(c.id)) 
        from c in Customer 
        sort by count, lname, fname

where cust_freq_count is defined as

define function cust_freq_count \
(language = "postquel", returntype = int4)\
arg is (int4)\
as "retrieve (count = count{Call.callerrn where Call.callerrn = $1})

Doing the same thing in tclpqx with:

retrieve (c.callerrn) from c in Call sort by callerrn
<retrieve lines, reduce list/produce count values>
retrieve (c.id, c.fname, c.lname) from c in Customer sort by id
<retrieve values, join lists>

takes ~38 seconds.  Perhaps I'm stupid, but shouldn't this be faster in the 
backend, rather than in a scripting language?  If anyone wants to see the 
complete code, I=ll be happy to forward it!

=====================================================================
| It's nice to be important, but it's *important* to suck up to the |
| sysadmin  -- Me                                                   |
=====================================================================
| Finger geek@cmu.edu for my public key.                            |
=====================================================================


==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/
