microsoft / microsoft/vscode-pgsql

running query with many insert rows is slow to even start

Open
#142 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
No language data
Stars
395
Forks
33
Avg merge
1h 46m
Merged PRs (30d)
3

Description

Type: Bug

the query runs quickly but executing the query gets delayed and makes it feel super slow (over a minute)

steps to reproduce:

  1. navigate to https://adventofsql.com/challenges/4
  2. download the challenge data (see button and instructions at bottom of page)
  3. create a local Docker PostgreSQL Server
  4. run the downloaded data dump query (advent_of_sql_day_4.sql) via "PGSQL: Execute PostgreSQL Query"
  5. note that in the bottom of VS Code it will show "Executing query... 0:SS" and that it will take upwards to a minute or more but once the query runs it only takes ~250ms to actually execute

I can modify the data query using the test data in the same web page and the VS Code extension immediately connects to the DB and runs the query as expected.

My guess is that there is something going on with having a query with 5,000 rows in a single insert statement or that there is some tokenization going on when the VS Code extension communicates with the PostgreSQL server that is being very slow (maybe caused by all of the ARRAY[] usages, some of them are a bit long).

I also tried connected directly to the DB via PSQL CLI tool and running the data dump query there directly via \i ~/Downloads/advent_of_sql_day_4.sql and it runs very quickly without the delay that I see when trying to execute the query via the VS Code extension.

Extension version: 1.8.0
VS Code version: Code 1.103.2 (Universal) (6f17636121051a53c88d3e605c491d22af2ba755, 2025-08-20T16:45:34.255Z)
OS version: Darwin arm64 24.6.0
Modes:

System Info
Item Value
CPUs Apple M4 (10 x 2400)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 2, 2, 3
Memory (System) 16.00GB (0.50GB free)
Process Argv --crash-reporter-id 7f170e05-a628-476b-a81b-f8fb3f6fba8e
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
a-cdx-r5-s1040-2:31371380
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
747dc170:31275177
aj953862:31281341
9d2cg352:31346308
nesew2to5:31336538
agentclaude:31335814
nes-set-on:31340697
6abeh943:31336334
envsactivate1:31353494
0927b901:31350571
f76d9909:31348711
custommodel3t:31371782
45650338:31358607
0cj2b977:31352657
justeven_python:31371804
0574c672:31362109
controlchatstate:31363048
pylancealldocst:31371774
gemagent1:31368469
cloudbuttont:31368504
retryenabled:31370050

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the delay with the Advent of SQL challenge 4 dump, Docker PostgreSQL, and the PGSQL: Execute PostgreSQL Query command, then compare it with running the same file through the PSQL CLI. Investigate the extension's handling of the 5,000-row INSERT and ARRAY[] values; done means the extension no longer adds the minute-long startup delay while preserving the fast query execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, vscode
Domain
database, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.