beautypg.com

HP Neoview Release 2.3 Software User Manual

Page 67

background image

AND QUERY_START_DATETIME >= CURRENT - INTERVAL '1' DAY
AND STATEMENT_STATE = 'COMPLETE'
GROUP BY client_id
ORDER BY client_id
FOR READ UNCOMMITTED ACCESS;

MAX_QRY_ELAPSED_TIME

AVG_QRY_ELAPSED_MSEC

NUM_OF_QUERIES

CLIENT_ID

32750

17330

16

EXPTC082205

728870

20340

51

ORDROBERTSC-P2

2070

260

162

ORDHROTHGAR-P2

5646470

316730

28

ordbantam-p2

Formatting Techniques to Enhance Readability of Query Output

Often the typical data in a column is much narrower than the maximum defined column size.
For example, the SESSION_ID column is defined as CHARACTER(108), and the DATASOURCE
column is defined as CHARACTER(128); actual values in those columns are usually much shorter.
Many query tools support automatic adjustment of column size for viewing results, but in some
cases, it is necessary to adjust the size of the columns returned from the query to improve
readability of the results.

Neoview SQL supports several string manipulation functions. Among these, the LEFT function
is useful for simple column size reduction. In addition to string functions, use of CAST is
sometimes helpful for modifying the appearance or size of numeric fields.

For example, the following query produces results that can be difficult to read:

select [first 10]
datasource,
client_id,
count(*) as query_count
from NEO.HP_METRICS.ODBC_QUERY_STATS_V1
where statement_status = 'START'
group by datasource, client_id
order by datasource, client_id;

DATASOURCE
CLIENT_ID QUERY_COUNT
--------------------------------------------------------------------------------------------------------------------------------
--------------- --------------------
RIBE_FIN
NWESTABX-DC76C 1
RR
FENSTERM-DC76C 6593
RR
fensterm-dc76c 1476
JDI_REPOS
TXNROGERSOJ-P2 59
Smart_JLverne
TXNJLVERNE1 2
TDM_Default_DataSource
REVSTADTBR 2629
TDM_Default_DataSource
REVKAZUKO 16
TDM_Default_DataSource
TXNLAZLON-DC76 86
TDM_Default_DataSource
FENSTERM-DC76C 20121
TDM_Default_DataSource
golden.fargo.c 20
TDM_Default_DataSource
chiarp-d530u 27
TDM_Default_DataSource
vleemgar-dc76 2548
TDM_Default_DataSource
vleemgar-dc76c 9
TDM_Default_DataSource
nwestabx-dc76c 186
TDM_Default_DataSource
pdict 3
TDM_Default_DataSource
watanabe.fargo. 9994
TDM_Default_DataSource

Formatting Techniques to Enhance Readability of Query Output

67