Re: Separate 100 M spatial data in 100 tables VS one big table

2024-03-05 Thread Tomas Vondra
On 3/5/24 13:47, Marc Millas wrote: > Salut Kimaidou, > why not a partitioned table with the department a partitioning Key ? > each year just detach the obsolete data, department by > department (ie.detach the partition, almost instantaneous) and drop or keep > the obsolete data. > No delete, quite

Re: Optimizing count(), but Explain estimates wildly off

2024-03-05 Thread Greg Sabino Mullane
> columns has not improved the planner's estimates, which are off by almost > 1M, and there's been no suggestion of what could cause that. You are asking a lot of the planner - how would it know that the average number of items is much higher for ids derived indirectly from "Mexico" versus ids der

Re: Optimizing count(), but Explain estimates wildly off

2024-03-05 Thread Chema
El lun, 4 mar 2024 a la(s) 7:50 p.m., Greg Sabino Mullane ( htamf...@gmail.com) escribió: > On Mon, Mar 4, 2024 at 2:14 PM Chema wrote: > >> There's one JSON column in each table with a couple fields, and a column >> with long texts in Items. > > and earlier indicated the query was: > >> Select

Re: Separate 100 M spatial data in 100 tables VS one big table

2024-03-05 Thread Marc Millas
Salut Kimaidou, why not a partitioned table with the department a partitioning Key ? each year just detach the obsolete data, department by department (ie.detach the partition, almost instantaneous) and drop or keep the obsolete data. No delete, quite easy to maintain. For each global index, Postgr