Skip site navigation (1) Skip section navigation (2)

Re: Too slow querying a table of 15 million records

From: PFC <lists(at)boutiquenumerique(dot)com>
To: kjelle(at)bingon(dot)no, pgsql-performance(at)postgresql(dot)org
Subject: Re: Too slow querying a table of 15 million records
Date: 2005-06-28 17:10:05
Message-ID: op.ss3ba3loth1vuj@localhost (view raw, whole thread or download thread mbox)
Lists: pgsql-performance

> database=> explain select date_trunc('hour', time),count(*) as total from
> test where p1=53 and time > now() - interval '24 hours' group by
> date_trunc order by date_trunc ;

	1. Use CURRENT_TIMESTAMP (which is considered a constant by the planner)  
instead of now()
	2. Create a multicolumn index on (p1,time) or (time,p1) whichever works  

In response to


pgsql-performance by date

Next:From: Karl O. PincDate: 2005-06-28 17:16:41
Subject: Re: Poor index choice -- multiple indexes of the same
Previous:From: John A MeinelDate: 2005-06-28 17:02:55
Subject: Re: read block size

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group