Life Quote: The difficulties, hardships and trials of life, the obstacles...are positive blessings. They knit the muscles more firmly, and teach self-reliance. ~ William Matthews
Sunday, April 12, 2015
Friday, April 10, 2015
SAP FI Practice
If you are working with SAP in the module FICO, you can use this one to practice http://languagexyz.appspot.com/sapfi
It looks like the following and you can run on your smartphone or tablet.
Saturday, February 22, 2014
Better Decisions with Smarter Data | MIT Sloan Management Review
Better Decisions with Smarter Data | MIT Sloan Management Review:
- Accurate – data must be what it says it is with enough precision to drive value. Data quality matters.
- Actionable – data must drive an immediate scalable action in a way that maximizes a business objective like media reach across platforms. Scalable action matters.
- Agile – data must be available in real-time and ready to adapt to the changing business environment. Flexibility matters.
Wednesday, January 22, 2014
Tuesday, January 1, 2013
PostgreSQL: Replace multiple spaces with one
If you want to use a single query to replace multiple spaces with one on SQL Server, you can read the articles here http://www.sqlservercentral.com/articles/T-SQL/68378/
However, it's very simple in PostgreSQL by using Regular Expression
SELECT regexp_replace('This sentence contains multiple spaces', '\s+', ' ', 'g');
Labels: DBA Tasks, PostgreSQL, PostgreSQL Query, PostgreSQL Tip
Sunday, December 30, 2012
PostgreSQL - Copy CSV to table with psql - part 2
CREATE TABLE tbl_test ( a text, b text, c text )Content of test.csv, and it put in /Database folder
a1,b1,c1
a2,b2,c2
a3,b3,c3
Instead of using COPY command directly, you can modify the test.cvs file to include it, as
COPY tbl_test FROM STDIN WITH CSV;
a1,b1,c1
a2,b2,c2
a3,b3,c3
\.
Note that you have to include a carriage return in the last line of the file (after '\.')
Then, run the following command to import
MyComputer$ psql -h localhost -p 5432 -U postgres testdb -f ~/Database/test.csv
Labels: DBA Tasks, PostgreSQL, PostgreSQL Query, PostgreSQL Tip
Thursday, December 13, 2012
PostgreSQL - Copy database
Sometimes, instead of back up and restore to a new db and wait your time if you only want to copy a database and put in the same server, you can use the following query:
CREATE DATABASE newdb WITH TEMPLATE originaldb OWNER dbuser;Note that this query only successfully if no sessions existing in originaldb. So, you can check originaldb sessions and kill them with this function pg_terminate_backend(procpid)
Labels: Backup, DBA Tasks, PostgreSQL, PostgreSQL Query, PostgreSQL Tip
PostgreSQL - Kill idle processes
Sometimes, you need to kill all unnecessary processes running on your database server. You can do that by using the following query:
SELECT procpid, ( SELECT pg_terminate_backend(procpid) ) AS killed FROM pg_stat_activity WHERE current_query LIKE '%idle%' AND datname = 'YourDBName';
Labels: DBA Tasks, PostgreSQL, PostgreSQL Query, PostgreSQL Tip
Sunday, December 9, 2012
PostgreSQL - Copy csv file to table with psql
CREATE TABLE tbl_test ( a text, b text, c text )Content of test.csv
a1,b1,c1
a2,b2,c2
a3,b3,c3
psql to COPY
psql -h localhost -U postgres testdb
testdb=# COPY tbl_test FROM 'D:\Temp\test.csv' WITH DELIMITER ',' CSV;
Labels: PostgreSQL, PostgreSQL Query, PostgreSQL Tip, psql
PostgreSQL - VACUUM ANALYZE EXPLAIN NOTIFY
Select the correct statement that records the space occupied by deleted or updated rows for later reuse, and also updates statistics.
A. VACUUM
B. VACUUM ANALYZE
C. EXPLAIN
D. EXPLAIN ANALYZE
E. NOTIFY
F. None of the above
Answer: [B]
Highlight to find out the answer.
Labels: PostgreSQL, PostgreSQL Query, PostgreSQL Quiz, PostgreSQL Tip