sql-serverdelphiquery-optimizationtquerydelphi-4

Query optimization in Delphi 4


In Delphi 4, we have one SELECT query which is fetching 3 Text type fields along with other required fields at a time using a TQuery component.
There are more than 1,000 records (which might increase in future).
This query consumes lots of memory. and I think due to this next query takes huge amount of time to execute.

I'm using BDE to connect to SQL-server.

I need to optimize the performance so that it won't take so much time. Please advice.


Solution

  • To reduce the time (depending on data) we can use DATALENGTH in a query.

    like

    DATALENGTH(TEXT) <> 0
    

    This will not load records having no value in TEXT field.