1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do i imporve my mysql query

Discussion in 'Databases' started by neilfurry, Aug 7, 2022.

  1. #1
    Hi,

    Im using symfony doctrine with my database.

    my problem is when i look into the profiler, i see that my problem is within the query that needs to retrieve thousands of rows and pass it through datatable.

    How can i improve my query to load the page fast?
     

    Attached Files:

    neilfurry, Aug 7, 2022 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    upload_2022-8-8_13-35-45.png n

    t0.docs_id_id is a foreign or parent key, right?

    Think about what you really want returned - there will be another filter or even just pagination through LIMIT.

    Make sure you have t0.docs_id_id indexed, that will help with speed.

    Is the datatable the jsquery datatable? If so, this needs to be an ajax query, they're super simple once you know what you're doing. I can give you some examples. And datatables definitely use paging.
     
    sarahk, Aug 7, 2022 IP
  3. laci272

    laci272 Well-Known Member

    Messages:
    163
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    118
    #3
    [QUOTE="..And datatables definitely use paging.[/QUOTE]
    Datatables also support back-end paging. Use that for paging, otherwise, it's still loading the entire set.
     
    laci272, Feb 15, 2023 IP