I have a database with 1,000,000 records and a query like this:
select count(code) from table1
It works well on the local system but becomes very slow on the network. Other queries like select * from table
execute quickly, but select count(code) from table1
is very slow. I can't change the database's structure. My database is Foxpro and I use VB.NET.
Is there a solution?
Edit: Should I write code like this?
dim ds as new dataset
dim da as new datadapter("select count(*) from table ", connection)
da.fill(ds,"tbl1")
Then how can I get select count(code) from table1
from the dataset?
Or do I have to use LINQ?
Edit 2: I mean the comparison between select count(*)
and select count(code)
.
What is the solution?