Re: Unused variable scanned_tuples in LVRelStats

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unused variable scanned_tuples in LVRelStats
Date: 2017-08-02 14:40:27
Message-ID: CA+TgmoaagZ17GmD_XOizrYT9d57x0G-R5RN-A4ES2gEpCs7Lhw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 4, 2017 at 10:13 PM, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> scanned_tuples variable in LVRelStats is introduced by commit b4b6923e
> but it seems to me that it's actually not used. We store num_tuples
> into vacrelstats->scanned_tuples after scanned all blocks, and the
> comment mentioned that saving it in order to use later but we actually
> use num_tuples instead of vacrelstats->scanned_tuples from there. I
> think the since the name of scanned_tuples implies more clearer
> purpose than num_tuples it's better to use it instead of num_tuples,
> or we can remove scanned_tuples from LVRelStats.

I think we should only store stuff in LVRelStats if it needs to be
passed to some other function. Data that's only used in
lazy_scan_heap() can just be kept in local variables. We could rename
the local variable, though, since I agree with you that scanned_tuples
is clearer.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-08-02 14:43:35 Re: pgbench: Skipping the creating primary keys after initialization
Previous Message Robert Haas 2017-08-02 14:17:32 Re: Domains and arrays and composites, oh my