Database

From: Date: Wed, 08 Nov 2000 17:39:35 +0000
Subject: Database
Groups: php.general 
Request: Send a blank email to php-general+get-24345@lists.php.net to get a copy of this message
Hope this not off topic, but if it is just scold me! I am using postgresql to store the location of some files being written by a php script. Now I am writing to different directories and storing the directory in the database (along with the full pathname). Now, before I do additional writes to the directories, I first want to know what the last directory is that I wrote to. Just trust me on this, there is a very good reason and I'll explain if I need to. Anyway, what I'm wondering is when you insert into the database, is the new record necessarily always going to be the last record in the database table? In otherwords, to find out the last directory I wrote to can I simply pull the last row out of the table? Is it sequential? Also, if I can just pull out the last row to find out what the last one is that I wrote to, is there anyway to do this on the order of magnitude of O(1)? or is the only way O(n)? Now I am using ODBC for this and can't use any of the functionality with the pg_... calls. I need an extremely efficient way of determining this as it is time critical and I don't want to have to wait. There's no way to store this in another table because of the nature of the program. It reads every table out of the database and constructs a drop down list (actuall, a list of companies) from the tables so I wouldn't want it showing the table I am storing this info in. So I would basically have to create a second database, but that's way too much overhead as I'd be making too many connections. Thanks a lot. It may sound vague, but I can explain a little more if necessary.

« previous php.general (#24345) next »