79354935

Date: 2025-01-14 12:12:45
Score: 4
Natty:
Report link

Fixed successfully with the index suggested by ChatGPT!

From 14s to 28ms:

Aggregate  (cost=11377.88..11377.89 rows=1 width=8) (actual time=28.306..28.307 rows=1 loops=1)
  ->  Nested Loop  (cost=0.99..11377.82 rows=26 width=4) (actual time=0.029..26.546 rows=34893 loops=1)
        ->  Index Scan using idx_36ac99f1296cd8ae on link l1_  (cost=0.43..194.94 rows=322 width=4) (actual time=0.013..0.156 rows=190 loops=1)
              Index Cond: (team_id = 37)
        ->  Index Scan using idx_20b8ff21ada402718b8e8428 on stat s0_  (cost=0.56..34.39 rows=34 width=8) (actual time=0.004..0.122 rows=184 loops=190)
              Index Cond: ((link_id = l1_.id) AND (created_at > '2024-12-14 07:46:04+01'::timestamp with time zone))
Planning Time: 0.403 ms
Execution Time: 28.343 ms

Thanks Laurent for your advice and thanks Richard for EXPLAIN ANALYZE.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Blacklisted phrase (0.5): thanks
  • RegEx Blacklisted phrase (3): Thanks Laurent for your advice
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Huluti