Skip to content
Snippets Groups Projects

Add unique index to system note metadata

Merged Stan Hu requested to merge sh-add-index-to-system-note-metadata into master
All threads resolved!

In issue 1, the sequential scan was taking 250+ ms.

See #30885 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • username-removed-443319 resolved all discussions

    resolved all discussions

  • Thanks @stanhu, this would definitely have got worse and worse. There shouldn't be any duplicates, but shouldn't your query check against note_id? I think this could indeed use a unique index. cc @jarka

  • Yep, the index can be unique. I don't expect any duplicates (something is probably wrong if there were some) however the query should really check note_id

  • Author Maintainer

    Good call. That's what I get for trying to do this late at night:

    gitlabhq_production=# SELECT note_id, COUNT(note_id) FROM system_note_metadata GROUP BY id HAVING COUNT(note_id) > 1;
     note_id | count 
    ---------+-------
    (0 rows)
  • Stan Hu added 18 commits

    added 18 commits

    Compare with previous version

  • Stan Hu changed title from Add index to system note metadata to Add unique index to system note metadata

    changed title from Add index to system note metadata to Add unique index to system note metadata

  • assigned to @smcgivern

  • username-removed-443319 approved this merge request

    approved this merge request

  • username-removed-443319 enabled an automatic merge when the pipeline for 3f0054a8 succeeds

    enabled an automatic merge when the pipeline for 3f0054a8 succeeds

  • mentioned in commit 28c63ce3

  • Picked into 9-1-stable, will go into 9.1.0-rc6

  • mentioned in commit 715d6813

  • Please register or sign in to reply
    Loading