COLOR_RED=`echo -en 'e[31m'` COLOR_YELLOW=`echo -en 'e[93m'` COLOR_RESET=`echo -en 'e[00m'` alias querylog="tail -f /var/www/bnt/Public/application/logs/queries.log | sed -E 's/(where|intersect|temp|filesort)/$COLOR_RED1$COLOR_RESET/g'"
MySQL optimizer rewrites uncorrelated subqueries (when the inner query does NOT use fields of the outer query) as correlated query, with perrformances of quadratic order rather than linear.
If the inner query does not use a WHERE with fields on the outer query, rewrite it as a JOIN
The problem is that, for a statement that uses an IN subquery, the optimizer rewrites it as a correlated subquery. Consider the following statement that uses an uncorrelated subquery:
SELECT … FROM t1 WHERE t1.a IN (SELECT b FROM t2);
The optimizer rewrites the statement to a correlated subquery:
SELECT … FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.b = t1.a);
If the inner and outer queries return M and N rows, respectively, the execution time becomes on the order of O(M×N), rather than O(M+N) as it would be for an uncorrelated subquery.
Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz allowing people “to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)”. The language takes many cues from existing conventions for marking up plain text in email.
This report shows the usage statistics and market share data of PHP on the web
I’m testing a class that is calling a method twice and with different parameters. I want to assert that this method (addSourceLinkAndUpdateCounts) is called twice and with different argument for each call.
The matcher to use is the “InvokedAtIndex”. See PHPUnit 3.6 documentation
Following, an example (the method addSourceLinkAndUpdateCounts is mocked and I assert that is called twice. The first time with arguments (http://www.link1.com, 12), and the second time with arguments (http://www.link2.com, 12)
// assert save function is called twice and with the two args $this->object ->expects($this->exactly(2)) ->method('addSourceLinkAndUpdateCounts') ; // assert calls return the two links $this->object ->expects($this->at(1)) ->method('addSourceLinkAndUpdateCounts') ->with('http://www.link1.com', 12) ; $this->object ->expects($this->at(2)) ->method('addSourceLinkAndUpdateCounts') ->with('http://www.link2.com', 12) ;
Clean code talks about testing, by Google