agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Brian Gallew <bg11@eden.as.cmu.edu>
To: postgres@postgres.Berkeley.EDU
Subject: Long running time for query
Date: Thu, 27 Apr 1995 16:33:35 -0400
Message-ID: <199504272033.QAA03205@eden.as.cmu.edu> (raw)
In-Reply-To: <199504271511.RAA16755@zen.gklw.co.at>

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/



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: postgres@postgres.berkeley.edu
  Cc: bg11@eden.as.cmu.edu
  Subject: Re: Long running time for query
  In-Reply-To: <199504272033.QAA03205@eden.as.cmu.edu>

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

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