List:General Discussion« Previous MessageNext Message »
From:Reindl Harald Date:February 12 2012 10:40pm
Subject:Re: Indexed Query examining too many rows!
View as plain text  

Am 12.02.2012 23:25, schrieb Cabbar Duzayak:
> Hi All,
> 
> I have a table with a btree index on its searchKey column, and when I
> send a simple query on this table:
> 
> explain select * from DataIndex where (searchKey like 'A%') order by
> searchKey limit 10
> 
> rows is returning 59548 and it tells me that it is using the searchKey index.
> 
> Also, a select count(*) on this table returns 32104 rows, i.e.
> 
> select count(*) from DataIndex where searchKey like 'a%' -> gives
> 32104 as its result
> 
> Am I doing something wrong here? Given that the searched column is
> indexed, shouldn't it examine way less rows?

LIKE does not benefit from keys!


Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Thread
Indexed Query examining too many rows!Cabbar Duzayak12 Feb
  • Re: Indexed Query examining too many rows!Reindl Harald12 Feb
    • Re: Indexed Query examining too many rows!Peter Brawley12 Feb
      • Re: Indexed Query examining too many rows!Cabbar Duzayak13 Feb