Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

Any way to get query data dynamically while its executing.

sahil_kumarsahil_kumar Employee
edited May 2020 in General Discussion

A client asked , if it is possible to get query data dynamically while it is executing, in batches for example.
instead of waiting until all the data is fetched and formated, client wants to get each time part of the data that has already been parsed.
for example select * from table limit 10000; (instead of waiting to all the 10000 rows get 1000 each time)
if it exists does it works with the order by clause?

Tagged:

Best Answers

  • sahil_kumarsahil_kumar Employee
    Accepted Answer

    thanks @Abhishek_Rana for detailed explanation.

Answers

  • Do you want the paging function?
    You can refer to OFFSETClause

  • @qinchaofeng yes the client referred paging function.

  • Not really sure if offsetclause will help to get query data dynamically.

  • thanks @marcothesane that actually makes sense.

  • moshegmosheg Employee

    In addition maybe parallel insert select can provide a way to analyze portions of the result set.
    Example 1:

        INSERT INTO MY_TABLE  
               SELECT a,b,c
               FROM OTHER_TABLE
               WHERE hash(a)/((9223372036854775807/YOUR_NODE_COUNT) + 1)= YOUR_SEGMENT;
    

    Example 2:

        INSERT INTO foo_cp
        SELECT * from foo
        WHERE HASH( some_column ) % 4 = 0;
    
        INSERT INTO foo_cp
        SELECT * from foo
        WHERE HASH( some_column ) % 4 = 1;
    
        INSERT INTO foo_cp
        SELECT * from foo
        WHERE HASH( some_column ) % 4 = 2;
    
        INSERT INTO foo_cp
        SELECT * from foo
        WHERE HASH( some_column ) % 4 = 3;
    

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.