Query running slow

From: "samantha mahindrakar" <sam(dot)mahindrakar(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Query running slow
Date: 2008-04-16 21:14:11
Message-ID: f0c828c40804161414u731aea46h35207eec1278c51c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi....
Iam finding the following query is working a bit slow:
EXECUTE '(SELECT ARRAY(SELECT DISTINCT date_part(''day'', measurement_start)
FROM ' || gettablestring(dates)|| '
WHERE lane_id IN (' || lanesidarr || ')))'
INTO temparr;

This function is trying to find all the days in a prticular month
whihc has data for the particular lane and put it in an array...which
can be used later.
gettablestring(dates) returns the partition name from which the data
needs to be extracted. These partitions have index on the
measurement_start field.
lanesidarr is a lane number. The partition has an index on this field to.
Could anyone give me some hints???/

Thanks
Sam

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Thomas Spreng 2008-04-16 21:48:21 Re: Oddly slow queries
Previous Message Gavin M. Roy 2008-04-16 20:52:57 Re: Anybody using the Dell Powervault MD3000 array?