[Dbix-class] Excluding columns from a query

Rob Kinyon rob.kinyon at gmail.com
Fri Feb 12 15:01:38 GMT 2010

On Fri, Feb 12, 2010 at 09:35, Nick Wellnhofer <wellnhofer at aevum.de> wrote:
> On 12.02.2010 15:17, Rob Kinyon wrote:
>> What is the *USE CASE* that is leading you to think that excluding
>> columns from a ->search is a good idea?
> It's simply an optimization. I have a table with a text column that can
> contain tens of KB of data per row. I also have some queries that don't
> need that column, so I'd like to avoid unnecessarily fetching all that
> content from the DB.

Ah. Now, had you said this at the beginning, you would have received
an answer yesterday. http://www.google.com/?q=XY+Problem

There is currently no clean way to do this. The best way I can think
of would be something like:
1) Don't specify it as a column in your resultsource.
2) when you need it, add it in the columns=> attribute and use get_column('x')

It's not very simple right now. Ideally, there would be a
"fetch_lazily" column attribute. Patches welcome. :)


More information about the DBIx-Class mailing list