Style formating of multiline query, advise

someone petshmidt at googlemail.com
Thu Mar 19 06:01:13 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 done some "kind of a optimization" that slowed queries by tenfold,
> because postgres didn't need my advice, and knew better. RDBMS

Query itself is fast. I'll try to time it and will report my results
here :)

> performance is non-intuitive, really. If you're using mysql, YMMV,
> because its optimizer is not as good.

That's true, I don't trust optimizer

>
> > 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.

textwrap.dedent? What's that? I'm new in python. Will google it.
How do your query formatting looks like then?



More information about the Python-list mailing list