[SQL] Turn off flushing after each write

2001-07-12 Thread Wei Weng

How can I control that?

Where is the setting I can tweak? I checked the doc at
http://www.archonet.com/pgdocs/tweak-perf.html. Couldn't find any
reference to it.

Thanks!

-- 
Wei Weng
Network Software Engineer
KenCast Inc.



---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



[SQL] shared memory size

2001-07-12 Thread Wei Weng

Will increasing kernel shared memory size (in linux by doing echo
134217728 /proc/sys/kernel/shmall; echo 134217728
/proc/sys/kernel/shmmax) help with the speed of a complicated query
with a large return set? (average 2 or more entries in return)

Thanks

-- 
Wei Weng
Network Software Engineer
KenCast Inc.



---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



[SQL] C Functions

2001-07-12 Thread Fernando Eduardo B. L. e Carvalho




#include pgsql/postgres.h
#include string.h

char *fernando(char *texto)
{
char *resultp = palloc(strlen(texto)+5);
*resultp = *texto;
strcat(resultp, mais);
return resultp;
}

gcc -shared fernando.c -o fernando.so

CREATE FUNCTION fernando (bpchar) RETURNS bpchar
  AS '/u/src/tef/fernando.so' LANGUAGE 'c';
CREATE
SELECT fernando ('Teste');
ERROR:  Memory exhausted in AllocSetAlloc(287341377)




---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [SQL] C Functions

2001-07-12 Thread Patrik Kudo

I've never used functions in postgres, but the line

 *resultp = *testo;

looks wrong to me. Shouldn't it be

 strcpy(resultp, testo);

?

Regards,
Patrik Kudo

ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Känns det oklart? Fråga på!

On Thu, 12 Jul 2001, Fernando Eduardo B. L. e Carvalho wrote:





---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



[SQL] Functions performed on intervals

2001-07-12 Thread Jimmie Fulton

I hope this is not the wrong list for this type of question...

I'm about to start development on a small app to track employee leave and
vacation time.  Based on a simple formula, each employee gets x number of
days at the end of each month.  x is a function of time-in-service and
employee type: part-time, full-time, and salary.  I could just write a view
to display total time accumulated from their start date to current date
(minus leave taken), but what happens when the employee moves from part-time
to full-time?  Their entire leave is recalculated with the new formula and
the employee gets some extra time off.  The solution I've thought of is to
call a function once a month with cron to update each employee's leave
balance.  Is this the proper way to accomplish this task or are there better
methods or approaches to getting the desired effect?

Thanks for any advice you can give,

Jimmie Fulton
Systems Administrator
Emory University School Of Medicine


---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



Re: [SQL] Functions performed on intervals

2001-07-12 Thread Josh Berkus

Jimmie,

 I hope this is not the wrong list for this type of question...

Nope.  You're come to *exactly* the right list.

 
 I'm about to start development on a small app to track employee leave
 and
 vacation time.  Based on a simple formula, each employee gets x
 number of
 days at the end of each month.  x is a function of time-in-service
 and
 employee type: part-time, full-time, and salary.  I could just write
 a view
 to display total time accumulated from their start date to current
 date
 (minus leave taken), but what happens when the employee moves from
 part-time
 to full-time?  Their entire leave is recalculated with the new
 formula and
 the employee gets some extra time off.  The solution I've thought of
 is to
 call a function once a month with cron to update each employee's
 leave
 balance.  Is this the proper way to accomplish this task or are there
 better
 methods or approaches to getting the desired effect?

Actually, I can think of at least 3 different approaches.  What's best
depends on:

1) your control over the data structure (e.g. can you add an
employee_history table?)
2) What changes to leave time calcualtions do you want to be time-bound,
and what do you want to be retroactively re-calculated for all active
employees?
3)  What other factors are likely to change over time.

That being said, any solution you come up with will involve *some* kind
of history table/fields being added to the application.  It's a question
of *what* kind:

1) You can add a leave time history that journals leave time
calculations on a daily, monthly, or weekly basis;
2) You can add an employee history table that journals an employees
status on a periodic basis;
3) You can add/extend the relational sub-tables governing the
characterisitcs that are peculiar to the different types of employees
(full-time, part-time, contract) (there's a good example of this in
Practical Issues in Database Design by F. Pascal) to include date
ranges;
4) You can even add a leave time rule history table to keep track of
how leave time is calculated over the history of the company (e.g. what
if leave time was 14 days per year through 1999, but decreased to 10
days per year in 2000?)
5) Any/all of the above.

-Josh Berkus


__AGLIO DATABASE SOLUTIONS___
   Josh Berkus
  Complete information technology  [EMAIL PROTECTED]
   and data management solutions   (415) 565-7293
  for law firms, small businessesfax 621-2533
and non-profit organizations.  San Francisco

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])