User say ur database is slow how u slove this how identified reasons

user say ur database is slow how u slove this how identified reasons

blame the developers for that, a bad tuned query will reduce your performance. Also you may blame the users for that, a lot of concurrent users running inefficient sql statements will strangle your system.
You may find further suggestions in your duplicated thread --> Some inter view Questions Please give prefect answer  help me

Similar Messages

  • I am a Facebook/Zynga user. Firefox 5 is slow, How do I revert bach to previous version?

    Too slow, revert to previous firefox version please

    '''''TpyeError: Components. classes[cid] is undefined. '''''
    That message is usually caused by an incompatible add-on. You need to do a little bit of troubleshooting to determine which one, and then disable that particular add-on until you can find and install an updated version which doesn't cause that error. <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes
    Your other problems might be cause by that "incompatible" add-on.
    Firefox 4 isn't supported any longer, Firefox 5 was a security update for Firefox 4.01. The version to "go back" to would be Firefox 3.6.19, if that is what you would prefer to do. http://www.mozilla.com/en-US/firefox/all-older.html

  • Database is slow due to indexes.

    Hi,
    Our database is slow and we are trying to identify duplicate indexes in a table within a schema where the index name may be different but the columns indexed are same. They may not necessarily be in the same order.Please update me the query which gives duplicate indexes.
    Thanks

    Dear,
    As Nicolas did emphasize it, you need facts and proof before claiming that your performance problem is due to indexes.
    Anyway, when speaking about duplicate indexes you need first to understand what is a duplicate index. Let me then show you a simple example about this
    mhouri>drop table t1;
    Table dropped.
    mhouri>create table t1(a number, b number, c varchar2(10), d date, x number, y  number);
    Table created.
    mhouri>create index t1_i1 on t1(a,b);
    Index created.I have created a simple table and added to it a simple composite index on (a,b)
    Now, I will create a duplicate index
    mhouri>create index t1_i2 on t1(a);
    Index created.You know why this index is considered as a duplicate one? simply because the first index I did create has its leading column = a and hence the second index t1_i2 can be covered by the first index t1_i1.
    And what about the following index
    mhouri>create index t1_i3 on t1(b,a);
    Index created.is it a duplicate index? the answer is NO; it is not a duplicate one. Because there is no index starting with the couple (b,a). However, if you have the intention to create an index say t1_i4(b) then do not do it because it will be covered by the index t1_i3(b,a).
    Finally, you can use simple select as the following one
    define m_table_name    = &m_table 
    set verify off
    set linesize 100
    select substr(uc1.table_name,1,25)  table_name
          ,substr(uc1.index_name,1,30)  index_name
          ,substr(uc1.column_name,1,10) column_name
          ,uc1.column_position          column_pos                
    from user_ind_columns uc1  
    where uc1.table_name   = upper('&m_table_name')
    order by          
        uc1.index_name  
       ,uc1.column_position
       ,uc1.column_position
    ;which will give you a list of existing indexes per input table together with their columns and the position of those columns. Based on your knowledge of what a duplicate index is you can analyse and act accordingly.
    The above select when executed against our current table t1 gives the following picture
    mhouri>start c:\red-index.sql
    Enter value for m_table: t1
    TABLE_NAME                INDEX_NAME                     COLUMN_NAM COLUMN_POS                     
    T1                        T1_I1                          A                   1                     
    T1                        T1_I1                          B                   2                     
    T1                        T1_I2                          A                   1                     
    T1                        T1_I3                          B                   1                     
    T1                        T1_I3                          A                   2                      In which we can point out that there exist two indexes t1_i and t1_i2 starting with the same column A . This is why the index t1_i2 is not necessary and should not have been created originally.
    Hope this helps
    Mohamed Houri

  • How to find the number of users  connected to database from OS level(Linux)

    Hi All,
    Could anyone know , how to find the number of users connected to database without connecting with sql*plus
    is there any command to find it?
    example we have 10 databases in one server, how to find the number of users connected to particular database without connecting to database(v$session)?
    oracle version:- 10g,11g
    Operating System:- OEL4/OEL5/AIX/Solaris
    any help will be appreciated.
    Thanks in advance.
    Thank you.
    Regards,
    Rajesh.

    Excellent.
    Tested, works as long as you set the ORACLE_SID first ( to change databases )
    ps -ef | grep $ORACLE_SID | grep "LOCAL=NO" | awk '{print $2}' | wc -l
    Thanks!
    select OSUSER
        from V$SESSION
    where AUDSID = SYS_CONTEXT('userenv','sessionid')
        and rownum=1;Best Regards
    mseberg

  • How to create a user in UME Database using web dynpro java custom application

    Hi,
    Can you please suggest me how to create a user in UME Database using web dynpro java custom application.
    My Requirement is user can register his/her user id in SAP Portal 7.3 UME database.
    Please suggest me.
    Thanks and Regards,
    Amit

    Hi Amit,
    Generated Documentation (Untitled)
    This is what you're looking for, there's no real cook-book -- though Amey mentioned there might be some material on SDN, perhaps some tutorials.
    You should be looking into com.sap.security.api.IUserFactory, methods newUser(String) which gives you and IUserMaint and commitUser(IUserMaint, IUserAccount) -- IUserAccount can be obtained using com.sap.security.api.IUserAccountFactory, method newUserAccount(String)
    Hope it helps,
    D.

  • How to Get  the SSO Logged user information in database trigger

    I need to track which SSO user is inserting data into a table , so how can i get the information of that user in a database trigger on that table
    thanks

    Try using portal30.wwctx_api.get_user returns a varchar2 (PUBLIC) or the Username that is logged in
    I need to track which SSO user is inserting data into a table , so how can i get the information of that user in a database trigger on that table
    thanks

  • How to create a user for a database

    hi all,
    in the default ORCL database (oracle 10g) how can i create a new user. i did the below steps.
    1. connecting as sysdba and creating a user
    2. create user kumar identified by kumar;
    3. create connect,resource to kumar.
    but after this when i tried to connect the ORCl database with user 'kumar' it is giving me the ora-01017 error.
    please help me how to create a user to a db using sqlplus.
    Thanks,
    Kumar.

    Kumar_9985 wrote:
    hi all,
    im looking into wrong database. in my system along with orcl another db 'practice' is there. as both are having same ports(1521) and this 'practice' is default database when i connected as 'conn / as sysdba'. instead of this i should have been done as 'conn sys/sysdba@orcl as sysdba'.
    sorry for posting this as issue.Has nothing to do with port 1521. That is not used by the database, it is used by the listener. And if you are configured properly (actually, if you are configured by default), the same listener listens on port 1521 for connection requests to all databases on the server.
    If you were connecting to the wrong database with 'conn / as sysdba' it's because you had the wrong environment value for ORACLE_SID. In fact, with that connection request, you weren't useing the listener at all. When you added "@orcl", the connection request looked up "orcl" in the tnsnames file, and asked the OS network stack to pass the request on to whatever was using PORT= at HOST=. And that should have been (and obviously was) the listener.

  • Chat App: how to store the user IP in database when they login.

    hello,
    i am working on chat application. first i made a login GUI form. after login when we run the Chat program, it ask the ip address of the server to whom it want to connect. and if u enter the ip address, it will connect to the server and chat will begin, thats working perfect.
    but i want to show the list of users who r logged on and when i simply click on the user name, chat should begin.
    i have the logic that when any user log in, then its IP address will be stored in the database. this ip address will shown to the online users.
    but i dont know how to store the user information in database when they log in. can any body suggest me wht lines of code i should use.
    thanks.

    palakk wrote:
    i have the logic that when any user log in, then its IP address will be stored in the database. Bad approach. That will only work if this chat is only intended for use on a LAN. If it's used on the internet, then your users' IP addresses will almost always be either a) those of their routers, or b) private IP addresses, and in both cases, multiple users can have the same IP address.
    this ip address will shown to the online users. Why would you want to do that? I want to chat with "Bill", not with "1.2.3.4".
    but i dont know how to store the user information in database when they log in.Do the same thing that you're currently doing to store the IP address, but with the other information you want to store.
    can any body suggest me wht lines of code i should use. This is not a code writing service.

  • How to find the maximum no of users logged in Database

    Hi All,
    How to find the maximum number of users logged in database at particular time? I can find currently logged users or umber of sessions running on Database but I wanted to find at what time maximum number of users or sessions connected to the DB? is that possible? if yes please help me. thanks.

    Vijay wrote:
    Hi All,
    How to find the maximum number of users logged in database at particular time? I can find currently logged users or umber of sessions running on Database but I wanted to find at what time maximum number of users or sessions connected to the DB? is that possible? if yes please help me. thanks.
    select * from v$resource_limit;Lists about 20 different resources with current, maximum and limit on usage. Session count is one of them. I don't think there's any (simple, efficient) way to determine the maximum number of different users of sessions, though.
    Regards
    Jonathan Lewis

  • How to create a user in SQL database table for FBA in SharePoint 2013

    Hi,
    I am trying to configure Form Based Authentication on my SharePoint Dev machine. The purpose is to add an external user to a table (using a registration page).The provider used is SQLMembershipProvider.The dev machine is also configured as domain controller
    so all users created locally are AD users.
    Reference articles that i checked are
    Either adding users to the database as a windows user (i.e. under users section in the database). But on my machine, windows user would be same as adding a AD user.
    Or by creating a dedicated IIS site for .Net users (after creating a FBA DB using aspnet_sql tool). Right now i have implemented FBA using this method.
    Is it possible to add user details in a table of choice and then access that user using people picker? (without any third party tools).
    Thanks,
    Thomas

    Hi,
    We can use CreateUserWizard control to achieve it.
    Here is a blog for your reference:
    Adding Users With SharePoint Forms Based Authentication
    http://psterpe.wordpress.com/2009/05/24/adding-users-with-sharepoint-forms-based-authentication/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Hi I am a new iPad user and would like to know how to ensure I am on wifi at my home instead of my providers network using up time. At the top of my iPad it says my providers name  and shows a signal strenght

    Hi I am a new iPad user and would like to know how to ensure I am using wifi instead of my network provider.  At the top of my screen it is showing my providers name and a signal strength. I have a router at home that I want it to use. I will also be traveling to Italy tomorrow and want to ensure it automatically hooks up to the wifi where we will be staying. Any help would be much appreciated.

    I copied this from another thread. I made the important line bold. Make sure that WiFi is turned on if you want to use WiFi first.
    After successfully connecting to a wireless network, the network and network settings are saved on your iPad. If wi-fi access is on, when returning within range of a wireless network you have successfully connected your iPad with, your iPad will automatically connect to the wireless network, or it should. If 3G access is on, when leaving the range of an available wi-fi network you have access to, it will switch to AT&T's cellular network automatically. If both are on, your iPad should switch between the two automatically and seamlessly. Your iPad will always connect to the fastest wireless connection available at the time as long both options are enabled. Between an available wi-fi network that you have access to and are in range of and AT&T's cellular network, it will or should be the wi-fi network.
    Here is the thread.
    https://discussions.apple.com/thread/2419363?start=0&tstart=0

  • How a user of external database can be connected to other database

    Hi
    I have two databases A and B. I have one user XYZ on database B.we want user XYZ to be connected to database A and also wants to create few tables on database A. Can you please tell me what are list of steps i need to perform.
    Regards,
    RJ.

    You can create a database link between database A and B to manipulate data in database A while connected to B. But you cannot create tables using database links. It does not allow DDLs in remote database. Tranparent gateway is a database link between oracle and some other database.
    Syntax is to create the link in B is
    create database link <name> connect to <user_in_A> identified by <password_in_A> using 'A';

  • I have iMac and need a good photo editing program to use.  Reviews say aperture runs really slow with Lion, any suggestions?

    I need a program where I can remove objects and touch up dead grass, etc.

    Reviews say Aperture runs really slow with Lion, any suggestions?
    To add on to Corky02 answer:
    The recent Aperture release AP 3.3.x is very efficient, both on Lion and Mountain Lion. But you need a decent hardware to support it. The older Macs will have problems with the storage and CPU requirements. For good performance on large raw images plenty of RAM is important, at least 4GB, but 8GB would be much better, and your library should be on a fast disk, preferably on an internal drive. And don't let the system drive get too full.
    Many reports about Aperture being slow are due to putting the Aperture library onto slow disks or acessing  the original image files over the network, insufficient RAM, or corrupted or  ill-designedAperture databases.
    Aperture excels at all kinds of image processing that can be considered image developement - raw processing and color/lighting adjustments, but does not do compositing. If you are shooting raw and want professional image developement I'd recommend to do this in Aperture and not in iPhoto - you will have much more control over this in Aperture (after a steep learning curve). You can also  repair and retouch the image to correct minor blamishes. For graphics compositing and inpainting you can set up an external editor and send your images from Aperture to this external editor - any of the editors Corky recommended would be o.k. for this.
    To see, if you will want the advanced image processing in Aperture or the easy to use, more basic options in iPhoro will be sufficient to you have a look at the Aperture User manual, or the tutorial on the support page: Aperture Support
    But Aperture is a professional apllication, not "plug and play". You should only consider it, if you are willing to spend some time on learning to use it properly and are willing to work your way through the manual.
    Regards
    Léonie

  • My MacBook Pro is running really slow - how can I fix it?

    my MacBook Pro is running really slow - how can I fix it?

    Things You Can Do To Resolve Slow Downs
    If your computer seems to be running slower here are some things you can do:
    Start with a visit to: OS X Maintenance - MacAttorney.
    Boot into Safe Mode then repair your hard drive and permissions:
    Repair the Hard Drive and Permissions Pre-Lion/Mountain Lion
    Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    Repair the Hard Drive - Lion/Mountain Lion
    Boot from your Lion Recovery HD. When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported, then click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu. Select Restart from the Apple menu.
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Restart your computer normally and see if this has helped any. Next do some maintenance:
    Suggestions for OS X Maintenance
    For situations Disk Utility cannot handle the best third-party utility is Disk Warrior;  DW only fixes problems with the disk directory, but most disk problems are caused by directory corruption; Disk Warrior 4.x is now Intel Mac compatible.
    OS X performs certain maintenance functions that are scheduled to occur on a daily, weekly, or monthly period. The maintenance scripts run in the early AM only if the computer is turned on 24/7 (no sleep.) If this isn't the case, then an excellent solution is to download and install a shareware utility such as Macaroni, JAW PseudoAnacron, or Anacron that will automate the maintenance activity regardless of whether the computer is turned off or asleep.  Dependence upon third-party utilities to run the periodic maintenance scripts was significantly reduced since Tiger.  These utilities have limited or no functionality with Snow Leopard or Lion and should not be installed.
    OS X automatically defragments files less than 20 MBs in size, so unless you have a disk full of very large files there's little need for defragmenting the hard drive. As for virus protection there are few if any such animals affecting OS X. You can protect the computer easily using the freeware Open Source virus protection software ClamXAV. Personally I would avoid most commercial anti-virus software because of their potential for causing problems. For more about malware see Macintosh Virus Guide.
    I would also recommend downloading a utility such as TinkerTool System, OnyX 2.4.3, or Cocktail 5.1.1 that you can use for periodic maintenance such as removing old log files and archives, clearing caches, etc.
    For emergency repairs install the freeware utility Applejack.  If you cannot start up in OS X, you may be able to start in single-user mode from which you can run Applejack to do a whole set of repair and maintenance routines from the command line.  Note that AppleJack 1.5 is required for Leopard. AppleJack 1.6 is compatible with Snow Leopard. There is no confirmation that this version also works with Lion.
    When you install any new system software or updates be sure to repair the hard drive and permissions beforehand.
    Get an external Firewire drive at least equal in size to the internal hard drive and make (and maintain) a bootable clone/backup. You can make a bootable clone using the Restore option of Disk Utility. You can also make and maintain clones with good backup software. My personal recommendations are (order is not significant):
      1. Carbon Copy Cloner
      2. Data Backup
      3. Deja Vu
      4. SuperDuper!
      5. SyncTwoFolders
      6. Synk Pro
      7. Synk Standard
      8. Tri-Backup
    Visit The XLab FAQs and read the FAQs on maintenance, optimization, virus protection, and backup and restore.
    Additional suggestions will be found in Mac maintenance Quick Assist.
    Referenced software can be found at CNet Downloads or MacUpdate.
    Additional Hints
    Be sure you have an adequate amount of RAM installed for the number of applications you run concurrently. Be sure you leave a minimum of 10% of the hard drive's capacity as free space.
    Add more RAM. If your computer has less than 2 GBs of RAM and you are using OS X Leopard or later, then you can do with more RAM. Snow Leopard and Lion work much better with 4 GBs of RAM than their system minimums. The more concurrent applications you tend to use the more RAM you should have.
    Always maintain at least 15 GBs or 10% of your hard drive's capacity as free space, whichever is greater. OS X is frequently accessing your hard drive, so providing adequate free space will keep things from slowing down.
    Check for applications that may be hogging the CPU:
    Open Activity Monitor in the Utilities folder.  Select All Processes from the Processes dropdown menu.  Click twice on the CPU% column header to display in descending order.  If you find a process using a large amount of CPU time, then select the process and click on the Quit icon in the toolbar.  Click on the Force Quit button to kill the process.  See if that helps.  Be sure to note the name of the runaway process so you can track down the cause of the problem.
    Often this problem occurs because of a corrupted cache or preferences file or an attempt to write to a corrupted log file.

  • Servlet Database I/O: How to "lock" a record being updated ?

    Say you have a servlet that displays a list of customers in HTML page, and a button on each customer to click to bring up another page (servlet generated) with the customer info to edit. The customer info is in a database file (could be Access or ORACLE). User makes any changes and clicks a button to update the customer record (with a servlet).
    How do you prevent two users from editing the same customer record at the same time? I do not want to lock the whole file, just a record.
    Any pointers towards info about this subject appreciated.
    Walk Good

    sridharranganathan, does your technique assume that the read operation is locked, so that two users cannot obtain the same value of LockCounter?
    I have some questions relevant to the following code:
    public class theServlet extends HttpServlet
        public void doGet(HttpServletRequest req, HttpServletResponse resp)
         throws ServletException, IOException
             Helper theHelper = new Helper();
             theHelper.setUser(req.getCookies);
             resp.setContentType("text/html");
                PrintWriter out = new PrintWriter(resp.getOutputStream());
                Connection con = null;
             try
                   SybDriver sybDriver = (SybDriver) Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
                   sybDriver.setVersion(com.sybase.jdbcx.SybDriver.VERSION_5);
                   DriverManager.registerDriver(sybDriver);
                   con = DriverManager.getConnection("jdbc:sybase:Tds:dbsrv1:3520/hospcap", "myuserid", "mypassword");                 if (con != null) {
                  if(theHelper.getUserRecord(con, this)) {
                           //do some stuff
                        else { //do some other stuff }
                        con.close();
                 }catch(Exception e) { //whatever }
                 finally { out.flush(); }
             } //end doGet()
    } //end class
    public class Helper {
        private String user = "";
        private String field1Val= "";
        private String field2Val= "";
        public boolean setUser(Cookie [] cookies) {
         // method gets the user's userid from a cookie and then:
            user = user_id_from_cookie;
       public boolean getUserRecord(Connection con, theServlet serv){
            StringBuffer sb = new StringBuffer();
            Statement stmt = null;
         try {
             //Try to get the user's info:
                stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY );
             StringBuffer sql = new StringBuffer("SELECT field1, field2 FROM UserRecords WHERE user_id = '" + user + "'");
             ResultSet rs = stmt.executeQuery(sql.toString());
                rs.last();
                int nrows = rs.getRow();
                if(nrows < 1) { //user doesn't have an entry in the table yet.
                 //First, get result set of records with blank userids:
                 sql.replace(0, sql.length(), "SELECT * FROM UserRecords WHERE user_id = '' OR user_id = NULL ORDER BY field1");
              rs = stmt.executeQuery(sql.toString());
                    rs.last();
                    nrows = rs.getRow();
                 if(nrows > 0) {
                     //there ARE some records with null user_id, so assign this user to the first one:
                        rs.first();
                     field1Val = rs.getString("field1").trim();
                     field2Val = rs.getString("field2").trim();
                        //QUESTION: IS IT POSSIBLE THAT TWO USERS/THREADS HAVE THE SAME VALUE OF field1Val AT THIS POINT?
                     sql.replace(0, sql.length(), "UPDATE UserRecords SET user_id = '" + user + "' ");
                     sql.append(" WHERE field1 = '" + field1Val+ "' AND user_id is NULL");
                  con.setAutoCommit(false);
                  //Trying to use transaction isolation to prevent two users from updating the same record.
                  //Does this only work if the users share the connection, con?
                  int level = con.getTransactionIsolation();
                  try {
                      if(con.getMetaData().supportsTransactionIsolationLevel(con.TRANSACTION_READ_COMMITTED)) {
                          con.setTransactionIsolation(con.TRANSACTION_READ_COMMITTED);
                            //SYNCHRONIZE ON SERVLET INSTANCE?
                      //synchronized(serv){
                            nrows = stmt.executeUpdate(sql.toString());
                  }catch(SQLException se) {
                         con.rollback();
                         con.setAutoCommit(true);
                         con.setTransactionIsolation(level);
                         stmt.close();
                         return false;
                     con.commit();
                     con.setAutoCommit(true);
                     con.setTransactionIsolation(level);
                        if(nrows < 1) { //couldn't update the db.
                         stmt.close();
                         return false;
                     else {
                         stmt.close();
                         return true;
                 else { //There aren't any unused records; deal with it.
                     stmt.close();
                     return false;
                else { // the user has an entry in the table
                    rs.first(); //should only be one record for this userid.
                    field1Val = rs.getString("field1").trim();
                    field2Val = rs.getString("field2").trim();
                    stmt.close();
                 return true;
            }catch(SQLException se) {
             //some problem not caught elsewhere
             return false;
       } // end getUserRecord
    } // end class HelperI should say that the UserRecords table now contains about 5000 records (this will grow in increments of 5000), many of which have null user_id. If the value is not null, then it contains a userid. A user can have either zero or one entry in the table.
    Here are my questions regarding the above:
    1. In the servlet, each thread will have its own instance of Helper and of Connection, correct?
    2. I want to ensure that only one thread can update a particular UserRecords table record at a time. In the getUserRecord method, please note the line where field1Val is assigned, just above the capitalized QUESTION comment. Is it possible that two threads could have the same value of field1Val at the same time?
    3. When you set the transaction isolation level for connection1, does that prevent other threads that are using other connections to the database from accessing records being updated by the thread using connection1?
    4. As you can see, I am considering passing a reference to the servlet instance into the getUserRecords method and synchronizing the update statement on the servlet instance. Will that ensure only one thread at a time can update the record, without using the transaction isolation code?
    Thanks in advance for your answer.

Maybe you are looking for