Below is the example of INNER JOIN
Ending cost = 303.67
Starting cost = 176.34
Above output will give you timestamp and above values is in milliseconds
12 seconds
Query is taking 12seconds to complete so it is Bad performance of the INNER join query.
Because both the tables don't have indexes
Now Let's create indexes on emp and dept tables and check the Explain plan :-
You can compare the previous explain plan with current explain plan.
1) Merge Join converted into Hash Join
2) Cost changed
3) number of rows selection reduced
Let's calculate final cost :-
Enables or disables the query planner's use of sequential scan plan types. It is impossible to suppress sequential scans entirely, but turning this variable off discourages the planner from using one if there are other methods available. The default is on
.
Temporary table is session specific,
Below is an example of temporary table emp_temp
https://pgtune.leopard.in.ua/
postgres=# \timing
check the table creation time
No comments:
Post a Comment