pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: " <pgsql-general@postgresql.org>
Subject: Returning SELECTed rows immediately instead of all at the end?
Date: Fri, 12 Jun 2020 23:39:58 -0500
Message-ID: <d9254330-2f4d-f851-a815-3df56e95c59a@gmail.com> (raw)


I'm running amcheck on a set of indices (test machine, not prod) and want to 
track the progress.  Is there a SELECT clause that makes rows display as 
they are created, or do I have to explicitly call bt_index_check() from a 
shell script or SQL function in order to see the output as each index is 
checked?


postgres=# select version();
                     version
------------------------------------------------------
PostgreSQL 9.6.18 on [snip] (Red Hat 4.4.7-23), 64-bit
(1 row)

postgres=# \dx
                            List of installed extensions
      Name     | Version |   Schema   | Description
--------------+---------+------------+--------------------------------------------
amcheck_next | 2       | public     | functions for verifying relation integrity
plpgsql      | 1.0     | pg_catalog | PL/pgSQL procedural language

#!/bin/bash
echo `date +"%F %T, %a"` Starting
psql CDSLBXW -c \
"SELECT clock_timestamp(),
         bt_index_check(c.oid, i.indisunique),
         n.nspname,
         c.relname ,
         c.relpages
FROM pg_index i
        JOIN pg_opclass op ON i.indclass[0] = op.oid
        JOIN pg_am am ON op.opcmethod = am.oid
        JOIN pg_class c ON i.indexrelid = c.oid
        JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE am.amname = 'btree'
   AND c.relpersistence != 't'
   AND c.relkind = 'i'
   AND i.indisready
   AND i.indisvalid
ORDER BY c.relpages desc
;"

echo `date +"%F %T, %a"` Finished



-- 
Angular momentum makes the world go 'round.





view thread (5+ messages)  latest in thread

Message-ID: <d9254330-2f4d-f851-a815-3df56e95c59a@gmail.com>
Permalink:  ../d9254330-2f4d-f851-a815-3df56e95c59a@gmail.com/
Also on:    postgresql.org/message-id/d9254330-2f4d-f851-a815-3df56e95c59a@gmail.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Returning SELECTed rows immediately instead of all at the end?
  In-Reply-To: <d9254330-2f4d-f851-a815-3df56e95c59a@gmail.com>
  References: <d9254330-2f4d-f851-a815-3df56e95c59a@gmail.com>

* 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