americanpanorama / panorama-foreignborn

Foreign-Born Population 1850-2010
8 stars 2 forks source link

Improve the response time of the data when making new selections #13

Closed almccon closed 8 years ago

ebrelsford commented 8 years ago

I've found that changing the query on this line by removing RTRIM() makes the query ~2x faster, which makes the transition happen that much faster when clicking on counties.

Is this something we can take care of on the table itself (UPDATEing nhgis_join with RTRIM(nhgis_join))? I'd be curious to also try adding an index on the nhgis_join column to see how that affects response time.

ebrelsford commented 8 years ago

Between 04bfea88 and the index on nhgis_join that I added (CREATE INDEX idx_site_foreignborn_county_breakdowns_materialized_nhgis_join ON site_foreignborn_county_breakdowns_materialized (nhgis_join)), selecting a new county is between 2 and 3x faster.

ebrelsford commented 8 years ago

@almccon Any selections I'm missing that should be speedier?

almccon commented 8 years ago

Wow, feels much faster to me! So you didn't need to remove the RTRIM() then, and just improved it with the index?

ebrelsford commented 8 years ago

@almccon I did both removing RTRIM() and adding the index, but the index is the big improvement here. I'm not sure if the RTRIM-less version is live, but it's slightly quicker.

emilyhobson commented 8 years ago

Closed?

ebrelsford commented 8 years ago

I'd be okay with closing it, @almccon do you think it's quick enough now or is there anything else I should look at?