substring implementation (long string) - Mailing list pgsql-general

From Scott Cain
Subject substring implementation (long string)
Date
Msg-id 1059533356.1545.65.camel@localhost.localdomain
Whole thread Raw
Responses Re: substring implementation (long string)
List pgsql-general
Hello,

I am wondering about the implementation of substring for very large
strings.  I've got strings that are several million characters long and
frequently need to extract relatively small substrings (5000-40000
characters) (that's right, it's DNA).  Before I cared much about
performance, I retrieved the whole string and and substr'ed it in perl.
I realized recently it is better to do the substring in postgres
(performance increase by an order of magnitude).  So here is what I am
wondering: does postgres read the whole string into memory before it
does the substring, or does it have some sort of smart way of reading
just the substring from disk?

I am wondering because I can think of ways of potentially improving
performance, but at significant cost to the API, and I don't want to
implement it unless I will get a big boost in performance.

Thanks,
Scott

--
------------------------------------------------------------------------
Scott Cain, Ph. D.                                         cain@cshl.org
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory


pgsql-general by date:

Previous
From:
Date:
Subject: Re: Does the block of code in a stored procedure execute as a transaction?
Next
From: Stephan Szabo
Date:
Subject: Re: Auto-increment not really working