May 25, 2012

Post: Avoiding auto-increment holes on InnoDB with INSERT IGNORE

… a value using a LEFT OUTER JOIN: insert into foo(name) select 1 from mutex left outer join foo on foo.name=1 where… IGNORE: insert into foo(name) select 1 from mutex left outer join foo on foo.name=1 where mutex.i = 1 and… sec) insert into foo(name) select 1 from mutex left outer join foo on foo.name=1 where mutex.i = 1 and…

Post: Eventual Consistency in MySQL

… orphaned rows in Bar: SELECT Bar.ID FROM Bar LEFT OUTER JOIN Foo ON (Bar.X,Bar.Y) = (Foo.A,Foo.B….TABLE_SCHEMA, ‘.’, K.TABLE_NAME, ‘ AS ‘, K.CONSTRAINT_NAME, ‘ ‘, ‘LEFT OUTER JOIN ‘, K.REFERENCED_TABLE_SCHEMA, ‘.’, K.REFERENCED_TABLE_NAME, ‘ AS ‘, K….Bar.ID` FROM test.Bar AS Bar_ibfk_1 LEFT OUTER JOIN test.Foo AS Foo ON (Bar_ibfk_1.X,Bar…

Comment: Is there a performance difference between JOIN and WHERE?

… INNER JOIN! Period!” (I argued once with someone who was claiming that and his “proof” was also “they told me”). Using outer joins without need is rare mistake among people who start learning joins with comma syntax. When comma… “join” is full list of all possible join types before even they come to the idea why joins are necessary at all. (Inner, outer

Post: Using Flexviews - part one, introduction to materialized views

… add indexes to the MV. Since the data is already joined together and pre-aggregated, CPU and memory usage may be… space (similar to ALTER TABLE) Supports all SQL syntax (like outer join) but can’t be refreshed to a specific point in… work. And some drawbacks: Not all SQL syntax supported (no outer join), no non-deterministic functions, etc. There is overhead for change…

Comment: Is there a performance difference between JOIN and WHERE?

Sorry, but the point that INNER JOIN might need to be rewritten to OUTER JOIN at some point is the weakest argument possible. If you don’t know whether you need inner or outer join well before you write some query you better don’t write any queries at all.

Comment: Multi-Column IN clause - Unexpected MySQL Issue

… that when we use IN clause, MySQL first executes the outer query i.e. the PRIMARY query as shown in the… executes the inner subquery. To bypass this problem I used JOIN and the execution time reduced drastically from few seconds to… outer join 106pages.106pages as t2 on t1.url = t2.url WHERE t2.url_crc IN ((2752937066,3799762538); I have used self join

Post: Flexviews - part 3 - improving query performance using materialized views

… the SQL features available to SELECT statements. Refresh type Aggregation Outer join All SQL functions Built using SQL Requires FlexCDC COMPLETE Y… mview_table_schema: demo mview_table_alias: o mview_join_condition: NULL mview_join_order: 999 *************************** 2. row *************************** mview_table_id: 28…

Post: EXPLAIN EXTENDED can tell you all kinds of interesting things

… | Note | 1003 | select ’0′ AS `c1` from `test`.`j1` join `test`.`j2` join `test`.`j3` where 0 | +——-+——+——————————————————————————-+ 1 row in set (0… contains no rows, and it is not used in an OUTER JOIN, then MySQL can immediately return an empty set because it…

Comment: Why MySQL could be slow with large tables ?

…). My queries are complex and involves a quite a few joins (due to the normalisation) and multiple subqueries (due to nature… PC) (select a, join b, where c…) eg: select a.a, b.x, etc.. from (select … .. ) a left outer join (select … ) b on b.a = a.a etc.. (in total I have like close to 11 subqueries joining a min…

Comment: Is there a performance difference between JOIN and WHERE?

… A.id = B.id and A.x=123; But, the join syntax will help it to be more flexible when necessary. Consider this for instance: SELECT * FROM A INNER JOIN B ON A.id = B.id WHERE A.x=123… tables should be in-place, the JOIN is more preferred: SELECT * FROM A LEFT OUTER JOIN B ON A.id=B.id WHERE…