IT Questions and Answers :)

Wednesday, August 28, 2019

What is the difference between ad hoc queries and stored procedures?

What is the difference between ad hoc queries and stored procedures?

  • There is no difference
  • Ad hoc queries are written on the fly
  • Stored procedures are embedded on the fly
  • Stored procedures are written by Microsoft 
What is the difference between ad hoc queries and stored procedures?

EXPLANATION

Stored Procedures
  • Pro: Good for short, simple queries (aka OLTP--i.e. add, update, delete, view records)
  • Pro: Keeps database logic separate from business logic
  • Pro: Easy to troubleshoot
  • Pro: Easy to maintain
  • Pro: Less bits transferred over network (i.e. only the proc name and params)
  • Pro: Compiled in database
  • Pro: Better security (users don't need direct table access)
  • Pro: Excellent query plan caching (good for OLTP queries--benefits from plan reuse)
  • Con: Excellent query plan caching (bad for OLAP queries--benefits from unique plans)
  • Con: Makes you tied to that SQL vendor
Ad Hoc SQL (i.e. created in your business code)
  • Pro: Good for long, complex quieres (aka OLAP--i.e. reporting or analysis)
  • Pro: Flexible data access
  • Pro: ORM usage is possible; can be compiled/tested in code (i.e. Linq-to-Sql or SqlAlchemy)
  • Pro: Poor query plan caching (good for OLAP queries--benefits from unique plans)
  • Con: Poor query plan caching (bad for OLTP queries--benefits from plan reuse)
  • Con: More bits transferred over network (i.e. the whole query and params)
  • Con: More difficult to maintain, if you don't use an ORM
  • Con: More difficult to troubleshoot, if you don't use an ORM
  • Con: More vulnerable to SQL injection attacks
T
hey mentioned that ad-hoc queries are written "on the fly". Does this mean that for a query to be ad-hoc it has to be written at the moment, like in a CLI or a DBMS? What about a query that I just wrote in a script for a specific purpose, is it still considered to be ad-hoc even though it is part of a script?

A "production" system has a lot of "canned queries". Such queries rarely change -- usually only when you "release" a new "version" of the "product".
An "Ad Hoc query" is a SELECT that you make up to look for something for which the canned queries don't help. It often comes from management asking something like "How many foobars happened last week?"
You will run that query once (or until you get the desired output), then toss it. Or you might develop it into a "canned query" for the "production" system, at which point it should no longer be called "ad hoc"

 

Share:

SNMP typically uses which UDP port number for general SNMP messages?

SNMP typically uses which UDP port number for general SNMP messages?

  • 22
  • 161
  • 21
  • 144 
SNMP typically uses which UDP port number for general SNMP messages?

EXPLANATION

Simple Network Management Protocol (SNMP) is an Internet Standard protocol for collecting and organizing information about managed devices on IP networks and for modifying that information to change device behavior. Devices that typically support SNMP include cable modems, routers, switches, servers, workstations, printers, and more.[1]


SNMPv3 STD0062
Communication protocol
OSI layerApplication
Port(s)161, 162 (Trap)
RFC(s)3411–3418
 
SNMP is widely used in network management for network monitoring. SNMP exposes management data in the form of variables on the managed systems organized in a management information base (MIB) which describe the system status and configuration. These variables can then be remotely queried (and, in some circumstances, manipulated) by managing applications.
Three significant versions of SNMP have been developed and deployed. SNMPv1 is the original version of the protocol. More recent versions, SNMPv2c and SNMPv3, feature improvements in performance, flexibility and security.
SNMP is a component of the Internet Protocol Suite as defined by the Internet Engineering Task Force (IETF). It consists of a set of standards for network management, including an application layer protocol, a database schema, and a set of data objects.[2]

Share:

In which year did Hewlett-Packard develop their first product?

In which year did Hewlett-Packard develop their first product?

  • 1958
  • 1988
  • 1978
  • 1938

In which year did Hewlett-Packard develop their first product?

EXPLANATION

HP invents first product

Drawing on Bill’s study of negative feedback, Bill and Dave produce HP's first product, the resistance-capacitance audio oscillator, used to test sound equipment. They name it the HP Model 200A. 
1938 HP invents first product

 

 
Share:

Which computer company was founded in a former wool mill?

Which computer company was founded in a former wool mill?

  • DEC
  • IBM
  • HP
  • Compaq 


EXPLANATION

DEC was headquartered at a former wool mill in Maynard, Massachusetts, from 1957 until 1992

Ken Olsen and Harlan Anderson were two engineers who had been working at MIT Lincoln Laboratory[7] on the lab's various computer projects. The Lab is best known for their work on what would today be known as "interactivity", and their machines were among the first where operators had direct control over programs running in real time. These had started in 1944 with the famed Whirlwind, which was originally developed to make a flight simulator for the US Navy, although this was never completed.[8] Instead, this effort evolved into the SAGE system for the US Air Force, which used large screens and light guns to allow operators to interact with radar data stored in the computer.[9]
When the Air Force project wound down, the Lab turned their attention to an effort to build a version of the Whirlwind using transistors in place of vacuum tubes. In order to test their new circuitry, they first built a small 18-bit machine known as TX-0, which first ran in 1956.[10] When the TX-0 successfully proved the basic concepts, attention turned to a much larger system, the 36-bit TX-2 with a then-enormous 64 kWords of core memory. Core was so expensive that parts of TX-0's memory were stripped for the TX-2, and what remained of the TX-0 was then given to MIT on permanent loan.[11]
At MIT, Olsen and Anderson noticed something odd: students would line up for hours to get a turn to use the stripped-down TX-0, while largely ignoring a faster IBM machine that was also available. The two decided that the draw of interactive computing was so strong that they felt there was a market for a small machine dedicated to this role, essentially a commercialized TX-0. They could sell this to users where graphical output or realtime operation would be more important than outright performance. Additionally, as the machine would cost much less than the larger systems then available, it would also be able to serve users that needed a lower-cost solution dedicated to a specific task, where a larger 36-bit machine would not be needed.[12]
In 1957 when the pair and Ken's brother Stan went looking for capital, they found that the American business community was hostile to investing in computer companies. Many smaller computer companies had come and gone in the 1950s, wiped out when new technical developments rendered their platforms obsolete, and even large companies like RCA and General Electric were failing to make a profit in the market. The only serious expression of interest came from Georges Doriot and his American Research and Development Corporation (AR&D). Worried that a new computer company would find it difficult to arrange further financing, Doriot suggested the fledgling company change its business plan to focus less on computers, and even change their name from "Digital Computer Corporation".[12]
The pair returned with an updated business plan that outlined two phases for the company's development. They would start by selling computer modules as stand-alone devices that could be purchased separately and wired together to produce a number of different digital systems for lab use. Then, if these "digital modules" were able to build a self-sustaining business, the company would be free to use them to develop a complete computer in their Phase II.[13] The newly christened "Digital Equipment Corporation" received $70,000 from AR&D for a 70% share of the company,[12] and began operations in a Civil War era textile mill in Maynard, Massachusetts, where plenty of inexpensive manufacturing space was available.

 

Share:

Which of the following definitions of PCL was defined by Hewlett-Packard?

Which of the following definitions of PCL was defined by Hewlett-Packard?

  • Posterior cruciate ligament
  • Point cloud library
  • Printer command language
  • Print capitalism language 
Which of the following definitions of PCL was defined by Hewlett-Packard?
 

EXPLANATION

 Short for Printer Command Language, PCL is the command language developed by Hewlett-Packard for its laser and inkjet printers.  PCL printer commands provide access to printer features. There are four general types of HP printer language commands:zcontrol codes zPCL commands zHP-GL/2 commands zPJL commandsControl CodesA control code is a character that initiates a printer function, for example Carriage Return (CR), Line Feed (LF), Form Feed (FF), etc












Share:

Popular Posts