JDBCDataStore.getCount should get a full Query object
-----------------------------------------------------

                 Key: GEOT-2321
                 URL: http://jira.codehaus.org/browse/GEOT-2321
             Project: GeoTools
          Issue Type: Improvement
          Components: data jdbc-ng
    Affects Versions: 2.5.3
            Reporter: Andrea Aime
            Assignee: Justin Deoliveira
             Fix For: 2.5.4


Currently the JDBCDataStoure count method looks like:
{code}
int getCount(SimpleFeatureType featureType, Filter filter, Connection cx)
{code}

This means the sql encoded does not have a chance to include offset and limit. 
In case of tables with millions of rows a count can take minutes, but if you 
add limit and offset natively, the time needed can go down very significantly. 
And sometimes, not :) 
I've been told Oracle can optimize this quite aggressively, but tried with 
postgis, and the time did not improve, at least not with the naive approach. 
I have a OSM table with 20 million lines, a {{select count(*)}} over it takes 
1m20s, doing a {{select count(*) from planet_osm_line offset 10000000 limit 
100}} (offset at 10M, halfway thru) takes exactly the same time and returns a 
wrong result, but a {{select count(*) from (select * from planet_osm_line 
offset 10000000 limit 100) as foo}} takes just 40s and gives the right result.
Ah, I get it. Limit and offset work on the result, which in this case is a 
single line. So in the case of count + limit/offset we actually need to wrap 
the query like I did...

Hum... Justin, opinions?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to