Database Performance Diagnostics Agent
I am planning a read-only agent that examines SQL execution plans and wait events to suggest likely causes of slow queries and show the evidence for each.
Making Complex Technology Simple.
Exploring the intersection of Artificial Intelligence, Cloud Infrastructure, and Data Technologies.
About

I started in data engineering and moved into systems and cloud engineering. Today I design and test how AI can ground its answers in enterprise data and act within the permissions it is given.
Kitae Kim · Community name BugEvil
I work with customers to understand the problem they need to solve. Then I test which data they can access in their cloud and database environments and how best to retrieve it.
In technical presales, I work with sales and engineering teams to propose designs that fit each customer’s environment. I use demos to explain the design choices and show what the tests found.
I test how AI databases and agents work in business settings and share the results in technical presentations and articles.
At Oracle Finance Forum, I spoke about execution permissions and memory for financial AI agents. Read the related insight
Placed first in the Oracle category of the ICSP competition.
Placed first in the VCC training program for new employees.
Technology Lab
Manage the model. Control the agent and its data.
The experiments use six sample products and sales records from the first half of 2001, modeled on the Sales History (SH) schema. Revenue is shown in US dollars.
Which product earned the most revenue in the Internet channel in Q2 2001, and what features does it have?
In Q1 2001, Studio Speaker led Internet-channel revenue at USD 1,600. The catalogue states: “A wired-only speaker for studio monitoring.”
Read product descriptions to verify features and sales rows to measure growth. When a question still lacks evidence, query the relevant source again.
Among products with wireless connectivity, which had the largest increase in Internet-channel revenue from Q1 to Q2 2001?
Which products support wireless connectivity themselves? Which passage confirms that capability?
How much did each product’s revenue in the same channel grow from Q1 to Q2?
Channel totals do not reveal product-level growth. Query revenue by product and check the detailed specifications for candidates with ambiguous capabilities.
Limit the query to the candidate product IDs and aggregate each quarter by product.
| Group | Q1 | Q2 | Change |
|---|---|---|---|
| Pocket Mouse | $400 | $700 | +$300 |
| Mini Speaker | $300 | $1,500 | +$1,200 |
| Desk Hub | $500 | $2,000 | +$1,500 |
SELECT PROD_ID, TRUNC(TIME_ID, 'Q') AS QTR,
SUM(AMOUNT_SOLD) AS SALES_AMOUNT
FROM SH.SALES
WHERE CHANNEL_ID = 4
AND TIME_ID >= DATE '2001-01-01'
AND TIME_ID < DATE '2001-07-01'
AND PROD_ID IN (101, 102, 103)
GROUP BY PROD_ID, TRUNC(TIME_ID, 'Q')Check how P102, P103 connect. Their summaries left wireless support unclear.
The speaker supports both Bluetooth wireless audio input and wired input.
The hub connects only through a USB cable. It has no wireless transmitter or receiver.
The previously verified sales totals still apply.
Mini Speaker ranked first in Internet-channel revenue growth. Revenue rose from $300 in Q1 to $1,500 in Q2, an increase of $1,200.
The speaker supports both Bluetooth wireless audio input and wired input.
| Group | Q1 | Q2 | Change |
|---|---|---|---|
| Pocket Mouse | $400 | $700 | +$300 |
| Mini Speaker | $300 | $1,500 | +$1,200 |
| Desk Hub | $500 | $2,000 | +$1,500 |
Which column tells us what “best-selling” means? Rank the same SH sales by revenue and by units sold, then compare the leaders.
PROD_IDFKCHANNEL_IDFKTIME_IDFKAMOUNT_SOLDQUANTITY_SOLDPROD_IDPKPROD_NAMECHANNEL_IDPKCHANNEL_DESCTIME_IDPKCALENDAR_QUARTER_DESCSALES.PROD_ID↔PRODUCTS.PROD_IDJoin each sales row to its product name.SALES.CHANNEL_ID↔CHANNELS.CHANNEL_IDThe Internet channel has ID 4.SALES.TIME_ID↔TIMES.TIME_IDLook up the calendar quarter for the transaction date.SUM(SALES.AMOUNT_SOLD)SUM(SALES.QUANTITY_SOLD)The product with the highest total revenue is Desk Hub ($2,000).
SELECT p.PROD_ID, p.PROD_NAME,
SUM(s.AMOUNT_SOLD) AS metric_value,
DENSE_RANK() OVER (ORDER BY SUM(s.AMOUNT_SOLD) DESC) AS sales_rank
FROM SH.SALES s
JOIN SH.PRODUCTS p ON p.PROD_ID = s.PROD_ID
WHERE s.CHANNEL_ID = :channel_id
AND s.TIME_ID >= :start_date AND s.TIME_ID < :end_date
GROUP BY p.PROD_ID, p.PROD_NAME
ORDER BY sales_rank, p.PROD_ID:channel_id:start_date:end_date| Product | Rank | Revenue (USD) |
|---|---|---|
| Desk Hub #103 | 1 | $2,000 |
| Mini Speaker #102 | 2 | $1,500 |
| Studio Speaker #104 | 3 | $1,000 |
| Pocket Mouse #101 | 4 | $700 |
| Desk Keyboard #105 | 5 | $240 |
| Numeric Keypad #106 | 6 | $150 |
Use the same sales rows and sum QUANTITY_SOLD. Check the product totals against the original transactions.
Ranked first by units sold in the Internet channel in Q2 2001. We grouped sales by product and compared the sums of QUANTITY_SOLD. Equal totals share a rank.
SELECT p.PROD_ID, p.PROD_NAME,
SUM(s.QUANTITY_SOLD) AS metric_value,
DENSE_RANK() OVER (ORDER BY SUM(s.QUANTITY_SOLD) DESC) AS sales_rank
FROM SH.SALES s
JOIN SH.PRODUCTS p ON p.PROD_ID = s.PROD_ID
WHERE s.CHANNEL_ID = :channel_id
AND s.TIME_ID >= :start_date AND s.TIME_ID < :end_date
GROUP BY p.PROD_ID, p.PROD_NAME
ORDER BY sales_rank, p.PROD_ID:channel_id:start_date:end_date| Product | Rank | Units sold |
|---|---|---|
| Pocket Mouse #101 | 1 | 70 units |
| Mini Speaker #102 | 2 | 30 units |
| Desk Hub #103 | 3 | 20 units |
| Desk Keyboard #105 | 4 | 16 units |
| Studio Speaker #104 | 5 | 5 units |
| Numeric Keypad #106 | 6 | 3 units |
These results compare sample two-dimensional vectors for questions and products using cosine similarity.
A language model can pass English and Korean terms and related phrases to a search tool. Inspect the highlighted Korean source alongside its English translation to see what matched.
Which speakers can play audio over Bluetooth?
search_productsquery Bluetooth speaker
The lexer removes Korean particles and analyzes word endings in queries and sources. At least one form must match within each group (OR), and every group must match (AND).
The LLM tool calls are prepared examples. The search runs against the catalogue with the conditions shown.
Matching products: 1
Matched expressions
Related expressions broaden the candidate set. Check the original passage to verify the product’s capabilities.
Connect channels and products through sales records. Find a path between two channels that sold the same product.
The first hop finds products sold through Partners. The second follows each product’s sales rows to another channel.
| Sale date | Quantity | Revenue (USD) |
|---|---|---|
| 50 | $2,500 |
| Sale date | Quantity | Revenue (USD) |
|---|---|---|
| 12 | $600 | |
| 18 | $900 |
Retrieval-Augmented Generation
Can the Pocket Mouse connect wirelessly? Follow the question through retrieval and generation, then open the citation to verify the product description.
The question names both a product and a property. Look for a source passage that states how the Pocket Mouse connects.
Does the Pocket Mouse support wireless connectivity?
An embedding model places questions and passages in a shared vector space for comparison. This example uses predefined two-dimensional vectors.
[1.00, 0.06]Compare the query with 6 product vectors using cosine similarity. More closely aligned vectors score higher. Retrieve the original passages for the top 2 IDs.
| Retrieved passage | Cosine similarity |
|---|---|
P101 Pocket Mouse | 0.998 |
P103 Desk Hub | 0.939 |
Both passages mention wireless. Passing the product IDs together with the text distinguishes the hub’s accessory receiver from the mouse’s own connection.
P101Pocket MouseA portable mouse with Bluetooth wireless connectivity.
P103Desk HubA desktop hub with ports for wireless accessory receivers.
A language model takes the question and retrieved passages as input. This simulation checks the product ID in the question and quotes the corresponding description.
Does the Pocket Mouse support wireless connectivity?
P101Pocket MouseA portable mouse with Bluetooth wireless connectivity.
P103Desk HubA desktop hub with ports for wireless accessory receivers.
Open the citation to read the description that explicitly confirms the Pocket Mouse’s Bluetooth connectivity.
Pocket Mouse · A portable mouse with Bluetooth wireless connectivity.
I am planning a read-only agent that examines SQL execution plans and wait events to suggest likely causes of slow queries and show the evidence for each.
Deep Dive
An agent can look up a transaction. Can it also authorize a refund? A disputed card charge reveals where to set boundaries for execution, disclosure and memory.
Perspective
A house can look perfect and still exceed the budget. Two insurance policies can mention the same treatment and cover different costs. Use business records to establish which candidates qualify, then let the evidence determine the next lookup.
Technology Explained
A customer writes, “My laptop keeps turning itself back on.” An engineer once recorded a similar symptom as an intermittent reboot. Follow the search from those two descriptions to a ranked list, and see how an index can miss a close match or a keyword can recover an error code.
Contact