phoenix404

phoenix404

Member Since 1 Year Ago

Experience Points 100
Experience Level 1

4,900 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

17 Mar
1 year ago

phoenix404 left a reply on Laravel Too Slow To Update 1k Records

Thanks for the answer. Should I add an index in every table or just product table? (ALTER TABLE products ADD INDEX product_id (product_id))

What do you mean? How? "the other models without having to query first, and removing two queries per loop" Little bit code if you can, please.

phoenix404 left a reply on Laravel Too Slow To Update 1k Records

@Cronix Thanks for answering. I don't know understand what I have to do?

phoenix404 left a reply on Laravel Too Slow To Update 1k Records

@skliche Hallo, No, I am doing it nothing bcrypt or remote... I am reading file .txt which has 25-30k records (I think, it takes 5-10 seconds) and uploading as shown in that picture. I am importing that with HTTP request called in crontab. Crontab runs call it three times in a day morning, afternoon and in evening.

phoenix404 left a reply on Laravel Too Slow To Update 1k Records

@Snapey by mistake. Sorry I don't know how to remove that one.

phoenix404 left a reply on Laravel Too Slow To Update 1k Records

@Snapey it takes 5-8sec to iterate all lines of .txt file

16 Mar
1 year ago

phoenix404 left a reply on Laravel Too Slow To Update 1k Records

Hey @lostdreamer_nl

uname -a : Linux newpixel24 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

processor       : 0 (4 processors in total)
vendor_id       : GenuineIntel
cpu family      : 6
model           : 42
model name      : Intel(R) Xeon(R) CPU E31220 @ 3.10GHz
stepping        : 7
microcode       : 0x1b
cpu MHz         : 2094.921
cache size      : 8192 KB (x4)

Ram is 16gb;

TOP command: http://prntscr.com/is5iic

$updateORNewInsertColumns is $product

$products["seller_id"] = $value["seller_id"];
$products["EAN"] = $value["EAN"];
$products["updated_at"] = Carbon::now()->toDateTimeString();

$whereColumn is just = ["seller_id" => $value["seller_id"]]
$result = Products::createORUpdate("App\Model\Products", ["seller_id" =>$value["seller_id"]], $products);
$product_id = $result->getKey();
03 Mar
1 year ago

phoenix404 left a reply on Laravel Too Slow To Update 1k Records

I am not using query log or debugging. Yes, I am using MySQL and I used artisan to create tables in MySQL.

Schema::create('products', function (Blueprint $table) {
        $table->engine = 'InnoDB';
        $table->charset = 'utf8';
        $table->collation = 'utf8_unicode_ci';
        $table->increments('product_id');
        $table->string('seller_id');
        $table->string('EAN')->nullable();
        $table->string('Model')->nullable();
        $table->timestamps();
    });

Schema::create('products_description', function (Blueprint $table) {
        $table->engine = 'InnoDB';
        $table->charset = 'utf8';
        $table->collation = 'utf8_unicode_ci';
        $table->increments('product_description_id');
        $table->string('product_name')->nullable();
    ...
        $table->unsignedInteger('product_id');
        $table->foreign('product_id')->references('product_id')->on('products');
        $table->timestamps();
    });

Schema::create('products_attributes', function (Blueprint $table) {
        $table->engine = 'InnoDB';
        $table->charset = 'utf8';
        $table->collation = 'utf8_unicode_ci';
        $table->increments('product_attribute_id');
        $table->integer('quantity')->nullable();
        $table->double('price')->nullable();
        $table->double('ship')->nullable();
    ....
        $table->unsignedInteger('product_id');
        $table->foreign('product_id')->references('product_id')->on('products');
        $table->timestamps();
    });
02 Mar
1 year ago

phoenix404 started a new conversation Laravel Too Slow To Update 1k Records

Hi everybody, I have 3 tables products, products_description, products_attributes. "products" is the main table and others two table contain products primary id. These tables are updating with a .txt file which contains 40k lines or records for tables. The problem, I am facing is that updating is too slow. I just put 800 lines in *.txt and try to update it takes more than 10 min. This file contains: productid, ean, price, shipping, qty, name, lang etc. What I am trying with laravel is

$data = Products::updateOrCreate($whereColumn, $updateORNewInsertColumns); $product_id = $data ->getKey();

ProductsAttributes::updateOrCreate( ["product_id" => $product_id], $dataForProductsAttrbutesTable);

ProductsDescription::updateOrCreate( ["product_id" => $product_id], $dataForProductsDescriptionTable);

Any Help? Thanks in advance!