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

"Repeated 1 times" #24

Open
peterbe opened this issue Sep 20, 2019 · 5 comments
Open

"Repeated 1 times" #24

peterbe opened this issue Sep 20, 2019 · 5 comments
Milestone

Comments

@peterbe
Copy link

peterbe commented Sep 20, 2019

It prints this:

web_1            | Repeated 1 times.
web_1            | SELECT `django_session`.`session_key`,
web_1            | `django_session`.`session_data`, `django_session`.`expire_date` FROM
web_1            | `django_session` WHERE (`django_session`.`session_key` =
web_1            | 'cln2uzh2qk21qqb6sfg7nvsrqwg2crbm' AND `django_session`.`expire_date`
web_1            | > '2019-09-20 12:53:39.352699')

But I think it actually ever happens 1 time for that request.
So, the logic for this inclusion should be something like [query for queries if query.times > 1].

@peterbe
Copy link
Author

peterbe commented Sep 20, 2019

Also, fixing this would be we don't need to correct the excessive plural s on times.

@peterbe
Copy link
Author

peterbe commented Sep 20, 2019

Perhaps here it could instead do:

    def _duplicate_queries(self, output):
        """Appends the most common duplicate queries to the given output."""
        if QC_SETTINGS['DISPLAY_DUPLICATES']:
            for query, count in self.queries.most_common(QC_SETTINGS['DISPLAY_DUPLICATES']):
                if count <= 1:
                    continue
                lines = ['\nRepeated {0} times.'.format(count)]
          ...

@morlandi
Copy link

morlandi commented Mar 6, 2020

Maybe "Executed" would be more appropriate than "Repeated", but please note that sometimes it is useful to dump all queries. With the current implementation, this can easily be achieved by setting a big value for the DISPLAY_DUPLICATES setting

@kevinrenskers
Copy link

I've just included this project into my Django app, and I was extremely surprised when I saw a whole bunch of queries show up saying they were repeated 1 time, when really the total count is 1. "Repeated 1 time" means that the query was executed twice, right? So maybe it's just a matter of improving the wording that's used, so don't say "repeated" but "executed" or something.

@bradmontgomery bradmontgomery added this to the 0.9.0 Release milestone Dec 12, 2022
@bradmontgomery
Copy link
Owner

Agreed that there's some work to do here. I've added this to the next release milestone & hope to sprint on it over the next few weeks.

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

4 participants