Monday, January 27, 2020
Advantages And Disadvantages To Using Indexes Computer Science Essay
Advantages And Disadvantages To Using Indexes Computer Science Essay Put simply, database indexes help speed up retrieval of data. The other great benefit of indexes is that your server doesnt have to work as hard to get the data. They are much the same as book indexes, providing the database with quick jump points on where to find the full reference (or to find the database row). There are both advantages and disadvantages to using indexes,however. One disadvantage is they can take up quite a bit of space check a textbook or reference guide and youll see it takes quite a few pages to include those page references. Another disadvantage is using too many indexes can actually slow your database down. Thinking of a book again, imagine if every the, and or at was included in the index. That would stop the index being useful the index becomes as big as the text! On top of that, each time a page or database row is updated or removed, the reference or index also has to be updated. So indexes speed up finding data, but slow down inserting, updating or deleting data. Some fields are automatically indexed. A primary key or a field marked as unique for example an email address, a userid or a social security number are automatically indexed so the database can quickly check to make sure that youre not going to introduce bad data. So when should a database field be indexed? The general rule is anything that is used to limit the number of results youre trying to find. Its hard to generalise so well look at some specific but common examples. Note the database tables shown below are used as an example only and will not necessarily be the best setup for your particular needs. In a database table that looks like this: Note: The SQL code shown below works with both MySQL and PostgreSQL databases. CREATE TABLE subscribers ( subscriberid INT PRIMARY KEY, emailaddress VARCHAR(255), firstname VARCHAR(255), lastname VARCHAR(255) ); if we want to quickly find an email address, we create an index on the emailaddress field: CREATE INDEX subscriber_email ON subscribers(emailaddress); and any time we want to find an email address: SELECT firstname, lastname FROM subscribers WHERE emailaddress=[emailprotected]; it will be quite quick to find! Another reason for creating indexes is for tables that reference other tables. For example, in a CMS you might have a news table that looks something like this: CREATE TABLE newsitem ( newsid INT PRIMARY KEY, newstitle VARCHAR(255), newscontent TEXT, authorid INT, newsdate TIMESTAMP ); and another table for authors: CREATE TABLE authors ( authorid INT PRIMARY KEY, username VARCHAR(255), firstname VARCHAR(255), lastname VARCHAR(255) ); A query like this: SELECT newstitle, firstname, lastname FROM newsitem n, authors a WHERE n.authorid=a.authorid; will be take advantage of an index on the newsitem authorid: CREATE INDEX newsitem_authorid ON newsitem(authorid); This allows the database to very quickly match the records from the newsitem table to the authors table. In database terminology this is called a table join you should index any fields involved in a table join like this. Since the authorid in the authors table is a primary key, it is already indexed. The same goes for the newsid in the news table, so we dont need to look at those cases. On a side note, table aliases make things a lot easier to see whats happening. Using newsitem n and authors a means we dont have to write: SELECT newstitle, firstname, lastname FROM newsitem, authors WHERE newsitem.authorid=authors.authorid; for more complicated queries where more tables are referenced this can be extremely helpful and make things really easy to follow. In a more complicated example, a news item could exist in multiple categories, so in a design like this: CREATE TABLE newsitem ( newsid INT PRIMARY KEY, newstitle VARCHAR(255), newscontent TEXT, authorid INT, newsdate TIMESTAMP ); CREATE TABLE newsitem_categories ( newsid INT, categoryid INT ); CREATE TABLE categories ( categoryid INT PRIMARY KEY, categoryname VARCHAR(255) ); This query: SELECT n.newstitle, c.categoryname FROM categories c, newsitem_categories nc, newsitem n WHERE c.categoryid=nc.categoryid AND nc.newsid=n.newsid; will show all category names and newstitles for each category. To make this particular query fast we need to check we have an index on: newsitem newsid newsitem_categories newsid newsitem_categories categoryid categories categoryid Note: Because the newsitem newsid and the categories categoryid fields are primary keys, they already have indexes. We need to check there are indexes on the join table newsitem_categories This will do it: CREATE INDEX newscat_news ON newsitem_categories(newsid); CREATE INDEX newscat_cats ON newsitem_categories(categoryid); We could create an index like this: CREATE INDEX news_cats ON newsitem_categories(newsid, categoryid); However, doing this limits some ways the index can be used. A query against the table that uses both newsid and categoryid will be able to use this index. A query against the table that only gets the newsid will be able to use the index. A query against that table that only gets the categoryid will not be able to use the index. For a table like this: CREATE TABLE example ( a int, b int, c int ); With this index: CREATE INDEX example_index ON example(a,b,c); It will be used when you check against a. It will be used when you check against a and b. It will be used when you check against a, b and c. It will not be used if you check against b and c, or if you only check b or you only check c. It will be used when you check against a and c but only for the a column it wont be used to check the c column as well. A query against a OR b like this: SELECT a,b,c FROM example where a=1 OR b=2; Will only be able to use the index to check the a column as well it wont be able to use it to check the b column. Multi-column indexes have quite specific uses, so check their use carefully. Now that weve seen when we should use indexes, lets look at when we shouldnt use them. They can actually slow down your database (some databases may actually choose to ignore the index if theres no reason to use it). A table like this: CREATE TABLE news ( newsid INT PRIMARY KEY, newstitle VARCHAR(255), newscontent TEXT, active CHAR(1), featured CHAR(1), newsdate TIMESTAMP ); looks pretty standard. The active field tells us whether the news item is active and ready to be viewed on the site. So should we should create an index on this field for a query like this? SELECT newsid, newstitle FROM news WHERE active=1; No, we shouldnt. If most of your content is live, this index will take up extra space and slow the query down because almost all of the fields match this criteria. Imagine 500 news items in the database with 495 being active. Its quicker to eliminate the ones that arent active than it is to list all of the active ones (if you do have an index on the active field, some databases will choose to ignore it anyway because it will slow the query down). The featured field tells us whether the news item should feature on the front page. S hould we index this field? Yes. Most of our content is not featured, so an index on the featured column will be quite useful. Other examples of when to index a field include if youre going to order by it in a query. To get the most recent news items, we do a query like this: SELECT newtitle, newscontent FROM news ORDER BY newsdate DESC; Creating an index on newsdate will allow the database to quickly sort the results so it can fetch the items in the right order. Indexing can be a bit tricky to get right, however there are tools available for each database to help you work out if its working as it should. Well there you have it my introduction to database indexes. Hopefully youve learned something from this article and can apply what youve learned to your own databases. This entry was posted in Programming. Bookmark the permalink. 22 Responses to Introduction to Database Indexes Jim says: February 17, 2006 at 7:13 am I think you need to be a bit more the reader knows absolutly nothing when describing the table joins. You lost me for a bit there. Perhaps a better step by step hand holding example would be better. [ Editors note: Sure thing. Ill see what I can come up with for next month! If youre desperate for information and cant wait drop me a line chris at interspire dot com and Ill explain it further ] Reply khani says: May 14, 2006 at 3:55 pm Good effort chris, You ve described Indexes in a simple way. Reply VRS says: May 24, 2006 at 1:32 pm Good article.Do include some explanation on clustered and non clustered indexes. Reply Vivek says: July 13, 2006 at 3:25 am Good article. Helped a lot in understading the basics of indexing. Thanks Reply Unknown says: October 11, 2006 at 8:43 pm Good article man. I really appretiate your effort. Reply Ayaz says: November 14, 2006 at 9:22 am Good article to understand indexes for a beginner. Reply Debiz says: November 27, 2006 at 5:21 pm Very well written and simply explained for those looking for a basic overview Reply Nand says: December 14, 2006 at 11:46 am Good article, felt like walking over the bridge on a gorge. Can u pl. explain drawbacks of using index also. [ Chris note The main drawback is that every insert, update or delete has to change the index as well. If you have a lot of indexes, that adds a lot of overhead to the operation. ] Reply Myo says: December 19, 2006 at 11:56 pm Very easy to understand and gives examples with different situations to demonstrate when and where we should use indexes and why. Thanks man! Reply John Lowe says: March 14, 2007 at 2:57 am A quick a useful reminder to what idexes are all about, thanks. Reply Shravanti says: June 26, 2007 at 3:11 am Good Introduction to Indexes. It would also be valuable to have information on how do indexes work on OLAP side of a Data Warehouse. Reply Harsha says: August 13, 2007 at 11:21 pm crisp tutorial.. good work Reply krish says: September 24, 2007 at 2:44 am Really very nice explanation Reply Alagesan says: October 10, 2007 at 11:33 pm This is a great article to learn indexing for beginners I really appreciate your efforts and good will in explaining them in words here.Thanks! Reply Heather says: October 12, 2007 at 8:23 am This was a great explanation of indexes for me I am self-taught when it comes to databases so the language in this tutorial was very easy for me to understand. Also, you used great examples to help explain your information. THANKS! Reply Jess Duckin says: October 28, 2007 at 4:58 am The explaination on the usage of indexing is very helpful Reply Mayur says: October 29, 2007 at 1:56 pm Thank you very much, a really informative tutorialfor me it was a 100% match to what I was looking for. Thanks Reply satish soni says: January 11, 2008 at 7:17 am Great article on indexes even oracle has not provided that much knowledge about indexes Reply Shweta says: January 11, 2008 at 4:25 pm Good. Just the overview i needed. Reply Hemant Jirange says: January 17, 2008 at 3:39 am Great articlethis is very simple to understand whole disadvantages about index Reply ramesh says: January 18, 2008 at 2:26 am impossible.even wikipedi couldnt match your tutorial on this topicthank uuuuuuuuuuuuuuu very much Reply Ravi says: September 12, 2008 at 5:57 am thanks Chris, was an easy read for a database novice. I look forward to seeing the next chapter Reply Leave a Reply Name (required) Mail (will not be published) (required) Website Home | Email Marketing | Shopping Cart | Knowledge Management Software | Content Management Software | Ecommerce Software | Sell Products Online | Our Guarantee | Privacy Policy Copyright 1999-2010 Interspire Pty. Ltd. ACN: 107 422 631
Sunday, January 19, 2020
Female Power, Maternity and Genderbending in Shakespeares Antony and C
Female Power, Maternity and Genderbending in Shakespeare's Antony and Cleopatra The 19th century essayist and literary critic William Hazlitt wrote of Cleopatra, "She is voluptuous, ostentatious, conscious, boastful of her charms, haughty, tyrannical, [and] fickle," which are "great and unpardonable faults" (Hazlitt 2-3). Much of the criticism of Antony and Cleopatra has recycled this judgement, depicting Cleopatra as a villainess uses her eroticism and sexuality to motivate Antony to seek power. Cleopatra is memorable for her propensity for violence as well. While Antony and Cleopatra was written after the death of a violent English queen, Elizabeth I, Shakespeare may have been faced with a dramatic dilemma: how to make a woman seem believably violent and intimidating on the stage. Coppà ©lia Kahn notes that Cleopatra was "Rome's most dangerous enemy" (111),i but how does one make the Queen of the Nile seem like such a threat during a time when women had little social and political power. Shakespeare does several things to accomplish this task: 1) he loca tes Cleopatra's power in a foreign or supernatural realm; 2) he inverts her gender role with that of Antony; 3) he suppresses her maternal qualities; and 4) he allows her to be redeemed only in death. Indeed, it is the only way to handle a difficult woman on the Jacobean stage. Locating Codes of Female Power In Antony and Cleopatra, the Roman values of honor and bravery embody masculinity, while Egypt and the Orient symbolize feminine weakness and fragility. Caesar and Agrippa are depicted as reasonable, logical, and practical, especially in matters of strategy and war. Cleopatra and her servants and eunuchs are consistently referred to in terms of laziness, let... ...ication of her superior intelligence. She understands that, should she live, she will be taken to Rome and will suffer the humiliation of seeing "some squeaking Cleopatra boy my greatness / I' th' posture of a whore" (V, ii, 216-217). iv In addition, Cleopatra has demonstrated her readiness in the past to ruin Egypt for Antony's sake. Without blinking, she considers "unpeopling" her country in order to send a new messenger to Antony in Rome every day. To mirror Antony's "Let Rome in Tiber sink," Cleopatra says, "Let Egypt in Nile melt." v Of course, her actions indicate that, as a Roman wife, her entire existence must center on Antony only, which means a rejection of anything else, including her earthly children ("What should I stay--"). The point is to emphasize her selfishness and her absolute focus on Antony, a constant of the queen's personality.
Saturday, January 11, 2020
Duty of Care in Health, Social Care Essay
1 Understanding the implications of duty of care. 1.1: Define the term â⬠Duty of Careâ⬠. The definition of ââ¬Å"duty of careâ⬠is a legal obligation and a requirement to work in a way that offers the best interest of a child, young person, or in my case vulnerable adult, in a way which will not be detrimental to the health, safety and wellbeing of that person. 1.2: Describe how the duty of care affects own work role. Carrying out my ââ¬Å"duty of careâ⬠in accordance with my Role, Responsibility and Competence, I must always carry out my duties that are in my own job description and decline those that are not, I must follow procedure, and provide a standard of care in line with the principle codes of practice in all aspects of my daily work, and make sure I have access to all resources and equipment that may assist me, I must observe confidentiality at all times, I must also be observant and make sure I update my knowledge and skills on a regular basis, I must also understand the importance and have the confidence to air concerns, which may be delicate and involve not only work colleagues, but also people I support. 2 Understanding support available for addressing dilemmas that may arise about duty of care. 2.1 describe dilemmas that may arise between the duty of care and an individualââ¬â¢s rights. A dilemma may arise between the duty of care and an individualââ¬â¢s rights when the basic human rights and freedoms of the individual are put to challenge, this could be the persons own concept of ââ¬Å"mental capacityâ⬠against that of a care plan or risk assessment, or simply giving the individual a choice, but at the same time understanding the need to keep the individual safe. A dilemma may also manifest when there is a need to divulge information about the individual but is also in the individualââ¬â¢s best interest, or where there may be a public safety concern. 2.2 explain where to get additional support and advice about how to resolve such dilemmas. I would get additional support from my mentor, tutor, line manager, the care quality commission, Ofsted, the association of Health Care Professionals (AHCP) unions such as Unison, also Skills Councils such as Skills for Care, Skills for Health. And where children were concerned, The Childrenââ¬â¢s Workforce and Development Council. 3 Know how to respond to complaints 3.1 describe how to respond to complaints It is very important to respond to the individuals feelings in a way that is fair and non-judgmental, listen to what is being said so I can clearly understand the problem, share advice on the procedures for making a complaint, make sure that the problem is my focus and not the personality, I would then pass this information on to my line manager, reflect on my response, and if necessary, seek further training or look for alternative practices that are available to me. 3.2 Identify the main points of agreed procedures for handling complaints The main points of agreed procedures for handling complaints are: a-Keeping a record of complaint, making sure everything is written down. b-Identifying what went wrong. c-Respond to the complaint within the agreed time. d-Responding to the complaint e.g. apologising, putting things right (local resolution stage). e-Informing complainant of their rights f-Who to complain to when complaints are not resolved. g-The role of local government ombudsman, and reflecting on complaints to improve practice.
Friday, January 3, 2020
Douglas SBD Dauntless Divebomber in World War II
The Douglas SBD Dauntless was the mainstay of the US Navys dive bomber fleet for much of World War II (1939-1945). Produced between 1940 and 1944, the aircraft was adored by its flight crews which praised its ruggedness, dive performance, maneuverability, and heavy armament. Flown from both carriers and land bases, the Slow but Deadly Dauntless played key roles at the decisive Battle of Midway and during the campaign to capture Guadalcanal. Also an excellent scout aircraft, the Dauntless remained in frontline use until 1944 when most US Navy squadrons began transitioning to the more powerful, but less popular Curtiss SB2C Helldiver.à à Design Development: Following the US Navys introduction of the Northrop BT-1 dive bomber in 1938, designers at Douglas began working on an improved version of the aircraft. Using the BT-1 as a template, the Douglas team, led by designer Ed Heinemann, produced a prototype which was dubbed the XBT-2. Centered on the 1,000 hp Wright Cyclone engine, the new aircraft featured a 2,250 lb. bomb load and a speed of 255 mph. Two forward firing .30 cal. machine guns and one rear-facing .30 cal. were provided for defense.à Featuring all metal construction (except for fabric covered control surfaces), the XBT-2 utilized a low-wing cantilever configuration and includedà hydraulically actuated, perforated split dive-brakes. Another change from the BT-1 saw the landing gear shift from retracting backwards to closing laterally into recessed wheel wells in the wing. Re-designated the SBD (Scout Bomber Douglas) following Douglas purchase of Northrop, the Dauntless was selected by the US Navy and Marine Corps to replace their existing dive bomber fleets. Production and Variants: In April 1939, the first orders were placed with the USMC opting for the SBD-1 and the Navy selecting the SBD-2. While similar, the SBD-2 possessed a greater fuel capacity and a slightly different armament. The first generation of Dauntlesses reached operational units in late 1940 and early 1941. As the sea services were transitioning to the SBD, the US Army placed an order for the aircraft in 1941, designating it the A-24 Banshee. In March 1941, the Navy took possession of the improved SBD-3 which featured self-sealing fuel tanks, enhanced armor protection, and an expanded array of weapons including an upgrade to two forward-firing .50 cal. machine guns in the cowling and twin .30 cal. machine guns on a flexible mount for the rear gunner. The SBD-3 also saw a switch to the more powerful Wright R-1820-52 engine. Subsequent variants included the SBD-4, with an enhanced 24-volt electrical system, and the definitive SBD-5. The most produced of all SBD types, the SBD-5 was powered by a 1,200 hp R-1820-60 engine and had a larger ammunition capacity than its predecessors. Over 2,900 SBD-5s were built, mostly at Douglas Tulsa, OK plant. A SBD-6 was designed, but it was not produced in large numbers (450 total) as Dauntless production was ended in 1944, in favor of the new Curtiss SB2C Helldiver. A total of 5,936 SBDs were built during its production run. Specifications (SBD-5) General Length: 33 ft. 1 in.Wingspan: 41 ft. 6 in.Height: 13 ft. 7 in.Wing Area: 325 sq. ft.Empty Weight: 6,404 lbs.Loaded Weight: 10,676 lbs.Crew: 2 Performance Power Plant: 1 Ãâ" Wright R-1820-60 radial engine, 1,200 hpRange: 773 milesMax Speed: 255 mphCeiling: 25,530 ft. Armament Guns: 2 x .50 cal. machine guns (mounted in cowling), 1 x (later 2 x) flexible-mounted .30 cal. machine gun(s) in rearBombs/Rockets: 2,250 lbs. of bombs Operational History The backbone of the US Navys dive bomber fleet at the outbreak of World War II, the SBD Dauntless saw immediate action around the Pacific. Flying from American carriers, SBDs aided in sinking the Japanese carrier Shoho at the Battle of the Coral Sea (May 4-8, 1942). A month later, the Dauntless proved vital in turning the tide of the war at the Battle of Midway (June 4-7, 1942). Launching from the carriers USS Yorktown (CV-5), USS Enterprise (CV-6), and USS Hornet (CV-8), SBDs successfully attacked and sank four Japanese carriers. The aircraft next saw service during the battles for Guadalcanal. Flying from carriers and Guadalcanals Henderson Field, SBDs provided support for the Marines on the island as well as flew strike missions against the Imperial Japanese Navy.à Though slow by the standards of the day, the SBD proved a rugged aircraft and was beloved by its pilots. Due to its relatively heavy armament for a dive bomber (2 forward .50 cal. machine guns, 1-2 flex-mounted, rear-facing .30 cal. machine guns) the SBD proved surprisingly effective in dealing with Japanese fighters such as the A6M Zero. Some authors have even argued that the SBD finished the conflict with a plus score against enemy aircraft. The Dauntless last major action came in June 1944, at the Battle of Philippine Sea (June 19-20, 1944). Following the battle, most SBD squadrons were transitioned to the new SB2C Helldiver, though several US Marine Corps units continued to fly the Dauntless for the remainder of the war. Many SBD flight crews made the transition to the new SB2C Helldiver with great reluctance. Though bigger and faster than the SBD, the Helldiver was plagued by production and electrical problems that made it unpopular with its crews. Many reflected that they wanted to continue flying the Slow but Deadly Dauntless rather than the new Son of a Bitch 2nd Class Helldiver. The SBD was fully retired at the end of the war. A-24 Banshee in Army Service While the aircraft proved highly effective for the US Navy, it was less so for the US Army Air Forces. Though it saw combat over Bali, Java, and New Guinea during the early days of the war, it was not well received and squadrons suffered heavy casualties. Relegated to non-combat missions, the aircraft did not see action again until an improved version, the A-24B, entered service later in the war. The USAAFs complaints about the aircraft tended to cite its short range (by their standards) and slow speed.
Subscribe to:
Comments (Atom)