[GENERAL] very slow after a while...

2005-04-06 Thread Costin Manda
Hello, I have a machine that uses pgsql version 8.0.1 I don't think the version is relevant because I had 7.4.1 before and I had the same problem. I have a PHP script that runs regularily and does this: select a bunch of lines from a mssql database insert into postgres the values taken if insert

Re: [GENERAL] very slow after a while...

2005-04-06 Thread Costin Manda
> Some more info please: > 1. This is this one INSERT statement per transaction, yes? If that > fails, you do an UPDATE correct. > 2. Are there any foreign-keys the insert will be checking? > 3. What indexes are there on the main table/foreign-key-related tables? this is the table, the only r

Re: [GENERAL] very slow after a while...

2005-04-06 Thread Costin Manda
I think I found the problem. I was comparing wrongly some values and based on that, every time the script was run (that means once every 5 minutes) my script deleted two tables and populated them with about 70 thousand records. I still don't know why that affected the speed of the database (e

Re: [GENERAL] very slow after a while...

2005-04-06 Thread Costin Manda
On Wed, 06 Apr 2005 14:07:36 +0100 Richard Huxton wrote: > Costin Manda wrote: > > I think I found the problem. I was comparing wrongly some values and > > based on that, every time the script was run (that means once every 5 > > minutes) my script deleted two tables an

Re: [GENERAL] very slow after a while...

2005-04-06 Thread Costin Manda
On Wed, 06 Apr 2005 15:54:29 +0100 Richard Huxton wrote: > > I mean from 5 to 5 minutes > > DROP TABLE > > CREATE TABLE > > INSERT 7 rows in table > > I thought you were trying an inserting / updating if it failed? You > shouldn't have any duplicates if the table was already empty. Or h

[GENERAL] Time and date functions give me headaches!!

2005-04-11 Thread Costin Manda
Hello, I have a table with columns defines as varchar that have values in format '-MM-DD HH:MM:SS'. Now, if I do a select timestamp '2005-10-10 10:10:10'; I get the value just fine. I can use abstime()::integer on the result to find the unix timestamp. (This is the simplest way I could find

Re: [GENERAL] What are the consequences of a bad database design

2005-04-11 Thread Costin Manda
> But the people i am working with are not considering the restructuring of > the database. They are even thinking of expanding it by adding new > modules. > Please can someone advise me, or tell me what to do, what may be the > consequences I have been working with databases for web scripts (P

[GENERAL] Division by zero

2005-04-16 Thread Costin Manda
In other SQL programs a division by zero is solved by transforming the result to NULL. How can I make postgres have the same behaviour without using CASE ? ---(end of broadcast)--- TIP 8: explain analyze is your friend

[GENERAL] indexes on functions, then modifying functions

2005-05-05 Thread Costin Manda
I have a plpgsql function that I am generating from time to time, like once a week or so. What it does is it compares some phone numbers for certain prefixes and then outputs the phone numbers without the prefixes. First I tried to make the function read from the database the prefixes, but w

[GENERAL] bug in Postgresql?

2005-05-09 Thread Costin Manda
Today I stumbled upon a very strange error. I was getting tired of getting errors when I tried using function round(double precision,integer) so I decided to build one of my own. I did*, then I issued select round(1.::double precision,2) To this the connection to the postgres serv