Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
admin:features:segments:querying [2012/03/05 21:17]
doc created
admin:features:segments:querying [2016/06/28 22:38] (current)
Line 15: Line 15:
 ==== Querying Segments ==== ==== Querying Segments ====
  
-Omnidex Segments can be referenced as criteria in a future query  using the [[dev:​sql:​functions:​segment:​home|SEGMENT]] function. ​ The SEGMENT function references the object name for any segment previously created ​or attached ​in the same connection.  ​Alternativelythe SEGMENT function can reference ​filename for a segment file created earlier by Omnidex or an external application +Omnidex Segments can be referenced as criteria in a future query  using the [[dev:​sql:​functions:​segment:​home|$SEGMENT]] function. ​ The $SEGMENT function references the object name for any segment previously created in the same connection.  ​Since Omnidex Segments already contain index pointersthey are incorporated into search with very high performance.
  
-Omnidex Segments can be used in conjunction with Omnidex Indexes. ​ Index segments already contain index pointers, and can be incorporated into a search instantaneously. ​ Data or delimited segments are processed like criteria, and require a search against the index to locate rows with those search values. +The following example shows several segments that were created in the previous page being referenced in a query using the $SEGMENT function:
- +
-The following example shows several segments that were created in the previous page being referenced in a query using the SEGMENT function:+
  
 <​code>​ <​code>​
-> ; Apply all temporary index segments, plus suppress any individuals that; 
-> ; were from two specific previous orders; 
-> create permanent delimited segment CURRENT_ORDER 
->> ​ physical ​         "​order_125.txt"​ 
->> ​ as (select ​       INDIVIDUAL 
->> ​       from        INDIVIDUALS 
->> ​       where       ​INDIVIDUAL in (segment(PART_1),​ segment(PART_2)) and 
->> ​                   INDIVIDUAL = segment(PART_3) and 
->> ​                   INDIVIDUAL not in (segment('​order_123.txt',​ '​DELIMITED'​), ​ 
->> ​                                      ​segment('​order_124.txt',​ '​DELIMITED'​))) 
->> ​ with              delete; 
-Segment CURRENT_ORDER created with 18 rows 
- 
 > ; Fulfill the query based on the final segment; > ; Fulfill the query based on the final segment;
 > select ​       INDIVIDUAL, > select ​       INDIVIDUAL,
Line 42: Line 27:
 >> ​  ​from ​       INDIVIDUALS >> ​  ​from ​       INDIVIDUALS
 >> ​  ​join ​       HOUSEHOLDS on INDIVIDUALS.HOUSEHOLD = HOUSEHOLDS.HOUSEHOLD >> ​  ​join ​       HOUSEHOLDS on INDIVIDUALS.HOUSEHOLD = HOUSEHOLDS.HOUSEHOLD
->> ​  ​where ​      ​INDIVIDUAL = segment(CURRENT_ORDER);+>> ​  ​where ​      INDIVIDUAL in ($segment(PART_1),​ $segment(PART_2)) and 
 +>> ​              INDIVIDUAL = $segment(PART_3);
  
 INDIVIDUAL ​   BIRTHDATE ​    ​CITY ​                         ST INDIVIDUAL ​   BIRTHDATE ​    ​CITY ​                         ST
Line 48: Line 34:
 000400191550 ​ 1996-04-26 ​   PHOENIX ​                      AZ 000400191550 ​ 1996-04-26 ​   PHOENIX ​                      AZ
 000400575367 ​ 1996-11-19 ​   PHOENIX ​                      AZ 000400575367 ​ 1996-11-19 ​   PHOENIX ​                      AZ
 +000400575366 ​ 1995-09-26 ​   PHOENIX ​                      AZ
 000400575369 ​ 2005-06-29 ​   PHOENIX ​                      AZ 000400575369 ​ 2005-06-29 ​   PHOENIX ​                      AZ
 000400575368 ​ 2004-07-30 ​   PHOENIX ​                      AZ 000400575368 ​ 2004-07-30 ​   PHOENIX ​                      AZ
 +000403467439 ​ 1994-08-28 ​   PHOENIX ​                      AZ
 000403467441 ​ 2003-04-19 ​   PHOENIX ​                      AZ 000403467441 ​ 2003-04-19 ​   PHOENIX ​                      AZ
 000403467440 ​ 1997-02-28 ​   PHOENIX ​                      AZ 000403467440 ​ 1997-02-28 ​   PHOENIX ​                      AZ
-000403490448 ​ 1988-07-03 ​   PHOENIX ​                      AZ 
-000403490440 ​ 1988-04-14 ​   PHOENIX ​                      AZ 
 000800345452 ​ 1998-08-31 ​   DENVER ​                       CO 000800345452 ​ 1998-08-31 ​   DENVER ​                       CO
-000800345451 ​ 1982-07-08    ​DENVER ​                       CO+000800345453 ​ 2003-12-25    DENVER ​                       CO 
 +000801610627 ​ 2004-03-17 ​   ​DENVER ​                       CO
 000802420583 ​ 1990-03-18 ​   DENVER ​                       CO 000802420583 ​ 1990-03-18 ​   DENVER ​                       CO
-000802420582 ​ 1987-06-16 ​   DENVER ​                       CO 
 000802420584 ​ 1993-10-06 ​   DENVER ​                       CO 000802420584 ​ 1993-10-06 ​   DENVER ​                       CO
 000803400688 ​ 1990-06-16 ​   DENVER ​                       CO 000803400688 ​ 1990-06-16 ​   DENVER ​                       CO
Line 71: Line 57:
 ====  ==== ====  ====
 **[[admin:​features:​segments:​creating|Prev]]** | **[[admin:​features:​segments:​creating|Prev]]** |
-**[[admin:​features:​segments:​attaching|Next]]** ​+**[[admin:​features:​segments:​dropping|Next]]** ​
  
    
 
Back to top
admin/features/segments/querying.1330982242.txt.gz · Last modified: 2016/06/28 22:38 (external edit)