Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8297905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:34:25+00:00 2026-06-08T15:34:25+00:00

I am using DoctrineExtensions for managing a nested tree(nested tree behavior). I have to

  • 0

I am using DoctrineExtensions for managing a nested tree(nested tree behavior). I have to import 10-20K records from a csv file and store them in the database.

I created a service for this task which makes a bunch of new categories(tree nodes), sets the parents of these categories and persists them and in the end I call EntityManager#flush method to save the created categories into the database.

According to my logic, the process should go like this:

  1. The extension calculates the data needed for each node(right, left, level etc.)
  2. Doctrine makes a query in which it inserts all the data, similarly to this:

    INSERT INTO table (field1, field2, parent_id, root, left, ...) VALUES
    (fields of 1st record),
    (fields of 2st record),
    ...
    

However, Doctrine inserts each record separately, additionally root, left and right values get updated during the flush causing a huge amount of update queries to be needed.

For inserting 70 categories, I needed ~250 queries, when I wanted to add 500 categories, the program terminated due to memory shortage.

How could I optimize the process? Of course I could write it from scratch, but I’d really love to use this superb extension.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:34:26+00:00Added an answer on June 8, 2026 at 3:34 pm

    My solution was to use materialized path tree instead of nested tree. I know, it’s not a real solution for this problem, however it works efficiently. If you have a better solution, please post it, and I might accept it as the solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Java,I have to fetch multiple sets of values from an XML file to
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using Android 2.1+. I have a service that gets killed from time to time
Using rails 3.1, ruby 1.92. I have a bunch of products in a store:
Using boost python I need create nested namespace. Assume I have following cpp class
Using import datetime in python, is it possible to take a formatted time/date string
Using ASIHTTPRequest, I downloaded a zip file containing a folder with several audio files.
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using the HTML5 File API I can get the Binary String representation of a
Using mercurial, I've run into an odd problem where a line from one committer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.