[ic] flypage sql-queries on crack .. optimisation?

Sandy Thomson sandy at scotwebshops.com
Tue Mar 8 10:06:28 EST 2005


Hi,
I was trying to debug high load on our server this morning, and I 
noticed loads of queries when someone looked at a product (See example 
at bottom of email).

I always thought that the flypage works something like:
====
begin page;
query: SELECT * FROM PRODUCTS WHERE sku='blarg'
print result->{description};  #[item-field description]
print result->{title}; #[item-field title]
..
finish query;
end page;
====

but it seems to work like:
====
begin page;
query: SELECT description FROM PRODUCTS WHERE sku='blarg'
print result1->{description}; #[item-field description]
finish query;
query: SELECT title FROM PRODUCTS WHERE sku='blarg'
print result2->{title}; #[item-field title]
finish query;
...
end page;
====



Although the query times involved are very short, is this a good thing 
to do? Is the saved memory worth the additional DB queries?
Using IC 5.2, Postgres 8.0.1, Apache 2.0.53

Can anyone shed any light about this? Cheers.

Sandy.



Example Below:


<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.683 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.633 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.579 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.562 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                SELECT 
outfit_contents FROM products WHERE sku='sr_swhdr_pearled_fly_plaid';
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.727 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.659 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.529 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.562 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.529 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.648 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.605 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.550 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.566 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.547 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.553 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.535 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.549 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.536 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.562 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.538 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.553 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.540 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.549 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.534 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.549 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.538 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.547 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.533 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.550 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.530 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.556 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.547 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.555 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.532 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.556 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.528 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.560 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.529 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.557 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.529 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.556 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.529 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.551 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.531 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.583 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.535 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.568 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.539 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.554 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.535 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.551 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.542 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.560 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.542 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.547 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.533 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.547 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.533 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.546 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.558 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.552 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.542 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.554 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.533 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.552 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select sku from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.538 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                select 
description from products where sku = 'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.556 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select * from products where sku =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 0.956 ms
<2005-03-08 11:52:50 GMT -- club> LOG:  
statement:                                                         
select * from options where code =  'sr_swhdr_pearled_fly_plaid'
<2005-03-08 11:52:50 GMT -- club> LOG:  duration: 2.819 ms



More information about the interchange-users mailing list