Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplier count(*) #1

Closed
rodo opened this issue Feb 3, 2016 · 2 comments
Closed

Simplier count(*) #1

rodo opened this issue Feb 3, 2016 · 2 comments

Comments

@rodo
Copy link

rodo commented Feb 3, 2016

In
https://github.com/jbranchaud/til/blob/master/postgres/count-records-by-type.md

I prefer select type, count(*) from table group by 1 as is if the elements counted are something like select substring(unnaccent(upper('firstname',1,2))) .... there are less character to type at the end of the command :)

@jbranchaud
Copy link
Owner

@rodo good tip! I also try to use the indexes when ordering.

@rodo
Copy link
Author

rodo commented Feb 4, 2016

It's just an alias, here if you have an index on type it will be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants