paypal/hera

Improve Sharding SQL Rewrite

ModEtchFill opened this issue · 3 comments

What I Did
With shard key name set to acct_id, I ran queries with SELECT id, note, scuttle_id FROM someTable WHERE id=:id and acct_id=:acct_id.

What I Expect
I'd like the SQL rewrite to add scuttle_id to the above query even though we accidentally put scuttle_id as a column to fetch.

and acct_id=:acct_id and scuttle_id=:scuttle_id

What I Saw Instead
The sql was not rewritten, causing suboptimal table scans with oracleworker.

I think the commit was rolled back.

We'll want to have errors, esp. in Hera deployments for application developers.

#167 generates an error when scuttle_id is in the select column set.

Merge sql statements aren't supported. Subqueries barely work since the predicates can be in the inner or outer queries.