Find a file
Toon Claes 1c481b7aac Enhance performance of counting local Uploads
Add an index to the `store` column on `uploads`. This makes counting
local uploads faster.

Also, there is no longer need to check for objects with `store = NULL`.
See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18557

---

### Query plans

Query:

```sql
SELECT COUNT(*)
FROM "uploads"
WHERE ("uploads"."store" = ? OR "uploads"."store" IS NULL)
```

#### Without index

```
gitlabhq_production=# EXPLAIN ANALYZE SELECT uploads.* FROM uploads WHERE (uploads.store = 1 OR uploads.store IS NULL);
                                                  QUERY PLAN
---------------------------------------------------------------------------------------------------------------
 Seq Scan on uploads  (cost=0.00..601729.54 rows=578 width=272) (actual time=6.170..2308.256 rows=545 loops=1)
   Filter: ((store = 1) OR (store IS NULL))
   Rows Removed by Filter: 4411957
 Planning time: 38.652 ms
 Execution time: 2308.454 ms
(5 rows)
```

#### Add index

```
gitlabhq_production=# create index uploads_tmp1 on uploads (store);
CREATE INDEX
```

#### With index

```
gitlabhq_production=# EXPLAIN ANALYZE SELECT uploads.* FROM uploads WHERE (uploads.store = 1 OR uploads.store IS NULL);
                                                          QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
 Bitmap Heap Scan on uploads  (cost=11.46..1238.88 rows=574 width=272) (actual time=0.155..0.577 rows=545 loops=1)
   Recheck Cond: ((store = 1) OR (store IS NULL))
   Heap Blocks: exact=217
   ->  BitmapOr  (cost=11.46..11.46 rows=574 width=0) (actual time=0.116..0.116 rows=0 loops=1)
         ->  Bitmap Index Scan on uploads_tmp1  (cost=0.00..8.74 rows=574 width=0) (actual time=0.095..0.095 rows=545 loops=1)
               Index Cond: (store = 1)
         ->  Bitmap Index Scan on uploads_tmp1  (cost=0.00..2.44 rows=1 width=0) (actual time=0.020..0.020 rows=0 loops=1)
               Index Cond: (store IS NULL)
 Planning time: 0.274 ms
 Execution time: 0.637 ms
(10 rows)
```

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/6070
2018-11-07 11:29:31 +01:00
.github
.gitlab
app Enhance performance of counting local Uploads 2018-11-07 11:29:31 +01:00
bin
builds
changelogs Enhance performance of counting local Uploads 2018-11-07 11:29:31 +01:00
config Merge branch 'dz-add-packages-to-yml' into 'master' 2018-11-06 15:05:44 +00:00
danger
db Enhance performance of counting local Uploads 2018-11-07 11:29:31 +01:00
doc Merge branch 'docs/fix-links-to-product-features' into 'master' 2018-11-07 10:13:50 +00:00
docker
fixtures/emojis
generator_templates
lib Merge branch 'winh-delayed-jobs-dynamic-timer' into 'master' 2018-11-07 10:27:54 +00:00
locale Merge branch 'winh-delayed-jobs-dynamic-timer' into 'master' 2018-11-07 10:27:54 +00:00
log
plugins/examples
public
qa Restore changes from: 2018-11-06 19:25:45 +08:00
rubocop
scripts Use CI_COMMIT_REF_SLUG when building assets image 2018-11-01 14:26:51 -05:00
shared
spec Enhance performance of counting local Uploads 2018-11-07 11:29:31 +01:00
symbol
tmp
vendor
.babelrc.js
.codeclimate.yml
.csscomb.json
.eslintignore
.eslintrc.yml
.foreman
.gitattributes Use merge_db_schema for db/schema.rb conflicts 2018-11-01 14:15:55 +01:00
.gitignore
.gitlab-ci.yml
.haml-lint.yml
.mailmap
.nvmrc
.pkgr.yml
.prettierignore
.prettierrc
.rubocop.yml
.rubocop_todo.yml
.ruby-version
.scss-lint.yml
CHANGELOG.md Update CHANGELOG.md for 11.4.5 2018-11-04 23:28:12 +00:00
config.ru
CONTRIBUTING.md
Dangerfile
docker-compose.yml
Dockerfile.assets
Gemfile
Gemfile.lock
Gemfile.rails5
Gemfile.rails5.lock
GITALY_SERVER_VERSION Bump Gitaly to 0.128.0 2018-11-05 12:05:19 +01:00
GITLAB_PAGES_VERSION
GITLAB_SHELL_VERSION
GITLAB_WORKHORSE_VERSION
INSTALLATION_TYPE
LICENSE
MAINTENANCE.md
package.json
PROCESS.md
Procfile
Rakefile
README.md
VERSION
yarn.lock

GitLab

Test coverage

  • Ruby coverage Ruby
  • JavaScript coverage JavaScript

Canonical source

The canonical source of GitLab Community Edition is hosted on GitLab.com.

Open source software to collaborate on code

To see how GitLab looks please see the features page on our website.

  • Manage Git repositories with fine grained access controls that keep your code secure
  • Perform code reviews and enhance collaboration with merge requests
  • Complete continuous integration (CI) and CD pipelines to builds, test, and deploy your applications
  • Each project can also have an issue tracker, issue board, and a wiki
  • Used by more than 100,000 organizations, GitLab is the most popular solution to manage Git repositories on-premises
  • Completely free and open source (MIT Expat license)

Hiring

We're hiring developers, support people, and production engineers all the time, please see our jobs page.

Editions

There are two editions of GitLab:

  • GitLab Community Edition (CE) is available freely under the MIT Expat license.
  • GitLab Enterprise Edition (EE) includes extra features that are more useful for organizations with more than 100 users. To use EE and get official support please become a subscriber.

Website

On about.gitlab.com you can find more information about:

Requirements

Please see the requirements documentation for system requirements and more information about the supported operating systems.

Installation

The recommended way to install GitLab is with the Omnibus packages on our package server. Compared to an installation from source, this is faster and less error prone. Just select your operating system, download the respective package (Debian or RPM) and install it using the system's package manager.

There are various other options to install GitLab, please refer to the installation page on the GitLab website for more information.

You can access a new installation with the login root and password 5iveL!fe, after login you are required to set a unique password.

Contributing

GitLab is an open source project and we are very happy to accept community contributions. Please refer to Contributing to GitLab page for more details.

Licensing

GitLab Community Edition (CE) is available freely under the MIT Expat license.

All third party components incorporated into the GitLab Software are licensed under the original license provided by the owner of the applicable component.

All Documentation content that resides under the doc/ directory of this repository is licensed under Creative Commons: CC BY-SA 4.0.

Install a development environment

To work on GitLab itself, we recommend setting up your development environment with the GitLab Development Kit. If you do not use the GitLab Development Kit you need to install and setup all the dependencies yourself, this is a lot of work and error prone. One small thing you also have to do when installing it yourself is to copy the example development unicorn configuration file:

cp config/unicorn.rb.example.development config/unicorn.rb

Instructions on how to start GitLab and how to run the tests can be found in the getting started section of the GitLab Development Kit.

Software stack

GitLab is a Ruby on Rails application that runs on the following software:

  • Ubuntu/Debian/CentOS/RHEL/OpenSUSE
  • Ruby (MRI) 2.4
  • Git 2.8.4+
  • Redis 2.8+
  • PostgreSQL (preferred) or MySQL

For more information please see the architecture documentation.

UX design

Please adhere to the UX Guide when creating designs and implementing code.

Third-party applications

There are a lot of third-party applications integrating with GitLab. These include GUI Git clients, mobile applications and API wrappers for various languages.

GitLab release cycle

For more information about the release process see the release documentation.

Upgrading

For upgrading information please see our update page.

Documentation

All documentation can be found on docs.gitlab.com/ce/.

Getting help

Please see Getting help for GitLab on our website for the many options to get help.

Why?

Read here

Is it any good?

Yes

Is it awesome?

These people seem to like it.