🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.delphi.bazy-danych
Article #70165

Re: zapytanie...może LIKE ?

#70165
From: Piotr Stęclik
Date: Sun, 08 Jul 2007 21:31
25 lines
1947 bytes
>> Wybierz z pola indeks_mat pierwsze (wszystkie) rekordy 4 znaki, które
>> odpowiadaj? 4 pierwszym znakom z pola Indeks.
> select * from tabela
> where
> substring(indeks_mat from 1 for 4) = substring(indeks from 1 for 4)
>> Oraz drugie zapytanie poka? wszystkie rekordy z pola indeks_mat i indeks,
>> których pierwsze 4 znaki s? ró?ne od siebie.
> select * from tabela
> where
> substring(indeks_mat from 1 for 4) <> substring(indeks from 1 for 4)
> dla firebirda.

W firebirdzie 2.0 wprowadzono możliwość zakładania indeksów na wyrażenia.
Nie miałem okazji przetestować więc chętnie przypatrzę się wynikom.
Zerknij na http://firebirdsql.org/rlsnotes/Firebird-2.0.1-ReleaseNotes.pdf, 
rozdział
"Expression Indexes".

Jeśli masz trochę siły to wykonaj jakieś testy szybkości dodając dodatkowy 
index

create index anyindexname on tabela computed by (substring(indeks_mat from 1 
for 4))

Piotr Stęclik. 
Technical Details
Message-ID: <f6rl6a$er0$1@news.onet.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail
References: <f564ce$svj$1@inews.gazeta.pl> <op.tt4o7poyq0kutt@xp_januszk.wag54gs>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail
From: Piotr Stęclik <biuro@isukces.com>
Newsgroups: pl.comp.lang.delphi.bazy-danych
Subject: Re: zapytanie...może LIKE ?
Date: Sun, 8 Jul 2007 23:31:48 +0200
Organization: Onet.pl
Lines: 27
Message-ID: <f6rl6a$er0$1@news.onet.pl>
References: <f564ce$svj$1@inews.gazeta.pl> <op.tt4o7poyq0kutt@xp_januszk.wag54gs>
NNTP-Posting-Host: 213.199.204.188
X-Trace: news.onet.pl 1183930378 15200 213.199.204.188 (8 Jul 2007 21:32:58 GMT)
X-Complaints-To: usenet@news.onet.pl
NNTP-Posting-Date: Sun, 8 Jul 2007 21:32:58 +0000 (UTC)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
X-Sender: tLvsXNlRNzhyIqIkAEV9mt40YQ4BePd6
X-RFC2646: Format=Flowed; Response
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-Priority: 3
X-MSMail-Priority: Normal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit