ruby on rails - Heroku Postgres query speed sanity check. Am I doing it wrong? -


i'm running rails website on heroku , doing performance profiling , improvements.

i wondering if experience profiling postgres performance on heroku tell me if i'm doing wrong or if database call can expected slow.

this select on table called cities has 3000 rows. there index on country_id.

here's image showing profiling of slow call

if can read image, you'll see i'm calling select name, slug,... "cities" "cities"."country_id" = 151.

this call (in production on heroku) took 14.739 seconds according miniprofiler. call seems take anywhere 2 seconds 25 seconds correlation between number of cities country has (between 2 , around 50). in development takes fraction of second.

i'm running heroku hosted postgres on $10 plan.

right i'm thinking ajax-loading content call used on page, still makes no sense me shoiuld taking long.

anyone have ideas?

for reference, site can found @ www.istorical.com , call took place when loading www.istorical.com/countries/russia

if hit actual site, might find doesn't take long load, that's because call made when cache expired page.

edit: here's explain (analyze,verbose,buffers) of query.

run more explain analyse tests, if come out 1 it's not database. query taking 20ms.

if other queries seem ok, it's not general database connection.

is on page communicating remote server - fetching data/images etc?


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -