简体   繁体   中英

Creating External Table takes long time

I have a table called table B that as 28 million records that is in Netezza and I want to export it to a text file so that I can export the text file to the mysql server. When I run the command below, the SQL client hangs. I am using SquirrelSQL.

CREATE EXTERNAL TABLE '/Users/blah/A.txt'
USING(DELIM '\t' REMOTESOURCE 'JDBC')
AS
SELECT * FROM tableB;

I am not sure if this is supposed to be the case.

Well I'm note sure if you are running Squirrel on a Window machine, but if you are you need to use backslash in the path, and you might need to escape them also. Below is an example I use in Squirrel running on a Window 7 laptop

CREATE EXTERNAL TABLE ‘C:\\Users\\ValuedCustomer\\customer dim dump.csv’ 
    USING ( DELIMITER ‘,’ Y2BASE 2000 ENCODING ‘internal’ REMOTESOURCE ‘JDBC’ ESCAPECHAR ‘\’ ) AS 
    SELECT CUSTOMER_FIRST_NAME, CUSTOMER_LASTNAME, CUSTOMER_ADDRESS, CUSTOMER_CITY, CUSTOMER_STATE 
    FROM DIM_CUSTOMER

You can find a little more info here on my blog

http://nztips.com/2012/07/returning-and-saving-large-result-sets-locally/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM