In our system we've been using Blobs in lots of heavy stuff to replace NFS-filesystems when
Running ABF (ESQL-routines since OpenIngres 1.2) and OpenROAD-applikations (Direct).
In ABF to transfer batch-output to On-line user and in OpenROAD to view this, or as well as
Uploading documents through OpenROAD appservers. (Many huge PDF Manuals uploaded during Tests :-)).
Later versions from 9.1 and forward has some improvements in performance.
Here an extract of some of my maintainance ABF-programs (Danish comments and variables but should
Be easy to understand anyway) that relocate's the blob-tables to take Usage of available locations, and
at the same time makes sure the iietab-tables is on a specified Page_size, and also compressed with high fill-factor.
Simply writing an SQL-file (file-write routine sps_skriv not included), which is later run by the
Shell-script that calls this ABF-program.
/*
** PROGRAMNAVN: saet_blobs
** TYPE.......: PROCEDURE
** KILDETEKST.: saet_blobs.osq
** AF.........: HGS 05.05.2010
** FORMÅL.....: At reorganisere blob-tabeller
** PARAMETRE..:
** RETUR......:
**
** TABELLER...: SELECT - UPDATE - INSERT - DELETE:
**
** KALDER.....:
** INCLUDES...:
*/
#include <def/define.h>
#include <sps/konstant.h>
procedure saet_blobs() =
declare
pgmnavn = varchar(24) not null,
table_name = varchar(32) not null,
page_size = integer not null,
katalog = varchar(256) not null,
filnavn = varchar(256) not null,
location_name = varchar(24) not null,
aktuel_list = varchar(256) not null,
location_list = varchar(256) not null,
sql_tekst = varchar(256) not null,
chg_jn = varchar(3),
begin
pgmnavn = 'saet_blobs'; chg_jn = NEJ;
g_svar = konv_setup();
if g_svar != OK then
return :g_svar;
endif;
/* BLOBS: Spread on ALL locations Previously Used */
select distinct location_name = location
from iifile_info
where table_name = 'b_location' and owner_name = :g_dba and
squeeze(location) != '' and location != 'ii_database'
order by location_name
begin
if location_list != '' then
location_list = location_list + ',';
endif;
location_list = location_list + location_name;
end;
commit;
message varchar(date('now')) + ' Blobs';
katalog = sps_path(ident = 'optimize');
katalog = katalog + 'chgsql/' + g_database + '/';
filnavn = katalog + 'blobs.sql';
g_dummy = sps_skriv(type = 'w', tekst = :filnavn);
g_dummy = sps_skriv(type = 'g', tekst = 'set autocommit on;\p\g');
/* BLOB Page.Size */
select table_name = table_name,
page_size = table_pagesize
from iitables i
where i.table_type = 'T' and i.table_owner = :g_dba and
i.expire_date = 0 and i.table_name like 'iietab\_%' escape '\'
order by table_name
begin
aktuel_list = '';
if page_size != 8192 then
chg_jn = JA; page_size = 8192;
sql_tekst = 'modify ' + :table_name + ' to reconstruct'
+ ' with page_size = ' + varchar(page_size) + ';\p\g\time';
g_dummy = sps_skriv(type = 'g', tekst = sql_tekst);
endif;
select distinct location_name = location
from iifile_info
where table_name = :table_name and owner_name = :g_dba and
squeeze(location) != ''
order by location_name
begin
if aktuel_list != '' then
aktuel_list = aktuel_list + ',';
endif;
aktuel_list = aktuel_list + location_name;
end;
if location_list != '' and location_list != aktuel_list then
chg_jn = JA;
sql_tekst = 'modify ' + table_name + ' to reorganize'
+ ' with location = (' + location_list + ');\p\g\time';
g_dummy = sps_skriv(type = 'g', tekst = sql_tekst);
endif;
end;
commit;
select i.table_name
from iitables i
where i.table_owner = :g_dba and i.expire_date = 0 and
i.table_name like 'iietab\_%' escape '\' and
i.storage_structure = 'BTREE' and
( i.table_ifillpct != 100
or i.table_dfillpct != 100
or i.table_lfillpct != 100
or i.is_compressed = 'N')
order by table_name
begin
chg_jn = JA;
sql_tekst = 'modify ' + :table_name + ' to reconstruct'
+ ' with compression = (data),'
+ ' nonleaffill = 100, leaffill = 100, fillfactor = 100;'
+ '\p\g\time';
g_dummy = sps_skriv(type = 'g', tekst = :sql_tekst);
end;
g_dummy = sps_skriv(type = 'c');
if chg_jn = NEJ then
/* Fjern filen igen :-) */
g_dummy = sps_skriv(type = 'd', tekst = :filnavn);
endif;
return OK;
end
/* No * More */
Kind regards
Henrik Georg Sørensen, Systemdeveloper and databaseadministrator
-----Oprindelig meddelelse-----
Fra:
info-ingr...@kettleriverconsulting.com [mailto:
info-ingr...@kettleriverconsulting.com] På vegne af Ingres Forums
Sendt: 17. maj 2012 10:00
Til:
info-...@kettleriverconsulting.com
Emne: Re: [Info-Ingres] Long Byte Object