[GENERAL] Couple of design questions

2000-07-07 Thread Jesse Scott

Hello everyone,

I'm just beginning a PHP / PostgreSQL project for someone and there are a 
couple of things where I am not sure the best design for the database.

The first is that we want to store kind of a history of values for the past 
3 days or so.  We want to use this so that we can analyze how the values 
have changed over the last few days.  The solution I thought of was having 
4 columns in the table for each value, like this:

somedataint,
somedata_24 int,
somedata_48 int,
somedata_72 int,

There are 3 different variables that we want to keep a history for in each 
row.  So what I thought we could do is at some arbitrary time each day, 
copy the values from somedata into somedata_24, from somedata_24 into 
somedata_48, from somedata_48 into somedata_72, and just forget whatever 
was in somedata_72.  My question is, how long would something like this 
take (relatively speaking, I don't know the hardware specs of the server 
exactly, it will be professionally hosted I believe) if there were around 
20,000 rows?  If it would take too long or be too taxing on resources, do 
you have any other ideas on how to handle something like this?


The second thing is we are going to be having our users update the data in 
the database quite frequently.  What will happen is that when User A wants 
to search the database for something, the system will first check and see 
what the oldest set of data it has is and then ask User A to fetch new data 
to replace the old stuff.  Now since we expect very frequent use of this, 
we want a way to mark which data was requested from User A so that when 
User B comes along, the system doesn't request the same data from him.  But 
we don't want to change the timestamp for when the data was updated until 
we actually get the information, in case the user decides he doesn't want 
to do a search and doesn't send the new data.  One way I thought I could do 
this is by having a table something like this:

dataset_id  int,
last_update timestamp, (or some other date/time field...I can never keep 
them straight in my head)
locked  bool

Then, when I request a dataset from User A, I set the bool field to true 
and my SQL for finding the oldest one already only selects from datasets 
where locked is false.  But I thought if PGSQL's transaction functions 
already did something like this, it would be easier and faster to use 
them.  Will SELECT ... FOR UPDATE help me out here?  Is there a way to 
check and see if a row is locked and ignore locked rows in another SELECT 
... FOR UPDATE?  Any input on a better way to handle this would also be 
appreciated.

Thanks for the time. :)

-Jesse




[GENERAL] Postgres on MacOS... Is it even a possibility?

2000-03-02 Thread Jesse Scott

Someone recently asked me about PostgreSQL as they were looking into
integrating some of the software they produce with a database system.  I'm
not sure the specifics of the planned integration itself, but one of the
requirements they had was support for MacOS.

I was wondering if anyone has thought about MacOS support.  Is it even
possible?  Is there some great impediment to porting or is it just that
there is not enough need to justify the effort?  The person that asked me
is actually one of the main C/C++ programmers at the company, (They are a
local development house that is owned by a very large software
publisher...no not Microsoft.) and he expressed some mild interest in
working on a port if it was feasible, so any input on this subject would be
appreciated as I might be able to convince him to work on it. :)

Thanks in advance!

-Jesse






[GENERAL] Upgrade question..

2000-04-23 Thread Jesse Scott

I'm a little confused, what is the proper and reccomended procedure for
upgrading from 6.3.x to 6.5.x?  I recently did an upgrade install of
Mandrake 7 on a Redhat 5.2 box and I would like to get my old data into the
6.5.x PostgreSQL that comes with Mandrake.

I searched the archives a bit and tried the suggestions in the readme.RPM
file but I couldn't get them to work.

Thanks :)

-Jesse