I propose that any query longer than 2048 chars get truncated on the queries page #15

Merged
merged 1 commit into from Apr 6, 2012

Conversation

Projects
None yet
2 participants
Contributor

linked commented Apr 6, 2012

Really cool: Seeing all my queries with your awesome plugin!
Not so cool: Taking 5 whole minutes to scroll down 312.7ft of a mega-monstrosity-query just to see that it actually executed pretty quickly.

Anything longer than 2048 was probably not meant to be shown in it's entirety on your list page.

@linked linked Really cool: Seeing all my queries with your awesome plugin!
Not so cool: Taking 5 whole minutes to scroll down 312.7ft of a mega-monstrosity-query just to see that it actually executed pretty quickly.

I propose that any query longer than 2048 queries was probably not meant to be shown in it's entirety on your list page.
f80917f
Owner

colinhowe commented Apr 6, 2012

Sounds good! Out of interest, what does your query look like? I'm thinking of making it so that queries like:

SELECT * FROM product WHERE id IN (%s, %s, %s)

Becomes

SELECT * FROM product WHERE id IN ([%s]*)

Or similar, so that queries that are basically the same but with different numbers of IN get grouped up properly.

Just thinking that this might also solve your problem :)

@colinhowe colinhowe added a commit that referenced this pull request Apr 6, 2012

@colinhowe colinhowe Merge pull request #15 from linked/patch-1
I propose that any query longer than 2048 chars get truncated on the queries page
7dd47ae

@colinhowe colinhowe merged commit 7dd47ae into colinhowe:master Apr 6, 2012

Contributor

linked commented Apr 7, 2012

I downloaded your plugin because I was optimizing some very large datasets that I was doing get_or_create for; first, djangosampler showed me that it was taking absurd time, so I rewrote the query to a cursor.execute() (raw query) that looks like this --

"INSERT INTO table (id, col1, col2...) VALUES (1, a, b...) (2, a, b...) (3, a, b...) [ten thousand more of these] ON DUPLICATE KEY UPDATE col1=values(col1), ..."

So this got pretty ugly really fast, in terms of display on your /sampler/ pages but thankfully worked like a charm ;)

Contributor

linked commented Apr 7, 2012

No clue why you'd want it, but here's the code that generates the huge query :)
https://github.com/linked/django-easy-button/blob/master/easy/__init__.py

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