Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Ở đây chúng tôi xem xét hai lựa chọn quan trọng nhất. effective_cache_size Thiết lập này cho các kế hoạch kích thước của bộ nhớ cache có thể mong đợi để được có sẵn cho một máy quét chỉ số duy nhất. Giá trị của nó là một con số tương đương với một trang đĩa | 778 CHAPTER 37 IMPORTING AND EXPORTING DATA Copying Data to and from a Table Copying data from a table to a text file or standard output is accomplished using the COPY tablename TO filename STDOUT variant of the COPY command. The complete syntax follows COPY tablename column . TO filename STDOUT WITH BINARY oids delimiter AS delimiter NULL AS null string csv heaDer QUOTE aS quote escape aS escape force nOt Null column . Copying data residing in a text file to a table or standard output is accomplished using the same syntax as that for copying from a table except for three slight variations of the syntax. These changes are bolded in the syntax that follows COPY tablename column . FROM filename STDIN WITH biNary OIDS delimiter AS delimiter NULL AS null string csv heaDer QUOTE aS quote escape aS escape FORCE QUOTE column . As you can see COPY has quite a bit to offer. Perhaps the best way to understand its many capabilities is through several examples. Copying Data from a Table To begin let s dump data from a table containing employee information to standard output psql COPY employee TO STDOUT This returns the following 1 JG100011 Jason Gilmore jason@example.com 2 RT435234 Robert Treat rob@example.com 3 GS998909 Greg Sabino Mullane greg@example.com 4 MW777983 Matt Wade matt@example.com CHAPTER 37 IMPORTING AND EXPORTING DATA 779 To redirect this output to a file simply specify a filename like so psql COPY employee TO home jason sqldata employee.sql Keep in mind that the PostgreSQL daemon user will require the necessary privileges for writing to the specified directory. Also an absolute path is required because COPY will not accept relative pathnames. Note On Windows forward slashes should be used to specify the absolute path. So for example to COPY data to PostgreSQL s data directory the path might look like c pgsql data employee. sql. Copying Data from a Text File Copying data from a text file to a table is as simple as copying data to it. Let s begin by importing .