why the same procedure (in shell or in sql) cost so different time?