I use the following SELECT to create a view to get a total of jobs under a certain quote, and a total of jobs that have been completed.
I use the following query to get a list of all quotes under a new style (no set design_production_number) where the jobs have not been completed. It takes 20 seconds to run and currently returns 30 rows
A change of the last line to is not null does a search for the old style jobs, and returns 796 rows in about 3 seconds. Still too slow for my Users. I think I have a logical flaw as well, assuming that of the 2k+ quotes we've done we have only completed about half of them, (a quick investigation provides a few jobs worth £20k as uncompleted, hence unbilled) yet we re miraculously still in business. A colleague has suggested that I don't have logical errors but that a combination of scrubbing some bad data and bad data entry has resulted in a high error rate, but that can be fixed after the fact. I'm just after more speed.
Code:
select
h.quote_id as quote_id
, count(h.quote_id) as qcount
, count(c.HT_ID) as ccount
from HouseType as h
left join HTCheck as c on h.ht_id = c.HT_ID
group by h.quote_id
I use the following query to get a list of all quotes under a new style (no set design_production_number) where the jobs have not been completed. It takes 20 seconds to run and currently returns 30 rows
Code:
select distinct c.quote_id from CheckedQuotes as c
left join HouseType as h
on h.quote_id = c.quote
where qcount != ccount
and h.design_production_no is null;
A change of the last line to is not null does a search for the old style jobs, and returns 796 rows in about 3 seconds. Still too slow for my Users. I think I have a logical flaw as well, assuming that of the 2k+ quotes we've done we have only completed about half of them, (a quick investigation provides a few jobs worth £20k as uncompleted, hence unbilled) yet we re miraculously still in business. A colleague has suggested that I don't have logical errors but that a combination of scrubbing some bad data and bad data entry has resulted in a high error rate, but that can be fixed after the fact. I'm just after more speed.