casperlee

How to promote the performance on querying filegeodatabase entries count??

Discussion created by casperlee on May 16, 2018

Hi, I tried to getting the count of some filegeodatabase rows with "File Geodatabase API 1.4", but the performance is very poor as following statements:

The Source code

Geodatabase geodatabase = Geodatabase.Open(@"xxxxxx");

var countStatements = $"SELECT count(*) FROM blk WHERE OBJECTID=1 or OBJECTID=2";
var countRows = geodatabase.ExecuteSQL(countStatements);

var countEnumerator = countRows.GetEnumerator();

if(countRows != null)
{
       countEnumerator.MoveNext();
       count = (int)countEnumerator.Current.GetDouble(0);
}

It took about two seconds to getting the result. The performance is very poor!

How can I promote the performance through query sql statements or the other approach?

I’m very appreciate for your any help.

 

Thanks,

Casper. Lee

Outcomes