Style formating of multiline query, advise

someon petshmidt at googlemail.com
Mon Mar 23 07:46:49 EDT 2009


On Mar 19, 10:26 am, Marco Mariani <ma... at sferacarta.com> wrote:
> 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 did explain on both kinds of query (with nested select and
without) and query plan is identical to both. So, there is no
difference, well in PostGres


> 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