Re: Whose Fish? RDBMS Solution



Jordan Marr <jnmarr@xxxxxxxxxxx> writes:

I decided to try this, as an SQL exercise. I took
me a couple of hours to get right, and I'm not entirely
happy with my solution, so I'm going to post the entire
thing. Comments are interspersed, especially where I think
I've done something particularly awkward. I'd appreciate
any suggestions you may have on how to make this solution
cleaner, or even on completely different (yet still legal
SQL) approaches.

Nice job Mark! That is a very creative solution!
How long does it take to process?


Thank you. Good fun.

The whole thing takes about 6 seconds; about half
in disk I/O in the (tiny) CREATE TABLEs at the
beginning, and half in the giant SELECT that finds
the answer.

(Measured on an elderly 2.5GHz Celeron machine running
PostgreSQL. Your mileage may vary.)

From looking at the query plan, if I were asked to
optimize the query, my best strategy is to change
my name and move to another country.


--
Mark Jeffcoat
Austin, TX
.