If I make a purchase with my credit card there is a delay of a few days before it shows up on my online statement.
If I make a purchase with my debit card it usually is displayed that day.
Why the delay with a credit card statement?
It all depends on the merchant. When you charge your card the information goes through but it waits for the merchant to send the info/confirm the charge before it shows up on your online activity.
For example: I use Intuit to accept CC payments. When I charge an Amex the info is sent to Amex on the spot which is why your credit limit updates immediately but Amex then waits for a confirmation. Intuit actually handles the entire process which is probably how all CC processing services work.
When you use your debit card in a debit transaction you are withdrawing cash from your checking account, which is in part why debit transactions do not have the same security as credit.
Another note about debit cards and referring to mhoran_psprep comment -
"it takes 2 or three days for the debit card transaction to appear" this is because you are using your debit card as a credit transaction, many bank cards offer this and it can come with added benefits. See - Credit vs Debit Transactions with Your ATM Card
I believe a delay is the result of the time it takes for all the information to change hands from when the transaction is created to when it is posted to your account.
The delay could be longer or shorter depending on how many transactions are being processed or perhaps how many transactions are being submitted. The amount of time would also then have to depend on your bank since it is their software posting these transactions. Also if you do a transaction on a Friday or before a holiday it probably won't post till after the weekend or holiday.
In the US, charging a credit card generally involves an authorization, which holds funds, followed by a capture which actually withdraws money from the account. This is helpful for merchants like restaurants which typically authorize the pre-tip amount while the customer is present, and later capture the full amount after the customer has left.
Other merchants have no need for this two-step process, but it's used anyway because it's widely supported technically. There is such as thing as a single-message credit card transaction, but it's not widely supported among US credit networks, issuers and middleman processors.
While authorizations are processed online, captures are traditionally queued up and processed in batches, for historical reasons. Batches are typically processed only once per day, and since there are several parties involved, it can take over 24 hours for the issuer to consider the transaction captured. Occasionally technical problems cause batches to be delayed even further.
The difference with debit cards is that single-message transactions are widely supported among US debit networks. It's still possible to auth and capture with debit cards, but there's usually no reason to.