Read about our upcoming Code of Conduct on this issue

  1. 28 Nov, 2019 1 commit
  2. 18 Oct, 2019 1 commit
  3. 09 Oct, 2019 1 commit
  4. 06 Mar, 2019 1 commit
  5. 05 Nov, 2018 1 commit
    • Yorick Peterse's avatar
      Rewrite SnippetsFinder to improve performance · b81102d2d9a4
      Yorick Peterse authored
      This completely rewrites the SnippetsFinder class from the ground up in
      order to improve its performance. The old code was beyond salvaging. It
      was complex, included various Rails 5 workarounds, comments that
      shouldn't be necessary, and most important of all: it produced a really
      poorly performing database query.
      As a result, I opted for rewriting the finder from scratch, instead of
      trying to patch the existing code. Instead of trying to reuse as many
      existing methods as possible, I opted for defining new methods
      specifically meant for the SnippetsFinder. This requires some extra code
      here and there, but allows us to have much more control over the
      resulting SQL queries. It is these changes that then allow us to produce
      a _much_ more efficient query.
      To illustrate how bad the old query was, we will use my own snippets as
      an example. Currently I have 52 snippets, most of which are global ones.
      To retrieve these, you would run the following Ruby code:
          user = User.find_by(username: 'yorickpeterse')
, author: user).execute
      On the resulting query will take between 10 and 15 seconds to
      run, producing the query plan found at Apart from the long execution time,
      the total number of buffers (the sum of all shared hits) is around 185
      GB, though the real number is probably (hopefully) much lower as I doubt
      simply summing these numbers produces the true total number of buffers
      The new query's plan can be found at,
      and this query takes between 10 and 100-ish milliseconds to run. The
      total number of buffers used is only about 30 MB.
  6. 31 Oct, 2018 1 commit
  7. 17 Sep, 2018 1 commit
    • Yorick Peterse's avatar
      Added FromUnion to easily select from a UNION · 84f6b869d148
      Yorick Peterse authored
      This commit adds the module `FromUnion`, which provides the class method
      `from_union`. This simplifies the process of selecting data from the
      result of a UNION, and reduces the likelihood of making mistakes. As a
      result, instead of this:
          union =[foo, bar])
          Foo.from("(#{union.to_sql}) #{Foo.table_name}")
      We can now write this instead:
          Foo.from_union([foo, bar])
      This commit also includes some changes to make this new setup work
      properly. For example, a bug in Rails 4
      ( would break the use of
      `from("sub-query-here").includes(:relation)` in certain cases. There was
      also a CI query which appeared to repeat a lot of conditions from an
      outer query on an inner query, which isn't necessary.
      Finally, we include a RuboCop cop to ensure developers use this new
      module, instead of using Gitlab::SQL::Union directly.
  8. 11 Sep, 2018 2 commits
  9. 14 Jun, 2018 1 commit
  10. 02 Mar, 2018 4 commits
  11. 22 Feb, 2018 1 commit
  12. 20 Feb, 2018 4 commits
  13. 09 Feb, 2018 1 commit
    • Douwe Maan's avatar
      Merge branch... · cad0ef2e1088
      Douwe Maan authored
      Merge branch 'security-10-4-25223-snippets-finder-doesnt-obey-feature-visibility' into 'security-10-4'
      [Port for security-10-4]: Makes SnippetFinder ensure feature visibility
  14. 06 Feb, 2018 1 commit
  15. 10 May, 2017 1 commit
  16. 10 Dec, 2016 3 commits
  17. 01 Dec, 2016 1 commit
  18. 16 Jun, 2016 2 commits
  19. 13 Jun, 2016 1 commit
  20. 25 Apr, 2016 1 commit
  21. 05 Mar, 2016 1 commit
  22. 03 Feb, 2015 1 commit
  23. 24 Oct, 2014 1 commit
  24. 13 Oct, 2014 1 commit
  25. 09 Oct, 2014 1 commit