Performance tuning in PostgreSQL?
От | Raymond Chui |
---|---|
Тема | Performance tuning in PostgreSQL? |
Дата | |
Msg-id | 3B4AF23F.D7D4B1@noaa.gov обсуждение исходный текст |
Список | pgsql-sql |
Hi dear dudes (buddies)! I have have a table with 8 columns, the primary key are column ID and orders. CREATE TABLE tablename ( ID char(8) not null, orders integer not null, col3 float(6) DEFAULT 0.01, col4 integer DEFAULT 15, col5 float(6) DEFAULT 0.0, col6 char(5) not null, col7 char(2) not null, col8 timestamp DEFAULT 1970-01-01 00:00:00, primary key (ID, orders), check (orders >= 0)); CREATE INDEX indexname ON tablename (ID, orders); There are more than 25 thousand rows in the table. This is a relative small database compare to Wal-Mark, Macy (big retail stores) inventory. But I have some performance issue. When I randomly query the table SELECT columnlist FROM tablename WHERE ID = '12345678' ORDER BY orders; It sometime take few seconds to display output query, sometime display output query instantly. This tell me when the ID I query is in the cache memory, I got output results instantly, when the ID is not in cache memory, I have to wait for few seconds. Because when I randomly pick an ID for above SELECT statement, 1st time I need to wait for few seconds, if I do the same SELECT again, I got the query output immediately/instantly. To wait for few seconds is not a big deal for most of application. If you doing online shopping, wait for few seconds is very fast. But for our application is close to the real-time application. We can't have any wait, must no waiting at all time. In other database systems, such as Informix, Sybase, etc. The database is stored in the raw disk partitions, you can config the database system into different partitions, different disks, slice into different trunks, etc. But PostgreSQL is stored the database in the file system in PGDATA directory. So how do I boost the performance in PostgreSQL? Thank you very much in advance! --Raymond
Вложения
В списке pgsql-sql по дате отправления: