Before running ANALYZE statement, the application was running slow. After analyze the schema, it's working fast. Is that mean i've not written effective Sql query?

I am not a DBA. But i like to know what will happen after analyzing the database. How often i've to ANALYZE the database schema?
analyzing the database will decreases the database performance???

I hope to get good reply

Thnx