On Fri, Jun 19, 2009 at 2:05 PM, Brian Cox wrote:
> David Rees [dree...@gmail.com] wrote:
>>
>> Along those lines, couldn't you just have the DB do the work?
>>
>> select max(ts_id), min(ts_id) from ... where ts_interval_start_time >=
>> ... and ...
>>
>> Then you don't have to transfer 500k ids ac
David Rees [dree...@gmail.com] wrote:
Along those lines, couldn't you just have the DB do the work?
select max(ts_id), min(ts_id) from ... where ts_interval_start_time >=
... and ...
Then you don't have to transfer 500k ids across the network...
I guess you didn't read the entire thread: I star
On Fri, Jun 19, 2009 at 1:05 PM, Brian Cox wrote:
> Thanks to all for the analysis and suggestions. Since the number of rows in
> an hour < ~500,000, brute force looks to be a fast solution:
>
> select ts_id from ... where ts_interval_start_time >= ... and ...
>
> This query runs very fast as does
Tom Lane [...@sss.pgh.pa.us] wrote:
Some experimentation suggests that it might help to provide a 2-column
index on (ts_id, ts_interval_start_time). This is still going to be
scanned in order by ts_id, but it will be possible to check the
ts_interval_start_time condition in the index, eliminatin
On Fri, Jun 19, 2009 at 3:26 PM, Tom Lane wrote:
>
> That's the problem then. Notice what the query plan is doing: it's
> scanning the table in order by ts_id, looking for the first row that
> falls within the ts_interval_start_time range. Evidently this
> particular range is associated with smal
Brian Cox writes:
> Kevin Grittner [kevin.gritt...@wicourts.gov] wrote:
>> Is there any correlation between ts_id and ts_interval_start_time?
> only vaguely: increasing ts_interval_start_time implies increasing ts_id
> but there may be many rows (100,000's) with the same ts_interval_start_time
> -Original Message-
> From: Brian Cox
> Subject: [PERFORM] select max() much slower than select min()
>
> seems like max() shouldn't take any longer than min() and
> certainly not 10 times as long. Any ideas on how to determine
> the max more quickly?
That is odd. It seems like max
Brian Cox wrote:
> Kevin Grittner [kevin.gritt...@wicourts.gov] wrote:
>> Is there any correlation between ts_id and ts_interval_start_time?
> only vaguely: increasing ts_interval_start_time implies increasing
> ts_id but there may be many rows (100,000's) with the same
> ts_interval_start_time
>
Kevin Grittner [kevin.gritt...@wicourts.gov] wrote:
Is there any correlation between ts_id and ts_interval_start_time?
only vaguely: increasing ts_interval_start_time implies increasing ts_id
but there may be many rows (100,000's) with the same ts_interval_start_time
Perhaps if you tried min
Brian Cox wrote:
> cemdb=# explain select min(ts_id) from
> ts_stats_transet_user_interval a
> where 0=0 and a.ts_interval_start_time >= '2009-6-16 01:00' and
> a.ts_interval_start_time < '2009-6-16 02:00';
> seems like max() shouldn't take any longer than min() and certainly
> not 10 times
10 matches
Mail list logo