infogws
asked on
speeding dbf queries results .net (cdx?)
Hi, I need to optimize a query in FoxPro 2.6 that I'm running from a dataset in visual studio 2008 the query is posted below.
I've been provided with cdx index files and been told they can help me speed up the query results, any ideas?
I've been provided with cdx index files and been told they can help me speed up the query results, any ideas?
SELECT geprevis.contrato, geprevis.codsoc, ccsocios.sonombre, ccsocios.soapelli, ccsocios.sosexo, ccsocios.sofecnac, ccsocios.soestciv, ccsocios.sodirecc,
ccsocios.sodistrito, ccsocios.sotelefo, ccsocios.socelu, ccsocios.somail, ccsocios.solibele, ccsocios.soocupa, ccsocios.socentra
FROM geprevis, ccsocios
WHERE (geprevis.codsoc = ccsocios.socodsoc) AND (geprevis.contrato LIKE 'S% ') AND (ccsocios.soapelli LIKE? + '% ') OR
(ccsocios.sonombre =? + '% ')
Hi buddy, I think that you must check your table indexes. How many rows have those tables?
ASKER
I've never worked with cdx files before to be honest.
Rows or columns? ccsocios has more than 20 rows, but I only need around 10.
I need to make a query to two tables at the same time.(geprevis and ccsocios).
When I only use one parameter it takes no longer than 3-5 seconds. When using 2 parameters it takes between 10-15, sometimes more (up to 20).
Rows or columns? ccsocios has more than 20 rows, but I only need around 10.
I need to make a query to two tables at the same time.(geprevis and ccsocios).
When I only use one parameter it takes no longer than 3-5 seconds. When using 2 parameters it takes between 10-15, sometimes more (up to 20).
ASKER
I've never worked with cdx files before to be honest.
Rows or columns? ccsocios has more than 20 columns, but I only need around 13.
I need to make a query to two tables at the same time.(geprevis and ccsocios).
When I only use one parameter it takes no longer than 3-5 seconds. When using 2 parameters it takes between 10-15, sometimes more (up to 20).
Rows or columns? ccsocios has more than 20 columns, but I only need around 13.
I need to make a query to two tables at the same time.(geprevis and ccsocios).
When I only use one parameter it takes no longer than 3-5 seconds. When using 2 parameters it takes between 10-15, sometimes more (up to 20).
the slow speed is because of the where clause, if you using non-indexed fields in where clause foxpro will take a long time to return the query, can you set the fields in where clause as index fields? is it an option for you or you can't change database?
alternatively, you can bring all the data in without 'where' then sort them later on by codes.
alternatively, you can bring all the data in without 'where' then sort them later on by codes.
ASKER
I cant alter the dbf/cdx files. The database is currently used by another (older) system.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You should also check the OLE DB driver version. The possibility to partially optimize LIKE operator is included in the latest version only.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your ideas
ASKER
it takes about 10-15 minutes to search among 65000 records...