Giter VIP home page Giter VIP logo

Comments (6)

mdevan avatar mdevan commented on June 12, 2024

Thanks, good suggestions!

How about a couple of options like:

--match-table=PATTERN    include only tables whose name matches PATTERN
--match-schema=PATTERN   include objects only from schema that match PATTERN

where PATTERN is a POSIX regular expression, and if it starts with ! then the meaning is inverted (exclude tables/schema). Both options may be used at the same time and works like "AND".

Do you think this will fit your use cases?

from pgmetrics.

MichaelDBA avatar MichaelDBA commented on June 12, 2024

The regex stuff is more than I asked for, but sure that'll work for most table and schema filtering, but what about the case where I don't want table info? Now I have to write a regex pattern that will not return anything as opposed to a parameter that just says --no-tables and/or --no-schemas. How about both? Also, if I use regex filtering it makes it more difficult than to specify 2 schemas directly with the --schema parameter which expects a comma-delimited list of schemas.

It seems to me regex stuff is more applicable to tables where you could have thousands, but not to schemas where you might have a few. So I would recommend the regex for tables but a comma-delimited list for schemas.

Also, don't forget about the system info being placed before table output.

2 ways to specify schemas:

--schemas schema1, schema2
--schema schema1 --schema schema2

from pgmetrics.

mdevan avatar mdevan commented on June 12, 2024

OK, let's list down the items.

  1. filter tables: use an option to include/exclude tables based on regexps
  2. filter schema: use a repeatable option to only include objects from the specified schema

These two sound good, let's go with it.

I guess the third item is what objects we should collect from a single database. Right now, pgmetrics gets information about:

  • tables
  • indexes
  • sequences
  • user function timings
  • extensions (this one is not schema-specific)
  • disabled triggers

So if we want to collect only some of these types, then there should be an option that specifies that, I think. Like "--collect=tables,indexes" would collect only tables and indexes, or "--collect=all" would collect everything. Thoughts?

And the fourth one is about the report cosmetics, which we'll handle separately in another issue -- it is not related to data collection after all. (And I agree, it makes sense to put it just below the "PostgreSQL Cluster:" section. It gives more context for the rest of the report.)

from pgmetrics.

mdevan avatar mdevan commented on June 12, 2024

b38c9ec includes these schema and table selection options:

Collection options:
  -c, --schema=REGEXP          collect only from schema(s) matching POSIX regexp
  -C, --exclude-schema=REGEXP  do NOT collect from schema(s) matching POSIX regexp
  -a, --table=REGEXP           collect only from table(s) matching POSIX regexp
  -A, --exclude-table=REGEXP   do NOT collect from table(s) matching POSIX regexp

These are similar to pg_dump's options, except that it's based on regexp.

from pgmetrics.

mdevan avatar mdevan commented on June 12, 2024

13393c2 shows the system information earlier on in the output.

from pgmetrics.

mdevan avatar mdevan commented on June 12, 2024

51462e3 includes option to omit the collection of one or more of: tables, indexes, sequences, functions, extensions and triggers.

      --omit=WHAT              do NOT collect the items specified as a comma-separated
                                   list of: "tables", "indexes", "sequences",
                                   "functions", "extensions", "triggers"

That addresses all the points in this issue, I think. Feel free to reopen this/open another issue if it doesn't.

from pgmetrics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.