order of reading the conf files

2018-12-05 Thread bhargav kamineni
Hi, may i know the order in which postgres reads the configuration files like conf , auto.conf , hba ? and how does postmaster forks postgres , can we see that forking process in logfile ? Thanks, Banu.

Re: Limitting full join to one match

2018-12-05 Thread Ron
On 12/05/2018 06:34 PM, Phil Endecott wrote: Dear Experts, I have a couple of tables that I want to reconcile, finding rows that match and places where rows are missing from one table or the other: db=> select * from a; +++ |date| amount | +++ |

Limitting full join to one match

2018-12-05 Thread Phil Endecott
Dear Experts, I have a couple of tables that I want to reconcile, finding rows that match and places where rows are missing from one table or the other: db=> select * from a; +++ |date| amount | +++ | 2018-01-01 | 10.00 | | 2018-02-01 | 5.00 |

Re: simple division

2018-12-05 Thread Alvaro Herrera
On 2018-Dec-06, Gavin Flower wrote: > Calculators normally work in floating point (in fact, as far as I am aware, > they never work in integer mode by default), The reason they don't work in "integer mode" is because it doesn't make sense. We only have this thing called "integer division"

Re: simple division

2018-12-05 Thread Gavin Flower
On 06/12/2018 02:32, Adrian Klaver wrote: On 12/5/18 4:45 AM, Gavin Flower wrote: On 06/12/2018 00:05, Geoff Winkless wrote: On Wed, 5 Dec 2018 at 09:13, Gavin Flower wrote: SELECT ceil(10/4.0); Geoff If you divide one integer by another, then it is logical to get an integer as as the

Re: simple division

2018-12-05 Thread Martin Mueller
I take the point that two decades of backward compatibility should and will win. That said, it's an easy enough thing to right the balance for novices and put in a really obvious place in the documentation what you should do if you want to divide two integers and get the results with the

Re: debugging intermittent slow updates under higher load

2018-12-05 Thread Alexey Bashtanov
The table has around 1.5M rows which have been updated/inserted around 121M times, the distribution of updates to row in alerts_alert will be quite uneven, from 1 insert up to 1 insert and 0.5M updates. Under high load (200-300 inserts/updates per second) we see occasional (~10 per hour)

Re: surprising query optimisation

2018-12-05 Thread Stephen Frost
Greetings, * Ron (ronljohnso...@gmail.com) wrote: > On 12/05/2018 08:42 AM, Chris Withers wrote: > >On 05/12/2018 14:38, Stephen Frost wrote: > * Chris Withers (ch...@withers.org) wrote: > >>>Interesting! In my head, for some reason, I'd always assumed a btree index > >>>would break down a

Re: Database corruption in cascaded replica, "pg_xact/003A" doesn't exist, reading as zeroes"

2018-12-05 Thread Achilleas Mantzios
On 5/12/18 4:10 μ.μ., Dejan Petrovic wrote: I believe this is a result of my "broken" procedure for setting up a cascaded replica. I would love to know where the issue is. This is a report of a database corruption which was detected after promoting a replica server to a master server. We

Re: simple division

2018-12-05 Thread Tom Lane
Geoff Winkless writes: > IMO it's fundamentally broken that SQL doesn't cast the result of a > divide into a numeric value - the potential for unexpected errors > creeping into calculations is huge; however that's the standard and > no-one's going to change it now. > Having said that it's worth

Re: Database corruption in cascaded replica, "pg_xact/003A" doesn't exist, reading as zeroes"

2018-12-05 Thread Stephen Frost
Greetings, * Dejan Petrovic (dejan.petro...@islonline.com) wrote: > I believe this is a result of my "broken" procedure for setting up a > cascaded replica. I would love to know where the issue is. [...] > Notes: > Machines are running on Centos 7, Postgresql 10.2 > DB-1 = master > DB-2 =

Re: surprising query optimisation

2018-12-05 Thread Ron
On 12/05/2018 08:42 AM, Chris Withers wrote: On 05/12/2018 14:38, Stephen Frost wrote: Greetings, * Chris Withers (ch...@withers.org) wrote: On 30/11/2018 15:33, Stephen Frost wrote: * Chris Withers (ch...@withers.org) wrote: On 28/11/2018 22:49, Stephen Frost wrote: For this,

Re: surprising query optimisation

2018-12-05 Thread Chris Withers
On 05/12/2018 14:38, Stephen Frost wrote: Greetings, * Chris Withers (ch...@withers.org) wrote: On 30/11/2018 15:33, Stephen Frost wrote: * Chris Withers (ch...@withers.org) wrote: On 28/11/2018 22:49, Stephen Frost wrote: For this, specifically, it's because you end up with exactly what

Re: surprising query optimisation

2018-12-05 Thread Stephen Frost
Greetings, * Chris Withers (ch...@withers.org) wrote: > On 30/11/2018 15:33, Stephen Frost wrote: > >* Chris Withers (ch...@withers.org) wrote: > >>On 28/11/2018 22:49, Stephen Frost wrote: > >For this, specifically, it's because you end up with exactly what you > >have: a large index with tons

Re: surprising query optimisation

2018-12-05 Thread Stephen Frost
Greetings, * Thomas Kellerer (spam_ea...@gmx.net) wrote: > Stephen Frost schrieb am 30.11.2018 um 14:05: > > PG doesn’t know, with complete certainty, that there’s only 3 > > values. > > Would the optimizer consult a check constraint ensuring that? Not today, I don't believe (haven't looked at

Database corruption in cascaded replica, "pg_xact/003A" doesn't exist, reading as zeroes"

2018-12-05 Thread Dejan Petrovic
I believe this is a result of my "broken" procedure for setting up a cascaded replica. I would love to know where the issue is. This is a report of a database corruption which was detected after promoting a replica server to a master server. We suspect the actual corruption occurred during

Re: querying both text and non-text properties

2018-12-05 Thread Rob Nikander
> On Dec 4, 2018, at 4:59 PM, Laurenz Albe wrote: > > You have two options: > > A combined index: > > CREATE EXTENSION btree_gin; > CREATE INDEX ON fulltext USING gin (to_tsvector('english', doc), color); > > That is the perfect match for a query with > > WHERE color = 'red' AND

Re: simple division

2018-12-05 Thread Raymond Brinzer
On Wed, Dec 5, 2018 at 7:55 AM Geoff Winkless wrote: > Where's the logical progression in step 3 here: > > 1 You asked the computer a question > > 2 The values you passed to it don't have decimal points > > ... > > 4 Ergo, you wanted an answer that was incorrect. > Well put. However the nature

Re: simple division

2018-12-05 Thread Adrian Klaver
On 12/5/18 4:45 AM, Gavin Flower wrote: On 06/12/2018 00:05, Geoff Winkless wrote: On Wed, 5 Dec 2018 at 09:13, Gavin Flower wrote: SELECT ceil(10/4.0); Geoff If you divide one integer by another, then it is logical to get an integer as as the answer. Hmm, grab any of my calculators

Re: simple division

2018-12-05 Thread Geoff Winkless
On Wed, 5 Dec 2018 at 12:45, Gavin Flower wrote: > If you divide one integer by another, then it is logical to get an > integer as as the answer. Hmm. It might fit with what a computer scientist might expect (or rather, not be surprised about), but I don't think you can say that it's "logical".

Re: simple division

2018-12-05 Thread Gavin Flower
On 06/12/2018 00:05, Geoff Winkless wrote: On Wed, 5 Dec 2018 at 09:13, Gavin Flower wrote: SELECT ceil(10/4.0); Is what you want for that example. Except that implies that "number of people who can fit in a car" is a real number, not a whole. IMO it's fundamentally broken that SQL doesn't

Re: surprising query optimisation

2018-12-05 Thread Thomas Kellerer
Chris Withers schrieb am 05.12.2018 um 12:42: > So, interestingly, this box has 250GB memory in it, and even though > I've set effective_cache_size to 200GB, I only see 9G of memory being > used. How can I persuade postgres to keep more in memory? effective_cache_size is a hint to the optimizer on

Re: surprising query optimisation

2018-12-05 Thread Thomas Kellerer
Stephen Frost schrieb am 30.11.2018 um 14:05: > PG doesn’t know, with complete certainty, that there’s only 3 > values. Would the optimizer consult a check constraint ensuring that?

Re: surprising query optimisation

2018-12-05 Thread Chris Withers
On 30/11/2018 22:10, Gavin Flower wrote: I once optimised a very complex set queries that made extensive use of indexes.  However, with the knowledge I have today, I would have most likely had fewer and smaller indexes.  As I now realize, that some of my indexes were probably counter

Re: surprising query optimisation

2018-12-05 Thread Chris Withers
On 30/11/2018 15:33, Stephen Frost wrote: Greetings, * Chris Withers (ch...@withers.org) wrote: On 28/11/2018 22:49, Stephen Frost wrote: * Chris Withers (ch...@withers.org) wrote: We have an app that deals with a lot of queries, and we've been slowly seeing performance issues emerge. We

Re: simple division

2018-12-05 Thread Geoff Winkless
On Wed, 5 Dec 2018 at 09:13, Gavin Flower wrote: > SELECT ceil(10/4.0); > > Is what you want for that example. Except that implies that "number of people who can fit in a car" is a real number, not a whole. IMO it's fundamentally broken that SQL doesn't cast the result of a divide into a

Re: Geographic coordinate values format conversion to DD (Decimal Degrees) format

2018-12-05 Thread Allan Kamau
Thank you very much Paul. Your suggestions and input have spared me many hours of trying to identify applications and functions to perform this transformation. I am now installing PostGIS. Allan. On Wed, Dec 5, 2018 at 1:25 AM Paul Ramsey wrote: > > On Dec 4, 2018, at 12:36 PM, Allan Kamau

Re: simple division

2018-12-05 Thread Gavin Flower
On 05/12/2018 20:07, Rob Sargent wrote: On Dec 4, 2018, at 9:33 PM, Gavin Flower wrote: On 05/12/2018 10:51, Rob Sargent wrote: On 12/4/18 2:36 PM, Martin Mueller wrote: It worked, and I must have done something wrong. I'm probably not the only person who would find something like the