Re: [PERFORM] Calculating 95th percentiles

2011-03-31 Thread Landreville
On Sat, Mar 5, 2011 at 7:34 PM, marcin mank wrote: > Is this fast enough on a slave: > > > with deltas as (select * from get_delta_table(...)), > p95 as(select round(count(volume_id) * 0.95) as p95v from deltas) > select > (select in_rate from deltas, p95 where > in_rate_order = p95v), > (select o

Re: [PERFORM] Calculating 95th percentiles

2011-03-05 Thread marcin mank
On Fri, Mar 4, 2011 at 4:18 PM, Landreville wrote: >    create temporary table deltas on commit drop as >        select * from get_delta_table(p_switchport_id, p_start_date, > p_end_date); > >    select round(count(volume_id) * 0.95) into v_95th_row from deltas; >    select in_rate into v_record.

Re: [PERFORM] Calculating 95th percentiles

2011-03-05 Thread Pierre C
Any time the volume tables are queried it is to calculate the deltas between each in_octets and out_octets from the previous row (ordered by timestamp). The delta is used because the external system, where the data is retrieved from, will roll over the value sometimes. I have a function to do t

[PERFORM] Calculating 95th percentiles

2011-03-04 Thread Landreville
This is not a performance bug -- my query takes a reasonably long amount of time, but I would like to see if I can get this calculation any faster in my setup. I have a table: volume_id serial primary key switchport_id integer not null in_octets bigint not null out_octets bigint not null insert_ti