Postgresql 9.3 GROUP BY on an indexed column in 30m rows table taking a long time
Looking at the number of buffers it took to read the index, you are probably suffering from table and index bloat.

If you can afford to lock the table, run vacuum full analyze gpsdata to clean up old data. 

There are several possible reasons why auto-vacuum did not take care of cleaning up properly and re-using deleted space:


You have many sessions accessing that table that are in the state "idle in transaction". Rows that are used by a transaction can't be cleaned up. Make sure you properly commit all transactions - that includes SELECT statement which also start a transaction.  The easiest way to do that is to enable autocommit (default in psql)
You have a high frequency of updates on that table so that the table is constantly changed and auto-vacuum can't keep up (or doesn't get a chance to clean up - see 1.) 
you have disabled auto-vacuum




An index on gpsdata (equipmentid,id) might speed up the calculation.