Subject | [firebird-support] Re: Newbie: Query speed and DB size |
---|---|
Author | Svein Erling Tysvær |
Post date | 2008-03-27T11:16:04Z |
Adam wrote:
Kogerbnz wrote:
select ID from mytable where pk = :pk
prepare it once, then assign the parameter before opening, rather than repeatedly using
select ID from mytable where pk = 1
select ID from mytable where pk = 2
...
You may get better advice if telling a bit more about what you're actually trying to design.
HTH,
Set
>> 2) Does the query speed depend on the number of columns in a table,I did observe such a performance penalty yesterday! Though admittedly, that was within an WHERE EXISTS(SELECT ...) construct, the table that was queried within the EXISTS contained over 1000 columns, and it was a small penalty.
>> assuming that I will only query the PK column (select ID from mytable)?
>It is certainly dependent on the number of fields returned, but I have never observed performance penalties >based on fields not returned.
Kogerbnz wrote:
>I'm not expecting an exact answer, I'm just trying to get a littleWhat can be important if having several queries, is to used prepared queries wherever there is a chance of them being reused, i.e. use
>feeling with how the DB would perform.
>Which would guide me when deciding if I should try optimize my design
>to use fewer queries, but giving a bit messier table design.
select ID from mytable where pk = :pk
prepare it once, then assign the parameter before opening, rather than repeatedly using
select ID from mytable where pk = 1
select ID from mytable where pk = 2
...
You may get better advice if telling a bit more about what you're actually trying to design.
HTH,
Set