Re: [HACKERS] BigInt woes

2003-10-08 Thread Shridhar Daithankar
Joshua D. Drake wrote:

Hello,

 I believe that the Int8/BigInt items are known issues but I have a knew 
programmer that ran into it
over the weekend (he didn't call me when he encountered the problem, 
when he should of) and we have a
customer that burned some significant time on it as well. Will this be 
fixed in 7.4?
Well, this is not an issue actually but fact that postgresql is very strict 
about it's data types. You need to cast explicitly even for those types which 
'seem' compatible, such as int4 and int2.

This query:

explain select bid_id, bid_time from bid where bid_id = 1

Will always sequential scan.

This query:

explain select bid_id, bid_time from bid where bid_id = '1'
Try explain select bid_id, bid_time from bid where bid_id = 1::bigint

create function bid_check(bigint) returns bool as '
declare
 in_bid_id alias for $1;
begin
 if (select count(*) from bid where bid_id = in_bid_id) = 1 then
Again try typecasting.

if (select count(*) from bid where bid_id::bigint = in_bid_id::bigint) = 1 then

I doubt in_bid_id needs to be casted that explicitly but I am sure it will be 
safe..:-)

HTH

 Shridhar



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


Re: [HACKERS] Possible Commit Syntax Change for Improved TPS

2003-10-08 Thread Adrian Maier
Seun Osewa wrote:
I observed that in in many applications there are some transactions
that are more critical than others.  I may have the same database
instance managing website visitor accounting and financial
transactions.  I could tolerate the loss of a few transactions whose
only job is to tell me a user has clicked a page on my website but
would not dare risk this for any of the real financials work my
web-based app is doing.
It is possible to split the data over 2 database clusters:
one which contains important data (this cluster will be configured 
with fsync enabled),   and a second one that contains the less
important data (configured with fsync=off for speed reasons).



Cheers,

Adrian Maier
([EMAIL PROTECTED])
---(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


Re: [HACKERS] Cannot dump/restore text value \N

2003-10-08 Thread Manfred Koizar
On Sun, 05 Oct 2003 19:12:50 -0400, Tom Lane [EMAIL PROTECTED]
wrote:
it seems we have to compare the null representation string to the
pre-debackslashing input.

Here is a patch that does this and adds a few regression tests.

(This is probably fairly easy to make happen
in CVS tip, but it might be pretty painful in 7.3.)

There haven't been too much changes in this area between 7.3 and 7.4.
A patch against 7.3.4 will follow ...

Servus
 Manfred
diff -ruN ../base/src/backend/commands/copy.c src/backend/commands/copy.c
--- ../base/src/backend/commands/copy.c 2003-08-28 15:52:34.0 +0200
+++ src/backend/commands/copy.c 2003-10-08 10:43:02.0 +0200
@@ -90,7 +90,8 @@
   char *delim, char *null_print);
 static void CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
 char *delim, char *null_print);
-static char *CopyReadAttribute(const char *delim, CopyReadResult *result);
+static char *CopyReadAttribute(const char *delim, const char *nullst,
+   CopyReadResult *result, bool *isnull);
 static Datum CopyReadBinaryAttribute(int column_no, FmgrInfo *flinfo,
Oid typelem, bool *isnull);
 static void CopyAttributeOut(char *string, char *delim);
@@ -1361,7 +1362,7 @@
 
if (file_has_oids)
{
-   string = CopyReadAttribute(delim, result);
+   string = CopyReadAttribute(delim, null_print, result, 
isnull);
 
if (result == END_OF_FILE  *string == '\0')
{
@@ -1370,7 +1371,7 @@
break;
}
 
-   if (strcmp(string, null_print) == 0)
+   if (isnull)
ereport(ERROR,

(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
 errmsg(null OID in COPY 
data)));
@@ -1403,7 +1404,7 @@
 errmsg(missing data for 
column \%s\,

NameStr(attr[m]-attname;
 
-   string = CopyReadAttribute(delim, result);
+   string = CopyReadAttribute(delim, null_print, result, 
isnull);
 
if (result == END_OF_FILE  *string == '\0' 
cur == attnumlist  !file_has_oids)
@@ -1413,7 +1414,7 @@
break;  /* out of per-attr loop */
}
 
-   if (strcmp(string, null_print) == 0)
+   if (isnull)
{
/* we read an SQL NULL, no need to do anything 
*/
}
@@ -1442,7 +1443,7 @@
{
if (attnumlist == NIL  !file_has_oids)
{
-   string = CopyReadAttribute(delim, result);
+   string = CopyReadAttribute(delim, null_print, 
result, isnull);
if (result == NORMAL_ATTR || *string != '\0')
ereport(ERROR,

(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
@@ -1650,14 +1651,13 @@
  * END_OF_FILE:EOF indicator
  * In all cases, the string read up to the terminator is returned.
  *
- * Note: This function does not care about SQL NULL values -- it
- * is the caller's responsibility to check if the returned string
- * matches what the user specified for the SQL NULL value.
- *
  * delim is the column delimiter string.
+ * nullst says how NULL values are represented.
+ * *isnull is set true if a null attribute, else false.
  */
 static char *
-CopyReadAttribute(const char *delim, CopyReadResult *result)
+CopyReadAttribute(const char *delim, const char *nullst,
+  CopyReadResult *result, bool *isnull)
 {
int c;
int delimc = (unsigned char) delim[0];
@@ -1665,6 +1665,17 @@
unsigned char s[2];
char   *cvt;
int j;
+   boolmatchnull = true;
+   int matchlen = 0;
+
+#define CHECK_MATCH(c) \
+   do { \
+   if (matchnull) \
+   if (c == nullst[matchlen]) \
+   ++matchlen; \
+   else \
+   matchnull = false; \
+   } while (0)
 
s[1] = 0;
 
@@ -1733,6 +1744,7 @@
}
 

Re: [HACKERS] new initdb.c available

2003-10-08 Thread Zeugswetter Andreas SB SD

 . using wb for writing out on Windows is so that we don't 
 get Windows' gratuitous addition of carriage returns. I will document that.

Please use the #define PG_BINARY_W from c.h which is defined
with the correct letters for all platforms (wb on Windows).

That is how Peter's comment was meant.

Andreas

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


[HACKERS] Compilation of PostgreSQL on Irix

2003-10-08 Thread Robert E. Bruccoleri
Dear Devrim,
I have been using Postgres on Irix for over 8 years, and I have only
used the SGI provided compilers. GCC doesn't work well on Irix. In addition,
you can build a 64 bit version of PostgreSQL. Here's the script we used for
PostgreSQL 7.3.2:

#!/bin/ksh -x

./copy_local_files_for_build
export SGI_ABI=-64
cat config.cache EOF
ac_cv_lib_nsl_main=${ac_cv_lib_nsl_main='no'}
ac_cv_prog_CPP=${ac_cv_prog_CPP='cc -E'}
ac_cv_prog_gcc=${ac_cv_prog_gcc=no}
ac_cv_prog_perl=${ac_cv_prog_perl=/stf/sys64/bin/perl}
EOF
gmake clean
CC=cc -64 \
AWK=awk \
INSTALL=/pg/postgresql-7.3.2/config/install-sh \
LDFLAGS=-rpath $POSTGRES_HOME/local/lib \
./configure --prefix=/pg/postgresql-7.3.2 \
--enable-hba \
--with-pgport=6543 \
--disable-locale \
--enable-cassert \
--with-template=irix5 \
--with-includes=$POSTGRES_HOME/local/include 
$POSTGRES_HOME/local/include/readline \
--with-libs=$POSTGRES_HOME/local/lib \
--without-CXX \
--with-maxbackends=128 \
--enable-debug \
--without-java \
--enable-odbc
gmake
LD_LIBRARY64_PATH=/pg/postgresql-7.3.2/src/interfaces/libpq:$LD_LIBRARY64_PATH gmake 
check
gmake install
export PATH=/pg/postgresql-7.3.2/bin:$PATH
initdb -D /pg/postgresql-7.3.2/data



src/Makefile.custom is set to:

CUSTOM_CC = cc -64
LD += -64
MK_NO_LORDER = 1

The script copy_local_files_for_build is as follows:

#!/bin/sh

source=/stf/sys64

if [ $POSTGRES_HOMEx = x ]
then
echo No POSTGRES_HOME variable set.
exit 1
fi

if [ ! -d $POSTGRES_HOME/local/lib ]
then
mkdir -p $POSTGRES_HOME/local/lib
fi

/usr/local/bin/tarcp $source/include/readline $POSTGRES_HOME/local/include/readline
cp ${source}/lib/libz* $POSTGRES_HOME/local/lib
cp ${source}/lib/libreadline* $POSTGRES_HOME/local/lib
cp ${source}/include/z* $POSTGRES_HOME/local/include

--Bob

+-++
| Robert E. Bruccoleri, Ph.D. | email: [EMAIL PROTECTED]|
| President, Congenomics Inc. | URL:   http://www.congen.com/~bruc |
| P.O. Box 314| Phone: 609 818 7251| 
| Pennington, NJ 08534||
+-++

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [HACKERS] new initdb.c available

2003-10-08 Thread Andrew Dunstan
Zeugswetter Andreas SB SD wrote:

. using wb for writing out on Windows is so that we don't 
get Windows' gratuitous addition of carriage returns. I will document that.
   

Please use the #define PG_BINARY_W from c.h which is defined
with the correct letters for all platforms (wb on Windows).
That is how Peter's comment was meant.

 

Ahh. Ok. thanks.

cheers

andrew

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [HACKERS] Possible Commit Syntax Change for Improved TPS

2003-10-08 Thread Jeroen T. Vermeulen
On Thu, Oct 02, 2003 at 05:31:52AM -0700, Seun Osewa wrote:

 The beauty of the scheme is that the WAL syncs which sync everyone's 
 changes so far would cost about the same as the WAL syncs for just 
 one transaction being committed.  But when there are so many trans-
 actions we would not have to sync the WAL so often.

In that case, why not go to a lazy policy in high-load situations,
where subsequent commits are bundled up into a single physical write?
Just hold up a commit until either there's a full buffer's worth of 
commits waiting to be written, or some timer says it's time to flush
so the client doesn't wait too long.

It would increase per-client latency when viewed in isolation, but if
it really improves throughput that much you might end up getting a
faster response after all.

(BTW I haven't looked at the code involved so this may be completely
wrong, impossible, and/or how it works already)


Jeroen


---(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


Re: [HACKERS] Disabling function validation

2003-10-08 Thread Matthew T. O'Connor
Tom Lane wrote:

Bruce Momjian [EMAIL PROTECTED] writes:
 

Should we add a variable that is set from the dump filew that identifies
the version of PostgreSQL that generated the dump?
	SET dumped_version = 7.3
   

Is that identifying the backend version, or the pg_dump version?

Without a solid rationale for this, I'd rather not do it.

 

Why not both?  I would also think this info could be used in pg_restore 
in some way at some point.  Even if if can't, wouldn't it be worth it 
just for debugging purposes.  Knowing for sure what the backend and 
pg_dump versions were could be helpful.

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


Re: [HACKERS] Disabling function validation

2003-10-08 Thread Bruce Momjian
Matthew T. O'Connor wrote:
 Tom Lane wrote:
 
 Bruce Momjian [EMAIL PROTECTED] writes:
   
 
 Should we add a variable that is set from the dump filew that identifies
 the version of PostgreSQL that generated the dump?
 SET dumped_version = 7.3
 
 
 
 Is that identifying the backend version, or the pg_dump version?
 
 Without a solid rationale for this, I'd rather not do it.
 
   
 
 Why not both?  I would also think this info could be used in pg_restore 
 in some way at some point.  Even if if can't, wouldn't it be worth it 
 just for debugging purposes.  Knowing for sure what the backend and 
 pg_dump versions were could be helpful.

My guess was that this information would allow us to change the behavior
of PostgreSQL in the future but allow older dumps to still load.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


[HACKERS] IDE Drives and fsync

2003-10-08 Thread scott.marlowe
OK, I've done some more testing on our IDE drive machine.

First, some background.  The hard drives we're using are Seagate 
drives, model number ST380023A.  Firmware version is 3.33.  The machine 
they are in is running RH9.  The setup string I'm feeding them on startup 
right now is:  hdparm -c3 -f -W1 /dev/hdx

where:

-c3 sets I/O to 32 bit w/sync (uh huh, sure...)
-f sets the drive to flush buffer cache on exit
-W1 turns on write caching

The drives come up using DMA.  turning unmask IRQ on / off has no affect 
on the tests I've been performaing.

Without the -f switch, data corruption due to sudden power down is an 
almost certain.  Running 'pgbench -c 5 -t 100' and pulling the plug 
will result in recovery failing with the typical invalid page type 
messages.

the pgbench database was originally set to -s 1 when initializing.

If I turn off write caching (-W0) then the data is coherent no matter how 
many concurrents I'm running, but performance is abysmal (drops from ~ 200 
tps down to 45, 10 if I'm using /dev/md0, a mirror set.)  This is all on a 
single drive.

If I use -W1 and -f, then I get corruption on about every 4th test or so 
if the number of parallel beaters is 50 or so.  If I crank it up to 200 or 
increase the size of the database by using -s 10 during initilization.  
Note that EITHER a larger test database OR a larger number of clients 
seems to increase the chance of corruption.

I'm guessing that the with -W1 and -f, what's happening is that at lower 
levels of parallel access, or a larger data set, the time between when the 
drive reports and fsync and when it actually writes the data out is 
climbing, and it is more likely that data that is in transit to the wal is 
getting lost during the power plug pull.

Tom, you had mentioned adding a delay of some kind to the fsync logic, and 
I'd be more than willing to try out any patch you'd like to toss out to me 
to see if we can get a semi-stable behaviour out of IDE drives with the 
-W1 and -f switches turned on.  As it is, the performance is quite good, 
and under low to medium loads, it seems to be capable of surviving the 
power plug being pulled, so I'm wondering if we can come up with a slight 
delay, that might drop the performance some small percentage while 
greatly decreasing the chance of data corruption.

Is this worth looking into?  I can see plenty of uses for a machine that 
runs on IDE for cost savings, while still providing a reasonable amount of 
data security in case of power failure, but I'm not sure if we can get rid 
of the problem completely or not.


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


[HACKERS] plpgsql overloading bug in 7.3.2 on OS X

2003-10-08 Thread Allie Micka
I'm having trouble overloading functions in plpgsql using PostgreSQL 
7.3.2 on OS X.

I have created two functions with the following declarations:

CREATE OR REPLACE FUNCTION set_entity_type(BIGINT,TEXT) RETURNS BOOLEAN 
AS ' ...
CREATE OR REPLACE FUNCTION set_entity_type(BIGINT,BIGINT) RETURNS 
BOOLEAN AS ' ...

But it is not using the correct function:
SELECT set_entity_type(88,'Category');
ERROR:  pg_atoi: error in Category: can't parse Category
swm on #postgresql suggested enforcing the datatype in the function 
call, as in 'Category'::text .  This worked fine, but as I understand 
it, this is still a bug.

Thanks!

---(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


Re: [HACKERS] Dreaming About Redesigning SQL

2003-10-08 Thread Seun Osewa
I have tried, twice, to download the evaluation version of the alphora
product for testing and it doesn't work.  Guess there would be a lot
to learn from playing with it; the product is more than a RDBMS

Regards,
Seun Osewa

[EMAIL PROTECTED] (Lauri Pietarinen) wrote:
 That is, in fact, the approach taken in a product called Dataphor
 (see www.alphora.com).  They have implemented a D-language (called D4)
 that translates into SQL and hence uses underlying SQLServer, Oracle
 or DB2- DBMS'es as the engine.

 regards,
 Lauri Pietarinen

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[HACKERS] Possible Bug in 7.3.2 on OS X

2003-10-08 Thread Allie Micka
I'm having trouble overloading functions in plpgsql using PostgreSQL 
7.3.2 on OS X.

I have created two functions with the following declarations:

CREATE OR REPLACE FUNCTION set_entity_type(BIGINT,TEXT) RETURNS BOOLEAN AS '

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


[HACKERS] compile warning

2003-10-08 Thread Alvaro Herrera
I'm seeing this compile warning on today's CVS tip:

$ make src/backend/commands/tablecmds.o
gcc -O2 -g -Wall -Wmissing-prototypes -Wmissing-declarations -I./src/include 
-D_GNU_SOURCE   -c -o src/backend/commands/tablecmds.o src/backend/commands/tablecmds.c
src/backend/commands/tablecmds.c: In function `validateForeignKeyConstraint':
src/backend/commands/tablecmds.c:3528: warning: dereferencing type-punned pointer will 
break strict-aliasing rules

$ gcc --version
gcc (GCC) 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ src/bin/pg_config/pg_config --configure
'--enable-debug' '--enable-nls=es' '--enable-integer-datetimes'

-- 
Alvaro Herrera (alvherre[a]dcc.uchile.cl)
In Europe they call me Niklaus Wirth; in the US they call me Nickel's worth.
That's because in Europe they call me by name, and in the US by value!

---(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


[HACKERS] index changing by unbalanced tree

2003-10-08 Thread monu_indian
gist supports only balanced trees but I have to implement index as suffix tree which 
is highly unbalanced.How can I do this?


monu_indian [EMAIL PROTECTED] writes:
 I have designed a new indexing tecknique for biological database now I want to 
 implement it in pgsql so what the work I will have to do? From where I should start?

You could write a new index access method ... though I would not exactly
recommend that as a good project for a first-time Postgres hacker.

It might be that you could implement what you want to do as a layer on
top of the GIST index type.  See the GIST-related contrib modules for
some examples.

regards, tom lane
Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com

 Buy The Best In BOOKS at http://www.bestsellers.indiatimes.com

Bid for for Air Tickets @ Re.1 on Air Sahara Flights. Just log on to 
http://airsahara.indiatimes.com and Bid Now!


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


Re: [HACKERS] IDE Drives and fsync

2003-10-08 Thread Manfred Spraul
scott.marlowe wrote:

OK, I've done some more testing on our IDE drive machine.

First, some background.  The hard drives we're using are Seagate 
drives, model number ST380023A.  Firmware version is 3.33.  The machine 
they are in is running RH9.  The setup string I'm feeding them on startup 
right now is:  hdparm -c3 -f -W1 /dev/hdx

where:

-c3 sets I/O to 32 bit w/sync (uh huh, sure...)

sync has nothing to do with sync to disk. The sync means read from three 
magic io ports before transfering data to or from the device.


-f sets the drive to flush buffer cache on exit

-f shouldn't have any effect: it means that the buffer cache in the OS 
is flushed after hdparm exits, it has no long-term effect on the disk.

-W1 turns on write caching

That's the problem: turning on write caching causes corruptions.
What's needed is partial write caching: write cache on, and fsync() 
sends a barrier to the disk, and only after the disk reports that the 
barrier is completed, then fsync() returns.
I consider that an OS/driver problem, not a problem for postgres.

The drives come up using DMA.  turning unmask IRQ on / off has no affect 
on the tests I've been performaing.
 

Of course. irq unmasking is about interrupt latency if DMA is not used: 
DMA off and dma masking off results in dropped bytes on serial links.

Without the -f switch, data corruption due to sudden power down is an 
almost certain.

It's odd that adding -f reduces the corruptions - probably it changes 
available memory, and thus the writeback of data from kernel to disk.

Tom, you had mentioned adding a delay of some kind to the fsync logic, and 
I'd be more than willing to try out any patch you'd like to toss out to me 
to see if we can get a semi-stable behaviour out of IDE drives with the 
-W1 and -f switches turned on.

I'm not aware that there is any safe delay. Disks with write caches 
reorder io operations, and some hold back write operations indefinitively.

Unfortunately Linux doesn't implement write barriers, and the support in 
some IDE disks is missing, too :-(

--
   Manfred
---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
 joining column's datatypes do not match


[HACKERS] setlocale

2003-10-08 Thread Andrew Dunstan
The MS runtime docs on setlocale() contaiun the following statement:

 At program startup, the equivalent of the following statement is executed:

 setlocale( LC_ALL, C );

Does this have any effect on us? Does it mean, as it appears to, that the locale will not be inherited from the parent? 

If so, I guess it could be got around by passing LC_COLLATE and LC_CTYPE arguments to postgres when running the bootstrap code. 

Of course, if I'm right, initdb would not pick up the locale from its caller, which might be ugly if that was what you expected.

(I'm new to this locale stuff - I know we have some experts out there).

Another question - will we want to internationalize initdb (I'm new to that, too :-) )

cheers

andrew



---(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


Re: [HACKERS] setlocale

2003-10-08 Thread Peter Eisentraut
Andrew Dunstan writes:

   At program startup, the equivalent of the following statement is executed:
   setlocale( LC_ALL, C );
 Does this have any effect on us?

No, that is just a peculiar way to express that by default nothing
happens.

 Does it mean, as it appears to, that the locale will not be inherited
 from the parent?

A process never inherits the locale from the parent.  It only inherits
environment variables, among which may be LC_ALL, etc.  To activate any
kind of locale in a program you need to call

setlocale(LC_xxx, something);

where something may be the name of the actual locale you want, or -- as
a special case -- it may be , in which case it takes the value of the
respective environment variable LC_xxx.

There is an appearance of inheritance in shell scripts, but only because
the shell takes care of some of these things automatically.

 If so, I guess it could be got around by passing LC_COLLATE and LC_CTYPE
 arguments to postgres when running the bootstrap code.

The easiest solution would be to stick LC_COLLATE and LC_CTYPE into the
environment of the postgres process when you call it the first time (in
bootstrap mode).  If no --lc-* options were given, you don't need to do
anything, because postgres will just take what's in the environment.  If
--lc-* options where given, you could use putenv().

 Another question - will we want to internationalize initdb

Yes, but that should really wait until we have a working C version first.

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---(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


[HACKERS] confused about bit strings

2003-10-08 Thread Neil Conway
Is the following behavior intentional? If so, what's the reasoning
behind it?

nconway=# select 1::bit;
 bit 
-
 0
(1 row)
nconway=# select '1'::bit;
 bit 
-
 1
(1 row)
nconway=# select X'1'::bit;
 bit 
-
 0
(1 row)
nconway=# select 1::bit varying;
ERROR:  cannot cast type integer to bit varying
nconway=# select 4::int2::bit;
ERROR:  cannot cast type smallint to bit

nconway=# select 4::bit;
 bit 
-
 0
(1 row)
nconway=# select '4'::bit;
ERROR:  4 is not a valid binary digit
nconway=# select X'4'::bit varying;
 varbit 

 0100
(1 row)
-- why is that 4 bits, not 3?

nconway=# select '14'::int::bit;
 bit 
-
 0
(1 row)
nconway=# select bit('14'::int);
ERROR:  syntax error at or near '14' at character 12
nconway=# select bit('14'::int);
   bit
--
 1110
(1 row)
-- shouldn't bit be equivalent to bit(1), which should be
right-truncated?

Cheers,

Neil


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Andrew Dunstan
Bruce Momjian wrote:

Jeff wrote:
 

On Wed, 8 Oct 2003, Neil Conway wrote:

   

What CFLAGS does configure pick for gcc? From
src/backend/template/solaris, I'd guess it's not enabling any
optimization. Is that the case? If so, some gcc numbers with -O and -O2
would be useful.
 

I can't believe I didn't think of this before! heh.
Turns out gcc was getting nothing for flags.
I added -O2 to CFLAGS and my 60 seconds went down to 21.  A rather mild
improvment huh?
I did a few more tests and suncc still beats it out - but not by too much
now (Not enought to justify buying a license just for compiling pg)
I'll go run the regression test suite with my gcc -O2 pg and the suncc pg.
See if they pass the test.
If they do we should consider adding -O2 and -fast to the CFLAGS.
   

[ CC added for hackers.]

Well, this is really embarassing.  I can't imagine why we would not set
at least -O on all platforms.  Looking at the template files, I see
these have no optimization set:

darwin
dgux
freebsd (non-alpha)
irix5
nextstep
osf (gcc)
qnx4
solaris
sunos4
svr4
ultrix4
I thought we used to have code that did -O for any platforms that set no
cflags, but I don't see that around anywhere.  I recommend adding -O2,
or at leaset -O to all these platforms --- we can then use platform
testing to make sure they are working.
 

Actually, I would not be surprised to see gains on Solaris/SPARC from 
-O3 with gcc, which enables inlining and register-renaming, although 
this does make debugging pretty much impossible.

worth testing at least (but I no longer have access to a Solaris machine).

cheers

andrew

---(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


Re: [HACKERS] [PORTS] Postgresql 7.3.4 compile failes on NetBSD 1.6 mac68k

2003-10-08 Thread Bruce Momjian

Would someone report on the answer to this m68k question?

---

Tom Lane wrote:
 =?ISO-8859-1?Q?R=E9mi_Zara?= [EMAIL PROTECTED] writes:
  Here is the patch to make postgresql compile on m68k 1.6.x NetBSD:
 
 I can't apply this as-is, since (I believe) adding the % marks would
 break the code for other m68k platforms.  What we need is an #if test
 that determines whether % or no-% is the appropriate syntax for
 registers.  Any ideas?
 
   regards, tom lane
 
 ---(end of broadcast)---
 TIP 9: the planner will ignore your desire to choose an index scan if your
   joining column's datatypes do not match
 

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

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


Re: [HACKERS] Separate shared_buffer management process

2003-10-08 Thread Bruce Momjian

Added to TODO:

* Use background process to write dirty shared buffers to disk

---

Tom Lane wrote:
 Bruce Momjian [EMAIL PROTECTED] writes:
  Would it be a good idea to have a separate shared buffer process to
  manage the cache?  Could such a process take workload off of the main
  backend and improve their performance?
 
  Just an idea?
 
 I can't recall if this has been discussed on the list, but I know I've
 thought about the idea of a background buffer writer process that
 would simply cycle through the buffer cache and write out dirty buffers
 in some low-priority fashion.
 
 The idea is this would reduce the I/O crunch at checkpoint times, as
 well as reducing the odds that any foreground backend process would have
 to block waiting for I/O before it could recycle a buffer slot to read
 in a page it needs.  (Perhaps the background writer could be tuned to
 preferentially write dirty buffers that are near the tail of the LRU
 queue, and thus are likely to get recycled soon.)
 
 In the WAL world, you cannot write a dirty buffer until you have
 written *and synced* the WAL log as least as far as the LSN of the
 buffer you want to write.  So a background buffer writer would have
 to write WAL buffers as well, and in that context it could find itself
 blocking foreground processes.  I'm not sure what this does to the
 notion of background I/O.  Maybe only buffers whose changes are
 already synced in WAL should be eligible for background write.
 It needs some thought anyway.
 
   regards, tom lane
 

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] confused about bit strings

2003-10-08 Thread Peter Eisentraut
Neil Conway writes:

 nconway=# select 1::bit;
  bit
 -
  0
 (1 row)

Oops.  I've always thought that casting between int and bit should be
disallowed, but apparently it keeps sneaking back in.

 nconway=# select X'4'::bit varying;
  varbit
 
  0100
 (1 row)
 -- why is that 4 bits, not 3?

SQL says so:

12) The declared type of a hex string literal is fixed-length
bit string. Each hexit appearing in the literal is equivalent
to a quartet of bits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C,
D, E, and F are interpreted as , 0001, 0010, 0011, 0100,
0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110,
and , respectively. The hexits a, b, c, d, e, and f have
respectively the same values as the hexits A, B, C, D, E, and
F.

 nconway=# select bit('14'::int);
bit
 --
  1110
 (1 row)
 -- shouldn't bit be equivalent to bit(1), which should be
 right-truncated?

It is, but here you're calling a function, not referring to the type.

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [HACKERS] 2-phase commit

2003-10-08 Thread Bruce Momjian
Andrew Sullivan wrote:
 On Sat, Sep 27, 2003 at 09:13:27AM -0300, Marc G. Fournier wrote:
  
  I think it was Andrew that suggested it ... when the slave timesout, it
  should trigger a READ ONLY mode on the slave, so that when/if the master
  tries to start to talk to it, it can't ...
  
  As for the master itself, it should be smart enough that if it times out,
  it knows to actually abandom the slave and not continue to try ...
 
 Yes, but now we're talking as though this is master-slave
 replication.  Actually, master and slave are only useful terms in
 a transaction for 2PC.  So every machine is both a master and a
 slave.
 
 It seems that one way out is just to fall back to read only as soon
 as a single failure happens.  That's the least graceful but maybe
 safest approach to failure, analogous to what fsck does to your root
 filesystem at boot time.  Of course, since there's no read only
 mode at the moment, this is all pretty hand-wavy on my part :-/

OK, I think we came to the conclusion that we want 2-phase commit, but
want some way to mark a server as offline/read-only, or notify an
administrator.  Can we communicate this to the Japanese guys working on
2-phase commit so they can start working toward including in 7.5?


Added to TODO:

* Add two-phase commit to all distributed transactions with
  offline/readonly server status or administrator notification 
  for failure

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: ADD FOREIGN KEY (was Re: [HACKERS] [GENERAL] 7.4Beta)

2003-10-08 Thread Bruce Momjian
Jan Wieck wrote:
  I think this is a larger argument than the one that was being discussed
  above. Given a dump of objects I own, can I restore them without requiring
  the fk check to be done if I alter table add constraint a foreign key? If
  the answer to that is no, then the option can be put in as a superuser
  only option and it's relatively easy. If the answer to that is yes, then
  there are additional issues that need to be resolved.
 
 Well, with the CREATE CONSTRAINT TRIGGER you _can_, but we already have 
 a consensus that we don't _want_ that. Probably we should declare it 
 deprecated and remove it in 7.5. And the option currently under 
 discussion is exactly what will cause ALTER TABLE to let you, but IMHO 
 that _should_ be restricted.

Added to TODO:

* Remove CREATE CONSTRAINT TRIGGER

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(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


[HACKERS] Autovacuum readme

2003-10-08 Thread Gaetano Mendola
Hi all,
I found on the readme the following lines:


deleteThreshold is equal to:
vacuum_base_value + (vacuum_scaling_factor * number of tuples in 
the table)

insertThreshold is equal to:
analyze_base_value + (analyze_scaling_factor * number of tuples in 
the table)



may be here  deleteThreshold shall be AnalyzeThreshold and
 insertThreshold shall be VacuumThreshold
am I missing something?



Regards
Gaetano Mendola
---(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


Re: ADD FOREIGN KEY (was Re: [HACKERS] [GENERAL] 7.4Beta)

2003-10-08 Thread Christopher Kings-Lynne

Well, with the CREATE CONSTRAINT TRIGGER you _can_, but we already have 
a consensus that we don't _want_ that. Probably we should declare it 
deprecated and remove it in 7.5. And the option currently under 
discussion is exactly what will cause ALTER TABLE to let you, but IMHO 
that _should_ be restricted.
How can we ever remove it - what about people upgrading from 7.0, 7.1, 
7.2?  Also, people upgrading from 7.3 who've never heard of adddepend...

Chris



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: ADD FOREIGN KEY (was Re: [HACKERS] [GENERAL] 7.4Beta)

2003-10-08 Thread Bruce Momjian
Christopher Kings-Lynne wrote:
 
 Well, with the CREATE CONSTRAINT TRIGGER you _can_, but we already have 
 a consensus that we don't _want_ that. Probably we should declare it 
 deprecated and remove it in 7.5. And the option currently under 
 discussion is exactly what will cause ALTER TABLE to let you, but IMHO 
 that _should_ be restricted.
 
 How can we ever remove it - what about people upgrading from 7.0, 7.1, 
 7.2?  Also, people upgrading from 7.3 who've never heard of adddepend...

Not sure.  We can remove documentation about it, at least.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(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


Re: [HACKERS] Cannot dump/restore text value \N

2003-10-08 Thread Tom Lane
Manfred Koizar [EMAIL PROTECTED] writes:
 Here is a patch that does this and adds a few regression tests.

Uh, I did that already ... for 7.4 at least.

regards, tom lane

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


Re: ADD FOREIGN KEY (was Re: [HACKERS] [GENERAL] 7.4Beta)

2003-10-08 Thread Jan Wieck
Bruce Momjian wrote:

Christopher Kings-Lynne wrote:
Well, with the CREATE CONSTRAINT TRIGGER you _can_, but we already have 
a consensus that we don't _want_ that. Probably we should declare it 
deprecated and remove it in 7.5. And the option currently under 
discussion is exactly what will cause ALTER TABLE to let you, but IMHO 
that _should_ be restricted.

How can we ever remove it - what about people upgrading from 7.0, 7.1, 
7.2?  Also, people upgrading from 7.3 who've never heard of adddepend...
Not sure.  We can remove documentation about it, at least.

If the idea is to support any 7.n - 7.m (where n  m) upgrade directly, 
then it's IMHO time for 8.0 and clearly stating that 7.x - 8.y only is 
supported as 7.x - 7.3 - 8.0 - 8.y and you're on your own with any 
other attempt.

Don't get this wrong, I am a big friend of easy upgrades. But I am not a 
big friend of making improvements impossible by backward compatibility 
forever. It was the backward compatibility to CP/M-80 (v2.2) that 
caused MS-DOS 7.0 to have a maximum commandline length of 127 characters 
... that was taking compatibility too far. Well, M$ took it too far the 
other way from there and is compatible to nothing any more, not even to 
themself ... but at least they learned from that mistake.

Jan

--
#==#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.  #
#== [EMAIL PROTECTED] #
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [HACKERS] missing COMMENT ON objects

2003-10-08 Thread Christopher Kings-Lynne
I notice you cannot COMMENT ON the following:
* Cast
* Conversion
* Operator class
Is that a deliberate omission, or is it an oversight?


Unimplemented feature AFAIR.  BTW, if you feel like doing something
about this, COMMENT ON LARGE OBJECT oid would be good too.
* COMMENT ON [ CAST | CONVERSION | OPERATOR CLASS | LARGE OBJECT ]

Bruce - want to make this a TODO?  May as well assign it to me - I'll 
have a play with it.  I assume this is a post-7.4 item?

Chris



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


Re: [HACKERS] missing COMMENT ON objects

2003-10-08 Thread Bruce Momjian

Added, yes, a 7.5 item.

---

Christopher Kings-Lynne wrote:
 I notice you cannot COMMENT ON the following:
 * Cast
 * Conversion
 * Operator class
 Is that a deliberate omission, or is it an oversight?
  
  
  Unimplemented feature AFAIR.  BTW, if you feel like doing something
  about this, COMMENT ON LARGE OBJECT oid would be good too.
 
 * COMMENT ON [ CAST | CONVERSION | OPERATOR CLASS | LARGE OBJECT ]
 
 Bruce - want to make this a TODO?  May as well assign it to me - I'll 
 have a play with it.  I assume this is a post-7.4 item?
 
 Chris
 
 
 
 ---(end of broadcast)---
 TIP 5: Have you checked our extensive FAQ?
 
http://www.postgresql.org/docs/faqs/FAQ.html
 

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [HACKERS] Autovacuum readme

2003-10-08 Thread Matthew T. O'Connor
On Wed, 2003-10-08 at 18:27, Gaetano Mendola wrote:
 I found on the readme the following lines:
 deleteThreshold is equal to:
  vacuum_base_value + (vacuum_scaling_factor * number of tuples in 
 the table)
 
 insertThreshold is equal to:
  analyze_base_value + (analyze_scaling_factor * number of tuples in 
 the table)
 may be here  deleteThreshold shall be AnalyzeThreshold and
   insertThreshold shall be VacuumThreshold
 
 
 am I missing something?

No, I don't think you are missing anything, this is a left over from
early development before I changed the thresholds delete and insert to
vacuum and analyze.  So you are correct.

Matthew T. O'Connor


---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] _GNU_SOURCE

2003-10-08 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian [EMAIL PROTECTED] writes:
  Jeroen Ruigrok/asmodai wrote:
  The crypt_r function is a GNU extension.
 
  BSD/OS doesn't have crypt_r(), and crypt() manual page says:
 
   The crypt() function may not be safely called concurrently from multiple
   threads, e.g., the interfaces described by pthreads(3).
 
 Right.  But whether crypt is re-entrant or not isn't really the issue
 here.  The problem is that the standard RHL 8 version of Perl is
 installed in such a way that perl.h fails to compile unless crypt_r's
 struct typedef is visible.  I have not looked, but I surmise this must
 mean that they configured Perl with _GNU_SOURCE defined.  Maybe it was
 done so Perl could get at crypt_r, but more likely it was for some other
 reasons altogether ...

Do we want to try this approach that the DBD:pg guys are using?

http://gborg.postgresql.org/pipermail/dbdpg-general/2003-September/000452.html

It involves $Config{q{ccflags}};.  I think they can use it because
they are using Makefile.PL, while our plperl is not, so maybe we can't
use it.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [HACKERS] missing COMMENT ON objects

2003-10-08 Thread Christopher Kings-Lynne

Unimplemented feature AFAIR.  BTW, if you feel like doing something
about this, COMMENT ON LARGE OBJECT oid would be good too.


* COMMENT ON [ CAST | CONVERSION | OPERATOR CLASS | LARGE OBJECT ]

Bruce - want to make this a TODO?  May as well assign it to me - I'll 
have a play with it.  I assume this is a post-7.4 item?
Actually, what about COMMENT ON LANGUAGE as well?

Chris



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


Re: [HACKERS] missing COMMENT ON objects

2003-10-08 Thread Bruce Momjian

Added.

---

Christopher Kings-Lynne wrote:
 
  Unimplemented feature AFAIR.  BTW, if you feel like doing something
  about this, COMMENT ON LARGE OBJECT oid would be good too.
  
  
  * COMMENT ON [ CAST | CONVERSION | OPERATOR CLASS | LARGE OBJECT ]
  
  Bruce - want to make this a TODO?  May as well assign it to me - I'll 
  have a play with it.  I assume this is a post-7.4 item?
 
 Actually, what about COMMENT ON LANGUAGE as well?
 
 Chris
 
 
 
 ---(end of broadcast)---
 TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
 

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 8: explain analyze is your friend


[HACKERS] Problem with the pq_recvbuf

2003-10-08 Thread shyamperi
4:12p
Dear all,
I am facing problems with the postgres(7.3.1) on windows machine(98). The problem is 
with pg_recvbuf. And here are the logs..
Can any one teach me more on this
LOG:  pq_recvbuf: unexpected EOF on client connection
LOG:  pq_recvbuf: unexpected EOF on client connection
LOG:  pq_recvbuf: recv() failed: No error
LOG:  incomplete startup packet

Have a grate day

-
Warm Regards
Shÿam Peri

II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003 
Ph : 91-824-2451001/5
Fax : 91-824-2451050 


DISCLAIMER: This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended
recipient you should not disseminate,distribute,store,print, copy or
deliver this message.Please notify the sender immediately by e-mail if
you have received this e-mail by mistake and delete this e-mail from
your system.4:12pDear all,
I am facing problems with the postgres(7.3.1) on windows machine(98). The problem is with pg_recvbuf. And here are the logs..
Can any one teach me more on this
LOG: pq_recvbuf: unexpected EOF on client connectionLOG: pq_recvbuf: unexpected EOF on client connectionLOG: pq_recvbuf: recv() failed: No errorLOG: incomplete startup packet
Have a grate day-
Warm Regards
Shÿam Peri

II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003 
Ph : 91-824-2451001/5
Fax : 91-824-2451050 




DISCLAIMER: This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended
recipient you should not disseminate,distribute,store,print, copy or
deliver this message.Please notify the sender immediately by e-mail if
you have received this e-mail by mistake and delete this e-mail from
your system.
---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Bruce Momjian
Jeff wrote:
 On Wed, 8 Oct 2003, Neil Conway wrote:
 
 
  What CFLAGS does configure pick for gcc? From
  src/backend/template/solaris, I'd guess it's not enabling any
  optimization. Is that the case? If so, some gcc numbers with -O and -O2
  would be useful.
 
 
 I can't believe I didn't think of this before! heh.
 Turns out gcc was getting nothing for flags.
 
 I added -O2 to CFLAGS and my 60 seconds went down to 21.  A rather mild
 improvment huh?
 
 I did a few more tests and suncc still beats it out - but not by too much
 now (Not enought to justify buying a license just for compiling pg)
 
 I'll go run the regression test suite with my gcc -O2 pg and the suncc pg.
 See if they pass the test.
 
 If they do we should consider adding -O2 and -fast to the CFLAGS.

[ CC added for hackers.]

Well, this is really embarassing.  I can't imagine why we would not set
at least -O on all platforms.  Looking at the template files, I see
these have no optimization set:

darwin
dgux
freebsd (non-alpha)
irix5
nextstep
osf (gcc)
qnx4
solaris
sunos4
svr4
ultrix4

I thought we used to have code that did -O for any platforms that set no
cflags, but I don't see that around anywhere.  I recommend adding -O2,
or at leaset -O to all these platforms --- we can then use platform
testing to make sure they are working.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Neil Conway
On Wed, 2003-10-08 at 14:31, Bruce Momjian wrote:
 Well, this is really embarassing.  I can't imagine why we would not set
 at least -O on all platforms.

ISTM the most legitimate reason for not enabling compilater
optimizations on a given compiler/OS/architecture combination is might
cause compiler errors / bad code generation.

Can we get these optimizations enabled in time for the next 7.4 beta? It
might also be good to add an item in the release notes about it.

-Neil



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


Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Jeff
On Wed, 8 Oct 2003, Neil Conway wrote:

 ISTM the most legitimate reason for not enabling compilater
 optimizations on a given compiler/OS/architecture combination is might
 cause compiler errors / bad code generation.

 Can we get these optimizations enabled in time for the next 7.4 beta? It
 might also be good to add an item in the release notes about it.

 -Neil


I just ran make check for sun with gcc -O2 and suncc -fast and both
passed.

We'll need other arguments to suncc to supress some warnings, etc. (-fast
generates a warning for every file compiled telling you it will only
run on ultrasparc machines)


--
Jeff Trout [EMAIL PROTECTED]
http://www.jefftrout.com/
http://www.stuarthamm.net/



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Tom Lane
Neil Conway [EMAIL PROTECTED] writes:
 On Wed, 2003-10-08 at 14:31, Bruce Momjian wrote:
 Well, this is really embarassing.  I can't imagine why we would not set
 at least -O on all platforms.

I believe that autoconf will automatically select -O2 (when CFLAGS isn't
already set) *if* it's chosen gcc.  It won't select anything for vendor
ccs.

 Can we get these optimizations enabled in time for the next 7.4 beta?

I think it's too late in the beta cycle to add optimization flags except
for platforms we can get specific success results for.  (Solaris is
probably okay for instance.)  The risk of breaking things seems too
high.

regards, tom lane

---(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


Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Peter Eisentraut
Bruce Momjian writes:

 Well, this is really embarassing.  I can't imagine why we would not set
 at least -O on all platforms.  Looking at the template files, I see
 these have no optimization set:

   freebsd (non-alpha)

I'm wondering what that had in mind:

http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/template/freebsd.diff?r1=1.10r2=1.11

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Bruce Momjian
Tom Lane wrote:
 Neil Conway [EMAIL PROTECTED] writes:
  On Wed, 2003-10-08 at 14:31, Bruce Momjian wrote:
  Well, this is really embarassing.  I can't imagine why we would not set
  at least -O on all platforms.
 
 I believe that autoconf will automatically select -O2 (when CFLAGS isn't
 already set) *if* it's chosen gcc.  It won't select anything for vendor
 ccs.

I think the problem is that template/solaris overrides that with:

  CFLAGS=

  Can we get these optimizations enabled in time for the next 7.4 beta?
 
 I think it's too late in the beta cycle to add optimization flags except
 for platforms we can get specific success results for.  (Solaris is
 probably okay for instance.)  The risk of breaking things seems too
 high.

Agreed.  Do we set them all to -O2, then remove it from the ones we
don't get successful reports on?

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Bruce Momjian
Peter Eisentraut wrote:
 Bruce Momjian writes:
 
  Well, this is really embarassing.  I can't imagine why we would not set
  at least -O on all platforms.  Looking at the template files, I see
  these have no optimization set:
 
  freebsd (non-alpha)
 
 I'm wondering what that had in mind:
 
 http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/template/freebsd.diff?r1=1.10r2=1.11

I was wondering that myself.  I think the idea was that we already do
-O2 in configure if it is gcc, so why do it in the template files.  What
is killing us is the CFLAGS= lines in the configuration files.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Christopher Kings-Lynne
Well, this is really embarassing.  I can't imagine why we would not set
at least -O on all platforms.  Looking at the template files, I see
these have no optimization set:


	freebsd (non-alpha)


I'm wondering what that had in mind:

http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/template/freebsd.diff?r1=1.10r2=1.11
When I used to build pgsql on freebsd/alpha, I would get heaps of GCC 
warnings saying 'optimisations for the alpha are broken'.  I can't 
remember if that meant anything more than just -O or not though.

Chris



---(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


Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Bruce Momjian
Tom Lane wrote:
 Neil Conway [EMAIL PROTECTED] writes:
  On Wed, 2003-10-08 at 14:31, Bruce Momjian wrote:
  Well, this is really embarassing.  I can't imagine why we would not set
  at least -O on all platforms.
 
 I believe that autoconf will automatically select -O2 (when CFLAGS isn't
 already set) *if* it's chosen gcc.  It won't select anything for vendor
 ccs.
 
  Can we get these optimizations enabled in time for the next 7.4 beta?
 
 I think it's too late in the beta cycle to add optimization flags except
 for platforms we can get specific success results for.  (Solaris is
 probably okay for instance.)  The risk of breaking things seems too
 high.

OK, patch attached and applied.  It centralizes the optimization
defaults into configure.in, rather than having CFLAGS= in the template
files.

It used -O2 for gcc (generated automatically by autoconf), and -O for
non-gcc, unless the template overrides it.

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073
Index: configure
===
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.302
diff -c -c -r1.302 configure
*** configure   3 Oct 2003 03:08:14 -   1.302
--- configure   9 Oct 2003 03:16:44 -
***
*** 2393,2398 
--- 2393,2402 
  if test $ac_env_CFLAGS_set = set; then
CFLAGS=$ac_env_CFLAGS_value
  fi
+ # configure sets CFLAGS to -O2 for gcc, so this is only for non-gcc
+ if test x$CFLAGS = x; then
+   CFLAGS=-O
+ fi
  if test $enable_debug = yes  test $ac_cv_prog_cc_g = yes; then
CFLAGS=$CFLAGS -g
  fi
Index: configure.in
===
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.293
diff -c -c -r1.293 configure.in
*** configure.in3 Oct 2003 03:08:14 -   1.293
--- configure.in9 Oct 2003 03:16:46 -
***
*** 238,243 
--- 238,247 
  if test $ac_env_CFLAGS_set = set; then
CFLAGS=$ac_env_CFLAGS_value
  fi
+ # configure sets CFLAGS to -O2 for gcc, so this is only for non-gcc
+ if test x$CFLAGS = x; then
+   CFLAGS=-O
+ fi
  if test $enable_debug = yes  test $ac_cv_prog_cc_g = yes; then
CFLAGS=$CFLAGS -g
  fi
Index: src/template/beos
===
RCS file: /cvsroot/pgsql-server/src/template/beos,v
retrieving revision 1.6
diff -c -c -r1.6 beos
*** src/template/beos   21 Oct 2000 22:36:13 -  1.6
--- src/template/beos   9 Oct 2003 03:16:51 -
***
*** 1 
- CFLAGS='-O2'
--- 0 
Index: src/template/bsdi
===
RCS file: /cvsroot/pgsql-server/src/template/bsdi,v
retrieving revision 1.16
diff -c -c -r1.16 bsdi
*** src/template/bsdi   27 Sep 2003 16:24:44 -  1.16
--- src/template/bsdi   9 Oct 2003 03:16:51 -
***
*** 5,13 
  esac
  
  case $host_os in
!   bsdi2.0 | bsdi2.1 | bsdi3*)
! CC=gcc2
! ;;
  esac
  
  THREAD_SUPPORT=yes
--- 5,11 
  esac
  
  case $host_os in
!   bsdi2.0 | bsdi2.1 | bsdi3*) CC=gcc2;;
  esac
  
  THREAD_SUPPORT=yes
Index: src/template/cygwin
===
RCS file: /cvsroot/pgsql-server/src/template/cygwin,v
retrieving revision 1.2
diff -c -c -r1.2 cygwin
*** src/template/cygwin 9 Oct 2003 02:37:09 -   1.2
--- src/template/cygwin 9 Oct 2003 03:16:51 -
***
*** 1,2 
- CFLAGS='-O2'
  SRCH_LIB='/usr/local/lib'
--- 1 
Index: src/template/dgux
===
RCS file: /cvsroot/pgsql-server/src/template/dgux,v
retrieving revision 1.10
diff -c -c -r1.10 dgux
*** src/template/dgux   21 Oct 2000 22:36:13 -  1.10
--- src/template/dgux   9 Oct 2003 03:16:51 -
***
*** 1 
- CFLAGS=
--- 0 
Index: src/template/freebsd
===
RCS file: /cvsroot/pgsql-server/src/template/freebsd,v
retrieving revision 1.23
diff -c -c -r1.23 freebsd
*** src/template/freebsd27 Sep 2003 16:24:44 -  1.23
--- src/template/freebsd9 Oct 2003 03:16:51 -
***
*** 1,17 
- CFLAGS='-pipe'
- 
  case $host_cpu in
!   alpha*)   CFLAGS=$CFLAGS -O ;;
  esac
  
  THREAD_SUPPORT=yes
  NEED_REENTRANT_FUNCS=yes
  THREAD_CPPFLAGS=-D_THREAD_SAFE
  case $host_os in
!   freebsd2*|freebsd3*|freebsd4*)
!   THREAD_LIBS=-pthread
!   ;;
!   *)
!   THREAD_LIBS=-lc_r
!   ;;
  esac
--- 1,11 
  case $host_cpu in
!   alpha*)   CFLAGS=-O;;
  esac
  
  THREAD_SUPPORT=yes
  NEED_REENTRANT_FUNCS=yes
  

Re: [HACKERS] [PERFORM] Sun performance - Major discovery!

2003-10-08 Thread Tom Lane

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings