Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Problem Statement

When a Datalist created is being viewed in an Userview's List, there are few things that will take place.

...

  • There are 2 tables, order and order_item.
  • order table has 1 million rows.
  • order_item has 2 million rows with foreign key order_id to table order and the necessary index added.
  • Every order has 2 order item.
  • This is the select query that we will use in the datalist binder.

    Code Block
    languagesql
    titleQuery
    SELECT o.*, i.* FROM app_fd_order o JOIN app_fd_order_item i ON o.id = i.order_id

Using the Datalist in a Userview

Depending on which Userview Menu you use, most of them would provide you the capability to show the row count appended to the menu name. The query we have here would take a long time to compute because the database would need to first execute the query (with JOIN) and return the data set entirely before it is able to count the records. The count query will be as the following:-

...

Info
titleALL

A full table scan is done for each combination of rows from the previous tables. This is normally not good if the table is the first table not marked const, and usually very bad in all other cases. Normally, you can avoid ALL by adding indexes that enable row retrieval from the table based on constant values or column values from earlier tables. (Source)

 

Viewing a List in a Userview

Clicking on the menu item will open up the Datalist. In a typical listing, we will have the pagination feature to traverse through records. For pagination to work, we will need to first (again) compute the number of records we have in total. The count query will kick in again this time around.

...

If the database server has stellar buffer or caching size/capabilities, then subsequent viewing of each page will not be penalized by the expensive count query.

Conclusion

When you start to design your App, you will need to try to project the amount of data that will be pouring in over a considerable amount of time and evaluate if your App can still serve and hold up well by then. You can try to also make use of Performance Analyzer for continuous monitoring of your App's performance.

...