X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E749AD6D78 for ; Mon, 22 Aug 2005 19:48:24 -0300 (ADT) 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 78049-09 for ; Mon, 22 Aug 2005 22:48:21 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id 55F7BD70B4 for ; Mon, 22 Aug 2005 19:48:19 -0300 (ADT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id 592332395A6; Mon, 22 Aug 2005 18:48:22 -0400 (EDT) Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id 50302-01-8; Mon, 22 Aug 2005 18:48:20 -0400 (EDT) Received: from [192.168.0.105] (CPE3285f62f0d42-CM0011aec5ebbc.cpe.net.cable.rogers.com [69.199.116.160]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailbox.samurai.com (Postfix) with ESMTP id B24AC2395B6; Mon, 22 Aug 2005 18:48:20 -0400 (EDT) Message-ID: <430A5632.10701@samurai.com> Date: Mon, 22 Aug 2005 18:48:18 -0400 From: Neil Conway User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jignesh Shah Cc: pgsql-performance@postgresql.org Subject: Re: MemoryContextSwitchTo during table scan? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200508/330 X-Sequence-Number: 14077 Jignesh Shah wrote: > Now the question is why there are so many calls to MemoryContextSwitchTo > in a single SELECT query command? Can it be minimized? I agree with Tom -- if profiling indicates that MemoryContextSwitchTo() is the bottleneck, I would be suspicious that your profiling setup is misconfigured. MemoryContextSwitchTo() is essentially a function call, two pointer assignments, and a function return. Try rerunning the test with current sources -- MemoryContextSwitchTo() is now inlined when using GCC, which should just leave the assignments. -Neil