Skip to content

update example queries #363

Description

@smola

Some gitbase-web examples look outdated, not using simplest syntax or not the most performance one. This needs a review by the gitbase devs to have optimal examples.

Example:

/* Commits per committer, each month of 2018, for each repository */
SELECT COUNT(*) as num_commits, month, repository_id, committer_name, committer_email
FROM ( SELECT MONTH(committer_when) as month,
              r.repository_id,
              committer_name,
              committer_email
    FROM ref_commits r
    INNER JOIN commits c
        ON YEAR(c.committer_when) = 2018 AND r.commit_hash = c.commit_hash
    WHERE r.ref_name = 'HEAD'
) as t GROUP BY committer_email, committer_name, month, repository_id

Shouldn't that be a NATURAL JOIN? Shouldn't the YEAR condition be in WHERE?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions