Efficiency vs. code bloat for SELECT wrappers - Mailing list pgsql-general

From Colin Wetherbee
Subject Efficiency vs. code bloat for SELECT wrappers
Date
Msg-id 4765B56C.3040801@denterprises.org
Whole thread Raw
Responses Re: Efficiency vs. code bloat for SELECT wrappers
List pgsql-general
Greetings.

I am working on a PostgreSQL-backed mod_perl web application that's just
in its infancy.

Let's say I have a users table that holds about 15 columns of data about
each user.

If I write one Perl sub for each operation on the table (e.g. one that
gets the username and password hash, another that gets the last name and
first name, etc.), there will be a whole lot of subs, each of which
performs one very specific task.

If I write one larger Perl sub that grabs the whole row, and then I deal
with the contents of the row in Perl, ignoring columns as I please, it
will require fewer subs and, in turn, imply cleaner code.

My concern is that I don't know what efficiency I would be forfeiting on
the PostgreSQL side of the application by always querying entire rows if
my transaction occurs entirely within a single table.  Of course, I
would want to handle more complicated JOINs and other more intensive
operations on the PostgreSQL side.

I don't think the application will ever store a tuple larger than about
512 bytes in any table, so the network speed wouldn't really come into play.

Thanks.

Colin

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Recovering data via raw table and field separators
Next
From: Tom Lane
Date:
Subject: Re: Efficiency vs. code bloat for SELECT wrappers