如何处理更大的数据库? [英] How to handle larger databases?

查看:54
本文介绍了如何处理更大的数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在创建一个包含少于20个简单表的数据库(仅限
SQL 92类型,简单约束,没有PostgreSQL特定的东西,没有存储

程序.. 。)


不幸的是,其中一些表将包含多达4百万个条目,

使整个数据库的大小为700-1000MB。


为了保持良好的查询时间(希望<1-3秒),我想要b / b
想要提供一些关于如何管理和组织这样一个数据库的技巧。

我应该做什么,应该避免什么?我应该在哪里以及如何使用

索引和所有这些东西?


我知道有更大的PostgreSQL数据库。他们如何管理好的查询时间?


非常感谢


马特

PS测试系统是一台普通的Win 2000 PC,目标机器将是基于IA-32的Linux机器。

------------ ---------------(播出结束)---------------------------

提示2:您可以使用取消注册命令一次性取消所有列表

(发送取消注册YourEmailAddressHere到 ma ******* @ postgresql.org

解决方案

那里你应该遵循一些基本的数据库问题,无论你的b
数据库引擎是什么。


索引你的列,但有理由,不要索引a只有

的列包含几个不同的值(例如是/否字段)。如果您的查询可以使用多个字段缩小结果集,则可以使用几个

列。


如果您要更新数据,请始终放置日志(WAL在

单独的物理光盘上登录pgsql)。如果您还可以在自己的光盘上拆分索引

(加速书签查找)。


使用常识类型,例如时间戳而不是存储日期as

字符串。不要使用可变长度类型。


当然,如果您可以发布有关您的设置的具体信息,您将获得更具体的答案。当然,使用一个数据库引擎,即
处理自己的缓存总能让你获得更好的性能,因为缓存索引顶层的
比缓存实际更重要

数据文件(用于数据库引擎anwyways)。但是由于pqsl依赖于操作系统

进行缓存,操作系统并不真正知道哪些文件优先级高,以便将它们保存在缓存中。


Jerry


< ma ****** @ cmklein.de>在消息中写道

新闻:E1 *************** @ www.strato-webmail.de ...

我是目前正在创建一个包含少于20个简单表的数据库(仅限SQL 92类型,简单约束,没有PostgreSQL特定的东西,没有存储的
程序......)

不幸的是,有些这些表中包含多达4百万个条目,
使整个数据库的大小为700-1000MB。

为了保持良好的查询时间(希望<1-3秒)我想要提供一些关于如何管理和组织这样一个数据库的技巧。
我应该做什么,应该避免什么?我应该在哪里以及如何使用
索引和所有这些东西?

我知道有更大的PostgreSQL数据库。他们如何管理好的查询时间?

非常感谢

Matt

P.S.测试系统是普通的Win 2000 PC,目标机器将是基于IA-32的Linux机器。

---------------- -----------(广播结束)---------------------------
提示2:您可以使用取消注册命令立即取消所有列表
(将取消注册YourEmailAddressHere发送到 ma **** ***@postgresql.org





2004年11月19日上午2:37 ,Jerry III写道:

不要使用可变长度类型。




为什么建议不使用可变长度类型?

Patrick B. Kelly

------------------------------ ------------------------
http://patrickbkelly.org

---------------------------(结束广播)---------------------------

提示3:如果通过Usenet发布/阅读,请和适当的

subscribe-nomail命令 ma ******* @ postgresql.org 这样你的

消息可以干净地通过邮件列表


是的,我想听听这也是,特别是因为我的所有

字符串都被定义为varchar。


2004年11月22日星期一02:09,Patrick B Kelly说:

2004年11月19日凌晨2:37,Jerry III写道:

不要使用可变长度类型。


为什么建议不使用可变长度类型?

Patrick B. Kelly
----------------------- -------------------------------
http://patrickbkelly.org

---------------------- -----(播出结束)---------------------------
提示3:如果通过Usenet发布/阅读,请结束适当的
subscribe-nomail命令以 ma*******@postgresql.org 您的
消息可以干净地通过邮件列表




-

工作:1-336-372-6812

Cell:1-336-363-4719

email: te *** @ esc1 .com


---------------------------(播出结束) ---------------------------

提示6:您是否搜索了我们的列表档案?

http://archives.postgresql.org


I am currently creating a database with less than 20 simple tables (only
SQL 92 types, simple constraints, no PostgreSQL specific stuff, no stored
procedures...)

Unfortunately, some of those tables will contain up to 4 Million entries,
making the size of the entire database 700-1000MB.

In order to maintain good query times (hopefully <1-3 seconds) I would
like to ask for some tips on how to manage and organize such a database.
Like what should I do and what should I avoid? Where and how should I use
indexes and all that stuff?

I know there are much larger PostgreSQL databases around. How do they
manage good query times?

Thanks a lot

Matt
P.S. The test system is a normal Win 2000 PC, the target machines will be
IA-32 based Linux machines.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

解决方案

There''s some basic database issues you should follow, no matter what your
database engine.

Index your columns, but with reason, do not index a column that only
contains several distinct values (such as yes/no fields). Inde xover several
columns if your queries can narrow the resultset using more than one field.

If you''re updating your data always put logs (WAL logs in pgsql) on a
separate physical disc. If you can also split indexes out on their own disc
(to speedup bookmark lookups).

Use common sense types, such as timestamps instead of storing dates as
strings. Do not use variable length types.

Of course if you can post specific information about your setup you would
get you a more specific answer. And of course, usng a database engine that
handles its own caching will always get you better performance, since
caching the top levels of your indexes is more important than caching actual
data files (for a database engine anwyways). But since pqsl relies on the OS
to cache, the OS doesn''t really know which files are higher priority to keep
them in the cache.

Jerry

<ma******@cmklein.de> wrote in message
news:E1***************@www.strato-webmail.de...

I am currently creating a database with less than 20 simple tables (only
SQL 92 types, simple constraints, no PostgreSQL specific stuff, no stored
procedures...)

Unfortunately, some of those tables will contain up to 4 Million entries,
making the size of the entire database 700-1000MB.

In order to maintain good query times (hopefully <1-3 seconds) I would
like to ask for some tips on how to manage and organize such a database.
Like what should I do and what should I avoid? Where and how should I use
indexes and all that stuff?

I know there are much larger PostgreSQL databases around. How do they
manage good query times?

Thanks a lot

Matt
P.S. The test system is a normal Win 2000 PC, the target machines will be
IA-32 based Linux machines.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)




On Nov 19, 2004, at 2:37 AM, Jerry III wrote:

Do not use variable length types.



Why do you suggest not using variable length types?
Patrick B. Kelly
------------------------------------------------------
http://patrickbkelly.org
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly


Yes, I would like to hear about this as well, especially since all my
character strings are defined as varchar.

On Monday 22 November 2004 02:09 am, Patrick B Kelly saith:

On Nov 19, 2004, at 2:37 AM, Jerry III wrote:

Do not use variable length types.



Why do you suggest not using variable length types?
Patrick B. Kelly
------------------------------------------------------
http://patrickbkelly.org
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly



--
Work: 1-336-372-6812
Cell: 1-336-363-4719
email: te***@esc1.com

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


这篇关于如何处理更大的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆