Skip to content

Expose source_url in API::Entities::BulkImport

George Koltsov requested to merge georgekoltsov/export-source-url-in-dt-api into master

What does this MR do and why?

This MR adds source_url attribute to API::Entities::BulkImport which is fetched via BulkImports::Configiration#url.

Mentions #462998 (closed)

SQL Query

finder = BulkImports::ImportsFinder.new(user: User.first, params: { include_configuration: true}) finder.execute

# existing, unchanged query to load imports
SELECT "bulk_imports".* FROM "bulk_imports" WHERE "bulk_imports"."user_id" = 1

# new query to load configurations
SELECT "bulk_import_configurations".* FROM "bulk_import_configurations" WHERE "bulk_import_configurations"."bulk_import_id" IN (1, 3, 4, 5, 6)

Execution plan (picked 200 configurations as an example)

explain SELECT "bulk_import_configurations".* FROM "bulk_import_configurations" WHERE "bulk_import_configurations"."bulk_import_id" IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200)

 Index Scan using index_bulk_import_configurations_on_bulk_import_id on public.bulk_import_configurations  (cost=0.29..147.58 rows=200 width=180) (actual time=0.023..2.017 rows=164 loops=1)
   Index Cond: (bulk_import_configurations.bulk_import_id = ANY ('{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200}'::integer[]))
   Buffers: shared hit=417 read=4
   I/O Timings: read=1.784 write=0.000

Recommendations:
 Looks good
Summary:

  
Time: 3.217 ms  
  - planning: 1.138 ms  
  - execution: 2.079 ms  
    - I/O read: 1.784 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 417 (~3.30 MiB) from the buffer pool  
  - reads: 4 (~32.00 KiB) from the OS file cache, including disk I/O  
  - dirtied: 0  
  - writes: 0  

Query plan link: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/30240/commands/93809

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

image

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by George Koltsov

Merge request reports

Loading