Optimize Oracle Database

Optimize Oracle Database

Overtime, the Oracle DB will become sluggish with the insert/update/deletes. So we need to optimize the DB so that the queries are faster. To optimize a single table, use the following command: exec DBMS_STATS.GATHER_TABLE_STATS (ownname => ‘&schema’ , tabname => ‘&tabname’, cascade => true); To optimize a single schema and...Read more

Mysql join and sum is doubling result

The way to get around this is to create inline views of your aggregates and join on the those results. SELECT R.title_id, R.revenue, R.cost, F.interest FROM (SELECT title_id, Sum(revenue) revenue, Sum(cost) cost FROM revenue GROUP BY revenue.title_id) r LEFT JOIN (SELECT title_id, Sum(interest) interest FROM fund GROUP BY title_id) f...Read more