Skip to Content.
Sympa Menu

internetworkers - Re: [internetworkers] SQL Help?

internetworkers AT lists.ibiblio.org

Subject: Internetworkers: http://www.ibiblio.org/internetworkers/

List archive

Chronological Thread  
  • From: Ilan Volow <listboy AT clarux.com>
  • To: "Internetworkers: http://www.ibiblio.org/internetworkers/" <internetworkers AT lists.ibiblio.org>
  • Subject: Re: [internetworkers] SQL Help?
  • Date: Mon, 25 Feb 2008 16:41:42 -0500

I'm a PostgreSQL guy, so take my educated guess with a grain of salt, but you might want to try this just to see if it works:

SELECT
perfstat_section.iteration
, latx_stats_data.label
, SUM(IF(latx_stats_data.statname = 'read_ops', `statval`, 0)) AS 'read_ops'
, SUM(IF(latx_stats_data.statname = 'read_data', `statval`, 0)) AS 'read_data'
, SUM(IF(latx_stats_data.statname = 'read_latency', `statval`, 0)) AS 'read_latency'
, SUM( IF(latx_stats_data.statname = 'read_latency', `statval`, 0) * IF(latx_stats_data.statname = 'read_latency', `statval`, 0) ) AS 'concurrency'

FROM (`latx_stats`)
JOIN `perfstat_section` ON perfstat_section.secid = latx_stats.secid
JOIN `latx_stats_data` ON latx_stats.latxid = latx_stats_data.latxid

WHERE latx_stats.perfid = '1'
AND latx_stats.object = 'volume'
AND perfstat_section.hostname = 'ny-filer1'
AND latx_stats_data.statname IN ('total_ops', 'avg_latency', 'read_ops', 'read_data', 'read_latency')

GROUP BY `iteration`, `label`
ORDER BY `read_ops` DESC
LIMIT 10;

If you haven't already thought about it, this kind of statement might be a good candidate for a database view.


On Feb 24, 2008, at 6:11 PM, Scott Russell wrote:

SELECT

perfstat_section.iteration

, latx_stats_data.label

, SUM(IF(latx_stats_data.statname = 'read_ops', `statval`, 0)) AS 'read_ops'

, SUM(IF(latx_stats_data.statname = 'read_data', `statval`, 0)) AS 'read_data'

, SUM(IF(latx_stats_data.statname = 'read_latency', `statval`, 0)) AS 'read_latency'


FROM (`latx_stats`)

JOIN `perfstat_section` ON perfstat_section.secid = latx_stats.secid

JOIN `latx_stats_data` ON latx_stats.latxid = latx_stats_data.latxid


WHERE latx_stats.perfid = '1'

AND latx_stats.object = 'volume'

AND perfstat_section.hostname = 'ny-filer1'

AND latx_stats_data.statname IN ('total_ops', 'avg_latency', 'read_ops', 'read_data', 'read_latency') 


GROUP BY `iteration`, `label`

ORDER BY `read_ops` DESC

LIMIT 10;


Ilan Volow
"Implicit code is inherently evil, and here's the reason why:"






Archive powered by MHonArc 2.6.24.

Top of Page