sql - PostgreSQL Query Time -


select *  vehicles t1  (select count(*) vehicles t2         t1.pump_number = t2.pump_number           , t1.updated_at < t2.updated_at       ) < 4       , t1.updated_at >= ? 

and supply '1970-01-01 00:00:00.000000' parameter ?.

i have around 10k records in vehicles table , no index added. above query takes around 10-20 seconds in execution.

how can optimize decrease execution time?

postgres provide nice admin tool has option explain see query execution plan . give great insights . here link pgadmin in detail http://www.pgadmin.org/docs/1.4/query.html

also use joins in query instead of select increase query performance


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -