Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id CF19A476DC6; Thu, 23 Jan 2003 05:44:24 -0500 (EST) Received: from localhost.localdomain (unknown [194.204.44.121]) by postgresql.org (Postfix) with ESMTP id 1CF06476E42; Thu, 23 Jan 2003 05:41:52 -0500 (EST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.5/8.12.5) with ESMTP id h0NAfpHf002670; Thu, 23 Jan 2003 12:41:52 +0200 Received: (from hannu@localhost) by localhost.localdomain (8.12.5/8.12.5/Submit) id h0NAfmZ1002668; Thu, 23 Jan 2003 12:41:48 +0200 X-Authentication-Warning: localhost.localdomain: hannu set sender to hannu@tm.ee using -f Subject: Re: Terrible performance on wide selects From: Hannu Krosing To: Tom Lane Cc: Dann Corbit , Steve Crawford , pgsql-performance@postgreSQL.org, pgsql-hackers@postgreSQL.org In-Reply-To: <1043316668.2348.15.camel@localhost.localdomain> References: <25622.1043281087@sss.pgh.pa.us> <1043316668.2348.15.camel@localhost.localdomain> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Message-Id: <1043318508.2347.39.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.1 Date: 23 Jan 2003 12:41:48 +0200 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/874 X-Sequence-Number: 34484 Hannu Krosing kirjutas N, 23.01.2003 kell 12:11: > make the pointer array incrementally for O(N) performance: > > i.e. for tuple with 100 cols, allocate an array of 100 pointers, plus > keep count of how many are actually valid, Additionally, this should also make repeted determining of NULL fields faster - just put a NULL-pointer in and voila - no more bit-shifting and AND-ing to find out if the field is null. One has to watch the NULL bitmap on fist pass anyway. > so the first call to get col[5] will fill first 5 positions in the array > save said nr 5 and then access tuple[ptrarray[5]] > > next call to get col[75] will start form col[5] and fill up to col[75] > > next call to col[76] will start form col[75] and fill up to col[76] > > next call to col[60] will just get tuple[ptrarray[60]] > > the above description assumes 1-based non-C arrays ;) -- Hannu Krosing