1. 18 1鏈, 2022 2 娆℃彁浜
  2. 17 1鏈, 2022 2 娆℃彁浜
  3. 15 1鏈, 2022 1 娆℃彁浜
  4. 14 1鏈, 2022 3 娆℃彁浜
  5. 13 1鏈, 2022 12 娆℃彁浜
  6. 12 1鏈, 2022 5 娆℃彁浜
  7. 11 1鏈, 2022 4 娆℃彁浜
  8. 10 1鏈, 2022 1 娆℃彁浜
  9. 08 1鏈, 2022 4 娆℃彁浜
  10. 07 1鏈, 2022 1 娆℃彁浜
    • A
      MM-40852: Fix make gen-serialized breakage (#19291) · 93a9c6c2
      Agniva De Sarker 鎻愪氦浜
      - Fixed the Makefile command so that it can be run in CI
      - Changed to go install to make it compatible with >1.16 versions.
      - Removed unnecessary lines in go.tools.mod now that we aren't using that.
      
      ```release-note
      NONE
      ```
      93a9c6c2
  11. 06 1鏈, 2022 2 娆℃彁浜
  12. 05 1鏈, 2022 3 娆℃彁浜
    • P
    • A
      MM-40799: Improve ReplyCount query (#19274) · 95fd1206
      Agniva De Sarker 鎻愪氦浜
      * MM-40799: Improve ReplyCount query
      
      This PR optimizes the reply count query to use only
      the indexed column to count the rows rather than using
      the ID column. This results in an index-only scan
      rather than an index scan. As a result, the query
      can be satisfied directly by scanning the index
      and there is no need to touch the heap.
      
      Count(*) also gives the same result, but is not recommended
      as it also verifies non-null columns and can take slightly
      longer.
      
      Before:
      ```
      explain analyze SELECT p.*, (SELECT COUNT(Posts.Id) FROM Posts WHERE Posts.RootId = (CASE WHEN p.RootId = '' THEN p.Id ELSE p.RootId END) AND Posts.DeleteAt = 0) AS ReplyCount FROM Posts p WHERE (CreateAt < (SELECT CreateAt FROM Posts WHERE Id = 'bguxt6zzcjytpffgza3dc7xody') AND p.ChannelId = '5xmynf36cinrzksuzhq7my1nbc' AND DeleteAt = 0) ORDER BY p.ChannelId, DeleteAt, CreateAt DESC LIMIT 30 OFFSET 0;
                                                                                       QUERY PLAN
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       Limit  (cost=9.14..130616.04 rows=30 width=922) (actual time=19.208..19.454 rows=30 loops=1)
         InitPlan 2 (returns $2)
           ->  Index Scan using posts_pkey on posts posts_1  (cost=0.56..8.58 rows=1 width=8) (actual time=0.028..0.030 rows=1 loops=1)
                 Index Cond: ((id)::text = 'bguxt6zzcjytpffgza3dc7xody'::text)
         ->  Index Scan Backward using idx_posts_channel_id_delete_at_create_at on posts p  (cost=0.56..2720977.61 rows=625 width=922) (actual time=0.075..0.317 rows=30 loops=1)
               Index Cond: (((channelid)::text = '5xmynf36cinrzksuzhq7my1nbc'::text) AND (deleteat = 0) AND (createat < $2))
               SubPlan 1
                 ->  Aggregate  (cost=4349.49..4349.50 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=30)
                       ->  Index Scan using idx_posts_root_id_delete_at on posts  (cost=0.56..4346.36 rows=1253 width=27) (actual time=0.007..0.007 rows=0 loops=30)
                             Index Cond: (((rootid)::text = (CASE WHEN ((p.rootid)::text = ''::text) THEN p.id ELSE p.rootid END)::text) AND (deleteat = 0))
      ```
      
      After:
      
      ```
      explain analyze SELECT p.*, (SELECT COUNT(Posts.RootId) FROM Posts WHERE Posts.RootId = (CASE WHEN p.RootId = '' THEN p.Id ELSE p.RootId END) AND Posts.DeleteAt = 0) AS ReplyCount FROM Posts p WHERE (CreateAt < (SELECT CreateAt FROM Posts WHERE Id = 'bguxt6zzcjytpffgza3dc7xody') AND p.ChannelId = '5xmynf36cinrzksuzhq7my1nbc' AND DeleteAt = 0) ORDER BY p.ChannelId, DeleteAt, CreateAt DESC LIMIT 30 OFFSET 0;
                                                                                       QUERY PLAN
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       Limit  (cost=9.14..130616.04 rows=30 width=922) (actual time=12.936..13.188 rows=30 loops=1)
         InitPlan 2 (returns $2)
           ->  Index Scan using posts_pkey on posts posts_1  (cost=0.56..8.58 rows=1 width=8) (actual time=0.029..0.030 rows=1 loops=1)
                 Index Cond: ((id)::text = 'bguxt6zzcjytpffgza3dc7xody'::text)
         ->  Index Scan Backward using idx_posts_channel_id_delete_at_create_at on posts p  (cost=0.56..2720977.61 rows=625 width=922) (actual time=0.076..0.324 rows=30 loops=1)
               Index Cond: (((channelid)::text = '5xmynf36cinrzksuzhq7my1nbc'::text) AND (deleteat = 0) AND (createat < $2))
               SubPlan 1
                 ->  Aggregate  (cost=4349.49..4349.50 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=30)
                       ->  Index Only Scan using idx_posts_root_id_delete_at on posts  (cost=0.56..4346.36 rows=1253 width=8) (actual time=0.007..0.007 rows=0 loops=30)
                             Index Cond: ((rootid = (CASE WHEN ((p.rootid)::text = ''::text) THEN p.id ELSE p.rootid END)::text) AND (deleteat = 0))
                             Heap Fetches: 14
      ```
      
      https://mattermost.atlassian.net/browse/MM-40799
      
      ```release-note
      NONE
      ```
      
      * Use COUNT(*) for faster
      
      ```release-note
      NONE
      ```
      95fd1206
    • A
      MM-40801: Use replica for getPostsAround (#19273) · 926e7c3b
      Agniva De Sarker 鎻愪氦浜
      This query deals with posts already created,
      and it was originally already querying replica.
      
      In recent performance investigations, this came up
      a lot of times. I believe the change to query master
      was unintentional.
      
      ```release-note
      NONE
      ```
      926e7c3b