Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor Large input first query performance #2238

Open
Huararanga opened this issue Nov 18, 2024 · 2 comments
Open

Poor Large input first query performance #2238

Huararanga opened this issue Nov 18, 2024 · 2 comments
Labels

Comments

@Huararanga
Copy link

Summary

We are refactoring from V4.
When we use large inputs, we are observing poor pefrormance for first query.

Steps to reproduce

Follow steps in readme https://github.com/Huararanga/postgraphile-large-input

Expected results

Good pefrormance on first query call

Actual results

Poor pefrormance on first query call

Additional context

@Huararanga
Copy link
Author

As @benjie suggested switching from

const $input = fieldArgs.get("input");

to

const $input = fieldArgs.getRaw("input");

fixed for this case

@benjie benjie moved this from 🌳 Triage to 🦥 Sloth in V5.0.0 Nov 29, 2024
@benjie
Copy link
Member

benjie commented Dec 10, 2024

A reproduction courtesy of @slaskis:

psql <<SQL
    DROP SCHEMA IF EXISTS a;
    CREATE SCHEMA a;

    CREATE TABLE a.ev (
        id serial primary key,
        input jsonb
    );

    CREATE FUNCTION a.insert_ev(evs a.ev[]) RETURNS void
        LANGUAGE sql
    AS $$
        INSERT INTO a.ev
            (id, input)
        SELECT
            new_ev.id,
            new_ev.input
        FROM
            UNNEST(insert_ev.evs) AS new_ev
        ON CONFLICT DO NOTHING;
    $$;
SQL
npx pgl@beta -P pgl/amber --connection "postgres://postgres@localhost:5432/test" --schema a
node -p 'JSON.stringify({query: "mutation MyMutation($input: InsertEvInput!) {insertEv(input: $input) {clientMutationId}}", variables: {input: {evs: Array.from(Array(1000)).map((_, i) => ({rowId:i,input:{a:123}}))}}})' | \
curl 'http://\[::\]:5678/graphql' \
  -H 'accept: application/json, multipart/mixed' \
  -H 'content-type: application/json' \
  -d @-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🦥 Sloth
Development

No branches or pull requests

2 participants