"<span class="Apple-style-span" style>A "filter" is essentially a point where an input stream is reduced."</span><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><br></font></div>
<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">Sounds more like a valve or attenuator</font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">of some kind.</font></div>
<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">Isn't a filter something that reduces the</font></div>
<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">components of a stream based on some </font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">criteria?  You remove contaminants from</font></div>
<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">a stream of water, but not the water.  Yes, </font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">you reduce </font><span class="Apple-style-span" style="color:rgb(34,34,34);font-family:arial,sans-serif">overall flow of material, but </span></div>
<div><span class="Apple-style-span" style="color:rgb(34,34,34);font-family:arial,sans-serif">that is not the </span><span class="Apple-style-span" style="color:rgb(34,34,34);font-family:arial,sans-serif">point.</span></div>
<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">As to how commercial data bases work,</font></div>
<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">I have to think a certain amount of that</font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">is not intended to be known.  i.e., trade</font></div>
<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">secrets.</font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">   -- Bob</font></div>
<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" color="#222222" face="arial, sans-serif">   -- Bob</font></div>
<div><font class="Apple-style-span" color="#222222" face="arial, sans-serif"><br></font><br><div class="gmail_quote">On Fri, Feb 3, 2012 at 8:51 PM, Adam  Tauno Williams <span dir="ltr"><<a href="mailto:awilliam@whitemice.org">awilliam@whitemice.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, 2012-02-03 at 17:44 -0500, Eric Beversluis wrote:<br>
> I've been doing some reading on The Raiser's Edge. I found it<br>
> interesting  that, when explaining queries, they emphasized that the<br>
> queries do "filtering." This raised the question for me whether<br>
> relational DB queries actually "filter" or whether the RE talk of<br>
> "filtering" is heuristic.<br>
<br>
The answer in terms of modern relational databases is "both" and<br>
"neither".  A modern engine like PostgreSQL/Oracle/DB2/Informix has a<br>
sophisticated optimized that determines the most efficient path for<br>
evaluating a query;  this can certainly include filtering [which is<br>
essentially what a "sequential scan" is, but it also uses indexes and<br>
statistics to skip around [discard] whole chunks of data].  This gets<br>
even more complicated when multiple sets [tables] are joined.  One could<br>
be pedantic and say 'all that is filtering' but it would push the<br>
concept of what-is-a-filter pretty far.<br>
<br>
A "filter" is essentially a point where an input stream is reduced.<br>
<br>
> In other words, which of these two descriptions fits how a database<br>
> query works?<br>
> 1. The "selection" method: If I say "select FName from tblPeople," the<br>
> programs opens a file and "copies" all the FName values to a new file<br>
> (or into memory).<br>
<br>
It is better to think in terms of "streams" rather than "files".  The<br>
term "file" brings in some baggage such as being random access [you can<br>
skip around inside it].  Moving the pointer in the source violates the<br>
concept of a "filter", IMNSO.  A filter receives a stream and reduces<br>
it; if it influences the stream itself it is something else [not a<br>
filter].<br>
<br>
> 2.  The "filter" method: If I say "select FName from tblPeople," the<br>
> program opens a file, deletes everything that is not "FName," and saves<br>
> the result to a new file (or into memory).<br>
<br>
Urg, that would be weird, it would certainly not be an efficient<br>
approach in a transactional system.<br>
<br>
> It seems to me that these two approaches are in fact different and would<br>
> be programmed very differently.<br>
<br>
Yes.<br>
<br>
> I've never thought of DBs as using the "filter" approach, but then I<br>
> haven't thought very hard about it either.<br>
<br>
You can have the database tell you exactly what it is doing - this is<br>
referred to in SQL as "EXPLAIN".  So "SELECT name FROM people WHERE<br>
email ILIKE '%@<a href="http://whitemice.org" target="_blank">whitemice.org</a>'" performs the query and gives you the<br>
result, while "EXPLAIN SELECT name FROM people WHERE email ILIKE '%<br>
@<a href="http://whitemice.org" target="_blank">whitemice.org</a>'" returns *how* the database would come up with the<br>
answer and the anticipated cost.  Depending on the size of the table,<br>
partitioning, fragmentation, cardinality, indexes, and sort order the<br>
database may approach even this simple query in different ways.<br>
<br>
See page 132 of<br>
<<a href="https://sourceforge.net/projects/coils/files/WMOGAG-Coils.pdf/download" target="_blank">https://sourceforge.net/projects/coils/files/WMOGAG-Coils.pdf/download</a>><br>
for a non-trivial EXPLAIN example.<br>
<br>
> Are these in fact two different logical approaches? If so, which do<br>
> relational DBs use--or do some use one approach and some the other?<br>
<br>
<br>
<br>_______________________________________________<br>
grlug mailing list<br>
<a href="mailto:grlug@grlug.org">grlug@grlug.org</a><br>
<a href="http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug" target="_blank">http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug</a><br></blockquote></div><br></div>
<br />-- 
<br />This message has been scanned for viruses and
<br />dangerous content by
<a href="http://www.mailscanner.info/"><b>MailScanner</b></a>, and is
<br />believed to be clean.