Skip to content

Build1 publisher2 min readPublished

An open-source Oracle scraper writes session and plan history into Postgres for later forensics

Harry collects Oracle session, wait and plan history into a relational Postgres schema. Its author's case is that SQL text and plan hashes were never metric labels, and that the evidence disappears when the sessions do.

The Engineer · Build desk

Photograph accompanying An open-source Oracle scraper writes session and plan history into Postgres for later forensics
Photo: dev.to

What happened

  • Harry Performance Scraper for Oracle Database, an open-source pipeline, collects SQL statistics, session activity, waits, blocking, plans and system metrics into PostgreSQL, readable through Grafana or plain SQL.
  • Its collectors run scheduled queries against Oracle's dynamic performance views, sampling each class of information at its own interval because facts differ in how fast they change and what they cost to read.
  • The schema keeps high-frequency samples apart from SQL text, execution plans and other slow-changing data, with time-based partitioning available and retention configurable.
  • The author says he uses Prometheus extensively and rates it excellent for numeric time series, operational monitoring and alerting, so the tool is not pitched as a replacement for it.
  • The stated premise is that once sessions disconnect or move on to other work, much of the evidence that would explain an activity spike is gone unless something collected it at the time.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • cost Adoption puts a PostgreSQL repository and its disk budget on the DBA team, and the post publishes no collector overhead or storage growth figures to size either one.
  • constraint Retained detail is only as fine as the interval each collector runs at, so a spike that starts and finishes between samples leaves the same hole in the repository as it does in a dashboard.
  • decision The split has to be made deliberately: infrastructure metrics and alerting stay where they are, while high-cardinality session evidence gets routed to a relational store somebody has to maintain.
  • capability Comparing the plans one SQL ID used in two separate periods, or naming the blocker behind last night's spike, becomes a query against retained rows instead of a reconstruction from memory.

The post's inventory of what an Oracle performance incident is actually made of runs to eight entries: database and instance, session ID and serial number, SQL ID and plan hash value, module and action and program, wait class and wait event, blocking and blocked sessions, SQL text, and execution-plan operations [12]. The author's position is that some of those make reasonable metric dimensions, that treating all of them as labels can create a large number of series, and that SQL text and execution plans are not natural metric labels at all [13]. So two of the eight are excluded from a label-based store before cardinality is even the argument [1]. SQL text as a label value is a mistake you only make once.

That exclusion is what shapes the schema. Copying the full SQL text or execution plan into every sample would waste storage and make the repository harder to query, so each kind of evidence is stored according to its own lifecycle and the pieces are connected through relational keys [9]. Grafana is the interface and the PostgreSQL repository is the evidence, in the author's framing [2]. The problem is stated narrowly: retaining enough connected evidence to investigate after the workload has already changed, rather than reading a metric at this exact moment [3].

Prometheus is the only alternative the post develops [18]. That leaves the sizing question open in the way these projects usually leave it. The default schedule is described as what the tool currently includes [7], and every interval is configurable per collector on the argument that a small development database and a busy production estate do not need the same sampling policy [6]. Read that schedule as a starting point you tune against your own instance, not a tested policy you can inherit from someone else's estate.

The part I would weight highest has the least sales copy attached to it: the collected data is not locked inside the tool, so DBAs can query the schema directly, join it with their own information, build new Grafana panels, or export it with standard tools [15]. History repositories die when the only way to ask a new question is to wait for someone to add a panel. This one puts the evidence in a database its users already know how to interrogate, which is the condition under which the retained rows are worth their disk.

What to watch

  • Whether the default collector schedule, described as what the tool currently includes, settles into a documented contract.
  • Whether Harry ships example queries or views for the relational questions it names, so DBAs are not writing the joins from scratch.
  • Whether anyone reports Oracle-side cost for the highest-frequency collector on a busy production instance.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories