Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • 12-9-stable
  • 12-7-stable
  • 12-6-stable
  • 12-8-stable
  • github/fork/Kloppi313/patch-1
  • 12-5-stable
  • 12-4-stable
  • github/fork/ramalokesh8477/master
  • 12-1-stable
  • 12-2-stable
  • 12-0-stable
  • 12-3-stable
  • 42-42-stable
  • github/fork/hussamgit398/patch-2
  • 12-3-auto-deploy-20190911
  • 12-3-auto-deploy-20190916
  • 12-3-auto-deploy-20190908
  • 12-3-auto-deploy-20190901
  • 12-3-auto-deploy-20190901-32664
  • v12.10.0.pre
  • v12.9.0
  • v12.9.0-rc42
  • v12.8.7
  • v12.8.6
  • v12.8.5
  • v12.8.4
  • v12.8.3
  • v12.6.8
  • v12.7.7
  • v12.8.2
  • v12.8.1
  • v12.9.0.pre
  • v12.8.0
  • v12.8.0-rc42
  • v12.5.10
  • v12.7.6
  • v12.6.7
  • v12.7.5
  • v12.5.9
40 results

lfs_object.rb

  • Toon Claes's avatar
    d5f290e4
    Enhance performance of counting local LFS objects · d5f290e4
    Toon Claes authored
    Add an index to the `file_store` column on `lfs_objects`. This makes
    counting local objects faster.
    
    Also, there is no longer need to check for objects with `file_store`
    being `NULL`. See
    https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18557
    
    ---
    
    ### Query plans
    
    #### Before & with `NULL`
    
    ```
    Aggregate  (cost=113495.96..113495.97 rows=1 width=8) (actual time=1691.394..1691.394 rows=1 loops=1)
      ->  Seq Scan on lfs_objects  (cost=0.00..106415.50 rows=2832186 width=0) (actual time=0.012..1312.488 rows=2852607 loops=1)
            Filter: ((file_store = 1) OR (file_store IS NULL))
            Rows Removed by Filter: 131
    Planning time: 0.077 ms
    Execution time: 1691.433 ms
    ```
    
    #### Before, without `NULL`
    
    ```
    Aggregate  (cost=113495.96..113495.97 rows=1 width=8) (actual time=856.423..856.424 rows=1 loops=1)
      ->  Seq Scan on lfs_objects  (cost=0.00..106415.50 rows=2832186 width=0) (actual time=0.012..672.181 rows=2852607 loops=1)
            Filter: (file_store = 1)
            Rows Removed by Filter: 131
    Planning time: 0.128 ms
    Execution time: 856.470 ms
    ```
    
    #### After & with `NULL`
    
    ```
    Aggregate  (cost=68819.95..68819.96 rows=1 width=8) (actual time=583.355..583.355 rows=1 loops=1)
      ->  Index Only Scan using index_lfs_objects_on_file_store on lfs_objects  (cost=0.43..61688.35 rows=2852643 width=0) (actual time=0.028..399.177 rows=2852607 loops=1)
            Filter: ((file_store = 1) OR (file_store IS NULL))
            Rows Removed by Filter: 131
            Heap Fetches: 867
    Planning time: 0.096 ms
    Execution time: 583.404 ms
    ```
    
    #### After, without `NULL`
    
    ```
    Aggregate  (cost=68817.29..68817.30 rows=1 width=8) (actual time=490.550..490.551 rows=1 loops=1)
      ->  Index Only Scan using index_lfs_objects_on_file_store on lfs_objects  (cost=0.43..61685.68 rows=2852643 width=0) (actual time=0.040..311.760 rows=2852607 loops=1)
            Index Cond: (file_store = 1)
            Heap Fetches: 831
    Planning time: 0.294 ms
    Execution time: 490.590 ms
    ```
    
    Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/6067
    d5f290e4
    History
    Enhance performance of counting local LFS objects
    Toon Claes authored
    Add an index to the `file_store` column on `lfs_objects`. This makes
    counting local objects faster.
    
    Also, there is no longer need to check for objects with `file_store`
    being `NULL`. See
    https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18557
    
    ---
    
    ### Query plans
    
    #### Before & with `NULL`
    
    ```
    Aggregate  (cost=113495.96..113495.97 rows=1 width=8) (actual time=1691.394..1691.394 rows=1 loops=1)
      ->  Seq Scan on lfs_objects  (cost=0.00..106415.50 rows=2832186 width=0) (actual time=0.012..1312.488 rows=2852607 loops=1)
            Filter: ((file_store = 1) OR (file_store IS NULL))
            Rows Removed by Filter: 131
    Planning time: 0.077 ms
    Execution time: 1691.433 ms
    ```
    
    #### Before, without `NULL`
    
    ```
    Aggregate  (cost=113495.96..113495.97 rows=1 width=8) (actual time=856.423..856.424 rows=1 loops=1)
      ->  Seq Scan on lfs_objects  (cost=0.00..106415.50 rows=2832186 width=0) (actual time=0.012..672.181 rows=2852607 loops=1)
            Filter: (file_store = 1)
            Rows Removed by Filter: 131
    Planning time: 0.128 ms
    Execution time: 856.470 ms
    ```
    
    #### After & with `NULL`
    
    ```
    Aggregate  (cost=68819.95..68819.96 rows=1 width=8) (actual time=583.355..583.355 rows=1 loops=1)
      ->  Index Only Scan using index_lfs_objects_on_file_store on lfs_objects  (cost=0.43..61688.35 rows=2852643 width=0) (actual time=0.028..399.177 rows=2852607 loops=1)
            Filter: ((file_store = 1) OR (file_store IS NULL))
            Rows Removed by Filter: 131
            Heap Fetches: 867
    Planning time: 0.096 ms
    Execution time: 583.404 ms
    ```
    
    #### After, without `NULL`
    
    ```
    Aggregate  (cost=68817.29..68817.30 rows=1 width=8) (actual time=490.550..490.551 rows=1 loops=1)
      ->  Index Only Scan using index_lfs_objects_on_file_store on lfs_objects  (cost=0.43..61685.68 rows=2852643 width=0) (actual time=0.040..311.760 rows=2852607 loops=1)
            Index Cond: (file_store = 1)
            Heap Fetches: 831
    Planning time: 0.294 ms
    Execution time: 490.590 ms
    ```
    
    Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/6067