Have basic performance question--
i need to display an table of 7 columns that has say example million records (partial post info of custom post type fields )
my pagination logic shows only first 5 records on home page , upon click on pagination button it shows next 5 records and so on till end of records (i.e million records .)
since it is home page , i am not sure if having this table on landing page will affect the loading time ??
i am pulling the records via ajax method along with pagination logic , does it mean when an user visits my home page , millions of records are fetched first and then my home page will be loaded ??
or is it only first 5 records would be fetched and my home page will be displayed .
whats the best solution to deal with this situation , i need table at my home page for users to shows first 5 records under table
Related
I have table in mysql with 20000 records.
How can I retrieve data faster?
I used datatable plugin for pagination and I also use codeigniter.
It took about one minute to split records to about 4000 page
please use pagination [ci Pagination, php pagination, jquery pagination ajax(faster than others) ] if you are using bootstrap datatable its not working because datatable fetch all the data in one hit after that it breaks data on view which is time consuming you need to break the data in small groups like 20-20 or 50-50 and you need to fetch data in every hit of pagination numbers.
if you are usign ci pagination it will reload on every page hit however if you are using jquery pagination it help you to fetch data in every number hit without refreshing the pages.
please go through the following link: https://phppot.com/php/ajax-pagination-with-php/
in order to implement ajax pagination.
Create view and load table headers
add id on tbody
start ajax pass number want to break = 50, and page = 1
send those value to controller and fetch data as per page.
in your modal you need to add limit and offset which will revised on every hit of pagination number.
Scenario:
In an integration in Magento 2 with Full Caching.
We have two types of customers Type 1 and Type 2. Both these types of customers are saved under same Customer Group we are distinguishing the customers based on a customer type attribute.
Customer of type 1 can belong to different departments (1 to many). When he first visits the site after login, he is redirected to select his department.
This value is saved in customer session, on run time customer can change his department that value is updated in the existing customer session.
When we access a new page we get the updated session, but if we access a page that was accessed earlier, we get the old data from session.
Options tried:
We tried to load the data from customer session factory instead of customer session, but still we are facing the issue. Our understanding is that data which is saved in customer object is loaded as new, but since our data is saved under customer session it is not returning the latest data.
For some section of the page we have used sections to load the data, but in that scenario also, if a page is accessed earlier the correct data is not loaded in first refresh, in second refresh the data is loaded properly.
We also tried to update the session data from AJAX, but that was also not much useful since that data is not getting loaded on the pages.
We also tried to use context variables, but when we log the data while saving the context variable the correct data is logged but when we try to fetch the context data, no data was returned. Also even if different context variable is set for each department, the page seems to be rendered from cache.
We can’t use Cookie since this is sensitive data, this will be the last option.
In Magento 1 we had an option to generate new Cache key by extending app\code\local\Enterprise\PageCache\Model\Processor.php,
Example
if
(isset($_COOKIE[Enterprise_PageCache_Model_Cookie::IS_USER_ALLOWED_SAVE_COOKIE]))
{ $uri .= '_' .
$_COOKIE[Enterprise_PageCache_Model_Cookie::IS_USER_ALLOWED_SAVE_COOKIE];
}
Is there any similar option available in Magento 2. If yes, please share some reference links to integrate the same.
How can I create a 2 page wizard based on 2 database tables with a foreign key from Table 1 to Table 2?
Client Table:
Client_ID, Client_Name
Subscription Plan Table:
Plan_Name, Client_ID
Wizard Page 1:
Enter Client name then click next
Wizard Page 2:
Client name visible with value from page 1 as display only
Select Plan Name
Submit > Action should save all the above info in the 2 DB tables
I'm still in the beginning of learning Oracle APEX so please be patient with my ignorance.
I already have the wizard with 2 pages each page with the required forms for table 1 & 2 but can't understand how to pass the data from page 1 to page 2 then submit all at the end.
Usuallly, in a wizard you don't want to commit data to the actual tables until you have clicked something like 'Finish' somewhere at the end of the wizard. So, be careful of that. You most likely do not want an automated row processing occuring on submit of page 1 and 2.
To store data temporarily you don't have to do any extra work. The keyword is session state here (and you'll deal with it a lot).
In your example you'd have page 1 and page 2 each with 1 page item on them. When you go from page 1 to page 2, you should set it up so clicking the 'Next' button on page 1 will submit the page. You can then branch to page 2 in one of the processing points.
Submitting the page will submit the value of the page items on that page to the session state. This session state of the item is retained in the user's session for as long as it exists and isn't cleared.
This means that when being on page 2 and page 3 you can still access the value of the page item on page 1. For example, by using :P1_CLIENT in a PLSQL process on page 3.
This is ideal for your wizard as you can simply let the user go through each step while at the end simply using the session state of the items on previous pages to process these to the database.
Alternatively, people have been known to put everything in apex collections, which are the alternative to global temporary tables from sql in apex's session state context. I wouldn't use those for single row storage, but if you ever need a multi-line storage in a wizard, these will serve the purpose.
You Need to Go through Sample Database Application's Order Process
How do load dynamic data tables ajax with pagination in Codeigniter. 100 records in db 1st loading in 10 records next on click again load next 10 records from database.
Here's the good example for pagination using codeigniter
http://codesamplez.com/development/codeigniter-pagination-tutorial
What's the best way to count and them add to a total in my database the unique views of a page?
fields-- userid page
data-- testuser index.php/whatever/
Add userid and page in database.
If the testuser visits that page again, don't add. However, if he visits a different page, add that information into db again.
Same with all users and pages.