<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aarbel</title>
    <description>The latest articles on DEV Community by Aarbel (@aarbel).</description>
    <link>https://dev.to/aarbel</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F435682%2F58c0cdd4-0ae7-423b-92f4-5b040b8bf893.jpeg</url>
      <title>DEV Community: Aarbel</title>
      <link>https://dev.to/aarbel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aarbel"/>
    <language>en</language>
    <item>
      <title>How to monitor URQL performance and link with database queries ?</title>
      <dc:creator>Aarbel</dc:creator>
      <pubDate>Sun, 23 Apr 2023 21:13:05 +0000</pubDate>
      <link>https://dev.to/aarbel/how-to-monitor-urql-performance-and-link-with-database-queries--2dp1</link>
      <guid>https://dev.to/aarbel/how-to-monitor-urql-performance-and-link-with-database-queries--2dp1</guid>
      <description>&lt;p&gt;Hi Urql community, i'm struggling debugging / optimising urql request as these requests are then converted to Postgre SQL requests thru Hasura.&lt;/p&gt;

&lt;p&gt;Extract of my urql file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
    ${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}`;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Extracts of a postgre request (log from EverSQL), maybe linked to this query (but i'm not sure, which is my problem):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
  coalesce((json_agg("root") -&amp;gt; 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)
              )
            )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As a conclusion here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;i have no way to know if the SQL log comes from this specific query&lt;/li&gt;
&lt;li&gt;which user performed the query&lt;/li&gt;
&lt;li&gt;how to optimise the urql query to avoid performance provlems with SQL.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do you have any tips / recommandations for that ?&lt;/p&gt;

&lt;p&gt;Thanks a lot &lt;/p&gt;

</description>
      <category>urq</category>
      <category>performance</category>
      <category>tracking</category>
      <category>hasura</category>
    </item>
  </channel>
</rss>
