substring implementation (long string)

From: Scott Cain <cain(at)cshl(dot)org>
To: pgsql General List <pgsql-general(at)postgresql(dot)org>
Subject: substring implementation (long string)
Date: 2003-07-30 02:49:16
Message-ID: 1059533356.1545.65.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)cshl(dot)org
GMOD Coordinator (http://www.gmod.org/) 216-392-3087
Cold Spring Harbor Laboratory

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dima Tkach 2003-07-30 03:10:23 Re: Does the block of code in a stored procedure execute
Previous Message btober 2003-07-30 02:44:42 Re: Does the block of code in a stored procedure execute as a transaction?