dbTalk Databases Forums  

Hanging Postgres?

comp.databases comp.databases


Discuss Hanging Postgres? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dave Mennenoh
 
Posts: n/a

Default Hanging Postgres? - 11-09-2006 , 05:55 AM






Hi there, I am in the process of writing a little PHP script to move a
single folder full of image files (110000+) into a larger folder structure.
I have already wrote a hashing class that gets the new folders based on
whatever input and it works fine. I let the code run on the current images
folder, just doing an echo of the file name and new path, and all 110000
displayed fine. It just took a few minutes.

Now, the image file names are based on usernames - as those are unique. In
outputting all the files to the browser I realized some images were likely
invalid and therefore not real users in the database. Ones with names like:
6fc2293f6564e06398bb3b7852c and ??????????1 014 So, I decided to add a
select and output only those that didn't exist. But after 15 minutes nothing
came back... My code:

if ($handle = opendir('../stuff/flash_images/')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
//got a file - strip out username - remove last 4 chars (.jpg)
$userName = substr($file, 0, strlen($uName) - 4);
//see if this is a valid user
$result = pg_query($connection, "SELECT user_id FROM users WHERE
login='$userName'");
if(!$result){
//user does not exist
echo("INVALID USER - $userName - There is no user with this login, in
the users table<br />");
}
$folders = $myHash->getFolders($userName);
$newFile =
"../stuff/new_flash_images/".$folders[0]."/".$folders[1]."/".$file;
echo("File: $file --> $newFile<br />");
//copy($file, $newFile);
$count++;
}
}

As you can see I echo each time a bad user is found, and I know there's a
bad image/user in the first 10 so I should see something immediately. It
works just fine if I simply comment out the pg_query line. If I do the SQL
within phpPgAdmin it executes properly.

Anyone see what might be causing the problem? Should I somehow wait a few
milliseconds between successive sql queries? Though that doesn't seem
right...

Thanks


--
Dave -
Head Developer
www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/



Reply With Quote
  #2  
Old   
Paul
 
Posts: n/a

Default Re: Hanging Postgres? - 11-18-2006 , 07:07 AM








"Dave Mennenoh" <dave (AT) blurredistinction (DOT) com> wrote:

Quote:
Hi there, I am in the process of writing a little PHP script to move a
single folder full of image files (110000+) into a larger folder structure.
I have already wrote a hashing class that gets the new folders based on
whatever input and it works fine. I let the code run on the current images
folder, just doing an echo of the file name and new path, and all 110000
displayed fine. It just took a few minutes.

Go to the postgres lists -they'll be far better than this generic
list.


Paul...



--

plinehan __at__ yahoo __dot__ __com__

XP Pro, SP 2,

Oracle, 9.2.0.1.0 (Enterprise Ed.)
Interbase 6.0.1.0;

When asking database related questions, please give other posters
some clues, like operating system, version of db being used and DDL.
The exact text and/or number of error messages is useful (!= "it didn't work!").
Thanks.

Furthermore, as a courtesy to those who spend
time analysing and attempting to help, please
do not top post.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.