- Design your Database schema in according to user requirement. Optimize your schema for most frequent use case.
- Combine objects into one documents if you will use them together, otherwise separate them.
- Duplicate the data because disk space is cheaper than computing time.
- Basically avoid joins however do while writing, not during reads.
- Don't insert mixed data-type values into one common fields, it can degrade performance.
- Do complex aggregation in schema.
- Do Capped Collection for fast writing on collection.
- Use Natural/default Order to read collection.
- Create index in Background . (offline).
- Avoid not in and not equal to operation . $ne and $nin.
For encrypting and decrypting , we must use the bytea data type on the column which we implement. Bcoz bytea will use the pgcrypto method by default. However, you will need to create the pgcrypto extension to enable these functions as they are not pre-defined in PostgreSQL/PPAS. Example CREATE EXTENSION pgcrypto; CREATE TABLE userinfo (username varchar(20), password bytea); >> Inserting the data in an encrypted format INSERT INTO userinfo VALUES(' suman ',encrypt('111222','password','aes')); select * from userinfo ; >> Retrieving the data as decrypted format SELECT decrypt(password,decode('password','escape'::text),'aes'::text) FROM userinfo; Thanks for reading Plz dont forget to like Facebook Page.. https://www.facebook.com/pages/Sql-DBAcoin/523110684456757
Comments
Post a Comment
Plz dont forget to like Facebook Page..
https://www.facebook.com/pages/Sql-DBAcoin/523110684456757