Re: Use of * affect the performance

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Use of * affect the performance
Date: 2006-01-16 21:55:11
Message-ID: dqh4lf$2o66$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


"Marcos" <mjs_ops(at)gmx(dot)net> wrote
>
> I always think that use of * in SELECT affected in the performance,
> becoming the search slowest.
>
> But I read in the a Postgres book's that it increases the speed of
> search.
>
> And now???? What the more fast?
>

If you mean use "*" vs. "explicitely name all columns of a relation", then
there is almost no difference except the negligible difference in parsing.
If you mean you just want part of the columns of a relation but you still
use "*": Yes, you will save one projection operation for each result row but
you will pay for more network traffic. In the worst case, say your "*"
involves some toast attributes, you just hurt performance. Considering the
benefits is so marginal and dangerous, I suggest stay with the idea that
"only retrive the columns that you are interested in".

Regards,
Qingqing

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Antoine 2006-01-16 22:07:52 new to postgres (and db management) and performance already a problem :-(
Previous Message Craig A. James 2006-01-16 21:19:27 Re: Suspending SELECTs