Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Everybody who reads the query knows how it will work. You don't need to see the query plan.

No, we don't. Is there an index join between any of the tables? Is there an index on the name in some fashion and/or on the zip code. All we know is that this query can _probably_ not be answered by index only. What's the relative sizes of the tables (even that's not entirely clear)? Are any tables clustered by the filter criteria?

You wouldn't know and if you think you do, you should read up on possible access plans in modern database systems.



There are only 1,681 voting precincts. And only a couple of parties.

So an index on the join is completely irrelevant.

There are also under a million voters. Even with no indexes at all this query will perform just fine.

Because of the where and the left join there's pretty much just one possible access plan.

Criticize the lack of bound parameters and other problems if you like, but the query itself is perfectly fine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: