pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedDatabase health check/auditing
18+ messages / 7 participants
[nested] [flat]
* Database health check/auditing
@ 2018-02-16 02:22 Tim Cross <theophilusx@gmail.com>
0 siblings, 3 replies; 18+ messages in thread
From: Tim Cross @ 2018-02-16 02:22 UTC (permalink / raw)
To: pgsql-general
Hi All,
I was wondering if anyone has some pointers to
sites/repositories/resources for scripts to perform basic database
audits and health checks.
situation: I have just commenced a DBA and developer role for an
organisation with a number of Postgres databases (9.4 and 9.6
versions). There has been no dedicated DBA and a number of the databases
were setup by people with little to know Postgres or database
experience. I need to get an overview on what I'm dealing with and start
prioritising what to address first.
It has been some years since I've done any real work with Postgres. Most
of my technical work over the last 10 years has been with Oracle. I
prefer to use scripts over GUI tools like pgAdmin and suspect that there
is probably some good resources out there with existing scripts I can
use as a starting point.
Any pointers greatly appreciated.
thanks,
Tim
--
Tim Cross
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 03:11 Melvin Davidson <melvin6925@gmail.com>
parent: Tim Cross <theophilusx@gmail.com>
2 siblings, 2 replies; 18+ messages in thread
From: Melvin Davidson @ 2018-02-16 03:11 UTC (permalink / raw)
To: Tim Cross <theophilusx@gmail.com>; +Cc: pgsql-general
On Thu, Feb 15, 2018 at 9:22 PM, Tim Cross <theophilusx@gmail.com> wrote:
> Hi All,
>
> I was wondering if anyone has some pointers to
> sites/repositories/resources for scripts to perform basic database
> audits and health checks.
>
> situation: I have just commenced a DBA and developer role for an
> organisation with a number of Postgres databases (9.4 and 9.6
> versions). There has been no dedicated DBA and a number of the databases
> were setup by people with little to know Postgres or database
> experience. I need to get an overview on what I'm dealing with and start
> prioritising what to address first.
>
> It has been some years since I've done any real work with Postgres. Most
> of my technical work over the last 10 years has been with Oracle. I
> prefer to use scripts over GUI tools like pgAdmin and suspect that there
> is probably some good resources out there with existing scripts I can
> use as a starting point.
>
> Any pointers greatly appreciated.
>
> thanks,
>
> Tim
>
>
> --
> Tim Cross
>
>
*Tim, Good luck to you. I have been in your situation a few times.I have
attached the following scripts which I use as a starterto get a general
idea of database status. All of the should run on both 9.4 & 9.4, but
sometimes catalog changes may fudge things up, so you may have to tweak a
bit. I have manymore general queries, so if you have any specific need,
letme know and I'll be glad to send if I have one that fits theneed.The
names should be self descriptive as to what the dobut except for
get_trans_min_cnt.sql (Transaction per minute) none have any DDL.
database_sizes.sqlbad_idx.sqlcache_hit_ratio.sqlget_trans_min_cnt.sqlget_version_num.sqlpg_runtime.sqlpg_stat_all_indexes.sqlpg_stat_all_tables.sqltable_sizes.sqltable_stats.sqluseless_indexes2.sqlPlease
also note I have bash script versions of the same, butas you did not state
the O/S, I felt the sql was best.*--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
Attachments:
database_sizes.sql (text/plain, 458B) download
SELECT oid,
datname,
pg_size_pretty(pg_database_size(datname))as size_pretty,
pg_database_size(datname) as size,
(SELECT pg_size_pretty (SUM( pg_database_size(datname))::bigint)
FROM pg_database) AS total,
((pg_database_size(datname) / (SELECT SUM( pg_database_size(datname))
FROM pg_database) ) * 100)::numeric(6,3) AS pct
FROM pg_database
ORDER BY datname;
bad_idx.sql (text/plain, 481B) download
SELECT n.nspname,
i.relname,
i.indexrelname,
CASE WHEN idx.indisprimary
THEN 'pkey'
WHEN idx.indisunique
THEN 'uidx'
ELSE 'idx'
END AS type,
'INVALID'
FROM pg_stat_all_indexes i
JOIN pg_class c ON (c.oid = i.relid)
JOIN pg_namespace n ON (n.oid = c.relnamespace)
JOIN pg_index idx ON (idx.indexrelid = i.indexrelid )
WHERE idx.indisvalid = FALSE
ORDER BY 1, 2;
cache_hit_ratio.sql (text/plain, 694B) download
SELECT pg_stat_database.datname,
pg_stat_database.blks_read,
pg_stat_database.blks_hit,
round((pg_stat_database.blks_hit::double precision
/ (pg_stat_database.blks_read
+ pg_stat_database.blks_hit
+1)::double precision * 100::double precision)::numeric, 2) AS cachehitratio
FROM pg_stat_database
WHERE pg_stat_database.datname !~ '^(template(0|1)|postgres)$'::text
ORDER BY round((pg_stat_database.blks_hit::double precision
/ (pg_stat_database.blks_read
+ pg_stat_database.blks_hit
+ 1)::double precision * 100::double precision)::numeric, 2) DESC;
get_trans_min_cnt.sql (text/plain, 582B) download
BEGIN;
DROP TABLE IF EXISTS tmp_trans_stats;
CREATE TEMP TABLE tmp_trans_stats AS
SELECT 'start_cnt'::varchar(10) AS taken,
SUM(xact_commit + xact_rollback) AS cnt
FROM pg_stat_database;
COMMIT;
SELECT pg_sleep(60);
INSERT INTO tmp_trans_stats
SELECT 'end_cnt'::varchar(10) AS taken,
SUM(xact_commit + xact_rollback) AS cnt
FROM pg_stat_database;
SELECT (
(SELECT cnt
FROM tmp_trans_stats
WHERE taken = 'end_cnt')
- (SELECT cnt
FROM tmp_trans_stats
WHERE taken = 'start_cnt')
) as tot_trans;
get_version_num.sql (text/plain, 48B) download
SELECT current_setting('server_version_num');
pg_runtime.sql (text/plain, 117B) download
SELECT pg_postmaster_start_time() as pg_start,
current_timestamp - pg_postmaster_start_time() as runtime;
pg_stat_all_indexes.sql (text/plain, 1.2K) download
SELECT n.nspname as schema,
i.relname as table,
i.indexrelname as index,
i.idx_scan,
i.idx_tup_read,
i.idx_tup_fetch,
CASE WHEN idx.indisprimary
THEN 'pkey'
WHEN idx.indisunique
THEN 'uidx'
ELSE 'idx'
END AS type,
idx.indisexclusion,
pg_get_indexdef(idx.indexrelid),
CASE WHEN idx.indisvalid
THEN 'valid'
ELSE 'INVALID'
END as statusi,
pg_relation_size(quote_ident(n.nspname)|| '.' || quote_ident(i.relname)) as size_in_bytes,
pg_size_pretty(pg_relation_size(quote_ident(n.nspname)|| '.' || quote_ident(i.relname))) as size
FROM pg_stat_all_indexes i
JOIN pg_class c ON (c.oid = i.relid)
JOIN pg_namespace n ON (n.oid = c.relnamespace)
JOIN pg_index idx ON (idx.indexrelid = i.indexrelid )
WHERE i.relname LIKE '%%'
AND n.nspname NOT LIKE 'pg_%'
AND NOT idx.indisunique = TRUE
AND NOT idx.indisprimary
-- AND i.indexrelname LIKE 'tmp%'
-- AND idx.indisvalid IS false
/* AND NOT idx.indisprimary
AND NOT idx.indisunique
AND idx_scan = 0
*/ ORDER BY 1, 2, 3;
pg_stat_all_tables.sql (text/plain, 1.3K) download
SELECT n.nspname,
s.relname,
c.reltuples::bigint,
-- c.relfrozenxid,
age(c.relfrozenxid) AS age_frozenxid,
-- n_live_tup,
n_tup_ins,
n_tup_upd,
n_tup_del,
date_trunc('second', last_vacuum) as last_vacuum,
date_trunc('second', last_autovacuum) as last_autovacuum,
date_trunc('second', last_analyze) as last_analyze,
date_trunc('second', last_autoanalyze) as last_autoanalyze
,
round( current_setting('autovacuum_vacuum_threshold')::integer + current_setting('autovacuum_vacuum_scale_factor')::numeric * C.reltuples) AS av_threshold
/* ,CASE WHEN reltuples > 0
THEN round(100.0 * n_dead_tup / (reltuples))
ELSE 0
END AS pct_dead,
CASE WHEN n_dead_tup > round( current_setting('autovacuum_vacuum_threshold')::integer + current_setting('autovacuum_vacuum_scale_factor')::numeric * C.reltuples)
THEN 'VACUUM'
ELSE 'ok'
END AS "av_needed"
*/
FROM pg_stat_all_tables s
JOIN pg_class c ON c.oid = s.relid
JOIN pg_namespace n ON (n.oid = c.relnamespace)
WHERE s.relname NOT LIKE 'pg_%'
AND s.relname NOT LIKE 'sql_%'
-- AND s.relname LIKE '%TBL%'
ORDER by 1, 2;
table_sizes.sql (text/plain, 1020B) download
SELECT n.nspname as schema,
c.relname as table,
a.rolname as owner,
c.relfilenode as filename,
c.reltuples::bigint,
pg_size_pretty(pg_relation_size(n.nspname|| '.' || c.relname)) as size,
pg_size_pretty(pg_total_relation_size(n.nspname|| '.' || c.relname)) as total_size,
pg_relation_size(n.nspname|| '.' || c.relname) as size_bytes,
pg_total_relation_size(n.nspname|| '.' || c.relname) as total_size_bytes,
CASE WHEN c.reltablespace = 0
THEN 'pg_default'
ELSE (SELECT t.spcname
FROM pg_tablespace t WHERE (t.oid = c.reltablespace) )
END as tablespace
FROM pg_class c
JOIN pg_namespace n ON (n.oid = c.relnamespace)
JOIN pg_authid a ON ( a.oid = c.relowner )
WHERE n.nspname NOT LIKE 'pg_%'
AND relname NOT LIKE 'pg_%'
AND relname NOT LIKE 'information%'
AND relname NOT LIKE 'sql_%'
AND relkind IN ('r')
ORDER BY total_size_bytes DESC, 1, 2;
--LIMIT 10;
table_stats.sql (text/plain, 469B) download
SELECT c.oid,
n.nspname as schema,
c.relname as table,
pg_stat_get_last_vacuum_time(c.oid) as last_vacuum,
pg_stat_get_tuples_inserted(c.oid) as inserted,
pg_stat_get_tuples_updated(c.oid) as updated,
pg_stat_get_tuples_deleted(c.oid) as deleted
FROM pg_class c
JOIN pg_namespace n ON (n.oid = c.relnamespace)
WHERE nspname NOT IN ('information_schema', 'pg_toast', 'pg_catalog')
and relkind = 'r'
ORDER BY 2, 3;
useless_indexes2.sql (text/plain, 749B) download
SELECT n.nspname as schema,
i.relname as table,
i.indexrelname as index,
i.idx_scan,
i.idx_tup_read,
i.idx_tup_fetch,
pg_size_pretty(pg_relation_size(quote_ident(n.nspname) || '.' || quote_ident(i.relname))) AS table_size,
pg_size_pretty(pg_relation_size(quote_ident(n.nspname) || '.' || quote_ident(i.indexrelname))) AS index_size,
pg_get_indexdef(idx.indexrelid) as idx_definition
FROM pg_stat_all_indexes i
JOIN pg_class c ON (c.oid = i.relid)
JOIN pg_namespace n ON (n.oid = c.relnamespace)
JOIN pg_index idx ON (idx.indexrelid = i.indexrelid )
WHERE i.idx_scan = 0
AND n.nspname <> 'pg_catalog'
AND NOT idx.indisprimary
AND NOT idx.indisunique
ORDER BY 1, 2, 3;
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 04:03 Tim Cross <theophilusx@gmail.com>
parent: Melvin Davidson <melvin6925@gmail.com>
1 sibling, 1 reply; 18+ messages in thread
From: Tim Cross @ 2018-02-16 04:03 UTC (permalink / raw)
To: Melvin Davidson <melvin6925@gmail.com>; +Cc: pgsql-general
Hi Mel,
thanks a lot. The databases are all running on Red Hat (well OUL to be
specific). The SQL is fine and I can always wrap them in a bash script if
needed.
Having these scripts is a real help. My biggest challenge at the moment is
just turning off my Oracle habits and getting back Postgres ones! Reading
these scripts really helps drag out old forgotten stuff. Luckily, there
doesn't seem to be too much really nasty or weird. For the most part,
doesn't look like anyone has made weird configuration changes and there are
no obscure triggers doing hidden things. Most of the user defined
functions seem pretty reasonable, though some seem to be doing some pretty
inefficient SQL and unnecessary type casting etc. Privileges and roles are
a mess - seems to be a bit of the 'make everyone a super user' approach
rather than work out what is required, but I expected that. There are a
couple of databases with considerable size, but many of them are quite
small (I will likely be consolidating a number of servers as their size and
load is low and it will be easier to manage fewer servers). All in all, it
isn't as bad as it could be or as bad as I've seen before, so it shouldn't
bee too bad. Establishing some standards and change control will help.
thanks again,
tim
On 16 February 2018 at 14:11, Melvin Davidson <melvin6925@gmail.com> wrote:
>
>
> On Thu, Feb 15, 2018 at 9:22 PM, Tim Cross <theophilusx@gmail.com> wrote:
>
>> Hi All,
>>
>> I was wondering if anyone has some pointers to
>> sites/repositories/resources for scripts to perform basic database
>> audits and health checks.
>>
>> situation: I have just commenced a DBA and developer role for an
>> organisation with a number of Postgres databases (9.4 and 9.6
>> versions). There has been no dedicated DBA and a number of the databases
>> were setup by people with little to know Postgres or database
>> experience. I need to get an overview on what I'm dealing with and start
>> prioritising what to address first.
>>
>> It has been some years since I've done any real work with Postgres. Most
>> of my technical work over the last 10 years has been with Oracle. I
>> prefer to use scripts over GUI tools like pgAdmin and suspect that there
>> is probably some good resources out there with existing scripts I can
>> use as a starting point.
>>
>> Any pointers greatly appreciated.
>>
>> thanks,
>>
>> Tim
>>
>>
>> --
>> Tim Cross
>>
>>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *Tim, Good luck to you. I have been in your situation a few times.I have
> attached the following scripts which I use as a starterto get a general
> idea of database status. All of the should run on both 9.4 & 9.4, but
> sometimes catalog changes may fudge things up, so you may have to tweak a
> bit. I have manymore general queries, so if you have any specific need,
> letme know and I'll be glad to send if I have one that fits theneed.The
> names should be self descriptive as to what the dobut except for
> get_trans_min_cnt.sql (Transaction per minute) none have any DDL.
> database_sizes.sqlbad_idx.sqlcache_hit_ratio.sqlget_trans_min_cnt.sqlget_version_num.sqlpg_runtime.sqlpg_stat_all_indexes.sqlpg_stat_all_tables.sqltable_sizes.sqltable_stats.sqluseless_indexes2.sqlPlease
> also note I have bash script versions of the same, butas you did not state
> the O/S, I felt the sql was best.*--
> *Melvin Davidson*
> I reserve the right to fantasize. Whether or not you
> wish to share my fantasy is entirely up to you.
>
--
regards,
Tim
--
Tim Cross
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 04:26 Melvin Davidson <melvin6925@gmail.com>
parent: Tim Cross <theophilusx@gmail.com>
0 siblings, 1 reply; 18+ messages in thread
From: Melvin Davidson @ 2018-02-16 04:26 UTC (permalink / raw)
To: Tim Cross <theophilusx@gmail.com>; +Cc: pgsql-general
On Thu, Feb 15, 2018 at 11:03 PM, Tim Cross <theophilusx@gmail.com> wrote:
> Hi Mel,
>
> thanks a lot. The databases are all running on Red Hat (well OUL to be
> specific). The SQL is fine and I can always wrap them in a bash script if
> needed.
>
> Having these scripts is a real help. My biggest challenge at the moment is
> just turning off my Oracle habits and getting back Postgres ones! Reading
> these scripts really helps drag out old forgotten stuff. Luckily, there
> doesn't seem to be too much really nasty or weird. For the most part,
> doesn't look like anyone has made weird configuration changes and there are
> no obscure triggers doing hidden things. Most of the user defined
> functions seem pretty reasonable, though some seem to be doing some pretty
> inefficient SQL and unnecessary type casting etc. Privileges and roles are
> a mess - seems to be a bit of the 'make everyone a super user' approach
> rather than work out what is required, but I expected that. There are a
> couple of databases with considerable size, but many of them are quite
> small (I will likely be consolidating a number of servers as their size and
> load is low and it will be easier to manage fewer servers). All in all, it
> isn't as bad as it could be or as bad as I've seen before, so it shouldn't
> bee too bad. Establishing some standards and change control will help.
>
> thanks again,
>
> tim
>
>
> On 16 February 2018 at 14:11, Melvin Davidson <melvin6925@gmail.com>
> wrote:
>
>>
>>
>> On Thu, Feb 15, 2018 at 9:22 PM, Tim Cross <theophilusx@gmail.com> wrote:
>>
>>> Hi All,
>>>
>>> I was wondering if anyone has some pointers to
>>> sites/repositories/resources for scripts to perform basic database
>>> audits and health checks.
>>>
>>> situation: I have just commenced a DBA and developer role for an
>>> organisation with a number of Postgres databases (9.4 and 9.6
>>> versions). There has been no dedicated DBA and a number of the databases
>>> were setup by people with little to know Postgres or database
>>> experience. I need to get an overview on what I'm dealing with and start
>>> prioritising what to address first.
>>>
>>> It has been some years since I've done any real work with Postgres. Most
>>> of my technical work over the last 10 years has been with Oracle. I
>>> prefer to use scripts over GUI tools like pgAdmin and suspect that there
>>> is probably some good resources out there with existing scripts I can
>>> use as a starting point.
>>>
>>> Any pointers greatly appreciated.
>>>
>>> thanks,
>>>
>>> Tim
>>>
>>>
>>> --
>>> Tim Cross
>>>
>>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *Tim, Good luck to you. I have been in your situation a few times.I have
>> attached the following scripts which I use as a starterto get a general
>> idea of database status. All of the should run on both 9.4 & 9.4, but
>> sometimes catalog changes may fudge things up, so you may have to tweak a
>> bit. I have manymore general queries, so if you have any specific need,
>> letme know and I'll be glad to send if I have one that fits theneed.The
>> names should be self descriptive as to what the dobut except for
>> get_trans_min_cnt.sql (Transaction per minute) none have any DDL.
>> database_sizes.sqlbad_idx.sqlcache_hit_ratio.sqlget_trans_min_cnt.sqlget_version_num.sqlpg_runtime.sqlpg_stat_all_indexes.sqlpg_stat_all_tables.sqltable_sizes.sqltable_stats.sqluseless_indexes2.sqlPlease
>> also note I have bash script versions of the same, butas you did not state
>> the O/S, I felt the sql was best.*--
>> *Melvin Davidson*
>> I reserve the right to fantasize. Whether or not you
>> wish to share my fantasy is entirely up to you.
>>
>
>
>
> --
> regards,
>
> Tim
>
> --
> Tim Cross
>
>
Tim,
FYI, the policy in this list is to avoid top posting and bottom post
instead.
Before you do anything else, * check the postgresql.conf* for *shared_buffers,
work_mem & maintenance_work_mem* values.
Quite often the developers have no clue on how to tune a database.
Roles and privileges can always be fixed. At least you don't have to deal
with the case of where they created indexes for every column
in every table, then copied the schema for each client....yeech!
Here's a couple more you may find helpful.
current_queries.sql
triggers.sql
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
Attachments:
current_queries.sql (text/plain, 616B) download
SELECT backend_start as be_start,
datname,
pid as pid,
client_addr,
usename as user,
state,
query,
wait_event_type, --< COMMENT OUT FOR 9.4 and below
/* --< UNCOMMENT FOR 9.4 and below
CASE WHEN waiting = TRUE
THEN 'BLOCKED'
ELSE 'no'
END as waiting,
*/
query_start,
current_timestamp - query_start as duration
FROM pg_stat_activity
WHERE pg_backend_pid() <> pid
ORDER BY 1,
datname,
query_start;
--SELECT * FROM pg_stat_activity LIMIT 2;
triggers.sql (text/plain, 663B) download
SELECT n.nspname AS schema,
c.relname AS table,
t.tgname AS trigger,
p.proname AS function_called,
CASE WHEN t.tgconstrrelid > 0
THEN (SELECT relname
FROM pg_class
WHERE oid = t.tgconstrrelid)
ELSE ''
END AS constr_tbl,
t.tgenabled AS mode,
t.tgconstrindid
FROM pg_trigger t
INNER JOIN pg_proc p ON ( p.oid = t.tgfoid)
INNER JOIN pg_class c ON (c.oid = t.tgrelid)
INNER JOIN pg_namespace n ON (n.oid = c.relnamespace)
WHERE tgname NOT LIKE 'pg_%'
AND tgname NOT LIKE 'RI_%' -- < comment out to see triggers
ORDER BY 1, 2;
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 07:25 Thomas Kellerer <spam_eater@gmx.net>
parent: Melvin Davidson <melvin6925@gmail.com>
0 siblings, 1 reply; 18+ messages in thread
From: Thomas Kellerer @ 2018-02-16 07:25 UTC (permalink / raw)
To: pgsql-general
Melvin Davidson schrieb am 16.02.2018 um 05:26:
> Tim,
>
> FYI, the policy in this list is to avoid top posting and bottom post instead.
Plus: trimming the original content, so that not the whole email thread is repeated in the quote.
Thomas
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 15:46 Basques, Bob (CI-StPaul) <bob.basques@ci.stpaul.mn.us>
parent: Melvin Davidson <melvin6925@gmail.com>
1 sibling, 1 reply; 18+ messages in thread
From: Basques, Bob (CI-StPaul) @ 2018-02-16 15:46 UTC (permalink / raw)
To: Melvin Davidson <melvin6925@gmail.com>; +Cc: Tim Cross <theophilusx@gmail.com>; pgsql-general
Melvin,
Thanks for posting these. I haven’t even looked at them yet and just grabbed them based on the names. :c)
On Feb 15, 2018, at 9:11 PM, Melvin Davidson <melvin6925@gmail.com<mailto:melvin6925@gmail.com>> wrote:
On Thu, Feb 15, 2018 at 9:22 PM, Tim Cross <theophilusx@gmail.com<mailto:theophilusx@gmail.com>> wrote:
Hi All,
I was wondering if anyone has some pointers to
--
Tim Cross
Tim,
Good luck to you. I have been in your situation a few times.
What about bottom and top posting. Just joking sort of. I really like to reply to questions inline myself on a lot of occasions.
Seems like a good Mail tool lets you know what’s what with top,vs bottom posting . . . .
bobb
"The doer alone learneth. “
- Friedrich Nietzsche
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 16:06 Melvin Davidson <melvin6925@gmail.com>
parent: Basques, Bob (CI-StPaul) <bob.basques@ci.stpaul.mn.us>
0 siblings, 1 reply; 18+ messages in thread
From: Melvin Davidson @ 2018-02-16 16:06 UTC (permalink / raw)
To: Basques, Bob (CI-StPaul) <bob.basques@ci.stpaul.mn.us>; +Cc: Tim Cross <theophilusx@gmail.com>; pgsql-general
On Fri, Feb 16, 2018 at 10:46 AM, Basques, Bob (CI-StPaul) <
bob.basques@ci.stpaul.mn.us> wrote:
> Melvin,
>
> Thanks for posting these. I haven’t even looked at them yet and just
> grabbed them based on the names. :c)
>
>
> On Feb 15, 2018, at 9:11 PM, Melvin Davidson <melvin6925@gmail.com> wrote:
>
>
>
> On Thu, Feb 15, 2018 at 9:22 PM, Tim Cross <theophilusx@gmail.com> wrote:
>
>> Hi All,
>>
>> I was wondering if anyone has some pointers to
>>
>> --
>> Tim Cross
>>
>>
>
>
> *Tim, Good luck to you. I have been in your situation a few times. *
>
>
> What about bottom *and* top posting. Just joking sort of. I really like
> to reply to questions inline myself on a lot of occasions.
>
> Seems like a good Mail tool lets you know what’s what with top,vs bottom
> posting . . . .
>
> bobb
>
>
>
> "The doer alone learneth. “
> - Friedrich Nietzsche
>
>
>
*Bob,> Thanks for posting these. *
*You are welcome. I have a bunch more I've written through the years, and
also bash counterparts. Let me know if you have *
*any particular need and I'll be glad to send them.*
*As for bottom or top posting, that is simply the convention of this
support list and I don't know of any email programs that *
*understand that policy. At least not until AI becomes more sophisicated.*
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 16:35 Ibrahim Edib Kokdemir <kokdemir@gmail.com>
parent: Tim Cross <theophilusx@gmail.com>
2 siblings, 2 replies; 18+ messages in thread
From: Ibrahim Edib Kokdemir @ 2018-02-16 16:35 UTC (permalink / raw)
To: Tim Cross <theophilusx@gmail.com>; +Cc: pgsql-general
Hi Tim,
There are good continuously running apps to monitor postgres.
IMHO, the most successful one is pgcenter.
Here is the link. https://github.com/lesovsky/pgcenter
Regards
İbrahim
On 16 Feb 2018 5:22 am, "Tim Cross" <theophilusx@gmail.com> wrote:
> Hi All,
>
> I was wondering if anyone has some pointers to
> sites/repositories/resources for scripts to perform basic database
> audits and health checks.
>
> situation: I have just commenced a DBA and developer role for an
> organisation with a number of Postgres databases (9.4 and 9.6
> versions). There has been no dedicated DBA and a number of the databases
> were setup by people with little to know Postgres or database
> experience. I need to get an overview on what I'm dealing with and start
> prioritising what to address first.
>
> It has been some years since I've done any real work with Postgres. Most
> of my technical work over the last 10 years has been with Oracle. I
> prefer to use scripts over GUI tools like pgAdmin and suspect that there
> is probably some good resources out there with existing scripts I can
> use as a starting point.
>
> Any pointers greatly appreciated.
>
> thanks,
>
> Tim
>
>
> --
> Tim Cross
>
>
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 16:42 Thomas Kellerer <spam_eater@gmx.net>
parent: Tim Cross <theophilusx@gmail.com>
2 siblings, 1 reply; 18+ messages in thread
From: Thomas Kellerer @ 2018-02-16 16:42 UTC (permalink / raw)
To: pgsql-general
> situation: I have just commenced a DBA and developer role for an
> organisation with a number of Postgres databases (9.4 and 9.6
> versions). There has been no dedicated DBA and a number of the databases
> were setup by people with little to know Postgres or database
> experience. I need to get an overview on what I'm dealing with and start
> prioritising what to address first.
>
> It has been some years since I've done any real work with Postgres. Most
> of my technical work over the last 10 years has been with Oracle. I
> prefer to use scripts over GUI tools like pgAdmin and suspect that there
> is probably some good resources out there with existing scripts I can
> use as a starting point.
You might want to have a look at OPM: http://opm.io/
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 19:40 Basques, Bob (CI-StPaul) <bob.basques@ci.stpaul.mn.us>
parent: Ibrahim Edib Kokdemir <kokdemir@gmail.com>
1 sibling, 1 reply; 18+ messages in thread
From: Basques, Bob (CI-StPaul) @ 2018-02-16 19:40 UTC (permalink / raw)
To: Ibrahim Edib Kokdemir <kokdemir@gmail.com>; +Cc: Tim Cross <theophilusx@gmail.com>; pgsql-general
All,
Not really an app, but we have a Apache script that logs all the activity to our Postgres/PostGIS services and inserts the log entries directly into Postgres. Works great for reporting our Postgres web traffic stuff. My dev guy was skeptical about it being effective and not binding up at some point, but it’s been running for a couple of years now with no ill effects.
I have a bunch of canned and automated reports being generated from it.
bobb
On Feb 16, 2018, at 10:35 AM, Ibrahim Edib Kokdemir <kokdemir@gmail.com<mailto:kokdemir@gmail.com>> wrote:
Hi Tim,
There are good continuously running apps to monitor postgres.
IMHO, the most successful one is pgcenter.
Here is the link. https://github.com/lesovsky/pgcenter
Regards
İbrahim
On 16 Feb 2018 5:22 am, "Tim Cross" <theophilusx@gmail.com<mailto:theophilusx@gmail.com>> wrote:
Hi All,
I was wondering if anyone has some pointers to
sites/repositories/resources for scripts to perform basic database
audits and health checks.
situation: I have just commenced a DBA and developer role for an
organisation with a number of Postgres databases (9.4 and 9.6
versions). There has been no dedicated DBA and a number of the databases
were setup by people with little to know Postgres or database
experience. I need to get an overview on what I'm dealing with and start
prioritising what to address first.
It has been some years since I've done any real work with Postgres. Most
of my technical work over the last 10 years has been with Oracle. I
prefer to use scripts over GUI tools like pgAdmin and suspect that there
is probably some good resources out there with existing scripts I can
use as a starting point.
Any pointers greatly appreciated.
thanks,
Tim
--
Tim Cross
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.”
- Albert Einstein
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 19:52 Melvin Davidson <melvin6925@gmail.com>
parent: Basques, Bob (CI-StPaul) <bob.basques@ci.stpaul.mn.us>
0 siblings, 0 replies; 18+ messages in thread
From: Melvin Davidson @ 2018-02-16 19:52 UTC (permalink / raw)
To: Basques, Bob (CI-StPaul) <bob.basques@ci.stpaul.mn.us>; +Cc: Ibrahim Edib Kokdemir <kokdemir@gmail.com>; Tim Cross <theophilusx@gmail.com>; pgsql-general
On Fri, Feb 16, 2018 at 2:40 PM, Basques, Bob (CI-StPaul) <
bob.basques@ci.stpaul.mn.us> wrote:
> All,
>
> Not really an app, but we have a Apache script that logs all the activity
> to our Postgres/PostGIS services and inserts the log entries directly into
> Postgres. Works great for reporting our Postgres web traffic stuff. My
> dev guy was skeptical about it being effective and not binding up at some
> point, but it’s been running for a couple of years now with no ill effects.
>
> I have a bunch of canned and automated reports being generated from it.
>
> bobb
>
>
>
> On Feb 16, 2018, at 10:35 AM, Ibrahim Edib Kokdemir <kokdemir@gmail.com>
> wrote:
>
> Hi Tim,
> There are good continuously running apps to monitor postgres.
> IMHO, the most successful one is pgcenter.
> Here is the link. https://github.com/lesovsky/pgcenter
>
> Regards
> İbrahim
>
> On 16 Feb 2018 5:22 am, "Tim Cross" <theophilusx@gmail.com> wrote:
>
>> Hi All,
>>
>> I was wondering if anyone has some pointers to
>> sites/repositories/resources for scripts to perform basic database
>> audits and health checks.
>>
>> situation: I have just commenced a DBA and developer role for an
>> organisation with a number of Postgres databases (9.4 and 9.6
>> versions). There has been no dedicated DBA and a number of the databases
>> were setup by people with little to know Postgres or database
>> experience. I need to get an overview on what I'm dealing with and start
>> prioritising what to address first.
>>
>> It has been some years since I've done any real work with Postgres. Most
>> of my technical work over the last 10 years has been with Oracle. I
>> prefer to use scripts over GUI tools like pgAdmin and suspect that there
>> is probably some good resources out there with existing scripts I can
>> use as a starting point.
>>
>> Any pointers greatly appreciated.
>>
>> thanks,
>>
>> Tim
>>
>>
>> --
>> Tim Cross
>>
>>
>
> "Only two things are infinite, the universe and human stupidity, and I'm
> not sure about the former.”
> - Albert Einstein
>
>
>
>
>
*> resources for scripts to perform basic database audits and health
checks. *
*PgBadger is free and an excellent log analyzer which is useful for
tracking query execution times and transaction
rates.https://sourceforge.net/projects/pgbadger/
<https://sourceforge.net/projects/pgbadger/>*
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 19:54 Tim Cross <theophilusx@gmail.com>
parent: Ibrahim Edib Kokdemir <kokdemir@gmail.com>
1 sibling, 0 replies; 18+ messages in thread
From: Tim Cross @ 2018-02-16 19:54 UTC (permalink / raw)
To: Ibrahim Edib Kokdemir <kokdemir@gmail.com>; +Cc: pgsql-general
Ibrahim Edib Kokdemir <kokdemir@gmail.com> writes:
> Hi Tim,
> There are good continuously running apps to monitor postgres.
> IMHO, the most successful one is pgcenter.
> Here is the link. https://github.com/lesovsky/pgcenter
>
Thanks, a useful link.
Tim
--
Tim Cross
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 20:04 Tim Cross <theophilusx@gmail.com>
parent: Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 0 replies; 18+ messages in thread
From: Tim Cross @ 2018-02-16 20:04 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-general
Thomas Kellerer <spam_eater@gmx.net> writes:
>> situation: I have just commenced a DBA and developer role for an
>> organisation with a number of Postgres databases (9.4 and 9.6
>> versions). There has been no dedicated DBA and a number of the databases
>> were setup by people with little to know Postgres or database
>> experience. I need to get an overview on what I'm dealing with and start
>> prioritising what to address first.
>>
>
> You might want to have a look at OPM: http://opm.io/
Looks interesting. Nagios is what is used here for monitoring and
although rusty, once upon a time, I use to cut quite a lot of perl, so
reasonable skill set match. Will check it out.
Although on-going monitoring of the systems is definitely required, the
first step is to just get an overall handle on the situation. There is
no documentation and configuration, maintenance etc has been patchy.
Tim
--
Tim Cross
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 20:17 Tim Cross <theophilusx@gmail.com>
parent: Melvin Davidson <melvin6925@gmail.com>
0 siblings, 0 replies; 18+ messages in thread
From: Tim Cross @ 2018-02-16 20:17 UTC (permalink / raw)
To: Melvin Davidson <melvin6925@gmail.com>; +Cc: Basques\, Bob \(CI-StPaul\) <bob.basques@ci.stpaul.mn.us>; pgsql-general
Melvin Davidson <melvin6925@gmail.com> writes:
> On Fri, Feb 16, 2018 at 10:46 AM, Basques, Bob (CI-StPaul) <
> bob.basques@ci.stpaul.mn.us> wrote:
>
>>
>> What about bottom *and* top posting. Just joking sort of. I really like
>> to reply to questions inline myself on a lot of occasions.
>>
>> Seems like a good Mail tool lets you know what’s what with top,vs bottom
>> posting . . . .
>>
>
> *As for bottom or top posting, that is simply the convention of this
> support list and I don't know of any email programs that *
>
> *understand that policy. At least not until AI becomes more sophisicated.*
I will try to comply with the list policy/conventions. My original reply
was from within the Gmail web interface, which is OK as web based mail
goes, but it certainly 'encourages' top posting. My preferred MUA is
more 'old school' (mu4e), where dealing with such preferences is much
easier, but our wise network admins ban access internally (but you can
still access the web interface...).
Top v bottom posting issues are a blast from the past - I've not even
seen a reference to it since the old Newsgroups days! ;-)
Tim
--
Tim Cross
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 20:23 Tim Cross <theophilusx@gmail.com>
parent: Thomas Kellerer <spam_eater@gmx.net>
0 siblings, 2 replies; 18+ messages in thread
From: Tim Cross @ 2018-02-16 20:23 UTC (permalink / raw)
To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-general
Thomas Kellerer <spam_eater@gmx.net> writes:
> Melvin Davidson schrieb am 16.02.2018 um 05:26:
>> Tim,
>>
>> FYI, the policy in this list is to avoid top posting and bottom post instead.
>
> Plus: trimming the original content, so that not the whole email thread is repeated in the quote.
>
> Thomas
While I'm happy to comply, I disagree with trimming/editing the
thread. Certainly made sense when networks were slower and MUAs were
less sophisticated, but these days I prefer using a MUA which is able to
fold the original content and keep all the content in the message. This
reduces confusion, misunderstanding and incorrect attribution arising
from poor editing and makes it easy to reference the full discussion in
one spot rather than having to go back through messages putting it all
back together. YMMV.
Tim
--
Tim Cross
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-16 20:26 Basques, Bob (CI-StPaul) <bob.basques@ci.stpaul.mn.us>
parent: Tim Cross <theophilusx@gmail.com>
1 sibling, 0 replies; 18+ messages in thread
From: Basques, Bob (CI-StPaul) @ 2018-02-16 20:26 UTC (permalink / raw)
To: Tim Cross <theophilusx@gmail.com>; +Cc: Thomas Kellerer <spam_eater@gmx.net>; pgsql-general
What Tim said!! :c)
I think the bigger deal is setting a new message Subject at the approriate point in a thread/conversation.
bobb
On Feb 16, 2018, at 2:23 PM, Tim Cross <theophilusx@gmail.com<mailto:theophilusx@gmail.com>> wrote:
Thomas Kellerer <spam_eater@gmx.net<mailto:spam_eater@gmx.net>> writes:
Melvin Davidson schrieb am 16.02.2018 um 05:26:
Tim,
FYI, the policy in this list is to avoid top posting and bottom post instead.
Plus: trimming the original content, so that not the whole email thread is repeated in the quote.
Thomas
While I'm happy to comply, I disagree with trimming/editing the
thread. Certainly made sense when networks were slower and MUAs were
less sophisticated, but these days I prefer using a MUA which is able to
fold the original content and keep all the content in the message. This
reduces confusion, misunderstanding and incorrect attribution arising
from poor editing and makes it easy to reference the full discussion in
one spot rather than having to go back through messages putting it all
back together. YMMV.
Tim
--
Tim Cross
The third-rate mind is only happy when it is thinking with the majority. The second-rate mind is only happy when it is thinking with the minority. The first-rate mind is only happy when it is thinking.
—A. A. Milne
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-17 02:43 George Neuner <gneuner2@comcast.net>
parent: Tim Cross <theophilusx@gmail.com>
1 sibling, 1 reply; 18+ messages in thread
From: George Neuner @ 2018-02-17 02:43 UTC (permalink / raw)
To: pgsql-general
On Sat, 17 Feb 2018 07:23:32 +1100, Tim Cross <theophilusx@gmail.com>
wrote:
>Thomas Kellerer <spam_eater@gmx.net> writes:
>
>> Plus: trimming the original content, so that not the whole email
>> thread is repeated in the quote.
>
>While I'm happy to comply, I disagree with trimming/editing the
>thread. Certainly made sense when networks were slower and MUAs were
>less sophisticated, but these days I prefer using a MUA which is able to
>fold the original content and keep all the content in the message. This
>reduces confusion, misunderstanding and incorrect attribution arising
>from poor editing and makes it easy to reference the full discussion in
>one spot rather than having to go back through messages putting it all
>back together. YMMV.
>
>Tim
The problem is that conversations rarely remained confined to a single
topic [this thread for example 8-)].
The list servers do have message size limits (independent of any email
server limits). It isn't a problem for simple text messages, but a
lot of people now are sending MIME messages that include all the text
twice (or 3 times) plus embedded HTML+CSS formatting.
On some lists, I have seen MIME messages (mostly sent from Google
Groups users) that contain - not kidding - 5,000+ lines of hidden
HTML+CSS surrounding a few lines of comment.
I agree with you that messages should stand alone wrt to the subject
they address. It's just that, too often, messages that contain a lot
of quoted material have wandered considerably and so are mostly noise.
YMMV,
George
^ permalink raw reply [nested|flat] 18+ messages in thread
* Re: Database health check/auditing
@ 2018-02-17 05:23 Tom Lane <tgl@sss.pgh.pa.us>
parent: George Neuner <gneuner2@comcast.net>
0 siblings, 0 replies; 18+ messages in thread
From: Tom Lane @ 2018-02-17 05:23 UTC (permalink / raw)
To: George Neuner <gneuner2@comcast.net>; +Cc: Tim Cross <theophilusx@gmail.com>; pgsql-general
George Neuner <gneuner2@comcast.net> writes:
> On Sat, 17 Feb 2018 07:23:32 +1100, Tim Cross <theophilusx@gmail.com>
> wrote:
>> Thomas Kellerer <spam_eater@gmx.net> writes:
>>> Plus: trimming the original content, so that not the whole email
>>> thread is repeated in the quote.
>> While I'm happy to comply, I disagree with trimming/editing the
>> thread.
> The problem is that conversations rarely remained confined to a single
> topic [this thread for example 8-)].
> The list servers do have message size limits (independent of any email
> server limits).
I don't think this rule is about any technical limits. It's about having
minimal courtesy to your readers by not forcing them to re-read stuff they
just read. There are hundreds or thousands of people reading this list;
if you take thirty seconds to save each reader a third of a second, it's
a good tradeoff. If you won't spend that time, you're being discourteous.
Personally, if I get two or three screenfuls down into a message without
seeing a single line of new content, I stop reading.
Conversely, if you figure you can avoid spending any of your precious time
in quote-clipping by top-posting a couple of lines of commentary, you're
also being discourteous to readers who may come across your post sometime
later, who won't have just seen the whole thread. They won't know what it
is you're responding to, and you shouldn't make them dig through the
entire thread history in order to figure out what your one or two
sentences are in response to.
Gmail have done their level best to destroy email in general, and mailing
lists in particular, as a useful communication medium. Don't help them
out by being a jerk about your quoting habits.
regards, tom lane
^ permalink raw reply [nested|flat] 18+ messages in thread
end of thread, other threads:[~2018-02-17 05:23 UTC | newest]
Thread overview: 18+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-02-16 02:22 Database health check/auditing Tim Cross <theophilusx@gmail.com>
2018-02-16 03:11 ` Melvin Davidson <melvin6925@gmail.com>
2018-02-16 04:03 ` Tim Cross <theophilusx@gmail.com>
2018-02-16 04:26 ` Melvin Davidson <melvin6925@gmail.com>
2018-02-16 07:25 ` Thomas Kellerer <spam_eater@gmx.net>
2018-02-16 20:23 ` Tim Cross <theophilusx@gmail.com>
2018-02-16 20:26 ` Basques, Bob (CI-StPaul) <bob.basques@ci.stpaul.mn.us>
2018-02-17 02:43 ` George Neuner <gneuner2@comcast.net>
2018-02-17 05:23 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-02-16 15:46 ` Basques, Bob (CI-StPaul) <bob.basques@ci.stpaul.mn.us>
2018-02-16 16:06 ` Melvin Davidson <melvin6925@gmail.com>
2018-02-16 20:17 ` Tim Cross <theophilusx@gmail.com>
2018-02-16 16:35 ` Ibrahim Edib Kokdemir <kokdemir@gmail.com>
2018-02-16 19:40 ` Basques, Bob (CI-StPaul) <bob.basques@ci.stpaul.mn.us>
2018-02-16 19:52 ` Melvin Davidson <melvin6925@gmail.com>
2018-02-16 19:54 ` Tim Cross <theophilusx@gmail.com>
2018-02-16 16:42 ` Thomas Kellerer <spam_eater@gmx.net>
2018-02-16 20:04 ` Tim Cross <theophilusx@gmail.com>
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