Which is the best way to work with PostGIS and OpenLayers?
I am not sure about what is the software stack that you are using, but usually, OpenLayers do not work directly with PostGIS.
A common configuration is PostGIS -> GeoServer -> OpenLayers
GeoServer will get your data from the database (or many other sources) and publish it in a valid format for openlayers like wms.
For more specific questions you can post your question in https://gis.stackexchange.com/