Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2012
    Posts
    2

    Angry Unanswered: Large SQL file with up to 200mb

    Hello folks,

    I'm Brazilian and a friend of mine recommended this forum.

    When I try to import that SQL file to my PostgreSQL database I get stuck.

    It is a list of Postal Codes from Brazil. It's very large.

    I can't see all of the contents, cuz it gets an error when I try to open it on excel.

    I just can see some lines:

    Code:
    -- SQL Manager for PostgreSQL 5.1.0.3 
    -- --------------------------------------- 
    #NOME? 
    #NOME? 
    -- Version : PostgreSQL 8.4.10 on x86_64-pc-linux-gnu, compiled by GCC gcc-4.4.real (Debian 4.4.5-8) 4.4.5, 64-bit 
    
    
    
    SET check_function_bodies = false; 
    -- 
    -- Definition for function sem_acentos (OID = 25419) : 
    -- 
    SET search_path = public, pg_catalog; 
    CREATE FUNCTION public.sem_acentos ( 
    string character varying 
    ) 
    RETURNS varchar 
    AS 
    $body$ 
    SELECT TRANSLATE($1, , aeiouaeiouaoaeiooaeioucAEIOUAEIOUAOAEIOOAEIOUC) 
    $body$ 
    LANGUAGE sql; 
    -- 
    -- Structure for table tend_cidade (OID = 16940) : 
    -- 
    CREATE TABLE public.tend_cidade ( 
    id_cidade integer NOT NULL, 
    cidade varchar(100) NOT NULL, 
    uf varchar(2) NOT NULL 
    ) WITHOUT OIDS; 
    -- 
    -- Structure for table tend_bairro (OID = 16943) : 
    -- 
    CREATE TABLE public.tend_bairro ( 
    id_bairro integer NOT NULL, 
    bairro varchar(50) NOT NULL, 
    id_cidade integer NOT NULL 
    ) WITHOUT OIDS; 
    -- 
    -- Structure for table tend_endereco (OID = 16946) : 
    -- 
    CREATE TABLE public.tend_endereco ( 
    cep varchar(10) NOT NULL, 
    endereco varchar(200) NOT NULL, 
    id_cidade integer NOT NULL, 
    id_bairro integer NOT NULL 
    ) WITHOUT OIDS; 
    -- 
    -- Data for table public.tend_cidade (OID = 16940) (LIMIT 0,500) 
    -- 
    BEGIN; 
    
    INSERT INTO tend_cidade (id_cidade, cidade, uf) 
    VALUES (1, Acrelndia, AC); 
    
    INSERT INTO tend_cidade (id_cidade, cidade, uf) 
    VALUES (2, Assis Brasil, AC); 
    
    INSERT INTO tend_cidade (id_cidade, cidade, uf) 
    VALUES (3, Brasilia, AC);
    And it goes in many more lines, that I just don't know how many.

    How can I import it to PostgreSQL?
    I've tried it by the "CTRL+E" and OPEN, but it get stuck. Then I need to restart Postgresql.

    If I manually insert this code into CTRL+E, it just doesn't work.
    Is it because of this Script?

    Anyone can please help me...I'm frustrated.

    Thank you all,

    Best,

    Yuri Cavazin
    --
    GIS ANALIST
    @ TECSA servios LTDA

  2. #2
    Join Date
    Aug 2011
    Posts
    42
    I would suggest you break the query in parts, it is more practical and also helps bgworker jobs like logging,wal and constraints to be more precise.

  3. #3
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    When I try to import that SQL file to my PostgreSQL database I get stuck.
    1. In what way do you get stuck?
    2. Are any errors generated, and if so, what are the errors?
    3. Are you using SQL Manager for PostgreSQL to run the script on the target server? (If not, you should, since that was the app which created the script file. Theoretically, this shouldn't make a difference, but it might.)
    4. Are the source and target database servers at the same version level? If they are not, this could be the source of your problems: refer to the PostgreSQL release documentation for all pg upgrades between the two version levels.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  4. #4
    Join Date
    Jun 2012
    Posts
    2

    PgAdmin III

    Hi there,

    I've found where the error was.

    It was cuz my work-pc has lesser memory than recommended, and it got stuck.

    I imported the SQL in a pc with more memory and it worked just fine.

    Thank you all for the answers.

    Best,

    Yuri Cavazin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •