From: Tom Lane <tgl@sss.pgh.pa.us>
To: Moises Lopez <moylop260@vauxoo.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: The query plan get all columns but I'm using only one column.
Date: Sat, 25 Apr 2020 10:24:23 -0400
Message-ID: <31936.1587824663@sss.pgh.pa.us> (raw)
In-Reply-To: <CAGro9RXViOXNBBA-SZur_UbpWrbkg_Ow4ha13FJu9dOJ=WdB7Q@mail.gmail.com>
References: <CAGro9RXViOXNBBA-SZur_UbpWrbkg_Ow4ha13FJu9dOJ=WdB7Q@mail.gmail.com>
Moises Lopez <moylop260@vauxoo.com> writes:
> -> Seq Scan on public.link l1 (cost=0.00..10.40 rows=40 width=516)
> (actual time=0.010..0.011 rows=1 loops=1)
> * Output: l1.id <http://l1.id;, l1.url, l1.name
> <http://l1.name;, l1.description, l1.rel*
This is normal; it is not a bug, and it is not a source of performance
issues either. The planner is choosing to do that to avoid a projection
step in this plan node, because there's no need for one. On the other
scan, where it *is* important to project out just the required columns to
minimize the size of the hash table above the scan, it does do so:
> -> Seq Scan on public.link l2 (cost=0.00..10.40 rows=40
> width=516) (actual time=0.010..0.011 rows=1 loops=1)
> Output: l2.url
> Is there a manner to avoid returning all columns in order to get a better
> performance?
You have not shown us anything about what your actual performance
issue is, but this isn't it.
https://wiki.postgresql.org/wiki/Slow_Query_Questions
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, moylop260@vauxoo.com, pgsql-performance@lists.postgresql.org
Subject: Re: The query plan get all columns but I'm using only one column.
In-Reply-To: <31936.1587824663@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox