Re: [GENERAL] understanding why two nearly identical queries take two different planner routes, one 5s and one 2hr

2014-08-06 Thread Marc Mamin
Hello, index_testruns_on_custom_spawnid btree ((custom_data - 'SpawnID'::text)) .. WHERE testruns.custom_data-'SpawnID' = 'SpawnID-428842195.338828' ... If all your SpawnID have this prefix, you may consider remove it from your index to reduce its size: = index_testruns_on_custom_spawnid

[GENERAL] Adding 3 hours while inserting data into table

2014-08-06 Thread M Tarkeshwar Rao
Hi Team, We are facing some inconsistence behaviour of Postgres. We have deployed our database on a server where timezone is GMT+3 hours. We have application which is running on the same server. When application starts, it is inserting the correct timestamp in the table but after running few

Re: [GENERAL] Adding 3 hours while inserting data into table

2014-08-06 Thread Adrian Klaver
On 08/06/2014 03:50 AM, M Tarkeshwar Rao wrote: Hi Team, We are facing some inconsistence behaviour of Postgres. We have deployed our database on a server where timezone is GMT+3 hours. What Postgres version? How was Postgres installed and on what OS? We have application which is running

Re: [GENERAL] Reindex taking forever, and 99% CPU

2014-08-06 Thread Alexey Klyukin
On Sun, Aug 3, 2014 at 3:20 AM, Phoenix Kiula phoenix.ki...@gmail.com wrote: Hi. I've been patient. PG is 9.0.17, updated via Yum yesterday. One of my large tables (101 GB on disk, about 1.1 billion rows) used to take too long to vacuum. Not sure if it's an index corruption issue. But I

Re: [GENERAL] postgresql referencing and creating types as record

2014-08-06 Thread David G Johnston
vpmm2007 wrote type function is record (f1 NUMERIC,f2 NUMERIC..); this is in oracle kindly tell me what is the substitute to use is record in postgres. its urgent . thanks and rgds vpmm No idea on exactly what Oracle is creating here (a type or a set returning function) but

[GENERAL] Questions on dynamic execution and sqlca

2014-08-06 Thread Bill Epstein
I'm very new to Postgres, but have plenty of experience developing stored procs in Oracle. I'm going to be creating Postgres stored procedures (functions actually, since I discovered that in postgres, everything is a function) to do a variety of batch-type processing. These functions may or

Re: [GENERAL] Questions on dynamic execution and sqlca

2014-08-06 Thread David G Johnston
Bill Epstein wrote I've tried a variety of ways based on the on-line docs I've seen, but I always get a syntax error on EXEC when I use only the line EXEC statement You likely need to use EXECUTE in PostgreSQL INFO: INSERT INTO UTILITY.BPC_AUDIT (COMPONENT, ACTIVITY, AUDIT_LEVEL,

Re: [GENERAL] understanding why two nearly identical queries take two different planner routes, one 5s and one 2hr

2014-08-06 Thread Jeff Janes
On Tue, Aug 5, 2014 at 2:08 PM, john gale j...@smadness.com wrote: - Bitmap Index Scan on index_testruns_on_custom_spawnid (cost=0.00..41437.84 rows=500170 width=0) (actual time=4872.404..4872.404 rows=2438520 loops=1) Ouch, ouch, and more ouch. Your

Re: [GENERAL] Re: understanding why two nearly identical queries take two different planner routes, one 5s and one 2hr

2014-08-06 Thread Jeff Janes
On Tue, Aug 5, 2014 at 4:30 PM, David G Johnston david.g.johns...@gmail.com wrote: NOTE: I am confused by this line: - BitmapAnd (cost=291564.31..291564.31 rows=28273 width=0) (actual time=23843.870..23843.870 rows=0 loops=1) How did actual match zero rows? It should be something like

Re: [GENERAL] Questions on dynamic execution and sqlca

2014-08-06 Thread Ray Stell
On Aug 6, 2014, at 12:28 PM, Bill Epstein epste...@us.ibm.com wrote: I'm very new to Postgres, but have plenty of experience developing stored procs in Oracle. I found this helpful:

Re: [GENERAL] Re: understanding why two nearly identical queries take two different planner routes, one 5s and one 2hr

2014-08-06 Thread David Johnston
On Wed, Aug 6, 2014 at 10:08 AM, Jeff Janes jeff.ja...@gmail.com wrote: On Tue, Aug 5, 2014 at 4:30 PM, David G Johnston david.g.johns...@gmail.com wrote: Anyway, you should probably experiment with creating a multi-column index instead of allowing PostgreSQL to BitmapAnd them together.

[GENERAL] Recursive CTE trees + Sorting by votes

2014-08-06 Thread Gregory Taylor
We are working on a threaded comment system, and found this post by Disqus to be super helpful: http://cramer.io/2010/05/30/scaling-threaded-comments-on-django-at-disqus/ The CTE works wonderfully, and we're really happy with the results. The last obstacle is figuring out how to sort by a votes

Re: [GENERAL] Recursive CTE trees + Sorting by votes

2014-08-06 Thread Martijn van Oosterhout
On Wed, Aug 06, 2014 at 05:28:09PM -0400, Gregory Taylor wrote: We are working on a threaded comment system, and found this post by Disqus to be super helpful: http://cramer.io/2010/05/30/scaling-threaded-comments-on-django-at-disqus/ The CTE works wonderfully, and we're really happy with

[GENERAL] Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method

2014-08-06 Thread Jorge Arevalo
Hello, I want to connect to my local installation of PostgreSQL 9.1 using my machine user (who is vagrant). So, after reading PostgreSQL documentation, I thought I just needed to: 1. Add username map in pg_ident.conf: # MAPNAME SYSTEM-USERNAME PG-USERNAME vp

Re: [GENERAL] Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method

2014-08-06 Thread Frank Pinto
Looks like you're doing it right, you actually have to specify the user though: psql -U postgres and make sure you restarted the server so your changes take effect. Frank On Wed, Aug 6, 2014 at 4:43 PM, Jorge Arevalo jorgearev...@libregis.org wrote: Hello, I want to connect to my local

Re: [GENERAL] Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method

2014-08-06 Thread John R Pierce
On 8/6/2014 3:43 PM, Jorge Arevalo wrote: I want to connect to my local installation of PostgreSQL 9.1 using my machine user (who is vagrant). So, after reading PostgreSQL documentation, I thought I just needed to: wouldn't it be easier to ... create user vagrant superuser;

Re: [GENERAL] Connecting with PostgreSQL 9.1 using the Ubuntu machine user and peer authentication method

2014-08-06 Thread Adrian Klaver
On 08/06/2014 03:43 PM, Jorge Arevalo wrote: Hello, I want to connect to my local installation of PostgreSQL 9.1 using my machine user (who is vagrant). So, after reading PostgreSQL documentation, I thought I just needed to: 1. Add username map in pg_ident.conf: # MAPNAME

[GENERAL] The dangers of streaming across versions of glibc: A cautionary tale

2014-08-06 Thread Matthew Kelly
The following is a real critical problem that we ran into here at TripAdvisor, but have yet figured out a clear way to mitigate. TL;DR: Streaming replicas—and by extension, base backups—can become dangerously broken when the source and target machines run slightly different versions of glibc.

Re: [GENERAL] The dangers of streaming across versions of glibc: A cautionary tale

2014-08-06 Thread Bruce Momjian
On Wed, Aug 6, 2014 at 09:24:17PM +, Matthew Kelly wrote: The following is a real critical problem that we ran into here at TripAdvisor, but have yet figured out a clear way to mitigate. TL;DR: Streaming replicas—and by extension, base backups—can become dangerously broken when the

Re: [GENERAL] The dangers of streaming across versions of glibc: A cautionary tale

2014-08-06 Thread Peter Geoghegan
On Wed, Aug 6, 2014 at 5:11 PM, Bruce Momjian br...@momjian.us wrote: No surprise; I have been expecting to hear about such breakage, and am surprised we hear about it so rarely. We really have no way of testing for breakage either. :-( I guess that Trip Advisor were using some particular

[GENERAL] Need help in tuning

2014-08-06 Thread Phoenix Kiula
My PG server is still going down. After spending the weekend doing a CLUSTER of my largest table (it's a RAID 1 system with SATA hard disks and 4 GB memory, mostly devoted to PG) I still have this issue. When I do a top command, 99% of the CPU and about 15% of the memory is being taken by PG.

Re: [GENERAL] The dangers of streaming across versions of glibc: A cautionary tale

2014-08-06 Thread Tatsuo Ishii
Over time, collation order will vary: there may be fixes needed as more information becomes available about languages; there may be new government or industry standards for the language that require changes; and finally, new characters added to the Unicode Standard will interleave with the

Re: [GENERAL] The dangers of streaming across versions of glibc: A cautionary tale

2014-08-06 Thread Peter Geoghegan
On Wed, Aug 6, 2014 at 6:30 PM, Tatsuo Ishii is...@postgresql.org wrote: Another idea could be having our own collation data to isolate any changes from outside world. I vaguley recall this had been discussed before. That's probably the best solution. It would not be the first time that we

Re: [GENERAL] Reindex taking forever, and 99% CPU

2014-08-06 Thread Phoenix Kiula
Thank you for the very specific idea of pg_stat_user. This is what I see (the output is also included in email below, but this is easier to read) -- https://gist.github.com/anonymous/53f748a8c6c454b804b3 The output here (might become a jumbled mess)-- =# SELECT * from pg_stat_user_tables where

Re: [GENERAL] Need help in tuning

2014-08-06 Thread David G Johnston
Phoenix Kiula wrote My PG server is still going down. After spending the weekend doing a CLUSTER of my largest table (it's a RAID 1 system with SATA hard disks and 4 GB memory, mostly devoted to PG) I still have this issue. When I do a top command, 99% of the CPU and about 15% of the memory

[GENERAL] Avoid WAL archiving when idle?

2014-08-06 Thread Laurence Rowe
I have WAL archiving setup on Postgres 9.3.2 using WAL-E on CentOS 6.4 using the postgresql.org RPM. This is working fine, except I see a lot of spurious activity in the S3 bucket with wal files being backed up every 5 minutes even when the database is idle. This can make restoring to a dev server

Re: [GENERAL] Questions on dynamic execution and sqlca

2014-08-06 Thread Guillaume Lelarge
Le 6 août 2014 18:47, David G Johnston david.g.johns...@gmail.com a écrit : Bill Epstein wrote I've tried a variety of ways based on the on-line docs I've seen, but I always get a syntax error on EXEC when I use only the line EXEC statement You likely need to use EXECUTE in PostgreSQL

Re: [GENERAL] Questions on dynamic execution and sqlca

2014-08-06 Thread David Johnston
- What are the differences among PL/SQL, PL/PGSQL and pgScript. The first two are languages you write functions in. pgScript is simply an informal way to group a series of statements together and have them execute within a transaction. AFAICT, this isn't true. Pgscript is a

Re: [GENERAL] Avoid WAL archiving when idle?

2014-08-06 Thread David G Johnston
Laurence Rowe wrote I have WAL archiving setup on Postgres 9.3.2 using WAL-E on CentOS 6.4 using the postgresql.org RPM. This is working fine, except I see a lot of spurious activity in the S3 bucket with wal files being backed up every 5 minutes even when the database is idle. This can make