Subject Weird and very slow tib_query
Author james_027
below is my ib_query which for an unknown reason I dont know why is
it so slowww. I have other ib_query which has thousand of record but
its not slow. how slow? if I scroll from first to last record you
could see the ib_grid repainting... I have try many things. removing
the inline select sql, removing the ordering items, and etc ...
please help me. Its slowliness cause so much annoyance in my
application.

thank in advance.

here are the properties of my slow ib_query


object request: TIB_Query
ColumnAttributes.Strings = (
'"ItemName"=COMPUTED'
'"UseIn"=COMPUTED'
'"Source"=COMPUTED'
'"Destination"=COMPUTED'
'ID=REQUIRED'
'"RequestDate"=REQUIRED'
'"RequestTime"=REQUIRED'
'"ItemID"=REQUIRED'
'"Purpose"=NOTREQUIRED'
'"Qty"=REQUIRED'
'"Unit"=REQUIRED'
'"Request"=REQUIRED'
'"From"=REQUIRED'
'"To"=REQUIRED'
'"Status"=REQUIRED')
DatabaseName = 'D:\Works\KSK\database\ACCTDB.GDB'
FieldsCharCase.Strings = (
'"ItemName"=UPPER'
'"UseIn"=UPPER'
'"Source"=UPPER'
'"Destination"=UPPER'
'"Request"=UPPER'
'"Unit"=UPPER'
'"Unit2"=UPPER')
FieldsDisplayLabel.Strings = (
'"Source"=From'
'"Destination"=To'
'"Unit"=Inventory Unit'
'"Unit2"=Ingredients Unit')
FieldsDisplayWidth.Strings = (
'ID=60'
'"RequestDate"=80'
'"RequestTime"=80'
'"Qty"=60'
'"Unit"=60'
'"Request"=80'
'"Remarks"=140'
'"Source"=80'
'"Destination"=80'
'"ItemName"=120'
'"UseIn"=120'
'"Unit2"=60'
'"Conversion"=80')
FieldsEditMask.Strings = (
'"RequestTime"=!90:00> LL;1;_')
FieldsIndex.Strings = (
'ID'
'"RequestDate"'
'"RequestTime"'
'"ItemID"'
'"Purpose"'
'"ItemName"'
'"Qty"'
'"Unit"'
'"Conversion"'
'"UseIn"'
'"Unit2"'
'"Request"'
'"From"'
'"To"'
'"Source"'
'"Destination"'
'"Remarks"'
'"Status"'
'"Use"')
FieldsReadOnly.Strings = (
'"ItemName"=NOEDIT'
'"Qty"=NOEDIT'
'"Unit"=NOEDIT'
'"ItemID"=NOEDIT')
FieldsVisible.Strings = (
'ID=FALSE'
'"ItemID"=FALSE'
'"Purpose"=FALSE'
'"From"=FALSE'
'"To"=FALSE'
'"Status"=FALSE'
'"Use"=FALSE'
'"UseIn"=FALSE')
IB_Connection = Form_main.IB_Connection1
SQL.Strings = (
'select m.*,'

' (select "Name" from "items" d where d.ID=m."ItemID")
as "Ite' +
'mName",'

' (select "Name" from "items" d2 where d2.ID=m."Purpose")
as "' +
'UseIn",'

' (select "Warehouse" from "warehouse" d3 where
d3.ID=m."From"' +
') as "Source",'

' (select "Warehouse" from "warehouse" d4 where
d4.ID=m."To") ' +
'as "Destination"'
'from "usage" m'

'where ("Status" != :paramstatus) and "RequestDate"
>= :paramdate' +
' ')
AutoFetchAll = True
ColorScheme = True
DefaultValues.Strings = (
'"Status"=ACT'
'"Use"=0'
'"Qty"=0'
'"From"=1')
DeleteSQL.Strings = (
'DELETE FROM "usage"'
'WHERE'
' ID = :OLD_ID')
EditSQL.Strings = (
'UPDATE "usage" SET'
' ID = :ID, /*PK*/'
' "RequestDate" = :"RequestDate",'
' "RequestTime" = :"RequestTime",'
' '
' '
' '
' "Unit" = :"Unit",'
' "Conversion" = :"Conversion",'
' "Request" = :"Request",'
' "From" = :"From",'
' "To" = :"To",'
' "Remarks" = :"Remarks",'
' "Status" = :"Status"'
'WHERE'
' ID = :OLD_ID')
GeneratorLinks.Strings = (
'"usage".ID="gen_usage"')
InsertSQL.Strings = (
'INSERT INTO "usage"('
' ID, /*PK*/'
' "RequestDate",'
' "RequestTime",'
' "ItemID",'
' "Purpose",'
' "Qty",'
' "Unit",'
' "Request",'
' "From",'
' "To",'
' "Remarks",'
' "Status",'
' "Unit2",'
' "Conversion",'
' "Use")'
'VALUES ('
' :ID,'
' :"RequestDate",'
' :"RequestTime",'
' :"ItemID",'
' :"Purpose",'
' :"Qty",'
' :"Unit",'
' :"Request",'
' :"From",'
' :"To",'
' :"Remarks",'
' :"Status",'
' :"Unit2",'
' :"Conversion",'
' :"Use")')
KeyLinks.Strings = (
'"usage".ID')
MasterSearchFlags = [msfOpenMasterOnOpen,
msfSearchAppliesToMasterOnly]
OrderingItemNo = 1
OrderingItems.Strings = (

'"RequestDate"="RequestDate", "RequestTime";"RequestDate"
DESC, "' +
'RequestTime" ASC')
OrderingLinks.Strings = (
'"RequestDate"=ITEM=1')
BeforeEdit = requestBeforeEdit
BufferSynchroFlags = []
FetchWholeRows = True
Left = 648
Top = 16
ParamValues = (
'PARAMSTATUS=CAN')
end