Improve PHP performance by caching Database Results (3) _php tutorial

Source: Internet
Author: User
to add a table to an existing registration
The previous section describes how to use the change notification service to make DatabaseIn the registration Object(in the example above, the ORDERS
Table) is notified when a change occurs. However, from a performance perspective, client applications may prefer to cache order_items tables rather than ORDERS
The query result set for the table itself, because it has to retrieve only one row from the Orders table each time it accesses an order, but must also be from the Order_items
The table retrieves multiple rows. In the actual situation, the order may contain dozens of or even hundreds of order items.
Because you have registered a query on the ORDERS table, you do not have to create another registration to register the
The query for the Order_items table. Instead, you can use an existing registration. To do this, you first need to retrieve the ID of an existing registration. You can execute the following query to complete this work
SELECT Regid, table_name from User_change_notification_regs;
The results might look like this:



After you get the registration ID, you can use Dbms_change_notification. Enable_reg
The function adds a new object to the registration as follows:








It's done! From now on, the database generates a notification to respond to any changes made to ORDERS and Order_items, and calls
Orders_nf_callback process to handle notifications. So the next step is to edit orders_nf_callback so that it can handle the Order_items
The notification generated by the table to perform DML operations. Before recreating the Orders_nf_callback procedure, however, you need to create the following table types that will be referenced during the update process:
CREATE TYPE Rdesc_tab as TABLE of SYS. Chnf$_rdesc;
Then, return to the list
2, after the following line of code:




SendNotification (URL, tblname, ord_id);


Insert the following code:

http://www.bkjia.com/PHPjc/631000.html www.bkjia.com true http://www.bkjia.com/PHPjc/631000.html techarticle Adding a table to an existing registration section describes how to use the change notification service to cause a database to be notified when a change is made to a registered object (in the above example, the ORDERS table). But from ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.