(self, sql)
| 139 | |
| 140 | |
| 141 | def pgsql_cost_estimation(self, sql): |
| 142 | try: |
| 143 | #success, res = self.execute_sql('explain (FORMAT JSON, analyze) ' + sql) |
| 144 | success, res = self.execute_sql('explain (FORMAT JSON) ' + sql) |
| 145 | if success == 1: |
| 146 | cost = res[0][0][0]['Plan']['Total Cost'] |
| 147 | return cost |
| 148 | else: |
| 149 | logging.error('pgsql_cost_estimation Fails!') |
| 150 | return 0 |
| 151 | except Exception as error: |
| 152 | logging.error('pgsql_cost_estimation Exception', error) |
| 153 | return 0 |
| 154 | |
| 155 | def pgsql_actual_time(self, sql): |
| 156 | try: |
no test coverage detected