2

だから私は最近、次のようなMagento API呼び出しを介してデータベースでいくつかのクエリを実行しました

$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$readresult = $connection_write->query("SELECT data_index FROM catalogsearch_fulltext WHERE MATCH(data_index) AGAINST ('anji') AND store_id = '1'");
$row = $readresult->fetch();

ただし、これにより、約 30 のレコードをループし、それらを操作して、レコードに書き戻すと、サーバー全体がクラッシュするようです。

Magento でデータベース テーブルの値を操作する方法が必要です。データベースに直接クエリを実行して、Magento の大規模な API をすべてバイパスする方法はありますか?

ありがとう!

編集:後でこれを見つける可能性のある人へ。

データベース呼び出しに Magento API をバイパスすることで、うまくいきました。データベースに直接クエリを実行するだけで、はるかに高速に動作しました。

ただし、私の場合、テーブルは他のテーブルと相互に関連付けられていませんでした。Magento の多くのテーブルは相互に関連しており、1 つのテーブルで何かを変更すると、他のテーブルにドミノ効果が発生します。したがって、細心の注意を払ってこれを行ってください。

4

1 に答える 1

1

Magento is SLOW by default, thats one of the Magento major problem in my opinion. It's slow and complex. You can use (call) this:

require_once '{ROOT_DIR}/app/Mage.php';
Mage::app('default');

and try to make a custom function but it will not be so much faster than Magento itself. You still use the Magento's classes but you can develop your own function but still you need some background knowledge which is not really easy to get - documentation is poor. Maybe you can start with some magento blogs and tips online.

You said it stopped working over about 30 seconds. Thats usually default time limit for PHP to stop executing. So also try to use set_time_limit at the top of your PHP file:

set_time_limit(0); //for unlimited time limit or
set_time_limit(120); //for 120 seconds time limit for example

Also connect using FTP and locate (usually) this directory:

{root}/var/cache/

There should be some subdirectories like: mage--0, mage--1, mage--2 ... etc. You can delete them from time to time. This is CACHE files and i noticed that if there are plenty of CACHE files magento work slowly. If you delete this cache files and directories it works better for some time.

于 2011-11-03T12:51:27.080 に答える