Logo

dev-resources.site

for different kinds of informations.

How to monitor URQL performance and link with database queries ?

Published at
4/23/2023
Categories
urq
performance
tracking
hasura
Author
aarbel
Categories
4 categories in total
urq
open
performance
open
tracking
open
hasura
open
Author
6 person written this
aarbel
open
How to monitor URQL performance and link with database queries ?

Hi Urql community, i'm struggling debugging / optimising urql request as these requests are then converted to Postgre SQL requests thru Hasura.

Extract of my urql file:


    ${GetApprovals_VersionFragmentDoc}`;
export const GetApprovalsDocument = gql`
    query GetApprovals($projectId: uuid!) {
  files(
    where: {is_approval_mode: {_eq: true}, project: {id: {_eq: $projectId}}, folder: {is_in_bin: {_eq: false}}}
  ) {
    ...GetApprovals_file
  }
}
    ${GetApprovals_FileFragmentDoc}`;

Enter fullscreen mode Exit fullscreen mode

Extracts of a postgre request (log from EverSQL), maybe linked to this query (but i'm not sure, which is my problem):

SELECT
  coalesce((json_agg("root") -> 0), 'null') AS "root"
FROM
  (
    SELECT
      row_to_json(
        (
          SELECT
            "_100_e"
          FROM
            (
              SELECT
                "_0_root.base"."id" AS "id",
                "_0_root.base"."name" AS "name",
                "public"."is_approved_on_a_version"("_0_root.base") AS "is_approved_on_a_version",
                "_0_root.base"."is_approval_mode" AS "is_approval_mode",
                "_16_root.or.assignation"."assignation" AS "assignation",
                "_99_root.cf.last_version"."last_version" AS "last_version",
                "_57_root.ar.root.file_versions"."file_versions" AS "file_versions",
                "_0_root.base"."due_date" AS "due_date",
                'files' AS "__typename"
            ) AS "_100_e"
        )
      ) AS "root"
    FROM
      (
        SELECT
          *
        FROM
          "public"."files"
        WHERE
          (
            (
              (
                (
                  "public"."get_user_can_read_file"("public"."files".*, $1)
                ) = (('true') :: boolean)
              )
              OR (
                (
                  (
                    "public"."get_user_can_read_file"("public"."files".*, $1)
                  ) IS NULL
                )
                AND ((('true') :: boolean) IS NULL)
              )
            )
Enter fullscreen mode Exit fullscreen mode

As a conclusion here:

  • i have no way to know if the SQL log comes from this specific query
  • which user performed the query
  • how to optimise the urql query to avoid performance provlems with SQL.

Do you have any tips / recommandations for that ?

Thanks a lot

hasura Article's
30 articles in total
Favicon
Convert insert mutation to upsert
Favicon
refinedev - hasura (nested/multiple query_root)
Favicon
From Idea to Launch: My 30-Day MVP Journey
Favicon
How to Build a GraphQL API for MongoDB Using Hasura in Six Steps
Favicon
How to Build a Supergraph using Snowflake, Neon PostgreSQL, and Hasura in Five Steps
Favicon
Streamlining CI/CD Pipelines with Hasura GraphQL Engine
Favicon
Supabase over Hasura for 2024?
Favicon
Hasura and Keycloak integration with NestJS server
Favicon
Modern API Development (Part 1)
Favicon
Build a graphQL API with Hasura low-code platform
Favicon
Startup Starter Kit
Favicon
Hasura x MEWS
Favicon
Hasura vs Apollo: Comparing GraphQL Platforms
Favicon
Hasura and Nhost vs Supabase
Favicon
How to monitor URQL performance and link with database queries ?
Favicon
Build a Powerful GraphQL API with Postgres in Under 10 Minutes
Favicon
Guide to Side effects in Hasura
Favicon
Hasura: Building Scalable and Real-Time Applications - An Extensive Guide
Favicon
Hasura Cloud: Building Scalable and Secure GraphQL APIs Made Easy
Favicon
How to avoid messing up squash migration in Hasura
Favicon
Appwrite vs. Hasura vs. Apollo
Favicon
Auth0, Hasura, Social Media Login
Favicon
Deno & Hasura for app development
Favicon
SSR: clerk with hasura
Favicon
Hasura Custom Authentication Using JWT
Favicon
Unable to HASURA_GRAPHQL_JWT_SECRET in docker-compose file
Favicon
Hasura Storage in Go: 5x performance increase and 40% less RAM
Favicon
Using Authorizer with Hasura
Favicon
Hasura + Supertokens
Favicon
Creating a todo web app in < 112 lines of code with Hasura and Python

Featured ones: