The Life of a Query Ingres Architecture
Total Page:16
File Type:pdf, Size:1020Kb
The Life of a Query Ingres Architecture R ecovery S erver GCA DBMS S erver Client App Archiver Name S erver Databases TX Log Journals Connection . Client requests connection . GCA Name server resolves address - returns Client App GCF server address SCF . Client connects to DB PSF OPF QEF server RDF QSF ADF Name S erver SXF GWF DMF GCF . Global Communication Facility GCA . Handles hardware, operating system and GCF network protocol SCF differences PSFOPFQEF . Used for all RDFQSFADF client/server SXF GWF communication DMF Session Startup . Server checks client connection request . GCA Does the DB exist? . Is this user allowed to access the DB in this GCF mode? SCF PSFOPFQEF . Session created for RDFQSFADF this user SXF GWF DMF SCF . System Control Facility . Handles server-wide GCA resources & control . Major components: GCF – Sequencer - what to SCF do with a query PSFOPFQEF – Session Control - create, destroy, RDFQSFADF dispatch SXF GWF DMF Client Sends Query Update emp set . Client sends query to salary = salary * 1.05 server . GCA Query may be text and parameters, or invocation of a GCF database procedure SCF . Query is stored in PSFOPFQEF QSF RDFQSFADF SXF GWF DMF QSF . Query Storage Facility . GCA Global memory area . Used for storing query objects GCF . SCF Used to pass PSFOPFQEF information between RDFQSFADF facilities SXF GWF DMF Query Processing . DBMS decides what to do with the query . Usually GCA – Parse – Optimize GCF – Execute SCF . Sometimes PSFOPFQEF – Parse and execute RDFQSF ADF – or just execute SXF GWF DMF Parsing . Does this query make sense? – Syntactically GCA – Semantically . Are the objects in the GCF query SCF – Real? OPFQEF PSF – Tables or views? RDFQSF ADF – Protected? SXF GWF DMF PSF . Parser Facility . Translates query text GCA to internal format . Performs QRYMOD processing for views, GCF permits, integrities, SCF etc. PSFOPFQEF RDFQSFADF . Uses RDF and QSF SXF GWF DMF RDF . Relation Descriptor Facility . Cache for information about DB objects – Databases, Tables, Views, GCA etc. – Avoid repeated access to catalogs GCF . Used for validation SCF – Does table exist? PSF OPFQEF – Can this user access it? RDFQSF ADF SXF GWF DMF Parsing . Parser takes the query text from QSF . GCA Processes it . Places the query tree (internal format) into GCF QSF SCF PSFOPFQEF . Returns control to RDFQSF ADF SCF SXF GWF DMF Optimizing . The DBMS must decide how to execute the query GCA – which order to join the tables – which restrictions will GCF remove the most rows SCF – which indexes are PSFOPFQEF available and RDFQSF ADF potentially useful ... SXF GWF DMF OPF . Optimizer Facility . Query rewrite GCA (transform to canonical form) . Plan enumeration/ GCF cost model (actual SCF optimization) PSFOPFQEF RDFQSFADF . Code generation SXF GWF DMF OPF . Translates query tree (from QSF) into optimal execution GCA plan . Uses statistics (from GCF RDF) & heuristics to SCF formulate plan PSFOPFQEF . Stores the plan in RDFQSFADF QSF SXF GWF DMF QEF . Query Execution Facility . GCA Executes the plan formulated by OPF . (real plan, not cost GCF tree) SCF PSFOPFQEF . Uses ADF and DMF RDFQSF ADF SXF GWF DMF Query Execution . Allocate buffers for rows, intermediate results (can be reused for successive execs of repeat q’s or dbprocs) GCA . In memory sorts . Execute logic for each GCF query plan action/node SCF (table access, joins, etc.) PSFOPFQEF RDFQSF ADF SXF GWF DMF ADF . Abstract Datatype Facility . Handles all operations on intrinsic (integer, float, char, …) and non-intrinsic (date/time, money) data types GCA . Handles SQL functions against tuples . Basis for UDTs GCF . Used by PSF (type SCF validation), OPF (expression compilation), PSFOPFQEF QEF (expression RDFQSFADF evaluation), DMF (sort comparisons) SXF GWF DMF DMF . Data Manipulation Facility . Performs data operations for QEF GCA – Locking – Logging – Disk access GCF – Caching SCF – Indexes PSFOPFQEF – Disk sorting RDFQSF ADF SXF GWF DMF Updating the DB GCF SCF GCA PSF OPF QEF RDF QSF ADF SXF GWF DMFACP Name DMF S erver Journal TX Log s Updating the DB GCF SCF R ecovery GCA S erver PSF OPF QEF Log Cache RDF QSF ADF Buffers SXF GWF DMF TX Log Updating the Journals GCF SCF GCA PSF OPF QEF RDF QSF ADF DMFACP Name SXF GWF S erver DMF Journal TX Log s E_what_was_that . Most facilities have been covered – GCF, SCF, PSF, OPF, QEF, RDF, QSF, DMF . What are the others.. – SXF, GWF, ULF, CLF . Error codes: E_GCnnnn, E_SCnnnn, …, E_USnnnn (user error) SXF . Security Extensions Facility . GCA Performs security validation and auditing (B1, C2) GCF . Not normally called SCF PSFOPFQEF RDFQSF ADF SXF GWF DMF GWF . Gateway facility . Maps Ingres queries into a non-Ingres request format GCA . Maps non-Ingres (sometimes non-relational) data into Ingres format GCF . SCF Used for IMA, Gateways, Enterprise DB PSFOPFQEF RDFQSFADF SXF GWF DMF ULF . Utility facility GCA . General purpose routines within the server GCAGCF . Memory SCF U SCF Management PSF OPF QEF L PSF OPF QEF . Error reporting FRDFRDFQSFQSFADFADF SXFSXF GWFGWF DMFDMF CLF . Compatibility Library . Mainline Ingres code GCA must run on many platforms . The CL provides the common interface for GCAGCF – Memory – I/O SCFSCF C – IPC PSFPSFOPFOPFQEFQEF – some arithmetic (float, L decimal) RDF QSF ADF F RDF QSF ADF – … SXFSXF GWFGWF DMFDMF ?.