Can we update expensive queries?

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • None
    • Component/s: Environment - Database
    • None
    • 2

      Hi Team,

      Here are some details about the query having count() function:

      jira2db=# explain analyze SELECT COUNT(I.ID) FROM public.jiraissue I
      jira2db-# ;
      QUERY PLAN
      -------------------
      Aggregate (cost=149130.40..149130.41 rows=1 width=8) (actual time=1076.914..1076.915 rows=1 loops=1)
      -> Index Only Scan using pk_jiraissue on jiraissue i (cost=0.43..142289.32 rows=2736429 width=6) (actual time=2.770..948.389 row
      s=2736446 loops=1)
      Heap Fetches: 744488
      Planning Time: 0.168 ms
      Execution Time: 1076.959 ms
      

      As we can see execution time is huge for the query, can we replace the expensive query for counting the number of rows in a table with an approximate number of rows from statistics on a table?

      Thanks,
      Vedika Tambolkar

            Assignee:
            Unassigned
            Reporter:
            Vedika Tambolkar
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: