(?=) - Positive look ahead assertion foo(?=bar) matches foo when followed by bar
(?!) - Negative look ahead assertion foo(?!bar) matches foo when not followed by bar
(?<=) - Positive look behind assertion (?<=foo)bar matches bar when preceded by foo
(?<!) - Negative look behind assertion (?<!foo)bar matches bar when NOT preceded by foo
(?>) - Once-only subpatterns (?>\d+)bar Performance enhancing when bar not present
(?(x)) - Conditional subpatterns
(?(3)foo|fu)bar - Matches foo if 3rd subpattern has matched, fu if not
(?#) - Comment (?# Pattern does x y or z)
Tuesday, March 21, 2017
Perl: lookahead operators
Source: negative regex for perl string pattern match
Monday, March 20, 2017
Friday, March 17, 2017
PostgreSQL: exclusive lock on a table
Source: Exploring Query Locks in Postgres
crmmbqt=# begin; lock table radius_db.radacct in access exclusive mode; BEGIN Time: 0.516 ms LOCK TABLE Time: 1001.108 msThen
crmmbqt=# rollback; ROLLBACK Time: 0.714 ms
Labels:
postgresql
PostgreSQL: list biggest tables
select table_schema||'.'||table_name as table, pg_size_pretty(size) as size from (select table_schema, table_name, pg_total_relation_size(table_schema||'.'||table_name) as size from information_schema.tables order by 3 desc) as foo;
Labels:
postgresql
Thursday, March 16, 2017
PostgreSQL: dump and restore a table
Dump table:
Restore table:
pg_dump --table offer_db.dt_pool_ip -FC crmmbqt > /tmp/dt_pool_ip.sql
Restore table:
pg_restore --dbname crmmbqt --table=offer_db.dt_pool_ip dt_pool_ip.sql
Labels:
postgresql
Subscribe to:
Posts (Atom)