1) is there a way to time execution of sql statements in postgres without using any frontend languages like php ?
You can use a shell time command to wrap around the psql command. Something like:
$ time psql -f sql_commands_to_execute
pg7.3devel (in CVS) lets you "EXPLAIN ANALYZE SELECT ...", which shows actually processing time for a query as well as each individual processing step (!)
2) is there also a way of inserting 2000000 records to a table without using any frontend languages like php?
Write it in plpgsql, plperl, plpython, or (not yet in the official distro) plruby.