Subject | Re: [ib-support] Utility to find slow queries? |
---|---|
Author | Mark Patterson |
Post date | 2003-02-18T23:27:24Z |
Helen Borrie wrote:
other of Jig Stations. All the fields in the where clauses are indexed. The
primary key is an autoincrement field.
function TfraSawStationJobs.GetJobListSql: string;
begin
result :=
'SELECT DISTINCT JOB_NUMBER FROM SAWMEMBERS'
+ ' WHERE STATUS <= ' + S_COMPLETED
+ ' AND STATION_ID = ' + IntToStr(StationID);
end;// GetJobListSql
procedure TfraSawStationJobs.ReloadTrusses;
begin
if lstJobs.Items.Count > 0 then
begin
if DMConnection.GetImportType(lstJobs.Items[lstJobs.ItemIndex]) = 'BULK' then
begin
lstTrusses.Items.Text := GlobalBulkJob;
end
else
begin
DBUtils.LoadStrings(DMConnection.DbSuite, lstTrusses.Items,
'SELECT DISTINCT TRUSS_NUMBER FROM SAWMEMBERS'
+ ' WHERE STATION_ID = ' + IntToStr(StationID)
+ ' AND JOB_NUMBER = ' + SQLString(JobNumber));
end;
end;
end;// ReloadTrusses
function TfraJigStationJobs.GetJobListSql: string;
begin
result :=
'SELECT DISTINCT JOB_NUMBER FROM JIGTRUSSDETAILS' +
' WHERE STATION_ID = ' + IntToStr(StationID) +
' AND STATUS <= ' + S_COMPLETED;
end;// GetJobListSql
procedure TfraJigStationJobs.ReloadTrusses;
var SQL: string;
begin
SQL := 'SELECT DISTINCT TRUSS_NUMBER FROM JIGTRUSSDETAILS'
+ ' WHERE STATION_ID = ' + IntToStr(StationID)
+ ' AND JOB_NUMBER = ' + SQLString(JobNumber)
+ ' ORDER BY TRUSS_SORT';
DbUtils.LoadStrings(DMConnection.DbSuite, lstTrusses.Items, SQL);
end;// ReloadTrusses
the data is laid out on the disk.
Thanks,
Mark
> The better the info you supply by way of problem description, the betterWe have 2 threads running, one populating a GUI (TFrame) of saw stations, the
> the solution is.
other of Jig Stations. All the fields in the where clauses are indexed. The
primary key is an autoincrement field.
function TfraSawStationJobs.GetJobListSql: string;
begin
result :=
'SELECT DISTINCT JOB_NUMBER FROM SAWMEMBERS'
+ ' WHERE STATUS <= ' + S_COMPLETED
+ ' AND STATION_ID = ' + IntToStr(StationID);
end;// GetJobListSql
procedure TfraSawStationJobs.ReloadTrusses;
begin
if lstJobs.Items.Count > 0 then
begin
if DMConnection.GetImportType(lstJobs.Items[lstJobs.ItemIndex]) = 'BULK' then
begin
lstTrusses.Items.Text := GlobalBulkJob;
end
else
begin
DBUtils.LoadStrings(DMConnection.DbSuite, lstTrusses.Items,
'SELECT DISTINCT TRUSS_NUMBER FROM SAWMEMBERS'
+ ' WHERE STATION_ID = ' + IntToStr(StationID)
+ ' AND JOB_NUMBER = ' + SQLString(JobNumber));
end;
end;
end;// ReloadTrusses
function TfraJigStationJobs.GetJobListSql: string;
begin
result :=
'SELECT DISTINCT JOB_NUMBER FROM JIGTRUSSDETAILS' +
' WHERE STATION_ID = ' + IntToStr(StationID) +
' AND STATUS <= ' + S_COMPLETED;
end;// GetJobListSql
procedure TfraJigStationJobs.ReloadTrusses;
var SQL: string;
begin
SQL := 'SELECT DISTINCT TRUSS_NUMBER FROM JIGTRUSSDETAILS'
+ ' WHERE STATION_ID = ' + IntToStr(StationID)
+ ' AND JOB_NUMBER = ' + SQLString(JobNumber)
+ ' ORDER BY TRUSS_SORT';
DbUtils.LoadStrings(DMConnection.DbSuite, lstTrusses.Items, SQL);
end;// ReloadTrusses
> Not clear what you mean by "the internal structure of theI'm trying to visualise what the database driver must be doing. I don't know how
> tables and indexes".
the data is laid out on the disk.
Thanks,
Mark