There are no silver bullets to database bottle neck, these 17 best practices can help you design a secure and fast database as they have helped me in the past, it should help you too.
- List column names on a SELECT, INSERT, and "INSERT INTO SELECT FROM .." SQL statements.
- A table MUST have a Primary Key.
- Grant a minimum Role/Privilege to a user.
- Data should not live on database forever therefore, plan to purge or archive it.
- Drop Index, load data and create Index for faster performance.
- Drop table with PURGE command if you don't need the table and data at all.
- Minimize the use of Trigger and never use it to implement a business logic. Trigger are notorious for slowing database down.
- Substitute Literals with Bind Variables where possible. Bind variables make the query execution faster by soft parsing.
- Avoid UNION and use UNION ALL.
- Avoid Public SYNONYM and DB LINK. Security audit team hates them.
- Use Stored procedure to manipulate data, do not use SQL query from the script. Stored Procedures are secure and fast.
- Use VARCHAR2 instead of CHAR. This saves disk space.
- Don't Index all table columns, this degrades the performance.
- Use Table Partition on a big table. Great for performance and maintenance.
- Use Merge and avoid multiple IF conditions.
- Index your JOIN and WHERE columns.
- Perform Delete or Update in batches.
Interested in working with me? I can be reached at pbaniya04[at]gmail.com for any questions, consulting opportunities or you may drop a line to say HELLO. Thank your again for visiting my blog and looking forward to serving you more.
Have a Database-ious Day!
Have a Database-ious Day!
ReplyDeleteThanks for sharing this.,
agile coach training
certified agile coach