Archive for November 12th, 2008

The pg_stat_activity table will show you what activity is currently happening on your PostgreSQL database server. The information will detail the database the activity is occuring on, the username initiating the activity, the length of time the acitivy has been occuring for, and much more.

Below is example output from running a SELECT query against the pg_stat_activity table. The pg_stat_activity table is located by default in the postgres database and can be accessed as shown below.

Read the rest of this entry »

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , ,

Comments No Comments »

The Linux kill command is used to kill PID’s or process ID’s. This command is beneficial for numerous reasons typically for run away processes, processes caught in some sort of loop, to kick users from a system, or any other number of reasons.

Typically kill is used in the below format with 12345 being the PID in this example.

[root@server ~]# kill 12345

If the process will not die from using the above command the -9 switch can be added to force it to stop as shown below.

Read the rest of this entry »

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , ,

Comments 8 Comments »

If you are having issues dropping a postgres database the issue is more than likely that a user is accessing the database you are attempting to drop. There isn’t technically a way to force drop the postgres database however there are steps you can take to prevent others from accessing the database and if needed kick the users whom are accessing the database.

If you receive an error similar to the below the issue with your attempt to drop the database is the fact that either a user is accessing the database or an application of some sort has an open connection to the database. In the second scenario PostgreSQL considers the application the same as a user. In the code below the name of the example database is dev.

Please note that dropping the database will destroy all data located within the database. I strongly suggest always backing up your data before dropping the database. You can backup the data with pg_dump and regardless of if you think you will need the data or not it is best to keep a copy just in case.

Read the rest of this entry »

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , , ,

Comments 16 Comments »

This post will explain how to post notes from Microsoft OneNote into the WordPress admin. When you copy and paste from most Microsoft products into a visual editor such as TinyMCE that WordPress uses you will typically include a bunch of unwanted tags from the Microsoft application. These tags will make it complicated to format correctly and can even spill over outside of your post and cause issues with your entire WordPress page. The method to input this data into WordPress will work with any of the Microsoft products such as Microsoft OneNote and Microsoft Word.

Below is an example of some basic formatted text copied directly from MS OneNote and pasted into WordPress’s visual editor.

Read the rest of this entry »

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , ,

Comments No Comments »

To create a PL/pgSQL stored procedure, copy and paste a dummy procedure like this into the “Execute arbitrary SQL queries” window in PgAdmin 1.8.4:

Read the rest of this entry »

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , ,

Comments 2 Comments »