Space not clearing up!

Forum with tips, support, etc, on using the PostgreSQL database with Poker Tracker. Please post any PostgreSQL questions here.

Space not clearing up!

Postby kslghost » Wed Aug 20, 2008 8:44 am

So my PT2 database reached about 7.3 GB over a ton of hands, so I did a purge of observed hands older than 3-4 months. It killed some 2.5 million hands (or was it 250k?), but it should be a huge amount of space. The amount of space PostgreSQL was taking up did not budge. I did a full vacuum (twice) and purged empty players, but no dice. How can I free up some space?

Thanks,

kslghost
kslghost
 
Posts: 6
Joined: Tue May 13, 2008 12:42 pm

Re: Space not clearing up!

Postby ptrack pat » Wed Aug 20, 2008 9:20 am

Doing a full vacuum/analyze should have freed up the disk space taken by the deleted records, I don't know why you wouldn't have recovered a fair amount of space if you deleted that many hands. Do you have more than one PostgreSQL database?
ptrack pat
 
Posts: 4841
Joined: Sun Dec 09, 2007 12:38 pm

Re: Space not clearing up!

Postby kslghost » Wed Aug 20, 2008 9:24 am

I do, but they are miniscule in comparison. Do i have to full vacuum all of them?
kslghost
 
Posts: 6
Joined: Tue May 13, 2008 12:42 pm

Re: Space not clearing up!

Postby kslghost » Wed Aug 20, 2008 9:33 am

When I look at the database files in windows, I see the folder for my database "16400" which is 6.35GB. There are four files that are larger than one GB... they are 16440 and 16450 as well as their ".1" extensions.

Thanks for your quick response :)
kslghost
 
Posts: 6
Joined: Tue May 13, 2008 12:42 pm

Re: Space not clearing up!

Postby kslghost » Wed Aug 20, 2008 10:39 am

After restarting, I was able to clear up around 500MB by running another vacuum full. Is there a difference between Vacuum Full/Analyze and Vacuum Full alone? Also, would repeatedly running vacuums help clear additional space?

Finally, I read (doing a search on this forum) that hand histories databases aren't cleared in this process. Does that mean the 500,000 hands I purged still have their hand histories in the database? How can I get rid of those? Sorry for all the questions!
kslghost
 
Posts: 6
Joined: Tue May 13, 2008 12:42 pm

Re: Space not clearing up!

Postby ptrack pat » Wed Aug 20, 2008 12:07 pm

The analyze part of the vacuum/analyze is, from what I understand about PostgreSQL, is updating the idexes in attempts to make querying the database faster. So that doesn't have anything to do with freeing up disk space.

The only way to clear out the hand_history data would be for you to write a SQL statement using pgAdmin that deletes the records in that table that no longer exist in the game table.
ptrack pat
 
Posts: 4841
Joined: Sun Dec 09, 2007 12:38 pm

Re: Space not clearing up!

Postby kslghost » Thu Aug 21, 2008 12:33 am

I don't suppose you have this command written before, do you? Or could give me a clue on how to write it? :P
kslghost
 
Posts: 6
Joined: Tue May 13, 2008 12:42 pm

Re: Space not clearing up!

Postby ptrack pat » Thu Aug 21, 2008 1:08 am

This statement will probably take a very long time to run so be prepared for that. ALSO MAkE SURE YOU BACKUP YOUR DATABASE FIRST!!!

Open the pgAdmin program - Start > PostgreSQL 8.x > pgAdmin III

Then right-click on the red X at the top left part of the window and select Connect from the menu. Enter you p/w when prompted.

Then click on your database in the list of databases and then select the Tools > Query Tool menu option.

On the next window, copy/paste this text, then hit F5 to run it.

delete from hand_histories
where hand_histories.game_number not in
(select game.game_id from game
where game.game_number = hand_histories.game_number
and game.site_id = hand_histories.site_id
and game.import_date = hand_histories.import_date) ;
ptrack pat
 
Posts: 4841
Joined: Sun Dec 09, 2007 12:38 pm

Re: Space not clearing up!

Postby kslghost » Fri Aug 22, 2008 12:12 am

Thank you for all the help, pat!
kslghost
 
Posts: 6
Joined: Tue May 13, 2008 12:42 pm


Return to PostgreSQL Forum

Who is online

Users browsing this forum: No registered users and 18 guests

cron
highfalutin