From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Moises Lopez <moylop260(at)vauxoo(dot)com> |
Cc: | pgsql-performance(at)lists(dot)postgresql(dot)org |
Subject: | Re: The query plan get all columns but I'm using only one column. |
Date: | 2020-04-25 14:24:23 |
Message-ID: | 31936.1587824663@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Moises Lopez <moylop260(at)vauxoo(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Arcadio Ortega Reinoso | 2020-04-25 19:47:52 | Re: PostgreSQL does not choose my indexes well |
Previous Message | Stephen Frost | 2020-04-25 12:02:46 | Re: PostgreSQL does not choose my indexes well |