Skip to content

⚡ Bolt: [performance improvement] Concurrent db queries for agents dashboard#102

Open
bobdivx wants to merge 1 commit into
devfrom
jules-bolt-perf-opt-agent-queries-11932520118464904040
Open

⚡ Bolt: [performance improvement] Concurrent db queries for agents dashboard#102
bobdivx wants to merge 1 commit into
devfrom
jules-bolt-perf-opt-agent-queries-11932520118464904040

Conversation

@bobdivx

@bobdivx bobdivx commented Jun 9, 2026

Copy link
Copy Markdown
Owner

This pull request introduces a performance optimization to the src/pages/agents.astro dashboard. It replaces three independent sequential database queries (AgentInstruction, AgentTask, and AgentAppIssue) with a single concurrent Promise.all() execution.

This eliminates the sequential blocking (N+1 delay) during server-side rendering, reducing the total query wait time to the duration of the slowest individual query rather than their sum.

Additionally, a new journal entry has been added to .jules/bolt.md documenting this finding and strategy. All tests have passed to verify no regressions were introduced.


PR created automatically by Jules for task 11932520118464904040 started by @bobdivx

…shboard

💡 **What**: Replaced sequential `await db.select()` queries in `src/pages/agents.astro` with concurrent execution using `Promise.all()`.

🎯 **Why**: The original implementation awaited three independent database calls (`AgentInstruction`, `AgentTask`, and `AgentAppIssue`) sequentially, leading to an N+1 fetching bottleneck during Astro SSR.

📊 **Impact**: Reduces initial SSR data loading time. The total DB fetching wait time is now determined by the slowest individual query, rather than the sum of all three query times.

🔬 **Measurement**: Verify SSR load times in the network tab when hitting `/agents`. Also logged the pattern learning in `.jules/bolt.md`.

Co-authored-by: bobdivx <6737167+bobdivx@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
forge Ready Ready Preview, Comment Jun 9, 2026 5:20pm

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request optimizes SSR load times in src/pages/agents.astro by parallelizing independent database queries using Promise.all, and documents this learning in .jules/bolt.md. The review feedback suggests further optimizing these queries by selecting only the specific columns needed for statistics rather than fetching all columns, which will reduce database I/O and memory usage.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/pages/agents.astro
Comment on lines +20 to +24
const [instructions, tasks, issues] = await Promise.all([
db.select().from(AgentInstruction),
db.select().from(AgentTask),
db.select().from(AgentAppIssue)
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Efficiency: Avoid Over-fetching Columns in Database Queries

Currently, the queries select all columns (db.select().from(...)) for AgentInstruction, AgentTask, and AgentAppIssue. However, the dashboard only uses a few specific fields to compute the statistics:

  • instructions only needs enabled to filter and count.
  • tasks only needs agentId to count total tasks and find unique agents with tasks.
  • issues only needs status to filter and count pending issues.

Selecting all columns (which may include large text fields, metadata, or JSON payloads) can lead to unnecessary memory usage, database I/O, and network overhead as the tables grow. Specifying only the required columns in the select clause significantly improves query performance and reduces SSR payload size.

  const [instructions, tasks, issues] = await Promise.all([
    db.select({ enabled: AgentInstruction.enabled }).from(AgentInstruction),
    db.select({ agentId: AgentTask.agentId }).from(AgentTask),
    db.select({ status: AgentAppIssue.status }).from(AgentAppIssue)
  ]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant