Category: | Bug report |
Priority: | Urgent |
Status: | New |
Project: | Severity: | Block |
Resolution: | Open |
|
Component: | Reproducibility: | N/A |
Assigned to: |
The first query the system executes after the topic is selected is:
-
Query
select "public_ahrange"."todate" as "public_ahrange_todate"
from "public"."ahperson" "public_ahperson"
inner join "public"."ahcompanyid" "public_ahcompanyid" on ("public_ahperson"."companyid" = "public_ahcompanyid"."companyid")
inner join "public"."ahrange" "public_ahrange" on ("public_ahperson"."asofdate" = "public_ahrange"."todate")
where ("public_ahcompanyid"."username" in ('X27'))
group by "public_ahrange"."todate"
order by "public_ahrange_todate"
In this query, todate is a measure (we tried it as a Field and get the same result). Since todate has thousands of values the query takes a very long time.
Then it executes:
-
Query
select "public_ahrange"."fromdate" as "public_ahrange_fromdate"
from "public"."ahperson" "public_ahperson"
inner join "public"."ahcompanyid" "public_ahcompanyid" on ("public_ahperson"."companyid" = "public_ahcompanyid"."companyid")
inner join "public"."ahrange" "public_ahrange" on ("public_ahperson"."asofdate" = "public_ahrange"."todate")
where ("public_ahcompanyid"."username" in ('X27'))
It executs this query twice for some reason. An then executes the first query again.
ToDate and FromDate both have input controls, so then it executes:
Query
select "public_ahrange"."fromdate" as "public_ahrange_fromdate",
"public_ahrange"."todate" as "public_ahrange_todate"
from "public"."ahperson" "public_ahperson"
inner join "public"."ahcompanyid" "public_ahcompanyid" on ("public_ahperson"."companyid" = "public_ahcompanyid"."companyid")
inner join "public"."ahrange" "public_ahrange" on ("public_ahperson"."asofdate" = "public_ahrange"."todate")
where ("public_ahcompanyid"."username" in ('X27')) and "public_ahrange"."todate" is null and "public_ahrange"."fromdate" is null
limit 1000
Which uses the input filters and runs quicly.
Is there no way to stop it doing all these pre-fetches for columns that that can have hughe numbers of values?
With these pre-fetches the system is unusable.