Arya
Arya

Reputation: 531

Simple Select query is running more than 5hours db2

We have a select query as below . Query to fetch the data is running more than 5 hours.

select ColumnA,
ColumnB,
ColumnC,
ColumnD,
ColumnE 
from Table 
where CodeN <> 'Z'

Is there any way we can collect stats or any other way to improve performance .. ? And in DB2 do we have any table where we can check whether collect stats are collected on the below table..

Upvotes: 0

Views: 305

Answers (2)

Evan
Evan

Reputation: 1

How many rows exist in table? and not equal operator '<>' not indexable predicates

Upvotes: 0

Mark Barinstein
Mark Barinstein

Reputation: 12314

The RUNSTATS command collects table & indexes statistics. Note, that this is a Db2 command and not an SQL statement, so you may either run it with Db2 Command Line Processor (CLP) or using relational interface with a special Stored Procedure, which is able to run such commands:
RUNSTATS command using the ADMIN_CMD procedure.
Statistics is stored in the SYSSTAT schema views. Refer to Road map to the catalog views - Table 2. Road map to the updatable catalog views.

Upvotes: 1

Related Questions