From: | "Bill" <bill(at)math(dot)uchicago(dot)edu> |
---|---|
To: | <pgsql-performance(at)postgresql(dot)org> |
Subject: | Query performance |
Date: | 2004-06-28 03:26:19 |
Message-ID: | BILLSA1XvpFVjCRGryW00000002@bill.fefferman.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Actually, I have some queries that are slow, however I was wondering if you
could help me write a query that is rather simple, but I, as a true database
novice, can't seem to conjure. So we have stocks, as I have previously
said, and I have a huge table which contains all of the opening and closing
prices of some stocks from each day. What I like to do, in English, for
each stock in each day is find a ratio: abs(closing-opening)/opening. Then
I would like to average all of the ratios of each day of each individual
stock together to find a final ratio for each stock, then I would like to
find the highest average, to find the best performing stock. So what query
can I use, and (as is appropriate for this group), how can it be optimized
to run the fastest?
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-06-28 03:29:46 | Re: SQL stupid query plan... terrible performance ! |
Previous Message | Jeff | 2004-06-28 02:48:16 | Re: SQL stupid query plan... terrible performance ! |