Filter out results from large resultsets


I am new to influxdb, sorry if this is written in the manual or elsewhere, but i could not find a solution.

I collect sensor data and state information from various sensors, and store them for every 30 seconds pr. device.

The user can retrieve charts with data up to 48 hours. That makes 5760 measurements for an 48 hour chart. As we have around 500 pixels in the chart it does not make sense to plot 5760, and its also very performance intensive.

So my question is: Anyway to filter out some of the data, my query is simply like this:
select * from measurements where uid=xxxx

Can i via query language tell that i only want 500 points? Right now i filter it right before i display it in the charts, but that abuses a lot of bandwith between chart server and influxdb.

I am not interested in averaging data - then i could use group by, but i cannot because some values are states, that cannot be averaged. I simply want to remove some points distributed evenly as early as possible.

Thank you very much.