Re: Slow query in table where many rows were deleted. VACUUM FULL fixes it

2024-01-30 Thread David Rowley
On Wed, 31 Jan 2024 at 09:09, Philip Semanchuk wrote: > So in your case those 5m rows that you deleted were probably still clogging > up your table until you ran VACUUM FULL. It seems more likely to me that the VACUUM removed the rows and just left empty pages in the table. Since there's no ind

Re: Slow query in table where many rows were deleted. VACUUM FULL fixes it

2024-01-30 Thread Philip Semanchuk
> On Jan 30, 2024, at 4:40 AM, Pavlos Kallis wrote: > > Shouldn't VACUUM ANALYZE reclaim the disk space? Hi Pavlos, The short answer to this is “no”. That’s an important difference between VACUUM (also known as “plain” VACUUM) and VACUUM FULL. In some special cases plain VACUUM can reclaim

Re: Slow query in table where many rows were deleted. VACUUM FULL fixes it

2024-01-30 Thread Laurenz Albe
On Tue, 2024-01-30 at 11:40 +0200, Pavlos Kallis wrote: > I have the following table: > > CREATE TABLE IF NOT EXISTS public.shortened_url > ( >     id character varying(12) COLLATE pg_catalog."default" NOT NULL, >     created_at timestamp without time zone, >     expires_at timestamp without time

Slow query in table where many rows were deleted. VACUUM FULL fixes it

2024-01-30 Thread Pavlos Kallis
Hi all, I have the following table: CREATE TABLE IF NOT EXISTS public.shortened_url ( id character varying(12) COLLATE pg_catalog."default" NOT NULL, created_at timestamp without time zone, expires_at timestamp without time zone, url text COLLATE pg_catalog."default" NOT NULL,