cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

simple select, but only one core is working.

Former Member
3,066

Dear All,

I have a problem with my ASA.

SQL Anywhere Network Server Version 12.0.1.3152

Connection limit (licensed seats): 3

By ASA: Processors detected: 1 (containing 8 logical processors)

In reality: I have 2CPU xQuadracore

I cannot get ASA to use more than one core. In real situation I have big SQL that contains logic like

select fun(id), id from table1.

Fun(id) executes quite long (over 5 sec) and number of rows is more 30k.

I have tried to make parallel run this query using something like

select fun(id), id from table1 where id <15000
 union all
select fun(id), id from table1 where id >=15000

but still only one core was in busy (looks like ASA runs "select" part on one core and fetching on second core). When I do Get query plan - it is visible that optimizer divided query into 2 parallel tasks.

Then to eliminate effect of disks etc, I have created 2 functions - emu() and emu2() and I have tried to run these functions in parallel. But still only one core is in use (in my understanding optimized shows that 2 tasks can be executed in parallel)

 select -> into two parallel tasks "dummy" and "dummy"

What can be wrong?

Asa starts like:

dbsrv12 -gn80 -gtc 8 -gnl 80 -c 700 demo.db

demo.db is from Sybase distribution

I have tried different parameters of max_query_tasks

My functions and select:

create function emu () returns bigint
begin
    declare i BIGINT ;
    declare i2 BIGINT ;
    SET i = -3000000;
    WHILE i <= 3000000 LOOP
        SET i = i + 1;
        SET i2 = -4;
        WHILE i2 <= 0 LOOP
            SET i2 = i2 + 1;
        END LOOP;
    END LOOP;
    return i
end
go

create function emu2 () returns bigint
begin
    declare i BIGINT ;
    declare i2 BIGINT ;
    SET i = -3000000;
    WHILE i <= 3000000 LOOP
        SET i = i + 1;
        SET i2 = -4;
        WHILE i2 <= 0 LOOP
            SET i2 = i2 + 1;
        END LOOP;
    END LOOP;
    return i
end
go

select emu()
 union
select emu2();

or very similar example (if you say that no tables in query below):

select emu(),id from customers
 union
select emu2(), id from contacts;

p.s. interesting, that if I run my selects and functions on IQ 15x, then 4 cores are in use (IQ on server with 4 cores)

Accepted Solutions (0)

Answers (1)

Answers (1)

Breck_Carter
Participant

The code you posted doesn't do anything at all with tables, and the rules for intra-query parallelism only talks about table-related processing; see http://dcx.sybase.com/index.html#1201/en/dbusage/parallelism.html

If the code you posted is not the actual code you are interested in, please post the actual code; perhaps someone might have an idea. For example, one way to force parallelism is to use an EVENT; see http://sqlanywhere.blogspot.ca/2012/12/intra-procedure-parallelism_5.html

Former Member
0 Kudos

Thank you Breck!

I was thinking that select emu(), id from customers and select emu2(), from contacts must run in parallel - scan of 2 not related tables. But I understood why it is not so when look your link.