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

Make heatmap simplify queries when all items on one axis are selected #58

Open
mrblueblue opened this issue Jun 22, 2017 · 1 comment
Open

Comments

@mrblueblue
Copy link
Contributor

Currently when one selects a whole row or column (or multiple rows or columns) on a heatmap, DC calls crossfilter in a way that generates a filter for every cell. This can get really expensive even on our backend at scale.

See below for the query that is generated when one selects the origin state of CA on one axis of flights.

screen shot 2017-02-07 at 8 25 55 pm

"SELECT COUNT(*) as val FROM flights_123M WHERE (origin_state = 'CA' AND dest_state = 'AK' OR origin_state = 'CA' AND dest_state = 'AR' OR origin_state = 'CA' AND dest_state = 'AZ' OR origin_state = 'CA' AND dest_state = 'CA' OR origin_state = 'CA' AND dest_state = 'CO' OR origin_state = 'CA' AND dest_state = 'CT' OR origin_state = 'CA' AND dest_state = 'FL' OR origin_state = 'CA' AND dest_state = 'GA' OR origin_state = 'CA' AND dest_state = 'HI' OR origin_state = 'CA' AND dest_state = 'IA' OR origin_state = 'CA' AND dest_state = 'ID' OR origin_state = 'CA' AND dest_state = 'IL' OR origin_state = 'CA' AND dest_state = 'IN' OR origin_state = 'CA' AND dest_state = 'KS' OR origin_state = 'CA' AND dest_state = 'KY' OR origin_state = 'CA' AND dest_state = 'LA' OR origin_state = 'CA' AND dest_state = 'MA' OR origin_state = 'CA' AND dest_state = 'MD' OR origin_state = 'CA' AND dest_state = 'ME' OR origin_state = 'CA' AND dest_state = 'MI' OR origin_state = 'CA' AND dest_state = 'MN' OR origin_state = 'CA' AND dest_state = 'MO' OR origin_state = 'CA' AND dest_state = 'MT' OR origin_state = 'CA' AND dest_state = 'NC' OR origin_state = 'CA' AND dest_state = 'ND' OR origin_state = 'CA' AND dest_state = 'NE' OR origin_state = 'CA' AND dest_state = 'NJ' OR origin_state = 'CA' AND dest_state = 'NM' OR origin_state = 'CA' AND dest_state = 'NV' OR origin_state = 'CA' AND dest_state = 'NY' OR origin_state = 'CA' AND dest_state = 'OH' OR origin_state = 'CA' AND dest_state = 'OK' OR origin_state = 'CA' AND dest_state = 'OR' OR origin_state = 'CA' AND dest_state = 'PA' OR origin_state = 'CA' AND dest_state = 'PR' OR origin_state = 'CA' AND dest_state = 'SD' OR origin_state = 'CA' AND dest_state = 'TN' OR origin_state = 'CA' AND dest_state = 'TX' OR origin_state = 'CA' AND dest_state = 'UT' OR origin_state = 'CA' AND dest_state = 'VA' OR origin_state = 'CA' AND dest_state = 'WA' OR origin_state = 'CA' AND dest_state = 'WI' OR origin_state = 'CA' AND dest_state = 'WY');"

This query could just as be easily represented as WHERE origin_state = 'CA'. Multiple columns and rows selected could simply be (row_var = 'A' or row_var = 'B' or col_var = 'C' or col_var = 'D'). Would be good to scope what it would take (likely simple) in the heatmap chart in DC to generate these simpler (and more performant) queries.

@tmostak
Copy link
Contributor

tmostak commented Jun 22, 2017

I'd bump this task in priority since it will take a way for people to sledgehammer our backend. Should be quite simple.

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

No branches or pull requests

2 participants