PitHub
HomeExplore
New pit
MCP serverSave straight from your agent
About usHow it worksFAQBlogContact us
Sign in
PitHub
Sign in
HomeExploreCreateSign in

Explore

Loading…

Explore

Tagged #sql

ActiveNewMost usedRecommended
AllAI & Prompt Engineering324Engineering176Data & Analytics89Product4Design28Sales2Marketing4Finance
#sqlClear filters
ANAnika Kim@anikakim·3w ago

The checklist I use for Postgres query tuning

Not magic wording, just enough context and a clear definition of done. Easy to adapt.

Anika Kim

I am stuck on Postgres query tuning. I need to read an EXPLAIN plan and choose the smallest index or query change that matters, but my current attempt is getting vague and too big. What would you check first?

Claudeclaude-opus-4.5

First, shrink the decision. Do not solve the whole subject at once. 1. Reproduce the failure before changing code. 2. Keep the patch smaller than the diagnosis. 3. Write the rollback before deployment. Write down the result you need by the end of this session. Then choose one input you trust and make a first pass that can be checked. If that pass fails, you will know which assumption to revisit instead of starting over.

Show all 3 messages
3303.8k
LULuca Reed@lucareed·4w ago

The cohort retention prompt I actually kept

A compact prompt and the response it produced. Replace the bracketed parts with your own details.

Luca Reed

Help me calculate and explain retention cohorts without mixing calendar and lifecycle time. Context: - Goal: [what a good result lets me do] - Current situation: [paste notes, draft, data, or constraints] - Audience: [who will use the result] - Deadline or limit: [time, budget, tools, length] Before answering, ask up to three questions only if the answers would materially change your recommendatio

ChatGPTgpt-5

This is usable as written. The important parts are the definition of done, the instruction to expose assumptions, and the request for a smallest test. For cohort retention, I would start with these checks: - Fix the grain before calculating - Keep assumptions next to the metric - Show uncertainty in the output If you share real material, remove anything private first and replace bracketed fields with concrete details.

Show all 3 messages
3302.2k
LULuca Reed@lucareed·1mo ago

A smaller way to tackle cohort retention

The useful bit was asking for trade-offs and a smallest test before committing to a full plan.

Luca Reed

For cohort retention, should I build a complete plan first or test one small slice? I have limited time and I do not want throwaway work.

ChatGPTgpt-5

Test one slice, but choose a slice that crosses the riskiest part of the problem. A tiny easy demo will only prove the easy part. Use this decision rule: - If reversing the choice is cheap, try it. - If the choice locks in data, money, or other people’s time, write the full decision first. - If uncertainty is concentrated in one step, test that step before planning around it. For cohort retention, make the first test produce evidence you can compare, not just something that looks complete.

Show all 3 messages
3403.3k
40404 brain not found@404_brain_not_found·2w ago

Why Postgres ignored my index (and the ANALYZE that fixed it)

A 40-second query that should have been 8ms. The plan was right; the statistics were four months stale.

404 brain not found

This query does a seq scan on a 40M row table even though there's an index on `created_at`: ```sql select * from events where created_at > now() - interval '1 hour' order by created_at desc limit 100; ```

Claudeclaude-opus-4.5

Get the plan with real numbers first: ```sql explain (analyze, buffers) select * from events where created_at > now() - interval '1 hour' order by created_at desc limit 100; ``` The thing to compare is `rows=` (the estimate) against `actual rows=`. If the planner thinks the predicate matches millions of rows, a seq scan is the *correct* choice given what it believes — the bug is in what it believes, not in how it decided. On an append-only events table this is usually stale statistics: the planner's histogram thinks the newest `created_at` is months old, so "the last hour" looks like it covers

Show all 4 messages
410537
ANAnika Kim@anikakim·1mo ago

Postgres query tuning: the version with actual constraints

I kept the useful constraints and dropped the role-play. It works better when the missing details are stated plainly.

Anika Kim

Give me a short checklist for Postgres query tuning. I want something I can run before I call the work done.

Claudeclaude-opus-4.5

Use this pass: - [ ] The goal is one sentence and names the user or decision - [ ] Inputs are current, relevant, and traceable - [ ] Assumptions are visible - [ ] Reproduce the failure before changing code - [ ] Keep the patch smaller than the diagnosis - [ ] Write the rollback before deployment - [ ] One failure case has been tested - [ ] The next owner and next action are clear If you cannot check an item, mark it unknown. Do not quietly treat unknown as done.

Show all 3 messages
340840
ANAnika Kim@anikakim·3mo ago

The Postgres query tuning prompt I actually kept

I kept the useful constraints and dropped the role-play. It works better when the missing details are stated plainly.

Anika Kim

Help me read an EXPLAIN plan and choose the smallest index or query change that matters. Context: - Goal: [what a good result lets me do] - Current situation: [paste notes, draft, data, or constraints] - Audience: [who will use the result] - Deadline or limit: [time, budget, tools, length] Before answering, ask up to three questions only if the answers would materially change your recommendation.

ChatGPTgpt-5

This is usable as written. The important parts are the definition of done, the instruction to expose assumptions, and the request for a smallest test. For Postgres query tuning, I would start with these checks: - Reproduce the failure before changing code - Keep the patch smaller than the diagnosis - Write the rollback before deployment If you share real material, remove anything private first and replace bracketed fields with concrete details.

Show all 3 messages
3403.7k
ANAnika Kim@anikakim·3mo ago

A smaller way to tackle Postgres query tuning

The first answers were broad enough to be useless. This version asks for assumptions, evidence, and a next step.

Anika Kim

For Postgres query tuning, should I build a complete plan first or test one small slice? I have limited time and I do not want throwaway work.

ChatGPTgpt-5

Test one slice, but choose a slice that crosses the riskiest part of the problem. A tiny easy demo will only prove the easy part. Use this decision rule: - If reversing the choice is cheap, try it. - If the choice locks in data, money, or other people’s time, write the full decision first. - If uncertainty is concentrated in one step, test that step before planning around it. For Postgres query tuning, make the first test produce evidence you can compare, not just something that looks complete.

Show all 3 messages
3303.7k
LULuca Reed@lucareed·3mo ago

cohort retention: the version with actual constraints

A compact prompt and the response it produced. Replace the bracketed parts with your own details.

Luca Reed

Give me a short checklist for cohort retention. I want something I can run before I call the work done.

Claudeclaude-opus-4.5

Use this pass: - [ ] The goal is one sentence and names the user or decision - [ ] Inputs are current, relevant, and traceable - [ ] Assumptions are visible - [ ] Fix the grain before calculating - [ ] Keep assumptions next to the metric - [ ] Show uncertainty in the output - [ ] One failure case has been tested - [ ] The next owner and next action are clear If you cannot check an item, mark it unknown. Do not quietly treat unknown as done.

Show all 3 messages
3301.9k
ANAnika Kim@anikakim·2mo ago

I asked Gemini for a second opinion on Postgres query tuning

I wanted help with Postgres query tuning without pretending the model knew facts I had not provided.

Anika Kim

Be blunt about my plan for Postgres query tuning. I am going to collect everything, ask for a polished answer, and fix details later. What is likely to go wrong?

Geminigemini-2.5-pro

Three things. - “Everything” has no boundary, so weak inputs and strong inputs will be treated alike. - A polished answer can hide missing evidence. Ask for gaps and assumptions before prose. - “Fix details later” means there is no acceptance test now. A safer sequence is: define the decision, choose the minimum trusted inputs, make an ugly first pass, check it, then polish. For this task, keep the patch smaller than the diagnosis.

Show all 3 messages
340954
LULuca Reed@lucareed·2mo ago

The checklist I use for cohort retention

Sharing the wording because it gave me something I could check instead of a confident wall of text.

Luca Reed

I am stuck on cohort retention. I need to calculate and explain retention cohorts without mixing calendar and lifecycle time, but my current attempt is getting vague and too big. What would you check first?

Claudeclaude-opus-4.5

First, shrink the decision. Do not solve the whole subject at once. 1. Fix the grain before calculating. 2. Keep assumptions next to the metric. 3. Show uncertainty in the output. Write down the result you need by the end of this session. Then choose one input you trust and make a first pass that can be checked. If that pass fails, you will know which assumption to revisit instead of starting over.

Show all 3 messages
340797
LULuca Reed@lucareed·3mo ago

I asked Gemini for a second opinion on cohort retention

This started as a messy question about cohort retention. The follow-up made the answer practical.

Luca Reed

Be blunt about my plan for cohort retention. I am going to collect everything, ask for a polished answer, and fix details later. What is likely to go wrong?

Geminigemini-2.5-pro

Three things. - “Everything” has no boundary, so weak inputs and strong inputs will be treated alike. - A polished answer can hide missing evidence. Ask for gaps and assumptions before prose. - “Fix details later” means there is no acceptance test now. A safer sequence is: define the decision, choose the minimum trusted inputs, make an ugly first pass, check it, then polish. For this task, keep assumptions next to the metric.

Show all 3 messages
330512

Browse by tag

#ai314#chatgpt211#claude208#gemini208#prompting182#agents174#context-engineering172#coding160
24
Strategy31
Operations4
Customer Success3
People & Recruiting4
Security & Compliance8
Legal2
Other Professional1
#debugging106
#software-learning100
#data85
#analysis55
#statistics55
#202650
#data-literacy50
#prompt-template50
#trending-questions50
#business25
#design25
#testing25
#automation21
#finance21
#cash-flow16
#research16