Style formating of multiline query, advise
Marco Mariani
marco at sferacarta.com
Thu Mar 19 05:26:32 EDT 2009
someone wrote:
>> Also, for SQL, (A) why are you using nested joins?, and
>
> inner select produce smaller set which is then joined with other
> table, kind a optimization
Did you time it?
I've done some "kind of a optimization" that slowed queries by tenfold,
because postgres didn't need my advice, and knew better. RDBMS
performance is non-intuitive, really. If you're using mysql, YMMV,
because its optimizer is not as good.
> Yes, my original question was about formatting. It's not original
> query (only a part).
Try this:
http://www.dpriver.com/pp/sqlformat.htm
My 2c: I use textwrap.dedent to strip leading spaces from every line.
More information about the Python-list
mailing list