Gossamer Forum
Home : Products : Gossamer Links : Discussions :

performance question

Quote Reply
performance question
Hi,

I have a Plugin where I get Prices for products. I store the price history so there are always multiple prices for every product. There are two ways and I am a little worried about performance. I would love to hear opinions and comments.
I have a .cfg file which is generated with arrays where the newest array is the newest price. The file is loaded during the update of the pricelist for every product.
So it is only:

Code:
my $config = GT::Config->load($dir . "/$data->{SupplierID}/$data->{'GTIN'}/price.cfg",
{create_ok => 1});
my $Price = $config->{NetPrice}[0]->{NetAmount}

And I have a table with all prices which I acces like this at the moment.
Code:
my $KIP = $DB->table('KIP');
$KIP->select_options ("ORDER BY Date DESC LIMIT 0,1"); #order by date DESC
my $kip_cond = GT::SQL::Condition->new();
$kip_cond->add('GTIN' => '=' => $data->{GTIN}); # item key = primary key with SupplierID
$kip_cond->add('SupplierID' => '=' => $data->{SupplierID}); # supplier key= primary key with GTIN

my $sth = $KIP->select('*', $kip_cond) || die $GT::SQL::error;
my $Price;
while (my $local_kip = $sth->fetchrow_hashref) {
$Price = $local_Kip->{NetAmount}
}
The .cfg file is much quicker and I wonder how I could improve the mysql way.

Regards

n||i||k||o

Last edited by:

el noe: Feb 11, 2015, 3:29 AM
Subject Author Views Date
Thread performance question el noe 3591 Feb 11, 2015, 3:28 AM
Thread Re: [el noe] performance question
Andy 3568 Feb 11, 2015, 6:19 AM
Thread Re: [Andy] performance question
el noe 3521 Feb 12, 2015, 1:03 AM
Post Re: [el noe] performance question
Andy 3540 Feb 12, 2015, 1:09 AM