RE: BUG #16031: Group by returns duplicate groups - Mailing list pgsql-bugs

From David Raymond
Subject RE: BUG #16031: Group by returns duplicate groups
Date
Msg-id VI1PR07MB6029CF9430ECED44CB457E3B87820@VI1PR07MB6029.eurprd07.prod.outlook.com
Whole thread Raw
In response to RE: BUG #16031: Group by returns duplicate groups  (David Raymond <David.Raymond@tomtom.com>)
Responses Re: BUG #16031: Group by returns duplicate groups
Re: BUG #16031: Group by returns duplicate groups
List pgsql-bugs
Looking possibly like indexing is part of the issue at the moment.

When I added an array_agg(id_1) in the group by, one of the 'DK' groups had 9, one had 16.

I wrote a script to scan the text dump and counted 25 records with the "name" field value of 'DK'

After the restore which includes the indexes, "count(*) from big_table where name = 'DK';" uses the index which starts
with"name" and returns 9.
 
Dropping that index and running it again returns 25.

I re-created the index...
create index on big_table (name, id_1, id_2);

...and count(*) goes back to returning 9 again.

and group by sees those 9 as one group and the other 16 as a different group.

Will get back to this sometime tomorrow as my brain has now melted.

pgsql-bugs by date:

Previous
From: David Raymond
Date:
Subject: RE: BUG #16031: Group by returns duplicate groups
Next
From: Peter Geoghegan
Date:
Subject: Re: BUG #16031: Group by returns duplicate groups