int8主键仍然没有使用没有手动JDBC驱动程序补丁的索引(7.4RC1) [英] int8 primary keys still not using index without manual JDBC driverpatch (7.4RC1)

查看:68
本文介绍了int8主键仍然没有使用没有手动JDBC驱动程序补丁的索引(7.4RC1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我以为我会提到我真的认为这个问题需要修复。
修复。我正在修补7.4RC1 JDBC驱动程序,正如我们所说的那样,因为这个优化器

bug,这是我第三次必须这样做。我认为这个bug

会导致很多人评估postgres并认定它很糟糕

主键性能!我喜欢postgres,并且不愿意认为这可能会发生这种情况。


template1 =#explain select * from lineitem其中lineitemid = 26845437;

查询计划

----------------------------------- ---------------------------

Seite Scan on lineitem(成本= 0.00..82685.91行= 1宽度) = 103)

过滤器:( lineitemid = 26845437)

(2行)

template1 =#explain select * from lineitem其中lineitemid = 26845437 :: int8;

QUERY PLAN

------------------------ -------------------------------------------------- ------

使用lineitem上的lineitem_pkey进行索引扫描(成本= 0.00..3.53行= 1宽度= 103)

指数条件:( lineitemid = 26845437: :bigint)

(2行)


我注意到这是在TODO中:

允许SELECT * FROM tab WHERE int2col = 4使用int2col索引,int8,

float4,数字/小数也是[优化器])


之前太难解决7.4决赛?


问候,


克雷格


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

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

http://archives.postgresql.org

Hi all,

Just thought I''d mention that I really think this problem needs to be
fixed. I

I''m patching the 7.4RC1 JDBC drivers as we speak due to this optimiser
bug, and it''s the third time I''ve had to do this. I would think this bug
causes quite a lot of people to evaluate postgres and decide it has awful
primary key performance! I love postgres, and hate to think that this
could be happening.

template1=# explain select * from lineitem where lineitemid=26845437;
QUERY PLAN
--------------------------------------------------------------
Seq Scan on lineitem (cost=0.00..82685.91 rows=1 width=103)
Filter: (lineitemid = 26845437)
(2 rows)

template1=# explain select * from lineitem where lineitemid=26845437::int8;
QUERY PLAN
--------------------------------------------------------------------------------
Index Scan using lineitem_pkey on lineitem (cost=0.00..3.53 rows=1 width=103)
Index Cond: (lineitemid = 26845437::bigint)
(2 rows)

I''ve noticed this is in the TODO :
Allow SELECT * FROM tab WHERE int2col = 4 to use int2col index, int8,
float4, numeric/decimal too [optimizer])

Too hard to fix before 7.4 final?

Regards,

Craig

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

http://archives.postgresql.org

推荐答案

任何特殊原因你都不能把价值放在报价中并让

postgres确定类型?

周五,2003年11月7日上午10:43:05 +1100,Craig O ''Shannessy写道:
Any particular reason you can''t just put the value in quotes and let
postgres determine the type?

On Fri, Nov 07, 2003 at 10:43:05AM +1100, Craig O''Shannessy wrote:
大家好,

我想我会提到我真的认为这个问题需要修复。我正在修补7.4RC1 JDBC驱动程序,正如我们所说的那样,由于这个优化器错误,这是我第三次不得不这样做。我认为这个bug会导致很多人评估postgres并判断它有可怕的主键性能!我喜欢postgres,并且不想认为这可能会发生。

template1 =#explain select * from lineitem其中lineitemid = 26845437;
查询计划
- -------------------------------------------------- -----------
seite Scan on lineitem(成本= 0.00..82685.91行= 1宽度= 103)
过滤器:( lineitemid = 26845437)
(2行)

template1 =#explain select * from lineitem where lineitemid = 26845437 :: int8;
QUERY PLAN
-------------- -------------------------------------------------- ----------------
使用lineitem上的lineitem_pkey进行索引扫描(成本= 0.00..3.53行= 1宽度= 103)
索引条件:( lineitemid = 26845437 :: bigint)
(2行)

我注意到这是在TODO中:
允许SELECT * FROM选项卡WHERE int2col = 4使用int2col索引, int8,
float4,数字/小数也是[优化器])

在7.4最终之前太难修复了?
克雷格



----------------- ----------(广播结束)---------------------------
提示6:有您搜索了我们的列表档案?

http://archives.postgresql.org

Martijn van Oosterhout< kl ***** @ svana.org>
http://svana.org/kleptog/ 部队所需要的一切邪恶胜利是为了让人无所作为。 - 爱德蒙伯克
好人为不参与政治而付出的代价是由比自己更糟糕的人管理。 - 柏拉图
Hi all,

Just thought I''d mention that I really think this problem needs to be
fixed. I

I''m patching the 7.4RC1 JDBC drivers as we speak due to this optimiser
bug, and it''s the third time I''ve had to do this. I would think this bug
causes quite a lot of people to evaluate postgres and decide it has awful
primary key performance! I love postgres, and hate to think that this
could be happening.

template1=# explain select * from lineitem where lineitemid=26845437;
QUERY PLAN
--------------------------------------------------------------
Seq Scan on lineitem (cost=0.00..82685.91 rows=1 width=103)
Filter: (lineitemid = 26845437)
(2 rows)

template1=# explain select * from lineitem where lineitemid=26845437::int8;
QUERY PLAN
--------------------------------------------------------------------------------
Index Scan using lineitem_pkey on lineitem (cost=0.00..3.53 rows=1 width=103)
Index Cond: (lineitemid = 26845437::bigint)
(2 rows)

I''ve noticed this is in the TODO :
Allow SELECT * FROM tab WHERE int2col = 4 to use int2col index, int8,
float4, numeric/decimal too [optimizer])

Too hard to fix before 7.4 final?

Regards,

Craig



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

http://archives.postgresql.org
--
Martijn van Oosterhout <kl*****@svana.org> http://svana.org/kleptog/ "All that is needed for the forces of evil to triumph is for enough good
men to do nothing." - Edmond Burke
"The penalty good people pay for not being interested in politics is to be
governed by people worse than themselves." - Plato




----- BEGIN PGP SIGNATURE -----

版本:GnuPG v1.0.6(GNU / Linux)

评论:有关信息,请参阅 http://www.gnupg.org


iD8DBQE / qusNY5Twig3Ge + YRAuaRAJ9 / fMV3pczwTcGOXN0Ci61Q4o39awCgj3Gl

y8mpmQesRJc + aBO4E8GXUf4 =

= Sjpt

----- END PGP SIGNATURE -----



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE/qusNY5Twig3Ge+YRAuaRAJ9/fMV3pczwTcGOXN0Ci61Q4o39awCgj3Gl
y8mpmQesRJc+aBO4E8GXUf4=
=Sjpt
-----END PGP SIGNATURE-----


我正在使用EJB CMP(Enterprise Java Bean,容器管理持久性),

所以生成了SQL。我认为这是作为现代EJB容器的数据库的常见用法。
PostgreSQL。有修复此选项的

(不包括修复postgres本身),恕我直言最好是修补JDBC PreparedStatement代码
以便setLong()添加'':: int8 ''。

这里的优点是你可以使用手工编写的预处理语句,如
以及自动CMP语句,两者都可以得到正确的演员。


真正的问题是开箱即用的PostgreSQL实际上并不可用

for CMP!这真的不好,而且我总是很惊讶它不是固定的。很幸运我们在网站上发现了这个错误,当我们对Oracle评估PostgreSQL时,跟踪或修复它是不容易的,

它导致真正可怕的性能问题。


我会把它称为我的宠儿。


Craig

在2003年11月7日星期五,Martijn van Oosterhout写道:
I''m using EJB CMP (Enterprise Java Beans, Container Managed Persistence),
so the SQL is generated. I would think this is a common usage of
PostgreSQL, as a database for a modern EJB container. There are options
for fixing this (not including fixing postgres itself), IMHO the best is
patching the JDBC PreparedStatement code so that setLong() adds ''::int8''.
The advantage here is that you can use hand coded prepared statements, as
well as auto CMP ones, and both will get the proper cast.

The real problem is that PostgreSQL out of the box is not really usable
for CMP! This really isn''t good, and I''m always suprised that it''s not
fixed. It was very luck we found the bug on the website when we were
evaluating PostgreSQL against Oracle, it wasn''t easy to track down or fix,
and it causes truly horrible performance problems.

I spose you''d call it my pet peeve.

Craig
On Fri, 7 Nov 2003, Martijn van Oosterhout wrote:
任何特殊原因你都不能把价值放在引号中并让
postgres确定类型?

在星期五,2003年11月7日上午10:43:05 +1100,Craig O'Shannessy写道:
Any particular reason you can''t just put the value in quotes and let
postgres determine the type?

On Fri, Nov 07, 2003 at 10:43:05AM +1100, Craig O''Shannessy wrote:
大家好,

以为我会提到我真的认为这个问题需要修复。我正在修补7.4RC1 JDBC驱动程序,正如我们所说的那样,由于这个优化器错误,这是我第三次不得不这样做。我认为这个bug会导致很多人评估postgres并判断它有可怕的主键性能!我喜欢postgres,并且不想认为这可能会发生。

template1 =#explain select * from lineitem其中lineitemid = 26845437;
查询计划
- -------------------------------------------------- -----------
seite Scan on lineitem(成本= 0.00..82685.91行= 1宽度= 103)
过滤器:( lineitemid = 26845437)
(2行)

template1 =#explain select * from lineitem where lineitemid = 26845437 :: int8;
QUERY PLAN
-------------- -------------------------------------------------- ----------------
使用lineitem上的lineitem_pkey进行索引扫描(成本= 0.00..3.53行= 1宽度= 103)
索引条件:( lineitemid = 26845437 :: bigint)
(2行)

我注意到这是在TODO中:
允许SELECT * FROM选项卡WHERE int2col = 4使用int2col索引, int8,
float4,数字/小数也是[优化器])

在7.4最终之前太难修复了吗?

克雷格

---------------------------(广播结束)---------------------------
提示6:您是否搜索了我们的列表档案?

http://archives.postgresql.org




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

提示4:不要杀死-9''邮政局长


---------------------------(end of broadcast)---------------------------
TIP 4: Don''t ''kill -9'' the postmaster


你好Craig,


Craig O'Shannessy schrieb:
Hi Craig,

Craig O''Shannessy schrieb:
我正在使用EJB CMP(企业Java Bean,容器管理持久性),
因此生成SQL。我认为这是PostgreSQL的常见用法,作为现代EJB容器的数据库。有修复这个的选项(不包括固定postgres本身),恕我直言,最好是修补JDBC PreparedStatement代码,以便setLong()添加'':: int8''。
这里的优点是你可以使用手工编写的预处理语句,以及自动CMP语句,并且两者都将得到适当的演员。

真正的问题是开箱即用的PostgreSQL是CMP真的不太可用了!这真的不好,我总是很惊讶它没有被修复。当我们在对Oracle评估PostgreSQL时,我们发现网站上的错误非常幸运,跟踪或修复并不容易,这会导致真正可怕的性能问题。

我打算把它称为我的宠儿。
I''m using EJB CMP (Enterprise Java Beans, Container Managed Persistence),
so the SQL is generated. I would think this is a common usage of
PostgreSQL, as a database for a modern EJB container. There are options
for fixing this (not including fixing postgres itself), IMHO the best is
patching the JDBC PreparedStatement code so that setLong() adds ''::int8''.
The advantage here is that you can use hand coded prepared statements, as
well as auto CMP ones, and both will get the proper cast.

The real problem is that PostgreSQL out of the box is not really usable
for CMP! This really isn''t good, and I''m always suprised that it''s not
fixed. It was very luck we found the bug on the website when we were
evaluating PostgreSQL against Oracle, it wasn''t easy to track down or fix,
and it causes truly horrible performance problems.

I spose you''d call it my pet peeve.



我全心全意地同意你的意见 - 这也困扰我为什么

postgresql can施放[0-9] +到int4,但只有

''[0-9] +''到int8或int2,我真的看不到

的区别。


我们需要寻找补丁的地方吗?


问候

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

提示9:如果您的

加入专栏,计划员将无视您选择索引扫描的愿望s数据类型不匹配


I agree with you wholeheartly - it also bothers me why
postgresql can cast [0-9]+ to int4, but only
''[0-9]+'' to int8 or int2, I really cannot see the
difference.

Any ideas where we have to look for the place to patch?

Regards
Tino
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column''s datatypes do not match


这篇关于int8主键仍然没有使用没有手动JDBC驱动程序补丁的索引(7.4RC1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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