X-Original-To: pgsql-benchmarks-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BDCC3556EE; Fri, 11 Mar 2005 13:05:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20175-08; Fri, 11 Mar 2005 13:05:34 +0000 (GMT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id 8E30B5653D; Fri, 11 Mar 2005 13:05:28 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 4.42) id 1D9jnT-000CPH-Go; Fri, 11 Mar 2005 13:03:19 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id BEE271755A; Fri, 11 Mar 2005 13:05:28 +0000 (GMT) Message-ID: <42319798.1060206@archonet.com> Date: Fri, 11 Mar 2005 13:05:28 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?AL=DD_=C7EL=DDK?= Cc: pgsql-benchmarks@postgresql.org, pgsql-general@postgresql.org, pgsql-performance@postgresql.org, pgsql-sql@postgresql.org Subject: Re: [GENERAL] more execution time References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.062 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/2 X-Sequence-Number: 40 ALİ ÇELİK wrote: > why this query needs more time? Its very slow Difficult to say for sure - could you provide the output of EXPLAIN ANALYSE rather than just EXPLAIN? Some other immediate observations: 1. Perhaps don't post to so many mailing lists at once. If you reply to this, maybe reduce it to pgsql-performance? 2. You don't say whether the row estimates are accurate in the EXPLAIN. 3. You seem to be needlessly coalescing personaldetails.masterid since you check for it being null in your WHERE clause 4. Do you really need to cast to numeric and generate a "sorting" column that you then don't ORDER BY? 5. Is ppid an id number? And are you sure it's safe to calculate it like that? 6. What is balance() and how long does it take to calculate its result? > select > coalesce(personaldetails.masterid::numeric,personaldetails.id) + > (coalesce(personaldetails.id::numeric,0)/1000000) as sorting, > floor(coalesce(personaldetails.masterid::numeric,personaldetails.id) + > (coalesce(personaldetails.id::numeric,0)/1000000)) as ppid, > balance('MASTER-REGISTRATION',personaldetails.id) as balance, > balance('MASTER-REGISTRATION',pd2.id) as accbalance, I'm guessing point 6 is actually your problem - try it without the calls to balance() and see what that does to your timings. -- Richard Huxton Archonet Ltd