example
- Code: Select all
00:01:01:974 6 00:10:329 Load foundset
select count(distinct article.id) as n from article left outer join article_group article_group on article.article_group_id=article_group.id and article_group.administration_id = ? left outer join article_main_group article_main_group on article_group.article_main_group_id=article_main_group.id and article_main_group.administration_id = ? where article.deleted = ? and article.vat != ? and article_group.id is not null and article_group.deleted = ? and article_main_group.id is not null and article_main_group.deleted = ? and article.deleted = ? and not exists (select article1.id from article article1 where article1.id not in (SELECT article1.id FROM article article1 WHERE article1.deleted = false AND ( article1.blocked = false OR article1.blocked = true AND ( im_blocked_month(article1.blocked_from) <= im_blocked_month(article1.blocked_to) AND ( im_make_blocked_date(article1.blocked_from, 0) > im_now() OR im_make_blocked_date(article1.blocked_to, 0) < im_now()) OR im_blocked_month(article1.blocked_from) > im_blocked_month(article1.blocked_to) AND im_make_blocked_date(article1.blocked_from, 0) > im_now() AND im_make_blocked_date(article1.blocked_to, 0) < im_now()))) and not exists (select article_price.article_id from article_price where article_price.block_caused_by_supplier = ? and article_price.customer_id is not null and article_price.deleted = ? and article_price.blocked = ? and article_price.customer_id = ? and article_price.article_id = article1.id and (article_price.customer_id = ? or article_price.customer_id is null) and article_price.administration_id = ?) and article1.id = article.id and article1.administration_id = ?) and not exists (select article_price1.article_id from article_price article_price1 where article_price1.customer_id is not null and article_price1.deleted = ? and article_price1.blocked = ? and article_price1.customer_id = ? and article_price1.article_id = article.id and (article_price1.customer_id = ? or article_price1.customer_id is null) and article_price1.administration_id = ?) and exists (select article_price2.article_id from article_price article_price2 where article_price2.customer_id = ? and article_price2.blocked = ? and article_price2.article_id = article.id and (article_price2.customer_id = ? or article_price2.customer_id is null) and article_price2.administration_id = ?) and article_main_group.id = ANY(?) and article.extra != ? and article.administration_id = ? limit ?
As seen above this is a query generated by servoy to load the count of a foundset.
If i remove the limit from this query it goes from 10 seconds to 200ms and results in the same value. Postgres is not a big fan of LIMIT statements in a count query so i wonder what makes servoy do this and if this could be disabled.