WebFaction
Community site: login faq

I have, on my WebFaction account, three instances of the same Django app, all hitting the same MySQL instance, but with three different databases. One of the three has probably multiple times the data size of the other two, but they're all small... The largest table has maybe a quarter of a million rows.

I just made a change to one query and it tested fine locally and I pushed it out.

One instance, the largest, returns results in well under a second. If I test the query directly I get results in about 160 ms.

On one of the smaller instances, the same query comes in at 6 seconds.

Checking "Explain" with both databases returns the exact same plan. I exported the schema for both (they should be the same, but it didn't hurt to check) and they're the same.

The quicker site is much busier than the slower site, so I thought maybe the database was caching data for it, but other searches in the smaller site comeback instantly.

Any pointers on how I should be diagnosing this would be appreciated.

asked 19 Dec '17, 02:08

leehinde
45111
accept rate: 0%


You would want to enable SQL logging in Django and profile the queries in SQL shell, this should tell you what is happening and why some things have different times.

permanent link

answered 19 Dec '17, 04:28

johns ♦♦
5.3k212
accept rate: 23%

edited 19 Dec '17, 04:29

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×901
×168

question asked: 19 Dec '17, 02:08

question was seen: 764 times

last updated: 19 Dec '17, 04:29

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM