sudo gitlab-psql -d gitlabhq_production -c "SELECT count(*) FROM users;"

Category: GitLab

sudo gitlab-psql -d gitlabhq_production -c "SELECT count(*) FROM users;"

Run one SQL query against GitLab's database

Executes the count query against the production database and exits, which is handy for quick checks without an interactive session. The -c flag takes a single SQL statement. Wrap complex queries in a heredoc or file instead.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.