Hi, Did u check your cusror using the index on the column last_name or not.
(and a.last_name like p_in_lastname || '%';) . What kind of index do you have on that column. Normal Btree or Function based index? Is your parition and index got analyzed? Thnks, Ramsubb On 2/20/13, Ninja Li <nickli2...@gmail.com> wrote: > Hi, > > I would like to ask for some advice on the design of PL/SQL procedure. I am > > trying to improve the performance of a PL/SQL procedure which allows a user > > to do search by their last name and returns their account information. I > will be joining two tables, customer_info (with last name as a column ) and > > account_details, with 8 million and 50 million rows respectively by user ID > > on each table. The procedure is already in place and very straight forward, > > which goes something like the following: > > procedure name_search ( p_in_user_id number, p_in_lastname varchar2 ,,,) > { > ....... > open cursor for > select a.column1, a.column2, b.column1, b.column2, ..... > from customer_info a, account_details b > where a.user_id = b.user_id > and a.last_name like p_in_lastname || '%'; > } > > The execution time varies from 3 to 15 seconds. > > I would like to ask if there are other ways to write the procedure, such as > > using with clause or global temporary tables which can significantly > improve performance in your experience. > > The tables already have partition and indexes on last_names, user_id in > place. > > Thanks in advance. > > Nick > > > > > > > > > > > > -- > -- > You received this message because you are subscribed to the Google > Groups "Oracle PL/SQL" group. > To post to this group, send email to Oracle-PLSQL@googlegroups.com > To unsubscribe from this group, send email to > oracle-plsql-unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/Oracle-PLSQL?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "Oracle PL/SQL" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to oracle-plsql+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en --- You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To unsubscribe from this group and stop receiving emails from it, send an email to oracle-plsql+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.