community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE

Pull only 1st record in-database. Limit 1?

Highlighted
Asteroid

Hi, this is an easy one I think, but I can't seem to find the answer after searching for a bit.

 

I have a hadoop table with hundreds of millions of records per day and I simply want to get 1 record back.  In the connect-in-db node I tried using 'limit 1' to pull just the first record (after restricting the date to yesterday's date), but it runs forever!  I'm guessing maybe 'limit 1' simply returns 1 record AFTER pulling all the records first? 

 

What is the best/fastest way in-database to pull just a small subset of records from a table?

 

btw here's my code:

select *

from 'default'.'bus_pd_data'

where src_trans_date>='2018-10-31'

limit 1

If you use a Sample In-DB and set the limit to 1 it should do what you want.

 

The way In-DB builds it's query it will only read the first record I believe

Labels