DEV Community

Aarbel
Aarbel

Posted on

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

Top comments (0)