Tag Info

New answers tagged

0

YMMV. Views sometimes fail to do the same optimizations, leading to slower execution than performing the SELECT directly. Since your case is straight forward, probably you will incur no noticeable overhead. INSERTs through a VIEW have limitations; sounds like you won't hit them. Read the manual. JOINs is a place where the optimizer may drop the ball; ...


0

You have 3 different instances of tables aliased as pm. Your "minor" change changed from using one instance to another.


1

I'm surprised that this query actually works. You're using the same aliases three times. You can access the outer tables in a subquery, you know? That's one of the reasons why aliases are actually there, to distinguish tables when used multiple times. First I would recommend, that you're using the join syntax introduced with the ANSI SQL standard from 1992 ...


0

Looks like in the name of alises you also seem to ignoring the join wp_postmeta as pm, wp_terms AS t! So my guess is non-existence of index is causing the delay, but you can confirm by posting explain plan and/or table definitions. SELECT DISTINCT pm.meta_value FROM wp_postmeta as pm, wp_terms AS t WHERE meta_key='company' AND pm.meta_value=t.term_id ...


1

It's more readable if you use a derived table. No need for 4 SELECT clauses, just 2. Plus, it's proper SQL, not some fancy feature that MySQL or Access has added: SELECT InvoiceNumber, CalcField1, CalcField2, (CalcField1 - CalcField2) / CalcField2 AS Percentage FROM ( SELECT InvoiceNumber, Field1 + Field2 AS ...



Top 50 recent answers are included