guy_sensei
guy_sensei

Reputation: 523

Query rows 9,000,000 to 10,000,000

New to postgresql, I have a table with 10,000,000 rows, I've been querying data a million rows at a time

SELECT mmsi, report_timestamp, position_geom, ST_X(position_geom) AS Long,ST_Y(position_geom) AS Lat 
FROM reports4 
WHERE position_geom IS NOT NULL 
ORDER by report_timestamp ASC 
LIMIT 1000000 
OFFSET 8000000

When I try and query the last million rows nothing shows up

SELECT mmsi, report_timestamp, position_geom, ST_X(position_geom) AS Long,ST_Y(position_geom) AS Lat 
FROM reports4 
WHERE position_geom IS NOT NULL 
ORDER by report_timestamp ASC 
LIMIT 1000000 
OFFSET 9000000

Not sure If I'm doing the query right, or im overlooking something.

Upvotes: 2

Views: 201

Answers (1)

Patrick
Patrick

Reputation: 32179

The table may have 10,000,000 rows, but how many of those rows have WHERE position_geom IS NOT NULL?

What do you get with:

SELECT count(*)
FROM reports4
WHERE position_geom IS NOT NULL;

Upvotes: 5

Related Questions