database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
ㆍPostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
PostgreSQL Q&A 1174 게시물 읽기
No. 1174
postgres 4만건 데이터 중 일정하게 20개씩의 row를 get하려 합니다???
작성자
이민우
작성일
2000-06-13 14:06
조회수
11,886

오라클에서는 hint를 이용해서 처리하는데 postgres에서는 어떻게 하는 지 궁금합니다. 다음과 같이

처리하는 경우에는 처리결과가 5분이나 걸리더라구요..(총 각 테이블마다 약 4만건의 데이터 있음)

현재 jdbc이용하여 java로 postgresql db를 access하고 있고 각 테이블마다 인덱스는 걸려

있습니다.

public TelnetLogPanelModel() {

try {

Class.forName("postgresql.Driver");

 

String url = "jdbc:postgresql://192.168.1.66/test";

String usr = "kkk";

String passwd = "1234";

 

Connection connect = DriverManager.getConnection(url, usr, passwd);

 

Statement state = connect.createStatement();

 

String query = null;

query = "select ip_src0, ip_src1, ip_src2, ip_src3, th_sport, ip_dst0, ip_dst1, ip_dst2, ip_dst3, th_dport, timestamp from iphdr, tcphdr, event where iphdr.sid = tcphdr.sid and iphdr.cid = tcphdr.cid and iphdr.sid = event.sid and iphdr.cid = event.cid and tcphdr.sid = event.sid and tcphdr.cid = event.cid ;";

 

 

ResultSet result = state.executeQuery(query);

metaData = result.getMetaData();

 

int numberOfColumns = metaData.getColumnCount();

columnNames = new String[numberOfColumns];

for ( int col = 0; col<numberOfColumns; col++ ) {

columnNames[col] = metaData.getColumnLabel(col+1);

}

 

while ( result.next() ){

 

int ip_src0 = result.getInt("ip_src1");

int ip_src1 = result.getInt("ip_src1");

int ip_src2 = result.getInt("ip_src2");

int ip_src3 = result.getInt("ip_src3");

int th_sport = result.getInt("th_sport");

 

int ip_dst0 = result.getInt("ip_dst0");

int ip_dst1 = result.getInt("ip_dst1");

int ip_dst2 = result.getInt("ip_dst2");

int ip_dst3 = result.getInt("ip_dst3");

int th_dport = result.getInt("th_dport");

 

Timestamp timestamp = result.getTimestamp("timestamp");

 

Vector newRow = new Vector();

for ( int i=1; i<=getColumnCount(); i++ ) {

newRow.addElement (result.getObject(i));

}

rows.addElement(newRow);

}

result.close();

state.close();

connect.close();

} catch(Exception e) {

System.out.println("Unable to connect DataBase");

e.printStackTrace();

}

}

 

//위의 sql중 어느 부분을 변경해야 할까요.....

//where조건절에 기술된 필드들은 모두 인덱스가 걸려 있습니다.

[Top]
No.
제목
작성자
작성일
조회
1182function and aggregate등......
나그네
2000-06-14
10641
1184┕>Re: function and aggregate등......
김종혁
2000-06-14 15:39:11
11577
1186 ┕>Re: Re: function and aggregate등......
정재익
2000-06-14 16:34:44
10721
1180web서버와 (postgresql)DB 서버분리 하는 방법을..좀...알켜주세여...
sixjina
2000-06-14
11430
1181┕>Re: web서버와 (postgresql)DB 서버분리 하는 방법을..좀...알켜주세여...
정재익
2000-06-14 12:01:30
11628
1185 ┕>Thanks!!*^^*근데요,,그럼 그설정은 프로그램짠사람이....
sixjina
2000-06-14 16:33:44
11863
1188  ┕>Re: Thanks!!*^^*근데요,,그럼 그설정은 프로그램짠사람이....
정재익
2000-06-14 16:36:27
11303
1176ecpg 사용법과 예제를 구하고 싶습니다
수하
2000-06-13
12853
1178┕>Re: ecpg 사용법과 예제를 구하고 싶습니다
정재익
2000-06-13 23:30:22
12519
1179┕>Re: ecpg 사용법과 예제를 구하고 싶습니다
김종혁
2000-06-14 02:48:31
12580
1174postgres 4만건 데이터 중 일정하게 20개씩의 row를 get하려 합니다???
이민우
2000-06-13
11886
1171긴급질문!!!! [알려주세요]
한밤중
2000-06-12
12587
1172┕>Re: 긴급질문!!!! [알려주세요]
Coral
2000-06-12 10:26:04
12370
1173 ┕>Re: Re: 긴급질문!!!! [알려주세요]
정재익
2000-06-13 11:41:19
13017
1175  ┕>Re: Re: Re: 긴급질문!!!! [알려주세요]
오승준
2000-06-13 17:39:36
12121
1177  ┕>Re: Re: Re: 긴급질문!!!! [알려주세요] 허걱...
Coral
2000-06-13 21:38:32
12451
1169[초보질문] PHP3 와 PostgreSQL 뭘루 공부해야 하나요?
DB초보
2000-06-11
11460
1170┕>Re: [초보질문] PHP3 와 PostgreSQL 뭘루 공부해야 하나요?
정재익
2000-06-12 02:16:39
11610
1167[질문] postgres로 클러스터링 해보신분 계시나요?
임현
2000-06-10
10651
1168┕>Re: [질문] postgres로 클러스터링 해보신분 계시나요?
Coral
2000-06-10 14:36:55
12048
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.020초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다