X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DEF9DD1C9C8 for ; Thu, 31 Jul 2003 20:20:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 78478-06 for ; Thu, 31 Jul 2003 17:19:35 -0300 (ADT) Received: from mail-1.zoominternet.net (mail-1.zoominternet.net [63.67.120.5]) by svr1.postgresql.org (Postfix) with SMTP id 88C4BD1C994 for ; Thu, 31 Jul 2003 17:20:37 -0300 (ADT) Received: (qmail 31326 invoked from network); 31 Jul 2003 20:20:39 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-1.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 31 Jul 2003 20:20:39 -0000 Subject: Re: EXTERNAL storage and substring on long strings From: Scott Cain To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <18305.1059680697@sss.pgh.pa.us> References: <1059679600.1429.41.camel@localhost.localdomain> <18305.1059680697@sss.pgh.pa.us> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1059682839.5415.53.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 31 Jul 2003 16:20:39 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/504 X-Sequence-Number: 2797 On Thu, 2003-07-31 at 15:44, Tom Lane wrote: > Scott Cain writes: > > explain analyze select substring(residues from 1000000 for 20000) > > from feature where feature_id=1; > > > where feature is a table with ~3 million rows, and residues is a text > > column, where for the majority of the rows of feature, it is null, for a > > large minority, it is shortish strings (a few thousand characters), and > > for 6 rows, residues contains very long strings (~20 million characters > > (it's chromosome DNA sequence from fruit flies)). > > I think the reason uncompressed storage loses here is that the runtime > is dominated by the shortish strings, and you have to do more I/O to get > at those if they're uncompressed, negating any advantage from not having > to fetch all of the longish strings. I'm not sure I understand what that paragraph means, but it sounds like, if PG is working the way it is supposed to, tough for me, right? > > Or it could be that there's a bug preventing John Gray's substring-slice > optimization from getting used. The only good way to tell that I can > think of is to rebuild PG with profiling enabled and try to profile the > execution both ways. Are you up for that? I am not against recompiling. I am currently using an RPM version, but I could probably recompile; the compilation is probably straight forward (adding something like `--with_profiling` to ./configure), but how straight forward is actually doing the profiling? Is there a document somewhere that lays it out? > > (BTW, if you are using a multibyte database encoding, then that's your > problem right there --- the optimization is practically useless unless > character and byte indexes are the same.) I shouldn't be, but since it is an RPM, I can't be sure. It sure would be silly since the strings consist only of [ATGCN]. Thanks, Scott -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory