Page 1 of 1

Defrag PT Stud

PostPosted: Wed Nov 26, 2008 1:19 am
by TH12345
Having problems getting started on this.
Following the directions from the old forum:

Use windows explorer to search for the file psql.exe
(for most people it will be in c:\program files\postgresql\bin\)
open a dos prompt (start-run type cmd, hit enter)


I am using Vista, and the search function can't find the exe file. I can locate the "psql to 'postgres' " interactive terminal if that helps, but in looking in the files/PostgreSQL/bin I don't seem to be able to locate it.

So to get past step 1: What can I do to find the exe file or its equivalent, and once I find it, whats my next step?

Thank you.

Re: Defrag PT Stud

PostPosted: Wed Nov 26, 2008 5:23 pm
by ptrack mike
Right-click on the Start menu and select Explore.
Click on Organize > Folder and Search Options
On the next window, click on the View tab and then:

1. Check the box that says "Show hidden files and folders" AND
2. UNcheck the box that says "Hide extensions for know file types"
and then click on the "Apply" button.

Then see if you can proceed.

Re: Defrag PT Stud

PostPosted: Wed Nov 26, 2008 7:12 pm
by TH12345
OK, the 'show hidden files' was checked, but I had to uncheck the 'Hide exten. etc.', and that shows the psql.exe file. So far so good.

Now: After locating the file, what step do I take with it before opening the dos prompt?

Re: Defrag PT Stud

PostPosted: Wed Nov 26, 2008 8:43 pm
by ptrack mike
To be honest I'm not entirely sure what you are attempting to do. Where did you get these "Defrag PT Stud" instructions?

Re: Defrag PT Stud

PostPosted: Wed Nov 26, 2008 9:52 pm
by TH12345
From the old forum:

Poker Tracker stud> Welcome!! Where did the old forum go>can be found here>PostgreSQL forum>Sticky: How to: Defrag PT

Here is the beginning of the instructions:

How to do it. ************ updated - pgadmin was a bad idea
*******************************
In Poker Tracker, find the DB File/DB Name/DSN you want to cluster. (File-Maintain Database Names) in my case it's GAMBLOR (and it's case sensitive)

Use windows explorer to search for the file psql.exe
(for most people it will be in c:\program files\postgresql\bin\)
open a dos prompt (start-run type cmd, hit enter)


If you have limited disk space and/or a very large database, you should check how much space each table/index is using. If you KNOW you have enough space, move on to Recreate the tables

At the dos prompt, type the following after the >
"c:\program files\postgresql\bin\psql" -d "YOUR_DB_NAME" -U postgres -c "select relname, relfilenode, relpages/128 as approx_Mb from pg_class order by approx_Mb desc limit 10;"
type your password IF prompted.
this shows the approx size of the tables/indexes (and the filename if you want to look)

******* Recreate the tables *******
This will take a long time, its IO bound, my 3Gb game_players table took 3 hours.
At the dos prompt, type the following after the >
"c:\program files\postgresql\bin\psql" -d "YOUR_DB_NAME" -U postgres -c "cluster session_idx_02 on session;"
"c:\program files\postgresql\bin\psql" -d "YOUR_DB_NAME" -U postgres -c "cluster player_winnings_idx_02 on player_winnings;"
"c:\program files\postgresql\bin\psql" -d "YOUR_DB_NAME" -U postgres -c "cluster player_idx_02 on players;"
"c:\program files\postgresql\bin\psql" -d "YOUR_DB_NAME" -U postgres -c "cluster game_idx_01 on game;"
"c:\program files\postgresql\bin\psql" -d "YOUR_DB_NAME" -U postgres -c "cluster game_players_idx_05 on game_players;"
================================================================================================================================

It is the bolded part where I am wondering what to do next on. After I find the exe file, what am I supposed to do with it before I open the dos prompt?

Re: Defrag PT Stud

PostPosted: Thu Nov 27, 2008 8:35 am
by ptrack mike
I've never done this, but I think the step that makes you find psql.exe is there just so you know what folder to type in on the next step where it says:

At the dos prompt, type the following after the >
"c:\program files\postgresql\bin\psql" -d "YOUR_DB_NAME" -U postgres -c "select relname, relfilenode, relpages/128 as approx_Mb from pg_class order by approx_Mb desc limit 10;"


If the psql.exe file on your PC is NOT in c:\program files\postgresql\bin\ the change this part of the instructions to match the location of the folder on your PC.

If you have any other trouble with this you might be better off posting in the PostgreSQL forum here:
viewforum.php?f=29

Re: Defrag PT Stud

PostPosted: Fri Nov 28, 2008 3:05 am
by TH12345
That did the trick. My file was listed as c:\program files\postgresql\8.2\bin\psql. Once I added the 8.2 I could progress through the rest of it, and am on the last cluster now.

Thanks.

highfalutin