Re: another query optimization question - Mailing list pgsql-performance

From David Teran
Subject Re: another query optimization question
Date
Msg-id 39D3D2E6-53D8-11D8-9392-000A95A6F0DC@cluster9.com
Whole thread Raw
In response to Re: another query optimization question  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: another query optimization question
List pgsql-performance
Hi Tim,

you are right:


> Interesting.  I have recollected where we saw this before:
> http://archives.postgresql.org/pgsql-hackers/2003-11/msg01528.php
> Apparently gettimeofday() has a glitch on some BSD releases.  OS X is
> a BSD derivative and it's not so surprising if it has it too.
>
> May I suggest that you try the test program given here:
> http://archives.postgresql.org/pgsql-hackers/2003-11/msg01546.php
> and file a bug report with Apple if it shows any out-of-order results?
>
> I am fairly certain that I tried that test program when I devised it
> on my own OS X machine, and couldn't get a failure.  Maybe it depends
> on your hardware (hm, could dual CPUs be the key factor)?


p:~ david$ ./a.out
bogus tv_usec: 1075544305 -615731632, prev 1075544304 349672
out of order tv_sec: 1075544304 349759, prev 1075544305 -615731632
out of order tv_usec: 1075544305 339904, prev 1075544305 339905
bogus tv_usec: 1075544307 -615731811, prev 1075544306 349493
out of order tv_sec: 1075544306 349498, prev 1075544307 -615731811
out of order tv_usec: 1075544307 339442, prev 1075544307 339443
out of order tv_usec: 1075544308 339351, prev 1075544308 339352

This is a part of the output. Whats -very- interesting:

Apple provides a little tool that can enable / disable the l2 cache ...
one CPU of a dual CPU system on the fly. When i start the testapp with
two CPU's enabled i get this output here, when i turn off one CPU while
the app is still running the messages disappear as long as one CPU is
turned off. Reactivating the CPU again produces new error messages. I
checked the app on a single G4, no errors and i checked the app on a
dual G4, -not- G5 and also no error messages.

Do you remember where one can find a patch? Maybe its something one can
fix because parts of the OS from Apple are 'open source'.

Do you know if this bug makes a system unusable with PostgresSQL?

Regards David


pgsql-performance by date:

Previous
From: Kari Lavikka
Date:
Subject: Re: Unique index and estimated rows.
Next
From: Tom Lane
Date:
Subject: Re: another query optimization question