Unix Technical Forum

serial and sequential scan

This is a discussion on serial and sequential scan within the Informix forums, part of the Database Server Software category; --> Hi, is this normal behaviour (IDS 7.31, hp-ux 10.20)? from dbschema: create table ano_k_out_hem ( id_pozad serial not null ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 08:40 AM
hajek@nspuh.cz
 
Posts: n/a
Default serial and sequential scan

Hi,
is this normal behaviour (IDS 7.31, hp-ux 10.20)?
from dbschema:
create table ano_k_out_hem
(
id_pozad serial not null ,
num_vysl decimal(14,6),
text_vysl char(30),
.......
primary key (id_pozad) constraint u3332_3326
);

from sqexplain.log:
QUERY:
------
update ano_k_out_hem set status_apl = "Z" where id_pozad = 2610405

Estimated Cost: 3
Estimated # of Rows Returned: 1

1) ano_k_out_hem: SEQUENTIAL SCAN

Filters: amis.ano_k_out_hem.id_pozad = 2610405

from dbaccess table info:
Index name Owner Type Cluster Columns
1006_3439 amis unique No id_pozad


So - why the sequential scan? (Update statistics (medium) is being
executed regularly)

Thanks, Michal

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 08:40 AM
Ben Thompson
 
Posts: n/a
Default Re: serial and sequential scan

hajek@nspuh.cz wrote:

> So - why the sequential scan? (Update statistics (medium) is being
> executed regularly)


How many rows are there in this table? If it's not very many it may be
quicker to do a sequential scan than refer to an index.

Ben.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-20-2008, 08:40 AM
hajek@nspuh.cz
 
Posts: n/a
Default Re: serial and sequential scan

It is table used for communication, so it holds betwen 0-5000 rows.
Just now there is about 3200 rows.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-20-2008, 08:40 AM
Ben Thompson
 
Posts: n/a
Default Re: serial and sequential scan

hajek@nspuh.cz wrote:
> It is table used for communication, so it holds betwen 0-5000 rows.
> Just now there is about 3200 rows.


I think the optimiser goes on how many rows there were when update
statistics was last ran. If this table changes frequently then your
statistics get out of date very quickly. Looking at your query plan an
estimated cost of 3 is not very high.

Ben.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-20-2008, 08:40 AM
scottishpoet
 
Posts: n/a
Default Re: serial and sequential scan

whats the output of dbshema -hd <tabname> -d <databasename>?

update statistics (medium) gives me a syntax error . Looks like the ( )
around the medium is not valid.

so maybe this is not having the desired affect?

update statistics medium moans that only the dba can do this so that
doesn;t work on all my tables either

what happens if you run

update statistics medium for table ano_k_out_hem

and re run the dbschema above? does the out put chnage?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-20-2008, 08:41 AM
Art S. Kagel
 
Posts: n/a
Default Re: serial and sequential scan

hajek@nspuh.cz wrote:

UPDATE STATISTICS MEDIUM FOR TABLE...

Is insufficient. Unlike HIGH and LOW, MEDIUM does NOT update the systables,
syscolumns, and sysindexes records. It is the information in the latter
that IDS uses to determine the cost of using a particular index. I would
suggest that you run AT LEAST the following and try again:

UPDATE STATISTICS MEDIUM FOR TABLE ano_k_out_hem;
UPDATE STATISTICS HIGH FOR TABLE ano_k_hem( id_pozad );

This is the MINIMUM set of stats that you need for a single table with a
single index. I assume you database is more complex than this one table and
that most tables, perhaps including this one, have more than the single
index on the primary key. So, I strongly suggest that you get my dostats
utility or one of the two scripts that implement the recommended UPDATE
STATISTICS protocols detailed in the Performance Guide. Dostats is part of
the package utils2_ak which, along with the scripts referred to, resides in
the IIUG Software Repository.

Art S. Kagel

> Hi,
> is this normal behaviour (IDS 7.31, hp-ux 10.20)?
> from dbschema:
> create table ano_k_out_hem
> (
> id_pozad serial not null ,
> num_vysl decimal(14,6),
> text_vysl char(30),
> .......
> primary key (id_pozad) constraint u3332_3326
> );
>
> from sqexplain.log:
> QUERY:
> ------
> update ano_k_out_hem set status_apl = "Z" where id_pozad = 2610405
>
> Estimated Cost: 3
> Estimated # of Rows Returned: 1
>
> 1) ano_k_out_hem: SEQUENTIAL SCAN
>
> Filters: amis.ano_k_out_hem.id_pozad = 2610405
>
> from dbaccess table info:
> Index name Owner Type Cluster Columns
> 1006_3439 amis unique No id_pozad
>
>
> So - why the sequential scan? (Update statistics (medium) is being
> executed regularly)
>
> Thanks, Michal
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-20-2008, 08:42 AM
Roy Mercer
 
Posts: n/a
Default Re: serial and sequential scan

Art,

I think you mean "UPDATE STATISTICS MEDIUM FOR TABLE tabname
DISTRIBUTIONS ONLY;

I ran a test on 9.40.FC5 for the stores_demo database and found the
MEDIUM for both table and database level did update the systables,
sysindexes and syscolums. It does only get a sample of the data but
you do not have to follow up with a low or high to update the system
tables.

Have you seen different behavior? If so what version?

Thanks

Roy

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-20-2008, 08:42 AM
Art S. Kagel
 
Posts: n/a
Default Re: serial and sequential scan

Roy Mercer wrote:
> Art,


> I think you mean "UPDATE STATISTICS MEDIUM FOR TABLE tabname
> DISTRIBUTIONS ONLY;


Yeah, don't know what I was smoking that night. 8-(

Art S. Kagel

> I ran a test on 9.40.FC5 for the stores_demo database and found the
> MEDIUM for both table and database level did update the systables,
> sysindexes and syscolums. It does only get a sample of the data but
> you do not have to follow up with a low or high to update the system
> tables.
>
> Have you seen different behavior? If so what version?
>
> Thanks
>
> Roy
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-20-2008, 08:42 AM
hajek@nspuh.cz
 
Posts: n/a
Default Re: serial and sequential scan

Thanks to all for your answers.
Art: I have dostats compiled (I tried to use myexport, but after
compiling, it coredumps on first index :-() I will try dostats, it
works with no problem.
Does later "update statistics" clear "update statistiscs high"
optimizing hints?
Michal

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-20-2008, 08:43 AM
Art S. Kagel
 
Posts: n/a
Default Re: serial and sequential scan

hajek@nspuh.cz wrote:
> Thanks to all for your answers.
> Art: I have dostats compiled (I tried to use myexport, but after
> compiling, it coredumps on first index :-() I will try dostats, it


Odd, what's core dumping, myschema or sqlunload? Myschema, I'd guess. Can
you send me the exact myexport commandline, a stack trace from the core dump
and a copy of the dbschema -ss output? I'd like to track down the problem
and fix it.

> works with no problem.
> Does later "update statistics" clear "update statistiscs high"
> optimizing hints?
> Michal
>

Only if the 'DROP DISTRIBUTIONS' clause were to be included.

Art S. Kagel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:18 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com