Closed GoogleCodeExporter closed 9 years ago
I should also mention that I am using H2 1.2.147.
Original comment by pwagl...@gmail.com
on 26 Feb 2011 at 1:47
I have also tested with 1.3.151. This has essentially the same result. The
results that I get from explain analyse, using a simplified form of the query
to remove a couple of tables from the inner query are:
/*
total: 3849250
TEST4.TEST41 read: 101136 (2%)
TEST4.TEST4_DATA read: 3738316 (97%)
TEST1.TEST1_DATA read: 9603 (0%)
TEST3.TEST3_DATA read: 195 (0%)
*/
Original comment by pwagl...@gmail.com
on 26 Feb 2011 at 2:12
Oddly enough, when I create the index over fields T1 and T4 on table Test4,
thus making the exists cheaper, the query plan inverts again, and decides to
check the fields NAME and VERSION before doing the exists clause. Not sure if
this helps, but I figure all information is good ;-)
Original comment by pwagl...@gmail.com
on 26 Feb 2011 at 2:54
I think I know what the problem is.
AND conditions are re-ordered based on the expected cost (ConditionAndOr). And
the expected cost of an EXISTS is always at last 8 points higher than the
expected cost of a simple comparison. However, the cost for EXISTS is converted
from the cost of the subquery (which is a double) to int. If the expected cost
is very high, then this conversion will result in a expected cost below 0... So
the EXISTS is evaluated first.
Original comment by thomas.t...@gmail.com
on 26 Feb 2011 at 11:57
That would make a lot of sense, and would also explain why adding in the index
to make the query "faster" moves it lower down in the pecking order. I will
test the patch when it is available, of if you can let me know where the
conversion is done I can put in the "too large, peg to MAX_INT' check and
verify that it works.
Original comment by pwagl...@gmail.com
on 26 Feb 2011 at 12:55
This is now committed in the trunk, see revision 3444.
Original comment by thomas.t...@gmail.com
on 26 Feb 2011 at 4:55
I have tested using revision 3445, which appears to have another fix related to
this ticket, and it indeed works as advertised. Many thanks. My query went from
~400seconds execution to 0.01seconds! ;-)
Is there any chance of getting this fix in a stable release soon?
Original comment by pwagl...@gmail.com
on 27 Feb 2011 at 11:39
I should probably also explain the reasoning behind my request… my company
has a policy of only using released, stable versions of the 3rd party s
Original comment by pwagl...@gmail.com
on 27 Feb 2011 at 12:06
I should probably also explain the reasoning behind my request… my company
has a policy of only using released, stable versions of the 3rd party software
that we include. Since we are not using the mvcc options, this slow query has a
tendency of licking the entire database, and hence most of the ui, for almost 7
minutes while this query is running. Unfortunately, this query runs every
fifteen minutes or so…. Fortunately, it only happens when one of the tables
gets very large, with a large associated cost, hence the reason we have only
recently seen it.
Original comment by pwagl...@gmail.com
on 27 Feb 2011 at 12:11
My plan is to release a new version (still beta) next week, and then then
another version (no longer beta) in about two weeks.
Original comment by thomas.t...@gmail.com
on 27 Feb 2011 at 1:36
Fixed in version 1.3.152
Original comment by thomas.t...@gmail.com
on 1 Mar 2011 at 8:06
Thanks again for the fix! Works perfectly.
Original comment by pwagl...@gmail.com
on 17 Mar 2011 at 9:26
Original issue reported on code.google.com by
pwagl...@gmail.com
on 26 Feb 2011 at 1:46