The problem was raised this week on IRC and this time again I felt it would be a good occasion for a blog entry: how to load an XML file content into a single field?
The usual tool used to import files is COPY, but it’ll want each line of the file to host a text representation of a database tuple, so it doesn’t apply to the case at hand. RhodiumToad was online and offered the following code to solve the problem:
As it happens, I’ve got some environments where I want to make sure HOT (
aka Heap Only Tuples) is in use. Because we’re doing so much updates a
second that I want to get sure it’s not killing my database server. I not
only wrote some checking view to see about it, but also made
a
quick article about
it in the French PostgreSQL website. Handling
around in #postgresql
means that I’m now bound to write about it in
English too!
So, you’re using londiste and the ticker has not been running all night long, due to some restart glitch in your procedures, and the on call admin didn’t notice the restart failure. If you blindly restart the replication daemon, it will load in memory all those events produced during the night, at once, because you now have only one tick where to put them all.
The following query allows you to count how many events that represents, with the magic tick numbers coming from pgq.