As you know, in MySQL/MariaDB there is no native function for splitting string column by comma or by some regex into a table. In PostgreSQL we a great function regexp_split_to_table for this, but in mysql compatible world it was not possible (till some time ago) to do this without complicated workarounds. Fortunately with introduction of […]
Simple function that compares two JSON structures (on 1st level only), and returns old values for changed keys. I’m using it to track table changes via before update trigger.
Checklist for major postgresql database upgrade: shutdown standby servers on each standby perform pg_upgrade shutdown master perform pg_upgrade if pg_upgrade fails on postgres database with encoding mismatch, re-init database with initdb start master verify master is ok check if recovery.conf present in slave datadir start slaves one-by-one check if slaves are live and recovering if […]
As always with Oracle its pretty ‘easy‘ and ‘straightforward‘ – you have to convert the high_value to XML and then extract it using XPATH (omg!). Let me guess, it would cost a fortune to provide native function/view that could do that…
Some hopefully useful tips on speeding up data import via SOLR DataImportHandler.
In PostgreSQL it’s quite easy to restrict access for user to some tables: create restrictive view grant usage on view schema grant select on view to restricted user done Really easy. And it’s not working when the restrictive view, is selecting from another view that is using function(s)!
I’ve encountered unusual problem while dumping one of the bigger PostgreSQL databases. Every try to run pg_dump resulted in this: sam@cerberus:~/backup$ pg_dump -v -c js1 >x pg_dump: Error message from server: ERROR: invalid memory alloc request size 18446744073709551613 pg_dump: The command was: COPY job.description (create_time, job_id, content, hash, last_check_time) TO stdout; pg_dump: *** aborted because […]
Just a short example C implementation of Oracle VARNUM/NUMBER type encoding, in case you could not use library functions. I didn’t found it anywhere when needed (and afterwards I found it doesn’t helps me at all due to little ‘problem’ in ora :() and Oracle documentation is pretty unclear about how-to do it. typedef […]
Just released initial release of dmlquery tool, for doing DML queries on SQL database (or anything perl DBI abstraction layer can handle) via formated XML files. Very useful for XML pipelining. With this and XML/XSLT transformations you can do very powerful thinks, like whole ETL tools for extracting data from one source (database, web…), transform […]
In previous post I’ve tried to present my solution for solving max(count()) problem. The solution was slightly suboptimal and I’ve needed to speed it up a bit, because I’m using it now in some statistical calculations and every millisecond is important. This is original solution. CREATE VIEW data_view_source AS SELECT DISTINCT ON (dp_id) dp_id, ds_id […]