English 中文(简体)
不使用指数的查询
原标题:Access query not using index

我有一个称为“东道国”的1个外勤出入表,是一个文本领域,拥有100个顶峰。 我用它储存国家安全局的东道国名称。 该领域是主要的关键。 如果我回答以下问题,它就会收到预期结果,但需要大约8秒才能填写一份有100万份记录的表格:

SELECT TOP 1 HostsRev.HostName FROM HostsRev WHERE (((HostsRev.HostName)>="test")) ORDER BY HostsRev.HostName;

如果我删除“按构成部分分列”部分,它就返回的时间不到二分之一,但总是不回到我所期望的——而不是“试验”的第一个记录。

我正在通过ADO从C++仪表中进行询问,但我也通过制造问询和取得相同结果在进入现场进行了测试。

我需要迅速找到第一个记录,如果是的话,这种记录始于某一方。 我也利用了LKE的询问,但结果相同。 我之所以需要这样做,是因为如果我搜索图像,那么我需要知道该清单是否含有古角度.com,但不是图像。

最佳回答

问题是,东方木材公司的指挥本身并不适用于数据,因此,如果它不按不同的顺序返回,从而得出不同的结果,你可以尝试如下:

SELECT Min(HostName) FROM HostsRev WHERE HostName >= "test"

Not sure if this will give any better performance though but worth a go : )

问题回答

我不相信你能够从C++中做到这一点,而不是作为C++方案制定者,但ADO支持一种财产,其指数允许你制定你希望使用的指数和一种检索该指数的种子方法。 这里,VB中的一些法典是值得的。

Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset

Set conn = New ADODB.Connection
conn.Open ConnectionString

rs.Open "mytable", conn
rs.Index = "primarykey"
rs.Seek "test", adSeekAfterEQ
If rs.EOF Then   record not found




相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签