Share, Vote, & Discuss Ideas

We're constantly looking for new ways to improve our products and are asking you to help us by sharing your own ideas, voting for ideas you like, and discussing them with the rest of the community.

Command line flag to return number of results instead of the list

There are a lot of times when I want to know the number of rows of data, as opposed to the rows themselves. For example, if I want to know how many users I have, or how many clients or branches, I have to run the appropriate command and feed the output to something like 'wc -l' to get a total. It would be very useful to have a --count flag that just returns the number of results but not the actual data. It would be a much lighter operation to just query the database for the row count and not have to retrieve the data and send it to the client, possibly over a slow WAN connection.

  • Guest
  • May 7 2018
  • Attach files
  • Jan Schormann commented
    May 08, 2018 07:07

    I wonder if it would also be possible for this kind of query to ignore the MaxResults limits. For example, we have our server set up to reject any query that affects more than 600000 rows. Sometimes I want to count occurrences of a pattern in a depot, and currently there are times when I have to carefully split the query and add up numbers later. It would be helpful for the `--count` feature to work without a limit, or a different configurable limit, even for `p4 grep`.