Re: [HACKERS] free space % calculation in pgstathashindex

2017-08-09 Thread Noah Misch
On Tue, Aug 08, 2017 at 02:30:51PM +0530, Amit Kapila wrote: > On Mon, Aug 7, 2017 at 9:38 PM, Ashutosh Sharma wrote: > > On Mon, Aug 7, 2017 at 7:19 PM, Amit Kapila wrote: > >> On Mon, Aug 7, 2017 at 6:07 PM, Ashutosh Sharma > >> wrote: > >>> Hi, > >>> > >> .. > .. > >> Why an extra parenthesi

Re: [HACKERS] free space % calculation in pgstathashindex

2017-08-08 Thread Amit Kapila
On Mon, Aug 7, 2017 at 9:38 PM, Ashutosh Sharma wrote: > On Mon, Aug 7, 2017 at 7:19 PM, Amit Kapila wrote: >> On Mon, Aug 7, 2017 at 6:07 PM, Ashutosh Sharma >> wrote: >>> Hi, >>> >> .. .. >> Why an extra parenthesis in above case whereas not in below case? I >> think the code will look consi

Re: [HACKERS] free space % calculation in pgstathashindex

2017-08-07 Thread Ashutosh Sharma
On Mon, Aug 7, 2017 at 7:19 PM, Amit Kapila wrote: > On Mon, Aug 7, 2017 at 6:07 PM, Ashutosh Sharma wrote: >> Hi, >> > .. >> In step #1, assuming '*' as an arithmetic operator, the left operand >> i.e. 'stats.unused_pages' is of type uint32 whereas the right operand >> i.e. 'stats.space_per_page

Re: [HACKERS] free space % calculation in pgstathashindex

2017-08-07 Thread Amit Kapila
On Mon, Aug 7, 2017 at 6:07 PM, Ashutosh Sharma wrote: > Hi, > .. > In step #1, assuming '*' as an arithmetic operator, the left operand > i.e. 'stats.unused_pages' is of type uint32 whereas the right operand > i.e. 'stats.space_per_page' is of type int32 and arithmetic > conversions of the ANSI C

[HACKERS] free space % calculation in pgstathashindex

2017-08-07 Thread Ashutosh Sharma
Hi, While working on - [1] (one of the bug reported for hash index), i noticed that the percentage of free space shown in 'free_percent' column of pgstathashindex() is incorrect for some of the boundary cases. This is how the free space percentage is calculated by pgstathashindex(), 1) /* Count