Okay
  Public Ticket #2414178
Multiple tables from the same mysql table - same page ok?
Closed

Comments

  • George E started the conversation

    I'll test later, but I'm asking about the best practise.

    If I want to show data from a mysql table, but in multiple ways, perhaps certain columns, collapsed differently etc - is it possible to make multiple tables?

    And if possible (I assume yes) - then will multiple tables (of the same mysql table) published on the same page be loaded as separate or only once?

    My worry is about speed loading and data searching/sorting etc.

    Any advice much appreciated, thank you.

  •  2,507
    Aleksandar replied

    Hello again George

    You can create as many SQL query based tables as you want, that will have the same source.

    For instance, one table can pull all the columns from the source:

    SELECT * FROM myTable

    Then, another table could only be showing 4 columns:

    SELECT column1, column3, column5, column6 FROM myTable

    Third table could be the entire table with a condition:

    SELECT * FROM myTable WHERE column1 = 'test'

    And all these tables would have a separate shortcode which can be posted on the same page.

    The speed of that page would depend on the amount of data being pulled, your server performance, hosting plan, etc.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • George E replied

    In regards with multiple tables from the same mysql - clear, it's possible, thank you.

    As for how and where I can place these tables I would appreciate better clarification.

    It doesn't matter what resources I have - that is obvious speed depends on server etc.

    What I wanted to know is same resources - one table vs multiple (from the same mysql table).

    I will exaggerate to make my point simpler. If I put 10 shortcodes on the same page (extracting data from the same mysql table) - will that page be 10 times slower (loading time, responsiveness, tables filter/search etc) - in comparison with having only one shortcode?

    Or would perhaps take more time to load the 10 queries, but once loaded, the 10 tables will be as fast as having a single one?

    I will do my tests, but an experienced answer will help.

    Thank you.

  •  2,507
    Aleksandar replied

    Hi again George

    As for how and where I can place these tables I would appreciate better clarification

    Every new table has a separate shortcode:

    [wpdatatable id=1], [wpdatatable id=2], etc.

    You can add them one below the other, and they would appear on the same page. Or, you can create new pages for every table to display them on front-end. You can also include them in some page builder's block or widget.

    Your page shouldn't be 10 times slower if you place 10 shortcodes, but it will be slower than with 1 shortcode, definitely. This is because all SQL query based tables with Server-side processing are making admin-ajax calls, and each call takes from 1 - 6 seconds to complete (in some extreme cases even more than that).

    Once loaded, the tables should be fast like you have one, but that also can depend on the amount of data displayed in those tables.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables