Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / IBM DB2, WebSphere, IMS, U2 [игнор отключен] [закрыт для гостей] / Primary Key и Index в iSeries / 17 сообщений из 17, страница 1 из 1
07.02.2013, 12:55
    #38141544
Wiseman_And
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
добрый день
подскажите: в iSeries (v5r3, v6r1)
примари кей не является индексом ?
...
Рейтинг: 0 / 0
07.02.2013, 13:43
    #38141666
Wiseman_And
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
Wiseman_Andдобрый день
подскажите: в iSeries (v5r3, v6r1)
примари кей не является индексом ?

Забыл добавить - для вызова хранимым процедур, через JDBC
...
Рейтинг: 0 / 0
07.02.2013, 14:16
    #38141738
Mark Barinstein
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
Wiseman_Andподскажите: в iSeries (v5r3, v6r1)
примари кей не является индексом ?

Здравствуйте.

Constraints :
Unique constraints are implemented with indexes
...
Рейтинг: 0 / 0
07.02.2013, 16:11
    #38142006
Wiseman_And
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
добрый день Mark Barinstein

Как бы на LUW DB2 - да
но на iSeries аккурат мы сталкнулись с проблемой:
есть таблица - есть примари кей - строиться процедура, выполняющая некий расчет
она может работать 2.5 часа
строим индекс с полями идентичными примари, перестраиваем процедуру - работает 2 мин

Было высказано предположение, что ПК юзаются для RPG програм запущенных с консоли
Мы же используем ODBC/JDBC соединение и просто вызов хранимых процедур
Возможно в этом ньюанс. Возможно причина в другом

Буду рад любой помощи
Спасибо
...
Рейтинг: 0 / 0
14.02.2013, 13:52
    #38151183
knudsen
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
Wiseman_And,

индекс - отдельный объект = Logical File -содержит только поля ключа, наверно просто намного короче строка. Используете таблицу в регулярной библиотеке или в SQL-collection?
...
Рейтинг: 0 / 0
19.02.2013, 08:10
    #38156751
Wiseman_And
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
knudsen,

Используем таблицу в SQL процедурах, причем как для инсертов-апдэйтов, так и для курсора отдовая данные наружу.
...
Рейтинг: 0 / 0
19.02.2013, 17:39
    #38157797
knudsen
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
Wiseman_And,

SQL-collection = SCHEMA
когда создаётся схема - там по умолчанию есть журналирование всех SQL-ей,
А если командой CRTLIB ... то шиш.. надо параметры указывать всяческие... по ссылке от Марка (выше) можно посмотреть.
А вот когда создаёшь таблицу и индех (например с промта = SQLSTR), то получается следующее:
1.
Enter SQL Statements

Type SQL statement, press Enter.
> CREATE TABLE TABLENM ( A1 INTEGER NOT NULL, A2 INTEGER, A3
CHAR(128), PRIMARY KEY (A1))
Table TABLENM in TESTLIB1 created but could not be journaled.
===>

2.
CREATE UNIQUE INDEX TABLENML ON TABLENM(A1)
Index TABLENML created in TESTLIB1 on table TABLENM in TESTLIB1.
===>

3. Запишем 10 записей (просто так)

получаются два объекта:

Work with Objects Using PDM TECL1

Library . . . . . TESTLIB1 Position to . . . . . . . .
Position to type . . . . .

Opt Object Type Attribute Text
TABLENM *FILE PF-DTA
TABLENML *FILE LF

PF-DTA:
Storage information:
Size . . . . . . . . . . . . . . . : 192512

LF:
Storage information:
Size . . . . . . . . . . . . . . . : 12288

,причём в PF - первичный ключ в самом объекте...

Access Path Description
Access path maintenance . . . . . . . . . . : MAINT *IMMED
Unique key values required . . . . . . . . : UNIQUE Yes
Access path journaled . . . . . . . . . . . : No
Access path . . . . . . . . . . . . . . . . : Keyed
Constraint Type . . . . . . . . . . . . . . : PRIMARY
Number of key fields . . . . . . . . . . . : 1
Record format . . . . . . . . . . . . . . . : TABLENM
Key field . . . . . . . . . . . . . . . . : A1
Sequence . . . . . . . . . . . . . . . : Ascending
Sign specified . . . . . . . . . . . . : SIGNED
Zone/digit specified . . . . . . . . . : *NONE
Alternative collating sequence . . . . : No
Sort Sequence . . . . . . . . . . . . . . . : SRTSEQ *HEX
.....
Constraint Description
Primary Key Constraint
Constraint . . . . . . . . . . . . . . : CST Q_TESTLIB1_TABLEN
Type . . . . . . . . . . . . . . . . : TYPE *PRIMARY
Key . . . . . . . . . . . . . . . . . : KEY A1
Number of fields in key . . . . . . . : 1
Key length . . . . . . . . . . . . . : 4
.....
Display Spooled File
File . . . . . : QPDSPFD Page/Line 3/18
Control . . . . . Columns 1 - 78
Find . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+...
Partial transaction exists,
roll back ended . . . . . . . . . . . . : *NO
Starting journal receiver for apply . . . :
Library . . . . . . . . . . . . . . . . :
ASP Device . . . . . . . . . . . . . . :
Constraint access path attributes . . . . :
Constraint . . . . . . . . . . . . . . : CST Q_TESTLIB1_TABLEN
Access path recovery . . . . . . . . : *IPL
Forced key access path . . . . . . . : *NO
Key must be unique . . . . . . . . . : *YES
Access path journaled . . . . . . . . : *NO
Access path valid . . . . . . . . . . : *YES
Number of access path entries . . . . : 10
Access path size . . . . . . . . . . : 139264
Access path logical reads . . . . . . :
Access path physical reads . . . . . :
More...
F3=Exit F12=Cancel F19=Left F20=Right F24=More keys
...
Рейтинг: 0 / 0
19.02.2013, 17:45
    #38157811
knudsen
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
Wiseman_And,

а может быть ещё статистику... типа, собрать... и всякое такое...

Но мне нравиться отдельно логические файлики строить, а там можно ещё и не все поля из PF брать и форматики всякие..., а iSeries сама может определить по какому LF шагать... нет, конечно, можно и нужно помогать ей в этом...
...
Рейтинг: 0 / 0
22.02.2013, 10:53
    #38161856
Wiseman_And
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
knudsen,
спасибо, за такое подробное описание - про логические и физические файлы уже в курсе
в зеленые экраны до последнего времени вообще не лазили

- создавали схемы из навигатора с журналированием

а вопрос - как на iSeriese собрать статистику ?

RUNSTATS ON TABLE NAME_TBL ON ALL COLUMNS WITH DISTRIBUTION ON ALL COLUMNS AND DETAILED INDEXES ALL ALLOW WRITE ACCESS
SQL1651N The request cannot be executed because the DB2 server version does
not support this functionality.
...
Рейтинг: 0 / 0
22.02.2013, 11:02
    #38161872
Wiseman_And
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
knudsen,

и еще вопрос - а есть ли REBIND в iSeries
спасибо ))
...
Рейтинг: 0 / 0
22.02.2013, 11:06
    #38161876
Wiseman_And
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
И контрольный ...

Эксплэйн запросов есть в том же навигаторе
а вот есть ли эксплэйн SQL процедур ?

Спасибо... ))
...
Рейтинг: 0 / 0
22.02.2013, 12:45
    #38162076
knudsen
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
Wiseman_And,
На счёт статистики - не надо ничего делать :) (каюсь - забыл, давно не работал.... может чего и поменялось...)
цитирую
DB2 ® SQL PL, Second Edition: Deployment and Advanced Configuration Essential Guide for DB2 ® UDB on Linux., UNIX™, Windows ® , i5/OS™, z/OS ®
By Zamil Janmohamed, Clara Liu, Drew Bradstock, Raul Chong, Michael Gao, Fraser McArthur, Paul Yip

Publisher : Prentice Hall PTR
Pub Date : November 15, 2004
ISBN : 0-13-147700-5
......
Database Statistics

Database table, column, and index statistics are vital to generating the most efficient query access plans. The Statistics Manager is tasked with collecting and keeping the statistics up to date. It keeps track of the following information:

Cardinality of column values

Selectivity (distribution of values in a column)

Frequent values (top values in a column and associated frequency)

Metadata information on a table (number of rows and indexes)

Estimate of I/O operation (for access to table or index)

The information is collected automatically, but updates to statistical information are not immediate, with the exception of indexes. Statistics on indexes are updated as changes occur. For other objects such as tables or columns, collection occurs in the background as system resources become available.

Because index statistics are immediately updated, they act as the primary source of statistical information for the DB2 UDB iSeries optimizer. One of the biggest causes of poor performance on iSeries is the absence of the correct indexes.

When the Statistics Manager receives requests from the query optimizer, estimates for column statistics are returned, regardless of whether the statistics have been collected. If a request for a column with no statistical data is received, a default value is returned and the column is marked for collection. The next time collection starts, statistics for that column will be collected.

To determine when to re-calculate statistics after they have been collected, the Statistics Manager relies on the Plan Cache. Recall from Chapter 7, "Working with Dynamic SQL," that the plan cache is an area in memory where generated access plans are stored. Each time a new access plan is created or an existing plan is re-used, the Statistics Manager will validate to see if more than 15 percent of the data in the underlying table(s) has changed. If it has, then the corresponding columns will be marked for collection. Additionally, the access plan will also be marked so the next time it is accessed, a new plan is generated.

The automation of the collection works well; however, there are cases when you may want to force the collection of statisticsfor example, if you've completed some mass updates or added large volumes of data. You have two options available to you for forcing the collection of statistics. You can use the IBM iSeries Navigator to select tables and columns for which to collect statistics, or you can do it programmatically through the use of APIs.

Note

If your system resources are busy for long periods of time, statistics collection will not occur because the Statistics Manager waits for system resources to become available.
...
Рейтинг: 0 / 0
22.02.2013, 13:04
    #38162121
knudsen
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
Wiseman_And,

Надеюсь, вы не хранилище там строите? через "зелёненький" экранчик-то побыстрее работают некоторые вещи...
...
Рейтинг: 0 / 0
22.02.2013, 13:33
    #38162187
knudsen
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
Wiseman_And,

db2rbind <dbname> -l <logfile.out> ALL .... - из командной строки DB2-Connect, что-то подобное делал, и там права нужны на библиотеку NULLID .... кажется... , ах ну и старый добрый "Ассистент конфигурирования" .
...
Рейтинг: 0 / 0
22.02.2013, 14:48
    #38162342
Wiseman_And
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
knudsen,

На хранилище это возможно и похоже, но только если судить по объемам данных

Спасибо.
...
Рейтинг: 0 / 0
24.02.2013, 14:01
    #38163672
knudsen
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
Wiseman_And,

А процедурки на RPG писать не пробовали... занятненько получается..., да и побыстрее порой.
...
Рейтинг: 0 / 0
25.02.2013, 10:12
    #38164230
Wiseman_And
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Primary Key и Index в iSeries
knudsen,

Нельзя ... вот так бывает )
...
Рейтинг: 0 / 0
Форумы / IBM DB2, WebSphere, IMS, U2 [игнор отключен] [закрыт для гостей] / Primary Key и Index в iSeries / 17 сообщений из 17, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]