internal/postgres: add DISTINCT to version subquery
internal/postgres: add DISTINCT to version subquery

Add DISTINCT to the subquery in getPackageVersions.

This seems to speed up the query significantly when there are many
versions. However, it's very hard to test because running the query
once fills up caches, so subsequent runs are fast.

In any case, this should make a difference, because

  SELECT v1_path FROM packages WHERE path = 'github.com/hortonworks/cb-cli'

returns 2991 rows, all of which are identical.

See b/139466710.

Change-Id: Ic6178637758814963bb40ffd1069485dfb25503d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/537585
Reviewed-by: Julie Qiu <e6cb64861edcc38971590ff27c111e0e672de045@google.com>

golang/pkgsite,golang/pkgsite,golang/pkgsite,golang/pkgsite