See a session · about 4 minutes

One week, one database, one conversation.

A store's evening sales drop by a third. Follow an AI assistant with NexQL as it finds out why, from the live database: narrowed to one slow request, explained, fixed without locking payments, and confirmed recovered.

Question 01 of 07 · The evening drop
01Noticed · Mon 09:12

The evening drop

head of online store

Sales were down about 4% last week. Can you tell me why?

Claude + NexQL

Checked the database

  1. list_schemaslooked at what this database holds11ms
  2. run_selectcounted orders for every hour of the week184ms
  3. run_selectcompared it with the week before96ms

Mornings and afternoons are completely normal. The entire drop happens between 6pm and 10pm — the busiest stretch of the day, when about a third of all orders are placed.

where the drop is
6–10pm
orders in that window
−31%
sales missed
$212K
Orders per houraveraged over last week
6ammidnight
02Narrowed · Mon 09:40

Where shoppers leave

data analyst

Where in the checkout are people giving up?

Claude + NexQL

Checked the database

  1. search_schemafound the tables behind checkout9ms
  2. get_join_pathlinked website visits to real orders17ms
  3. run_selectmeasured how far each visit got240ms

They get all the way to the payment page and then leave. Of every 100 evening shoppers who open a cart, 76 reach payment but only 57 finish — and the ones who quit had been watching a loading spinner for about nine seconds.

average wait before quitting
9 seconds
lost on the payment page
19 in 100
Evening checkout, step by stepout of 100 shoppers who open a cart
STEPGET THERELEAVE HERE
Opens the cart100—
Enters address946
Reaches payment7618
Completes the order5719
03Narrowed · Mon 09:55

One slow request

data analyst

Is the whole site slow in the evening, or just that page?

Claude + NexQL

Checked the database

  1. db_health_checkran the general health checks140ms
  2. slow_queriesranked what takes the most time61ms
  3. table_statschecked size and activity per table29ms

Just one thing. The database itself is in good shape — but a single request, the one that adds up the cart total, is using almost half of all the evening capacity. Nothing else has changed.

slow request
1
of evening capacity
46%
What came back
  • The cart total request is using 46% of the eveningIt adds up items and stock levels for the cart page.
  • Memory, connections and disk are all healthyNo warnings outside this one request.
  • No other request is above 17%Payments, prices and logins are unchanged from last month.
04Explained · Mon 10:20

Why only after 6pm

engineer

Why is that only slow after 6pm?

Claude + NexQL

Checked the database

  1. explain_queryasked the database how it runs that request74ms
  2. table_statslooked at the stock table26ms
  3. sample_valuessampled tonight’s stock rows19ms

It is working from an eleven-day-old summary of the stock table. That summary says only about 40 rows will match, so the database checks them one at a time. After the evening restock there are 8,100 — and checking those one at a time is what takes nine seconds.

since the summary updated
11 days
off in its estimate
200×
What it expected vs what is therestock rows during the evening restock
EXPECTEDACTUAL
Rows to check408,100
Time to answer30 ms9,000 ms
Method chosenone at a timeneeds bulk match
05Fixed · Mon 10:35

The safe fix

engineer

What is the safest fix we can ship today?

Claude + NexQL

Checked the database

  1. check_ddl_safetytested the fix before running it34ms
  2. get_ddlchecked how the table is built21ms
  3. auto_tune_queryproposed a faster approach52ms

Two small pieces of work, and one trap to avoid. Refreshing the summary is instant. The shortcut that keeps it fast has to be added in two steps — written the obvious way, in one step, it would freeze every payment for four to seven minutes.

pause, done safely
0.2 sec
pause, done the obvious way
4–7 min
Plan for tonight
  1. Refresh the stock summaryThree seconds, nothing goes offline.
  2. Add the shortcut in two steps, not onePayments pause for under a fifth of a second.
  3. Do not run it as a single commandThat version locks payments for four to seven minutes — the table is split into nine parts and all of them freeze.
  4. Both steps can be undone in seconds if anything looks wrong.
06Fixed · Mon 19:04

Did it work?

engineer

It is live. Did it work?

Claude + NexQL

Checked the database

  1. explain_queryconfirmed the new approach is being used68ms
  2. slow_queriescompared tonight with last night58ms
  3. db_health_checkreran the health checks: no warnings132ms

Yes. The cart total now comes back in 31 milliseconds instead of 812 — about 26 times faster — and no single request is taking more than 9% of the evening.

cart total
26× faster
warnings left
0
Time to load a cart totaltypical evening request
Last night812 ms
Tonight31 ms
07Recovered · Tue 09:10

Sales are back

head of online store

Are sales back to normal?

Claude + NexQL

Checked the database

  1. run_selectcounted last night’s orders per hour176ms
  2. run_selectcompared with the same night last week104ms
  3. run_selectchecked carts abandoned at payment88ms

Better than normal. Last night’s evening orders came in slightly ahead of the daytime rate, and the payment page lost 2 shoppers in 100 instead of 19. That is $28.4K of sales recovered in a single night.

orders vs last week
+4.1%
recovered, first night
$28.4K
question to fix
1 day
Orders per hour, eveninglast night compared with the week before
fix went live6pm last week10pm last night

Tools in this session

Each one is explained in the docs: what it does, how it works and what it needs.

Guided tourSet it up yourself in five minutesPick your app, install, connect a database, ask.Agent promptsLet your AI agent set it upSix prompts to paste into Claude Code, Cursor, Codex and others.DocsHow every tool and guardrail worksAll 55 tools, access modes, masking and more.