RE: Parallel heap vacuum

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Masahiko Sawada' <sawada(dot)mshk(at)gmail(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Parallel heap vacuum
Date: 2024-12-24 06:26:48
Message-ID: OS7PR01MB149680A60916301BAA18CA6A7F5032@OS7PR01MB14968.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Sawada-san,

Thanks for updating the patch. ISTM that 0001 and 0002 can be applied independently.
Therefore I can firstly post some comments only for them.

Comments for 0001:

```
+ /* New estimated total # of tuples and total # of live tuples */
```

There is a unnecessary blank.

```
+ scan_state = palloc(sizeof(LVRelScanState));
+ scan_state->scanned_pages = 0;
+ scan_state->removed_pages = 0;
+ scan_state->new_frozen_tuple_pages = 0;
+ scan_state->lpdead_item_pages = 0;
+ scan_state->missed_dead_pages = 0;
+ scan_state->nonempty_pages = 0;
+ scan_state->tuples_deleted = 0;
+ scan_state->tuples_frozen = 0;
+ scan_state->lpdead_items = 0;
+ scan_state->live_tuples = 0;
+ scan_state->recently_dead_tuples = 0;
+ scan_state->missed_dead_tuples = 0;
+ scan_state->vm_new_visible_pages = 0;
+ scan_state->vm_new_visible_frozen_pages = 0;
+ scan_state->vm_new_frozen_pages = 0;
+ vacrel->scan_state = scan_state;
```

Since most of attributes are initialized as zero, can you use palloc0() instead?

```
- * the relation are read. vacrel->skippedallvis is set if we skip a block
- * that's all-visible but not all-frozen, to ensure that we don't update
+ * the relation are read. vacrel->scan_state->skippedallvis is set if we skip
+ * a block that's all-visible but not all-frozen, to ensure that we don't update
* relfrozenxid in that case. vacrel also holds information about the next
```

A line exceeds 80-char limit.

```
+ /* How many time index vacuuming or cleaning up is executed? */
+ int num_index_scans;
+
```

Comments for 0002:

```
+ /* How many time index vacuuming or cleaning up is executed? */
+ int num_index_scans;
+
```

I feel this is bit confusing because LVRelState also has "num_index_scans".
How about "num_parallel_index_scans"?

Attached patch contains above changes.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment Content-Type Size
kuroda.diffs application/octet-stream 5.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2024-12-24 07:04:42 Re: Allow ILIKE forward matching to use btree index
Previous Message wenhui qiu 2024-12-24 06:20:15 adjust_limit_rows_costs algorithm