如何通过子选择结果使用TOP来减少读取行(Sybase)

时间:2016-04-14 15:47:14

标签: sybase-ase

我正在尝试按子选择结果进行分组,以减少处理的数据量。

My_table有超过2000万行。

示例:

SELECT TOP 100 A.Column FROM (

SELECT TOP 500 Column FROM My_table) A

GROUP BY A.Column

我希望查询只能在我的表中使用500行,但是当我使用group by时,需要花费很多时间,比如当我只分组500时,它会将整个2000行分组。

有没有办法让sql motor只能用500行?

1 个答案:

答案 0 :(得分:0)

如果与您无关,使用了哪500行,您是否考虑过使用<?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="*" Name="DummyInstaller" Language="1033" Version="1.0.0.0" Manufacturer="Bryan" UpgradeCode="94D1BC64-7CC1-45DA-BD5F-8ED40980E75C"> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64"/> <Property Id="JAVA_CURRENT_VERSION64"> <RegistrySearch Id="JRE_CURRENT_VERSION_REGSEARCH64" Root="HKLM" Key="SOFTWARE\JavaSoft\Java Runtime Environment" Name="CurrentVersion" Type="raw" Win64="yes" /> </Property> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> <MediaTemplate /> <Feature Id="ProductFeature" Title="DummyInstaller" Level="1" > <!--<ComponentGroupRef Id="NewFilesGroup" />--> <ComponentRef Id="REGISTRY_A" /> <ComponentRef Id="PROCRUN.EXE"/> </Feature> </Product> <Fragment> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFiles"> <Directory Id="DummyDir" Name="DummyInstaller"> <!--<Directory Id="MyProgramDir" Name="MosquittoNew" />--> <Directory Id="SERVERDIR" Name="Kube2UpdaterService"> <Component Id="REGISTRY_A" DiskId="1" Guid="*" Win64="no"> <RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Java" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Name="Classpath" Value="E:\Service\Update_Service-1.0.jar" KeyPath="yes" /> <RegistryValue Type="string" Name="Jvm" Value="C:\Program Files\Java\jdk1.8.0_25\jre\bin\server\jvm.dll" /> <RegistryValue Type="multiString" Action="append" Name="Options"> <MultiStringValue Type="multiString" Name="Options" Action="append">-Duser.language=en</MultiStringValue> <MultiStringValue Type="multiString" Name="Options" Action="append">-Duser.region=US</MultiStringValue> </RegistryValue> <RegistryValue Type="integer" Name="JvmMs" Value="256" /> <RegistryValue Type="integer" Name="JvmMx" Value="1024" /> <RegistryValue Type="integer" Name="JvmSs" Value="4000" /> </RegistryKey> <RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Log" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Name="Path" Value="c:\logs" /> <RegistryValue Type="string" Name="Level" Value="Error" /> <RegistryValue Type="string" Name="Prefix" Value="Kube2UpdaterService" /> <RegistryValue Type="string" Name="StdError" Value="c:\logs\stderr.txt" /> <RegistryValue Type="string" Name="StdOutput" Value="c:\logs\stdout.txt" /> </RegistryKey> <RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Start" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Name="Mode" Value="jvm" /> <RegistryValue Type="string" Name="Class" Value="com.kohls.kube.services.updater.UpdaterServiceMain" /> <RegistryValue Type="string" Name="Params" Value="start" /> </RegistryKey> <RegistryKey Root="HKLM" Key="SOFTWARE\Apache Software Foundation\Procrun 2.0\Kube2UpdaterService\Parameters\Stop" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Name="Mode" Value="jvm" /> <RegistryValue Type="string" Name="Class" Value="com.kohls.kube.services.updater.UpdaterServiceMain" /> <RegistryValue Type="string" Name="Method" Value="stop" /> <RegistryValue Type="string" Name="Params" Value="stop" /> <RegistryValue Type="string" Name="StdOutput" Value="auto" /> </RegistryKey> <RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\Kube2UpdaterService" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Name="Description" Value="Kube updater service performing updates and installation" /> <RegistryValue Type="string" Name="DisplayName" Value="Kube2UpdaterService" /> <RegistryValue Type="string" Name="ImagePath" Value="E:\Service\prunsrv.exe //RS//Kube2UpdaterService" /> <RegistryValue Type="string" Name="DependsOnService" Value="Tcpip Afd" /> <RegistryValue Type="string" Name="ObjectName" Value="LocalSystem" /> <RegistryValue Type="integer" Name="ErrorControl" Value="1" /> <RegistryValue Type="integer" Name="Start" Value="2" /> <RegistryValue Type="integer" Name="Type" Value="16" /> </RegistryKey> <RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\Kube2UpdaterService\Parameters" Action="createAndRemoveOnUninstall"> <RegistryValue Type="string" Name="Test" Value="Pass" /> </RegistryKey> </Component> <Component Id="PROCRUN.EXE" DiskId="1" Guid="468C2DB3-F722-4DE6-8A91-B6FB8009757D" Win64="no"> <!-- this is the renamed procrun 64 bit executable --> <File Id="prunsrv.exe" Name="prunsrv.exe" Source="E:\Service\prunsrv.exe" /> <ServiceInstall Id="PROCRUN" Type="ownProcess" Name="Kube2UpdaterService" DisplayName="Kube2UpdaterService" Description="Kube 2.0 Updater Service" Start="auto" Account="LocalService" ErrorControl="normal" Arguments=" //RS//Kube2UpdaterService" /> <ServiceControl Id="StartPRUNSRV" Start="install" Stop="both" Remove="uninstall" Name="Kube2UpdaterService" Wait="no" /> </Component> </Directory> </Directory> </Directory> </Directory> </Fragment> </Wix>

  

set {rowcount number,textsize number} - 使SAP ASE服务器在指定的行数受到影响后停止处理查询(选择,插入,更新或删除)。数字可以是没有小数点的数字文字,也可以是整数类型的局部变量。

Infocenter source